revert to old method of graphics
This commit is contained in:
parent
90be393276
commit
073fb10abb
|
@ -19,6 +19,7 @@ TODO clean up
|
||||||
#include "uxn.h"
|
#include "uxn.h"
|
||||||
#include "devices/ppu.h"
|
#include "devices/ppu.h"
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
#include "lib/pluginlib_actions.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -178,9 +179,10 @@ const Uint8 vector_rom[] = { // screen vector test ROM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Uxn u;
|
static Uxn u;
|
||||||
static Ppu ppu;
|
static Ppu ppu;
|
||||||
static Device *devsystem, *devconsole, *devscreen;
|
static Device *devctrl, *devsystem, *devconsole, *devscreen;
|
||||||
unsigned int palette[3];
|
unsigned int palette[3];
|
||||||
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
static Uint8 framebuffer[LCD_HEIGHT * LCD_WIDTH * 4];
|
||||||
|
|
||||||
|
@ -212,7 +214,7 @@ inspect(Stack *s, char *name)
|
||||||
static void
|
static void
|
||||||
set_palette(Uint8 *addr)
|
set_palette(Uint8 *addr)
|
||||||
{
|
{
|
||||||
#if LCD_HAS_COLOR
|
#if LCD_DEPTH > 4
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 4; ++i) {
|
for(i = 0; i < 4; ++i) {
|
||||||
Uint8
|
Uint8
|
||||||
|
@ -221,14 +223,6 @@ set_palette(Uint8 *addr)
|
||||||
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
||||||
palette[i] = LCD_RGBPACK(r*8,g*8,b*8);
|
palette[i] = LCD_RGBPACK(r*8,g*8,b*8);
|
||||||
}
|
}
|
||||||
#elif LCD_DEPTH > 1 // greyscale
|
|
||||||
int i;
|
|
||||||
for(i = 0; i < 4; ++i) {
|
|
||||||
Uint8 sum = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
|
||||||
sum += (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
|
||||||
sum += (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f;
|
|
||||||
palette[i] = sum;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < 4; ++i) {
|
for(i = 0; i < 4; ++i) {
|
||||||
|
@ -336,10 +330,7 @@ static void redraw(void)
|
||||||
Uint16 x, y;
|
Uint16 x, y;
|
||||||
for(y = 0; y < ppu.height; ++y)
|
for(y = 0; y < ppu.height; ++y)
|
||||||
for(x = 0; x < ppu.width; ++x) {
|
for(x = 0; x < ppu.width; ++x) {
|
||||||
#if LCD_HAS_COLOR
|
#if LCD_DEPTH > 4
|
||||||
rb->lcd_set_foreground(palette[ppu_read(&ppu, x, y)]);
|
|
||||||
rb->lcd_drawpixel(x, y);
|
|
||||||
#elif LCD_DEPTH > 1
|
|
||||||
rb->lcd_set_foreground(palette[ppu_read(&ppu, x, y)]);
|
rb->lcd_set_foreground(palette[ppu_read(&ppu, x, y)]);
|
||||||
rb->lcd_drawpixel(x, y);
|
rb->lcd_drawpixel(x, y);
|
||||||
#else
|
#else
|
||||||
|
@ -398,7 +389,7 @@ enum plugin_status plugin_start(const void* parameter)
|
||||||
/* audio2 */ uxn_port(&u, 0x5, nil_talk);
|
/* audio2 */ uxn_port(&u, 0x5, nil_talk);
|
||||||
/* audio3 */ uxn_port(&u, 0x6, nil_talk);
|
/* audio3 */ uxn_port(&u, 0x6, nil_talk);
|
||||||
/* empty */ uxn_port(&u, 0x7, nil_talk);
|
/* empty */ uxn_port(&u, 0x7, nil_talk);
|
||||||
/* control */ uxn_port(&u, 0x8, nil_talk);
|
/* control */ devctrl = uxn_port(&u, 0x8, nil_talk);
|
||||||
/* mouse */ uxn_port(&u, 0x9, nil_talk);
|
/* mouse */ uxn_port(&u, 0x9, nil_talk);
|
||||||
/* file */ uxn_port(&u, 0xa, nil_talk);
|
/* file */ uxn_port(&u, 0xa, nil_talk);
|
||||||
/* datetime */ uxn_port(&u, 0xb, nil_talk);
|
/* datetime */ uxn_port(&u, 0xb, nil_talk);
|
||||||
|
|
Loading…
Reference in New Issue