]> Shamusworld >> Repos - virtualjaguar/commitdiff
Initial stab at making Jaguar core work in QT: Works, but wrong colors.
authorShamus Hammons <jlhamm@acm.org>
Thu, 20 Jan 2011 15:25:59 +0000 (15:25 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 20 Jan 2011 15:25:59 +0000 (15:25 +0000)
src/gui/glwidget.cpp
src/gui/mainwin.cpp
src/tom.cpp

index 9788bc3b4f65e53cc6cd5fb039e01f3ee827b59d..51f2c26679b529a165a9e2578fd593faa1dc8161 100644 (file)
@@ -34,7 +34,7 @@ GLWidget::GLWidget(QWidget * parent/*= 0*/): QGLWidget(parent), texture(0),
 
 GLWidget::~GLWidget()
 {
-       delete[] backbuffer;
+       free(backbuffer);
 }
 
 void GLWidget::initializeGL()
index 90f192a464a69932108fe592b28bab75c3e0e971..8c66b8d3b3fd1854bec92b58d2d06162c90cc6bf 100644 (file)
@@ -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();
index 29860682832fcb655c33c67ce0711c31de8dff51..c2ef28192a8270c107724ba45c0df0b7880464c2 100644 (file)
@@ -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<tomWidth; i++)
                                *currentLineBuffer++ = pixel;