Prevent source file reading issue on no-Windows system
[clinton/Virtual-Jaguar-Rx.git] / src / gui / mainwin.cpp
index a3ff16d..2e6552c 100644 (file)
@@ -90,7 +90,7 @@
 #include "joystick.h"\r
 #include "m68000/m68kinterface.h"\r
 \r
-#include "debugger/VideoWin.h"\r
+//#include "debugger/VideoWin.h"\r
 #include "debugger/DasmWin.h"\r
 #include "debugger/m68KDasmWin.h"\r
 #include "debugger/GPUDasmWin.h"\r
@@ -145,6 +145,8 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        //      setCentralWidget(mainWindowCentrale);\r
        //}\r
 \r
+       WriteLog("Window creation start\n");\r
+\r
        // video output\r
        videoWidget = new GLWidget(this);\r
        videoWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);\r
@@ -184,7 +186,7 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        riscDasmBrowseWin = new RISCDasmBrowserWindow(this);\r
        if (vjs.softTypeDebugger)\r
        {\r
-               VideoOutputWin = new VideoOutputWindow(this);\r
+               //VideoOutputWin = new VideoOutputWindow(this);\r
                //VideoOutputWin->setCentralWidget()\r
                //DasmWin = new DasmWindow();\r
                DasmWin = new DasmWindow(this);\r
@@ -230,7 +232,7 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
 \r
        // Create actions\r
 \r
-       quitAppAct = new QAction(tr("E&xit"), this);\r
+       quitAppAct = new QAction(QIcon(":/res/exit.png"), tr("E&xit"), this);\r
 //     quitAppAct->setShortcuts(QKeySequence::Quit);\r
 //     quitAppAct->setShortcut(QKeySequence(tr("Alt+x")));\r
        //quitAppAct->setShortcut(QKeySequence(tr("Ctrl+q")));\r
@@ -251,8 +253,8 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        connect(powerAct, SIGNAL(triggered()), this, SLOT(TogglePowerState()));\r
 \r
        QIcon pauseIcon;\r
-       pauseIcon.addFile(":/res/pause-off", QSize(), QIcon::Normal, QIcon::Off);\r
-       pauseIcon.addFile(":/res/pause-on", QSize(), QIcon::Normal, QIcon::On);\r
+       pauseIcon.addFile(":/res/pause-off.png", QSize(), QIcon::Normal, QIcon::Off);\r
+       pauseIcon.addFile(":/res/pause-on.png", QSize(), QIcon::Normal, QIcon::On);\r
        pauseAct = new QAction(pauseIcon, tr("Pause"), this);\r
        pauseAct->setStatusTip(tr("Toggles the running state"));\r
        pauseAct->setCheckable(true);\r
@@ -329,7 +331,7 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        configAct->setShortcutContext(Qt::ApplicationShortcut);\r
        connect(configAct, SIGNAL(triggered()), this, SLOT(Configure()));\r
 \r
-       emustatusAct = new QAction(QIcon(""), tr("&Status"), this);\r
+       emustatusAct = new QAction(QIcon(":/res/status.png"), tr("&Status"), this);\r
        emustatusAct->setStatusTip(tr("Emulator status"));\r
        //emustatusAct->setShortcut(QKeySequence(tr("Ctrl+s")));\r
        emustatusAct->setShortcut(QKeySequence(tr(vjs.KBContent[KBEMUSTATUS].KBSettingValue)));\r
@@ -614,7 +616,11 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
        // Do this in case original size isn't correct (mostly for the first-run case)\r
        ResizeMainWindow();\r
 \r
-       // Create our test pattern bitmaps\r
+       WriteLog("Window creation done\n");\r
+\r
+       // Create our test pattern NTSC bitmap\r
+       WriteLog("Test pattern 1 bitmap\n");\r
+\r
        QImage tempImg(":/res/test-pattern.jpg");\r
        QImage tempImgScaled = tempImg.scaled(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_PAL, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);\r
 \r
@@ -629,7 +635,10 @@ MainWin::MainWin(bool autoRun): running(true), powerButtonOn(false),
                }\r
        }\r
 \r
