From 50f460157ef1f6fc4da4dc63a92f7d3df98bc555 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Thu, 20 Jan 2011 15:25:59 +0000 Subject: [PATCH] Initial stab at making Jaguar core work in QT: Works, but wrong colors. --- src/gui/glwidget.cpp | 2 +- src/gui/mainwin.cpp | 8 +++++--- src/tom.cpp | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/gui/glwidget.cpp b/src/gui/glwidget.cpp index 9788bc3..51f2c26 100644 --- a/src/gui/glwidget.cpp +++ b/src/gui/glwidget.cpp @@ -34,7 +34,7 @@ GLWidget::GLWidget(QWidget * parent/*= 0*/): QGLWidget(parent), texture(0), GLWidget::~GLWidget() { - delete[] backbuffer; + free(backbuffer); } void GLWidget::initializeGL() diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 90f192a..8c66b8d 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -206,12 +206,14 @@ WriteLog("About to attempt to load BIOSes...\n"); SET32(jaguarMainRAM, 0, 0x00200000); // Set top of stack... +//Let's try this... +/*if*/ JaguarLoadFile("./software/Rayman (World).j64"); + //This is crappy!!! !!! FIX !!! //Is this even needed any more? Hmm. Maybe. Dunno. //Seems like it is... But then again, maybe not. Have to test it to see. WriteLog("GUI: Resetting Jaguar...\n"); JaguarReset(); - } void MainWin::closeEvent(QCloseEvent * event) @@ -246,7 +248,7 @@ void MainWin::Timer(void) #else JaguarExecuteNew(); // memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->rasterWidth); - memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth); + memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t)); // memcpy(surface->pixels, backbuffer, TOMGetVideoModeWidth() * TOMGetVideoModeHeight() * 4); #endif @@ -385,7 +387,7 @@ void MainWin::ToggleRunState(void) } // memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->rasterWidth); - memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth); + memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t)); #endif videoWidget->updateGL(); diff --git a/src/tom.cpp b/src/tom.cpp index 2986068..c2ef281 100644 --- a/src/tom.cpp +++ b/src/tom.cpp @@ -336,8 +336,6 @@ uint16 tom_jerry_int_pending, tom_timer_int_pending, tom_object_int_pending, //int16 * TOMBackbuffer; uint32 * TOMBackbuffer; -uint32 tomDeviceWidth; - static const char * videoMode_to_str[8] = { "16 BPP CRY", "24 BPP RGB", "16 BPP DIRECT", "16 BPP RGB", "Mixed mode", "24 BPP RGB", "16 BPP DIRECT", "16 BPP RGB" }; @@ -910,6 +908,7 @@ void TOMResetBackbuffer(uint32 * backbuffer) // // Process a single scanline // +uint32 tomDeviceWidth;//kludge void TOMExecScanline(uint16 scanline, bool render) { bool inActiveDisplayArea = true; @@ -1016,7 +1015,8 @@ void tom_render_24bpp_scanline(uint32 * backbuffer) // If outside of VDB & VDE, then display the border color uint32 * currentLineBuffer = TOMBackbuffer; uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1]; - uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r; +//Hm. uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r; + uint32 pixel = 0x000000FF | (r << 24) | (g << 16) | (r << 8); for(uint32 i=0; i