Fixed incomplete display updates in gui qsimulat0r

This commit is contained in:
bernd 2011-07-25 08:34:03 +02:00
parent 955b724d1a
commit 54a8ce80f9
2 changed files with 25 additions and 0 deletions

View File

@ -31,6 +31,7 @@ QT_WRAP_CPP(qsimulat0r MocSources ${qsimulat0r_SRCS})
set(FIRMWARE_OBJS set(FIRMWARE_OBJS
../simcore/simcore.o ../simcore/simcore.o
../simcore/misc.o ../simcore/misc.o
../simcore/timecounter.o
) )

View File

@ -19,9 +19,28 @@ using namespace std;
extern "C" { extern "C" {
#include "basic/basic.h" #include "basic/basic.h"
#define lcdGetPixel __hideaway_lcdGetPixel
#include "lcd/display.h" #include "lcd/display.h"
#undef lcdGetPixel
#include "../simcore/simulator.h" #include "../simcore/simulator.h"
extern int lcd_layout; extern int lcd_layout;
#define ptrXor(a,b) ((uint8_t*)(((uintptr_t)a)^((uintptr_t)b)))
uint8_t guiBuffer1[RESX*RESY_B];
uint8_t guiBuffer2[RESX*RESY_B];
uint8_t *guiBuffer=guiBuffer1;
uint8_t *xorBuffer=ptrXor(guiBuffer1,guiBuffer2);
static bool lcdGetPixel(char x, char y){
char y_byte = (RESY-(y+1)) / 8;
char y_off = (RESY-(y+1)) % 8;
char byte = guiBuffer[y_byte*RESX+(RESX-(x+1))];
return byte & (1 << y_off);
}
} }
time_t starttime; time_t starttime;
@ -181,6 +200,11 @@ public:
extern "C" { extern "C" {
void simlcdDisplayUpdate() { void simlcdDisplayUpdate() {
uint8_t *src=lcdBuffer;
uint8_t *dst=ptrXor(guiBuffer,xorBuffer);
memcpy(dst,src,RESX*RESY_B);
guiBuffer=dst;
hackptr->update(); hackptr->update();
usleep(10000); usleep(10000);
} }