-       QImage tempImg2(":/res/test-pattern-pal");\r
+       // Create our test pattern PAL bitmap\r
+       WriteLog("Test pattern 2 bitmap\n");\r
+\r
+       QImage tempImg2(":/res/test-pattern-pal.jpg");\r
        QImage tempImgScaled2 = tempImg2.scaled(VIRTUAL_SCREEN_WIDTH, VIRTUAL_SCREEN_HEIGHT_PAL, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);\r
 \r
        for(uint32_t y=0; y<VIRTUAL_SCREEN_HEIGHT_PAL; y++)\r
@@ -1321,10 +1330,14 @@ void MainWin::LoadSoftware(QString file)
        uint8_t * biosPointer = jaguarBootROM;\r
 \r
        if (vjs.hardwareTypeAlpine)\r
+       {\r
                biosPointer = jaguarDevBootROM2;\r
+       }\r
 \r
        if (vjs.softTypeDebugger)\r
+       {\r
                biosPointer = jaguarDevBootROM2;\r
+       }\r
 \r
        memcpy(jagMemSpace + 0xE00000, biosPointer, 0x20000);\r
 \r
@@ -1340,7 +1353,9 @@ void MainWin::LoadSoftware(QString file)
        // This is icky because we've already done it\r
 // it gets worse :-P\r
        if (!vjs.useJaguarBIOS)\r
+       {\r
                SET32(jaguarMainRAM, 4, jaguarRunAddress);\r
+       }\r
 \r
        m68k_pulse_reset();\r
 \r
@@ -1363,8 +1378,7 @@ void MainWin::LoadSoftware(QString file)
 \r
        if ((!vjs.hardwareTypeAlpine || !vjs.softTypeDebugger) && !loadAndGo && jaguarRunAddress)\r
        {\r
-               QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " Rx - Now playing: %1")\r
-                       .arg(filePickWin->GetSelectedPrettyName());\r
+               QString newTitle = QString("Virtual Jaguar " VJ_RELEASE_VERSION " Rx - Now playing: %1").arg(filePickWin->GetSelectedPrettyName());\r
                setWindowTitle(newTitle);\r
        }\r
 }\r
@@ -1408,7 +1422,9 @@ void MainWin::TraceStepInto(void)
 void MainWin::Restart(void)\r
 {\r
        m68k_set_reg(M68K_REG_PC, jaguarRunAddress);\r
+       m68k_set_reg(M68K_REG_SP, vjs.DRAM_size);\r
        //m68kDasmWin->SetAddress(jaguarRunAddress);\r
+       ResetDebuggerWindows();\r
        RefreshDebuggerWindows();\r
 #ifdef _MSC_VER\r
 #pragma message("Warning: !!! Need to verify the Restart function !!!")\r
@@ -1615,7 +1631,7 @@ void MainWin::ShowVideoOutputWin(void)
        //VideoOutputWindowCentrale->setWindowTitle(QString(tr("Video output")));\r
        //VideoOutputWindowCentrale->show();\r
        //memBrowseWin->show();\r
-       VideoOutputWin->show();\r
+       //VideoOutputWin->show();\r
        //VideoOutputWin->RefreshContents(videoWidget);\r
 }\r
 \r
@@ -1755,6 +1771,8 @@ void MainWin::ReadSettings(void)
        vjs.p2KeyBindings[BUTTON_s] = settings.value("p2k_star", Qt::Key_Asterisk).toInt();\r
 #endif\r
 \r
+       WriteLog("Read setting = Done\n");\r
+\r
        ReadProfiles(&settings);\r
 }\r
 \r
@@ -1892,6 +1910,8 @@ void MainWin::ReadUISettings(void)
        }\r
 \r
        settings.endGroup();\r
+\r
+       WriteLog("Read UI setting = Done\n");\r
 }\r
 \r
 \r
@@ -2094,8 +2114,20 @@ void     MainWin::RefreshAlpineWindows(void)
 }\r
 \r
 \r
+// Reset soft debugger & alpine debug windows\r
+void MainWin::ResetDebuggerWindows(void)\r
+{\r
+       if (vjs.softTypeDebugger)\r
+       {\r
+               heapallocatorBrowseWin->Reset();\r
+       }\r
+\r
+       //ResetAlpineWindows();\r
+}\r
+\r
+\r
 // Refresh soft debugger & alpine debug windows\r
-void   MainWin::RefreshDebuggerWindows(void)\r
+void MainWin::RefreshDebuggerWindows(void)\r
 {\r
        size_t i;\r
 \r