]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixed GUI to be able to load carts, updated documentation.
authorShamus Hammons <jlhamm@acm.org>
Tue, 21 Jun 2011 06:02:47 +0000 (06:02 +0000)
committerShamus Hammons <jlhamm@acm.org>
Tue, 21 Jun 2011 06:02:47 +0000 (06:02 +0000)
Makefile
docs/INSTALL
docs/README
docs/WHATSNEW
src/filedb.cpp
src/gui/filepicker.cpp
src/gui/filepicker.h
src/gui/mainwin.cpp
src/gui/mainwin.h

index 895a0ab29e1202d029c61ca6e8dbb65e8ac47e6e..73f27aa47dabc850541267a5a90c42070a00d703 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,7 @@
 # file GPL.TXT for details. ;-)
 #
 
-# NOTE: zlib and OpenGL libs are a dependency, but are not checked for.
-#       same goes for libcdio, Qt
+# NOTE: Qt and OpenGL libs are a dependency, but are not checked for.
 
 # Figure out which system we're compiling for, and set the appropriate variables
 
@@ -41,7 +40,7 @@ ICON       :=
 SDLLIBTYPE := --libs
 MSG        := GNU/Linux
 
-else                                                                                   # *nix
+else                                                                                   # ???
 
 $(error OS TYPE UNDETECTED)
 
@@ -129,9 +128,10 @@ OBJS := \
 # Targets for convenience sake, not "real" targets
 .PHONY: clean
 
-all: checkenv message2 obj $(TARGET)$(EXESUFFIX)
+all: checkenv message obj $(TARGET)$(EXESUFFIX)
        @echo
        @echo -e "\033[01;33m***\033[00;32m Looks like it compiled OK... Give it a whirl!\033[00m"
+       @echo
 
 # Check the compilation environment, barf if not appropriate
 
@@ -200,7 +200,7 @@ msg-check-env:
        @echo -e "\033[01;33m***\033[00;32m Checking compilation environment: \033[00m"
        @echo
 
-message2:
+message:
        @echo
        @echo -e "\033[01;33m***\033[00;32m Building Virtual Jaguar for $(MSG)...\033[00m"
        @echo
index 94c054cb398dec729e90cb4f118422076069f0d7..6947f494406d1fc1c66c89d904f1fb36dde6a927 100644 (file)
@@ -1,6 +1,6 @@
----------------------------------------------
-Virtual Jaguar v1.1.0 GCC/SDL release INSTALL
----------------------------------------------
+----------------------------------------
+Virtual Jaguar v2.0.0 Qt release INSTALL
+----------------------------------------
 
 
 REQUIREMENTS:
@@ -8,11 +8,12 @@ REQUIREMENTS:
 
 The minimum requirements for compiling Virtual Jaguar from source are:
 
- o  GCC v4.3.x or higher
- o  SDL v1.2.13 or higher
- o  zlib v1.2.3
- o  libcdio v0.80 or higher
+ o  GCC v4.4.x or higher
+ o  SDL v1.2.14 or higher
+ o  zlib v1.2.5
+ o  libcdio v0.82 or higher (optional, for Jaguar CD support)
  o  OpenGL libraries
+ o  Qt 4.7.3 or higher
  o  supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw, MacOS); other
     OSs may work to but you may need to change some items in the Makefile.
 
@@ -34,8 +35,9 @@ Optionally you can manually strip vj[.exe] to downsize the binary. If you have
 upx in your path somewhere, you can uncomment the line in the makefile that
 executes upx so that you'll end up with a somewhat smaller binary.
 
-That's it! You can now start the emulator with ./vj. See the output for more
-details (or stdout.txt on Win32) or consult the README file for more info.
+That's it! You can now start the emulator with ./virtualjaguar. See the output
+for more details (or stdout.txt on Win32) or consult the README file for more
+info.
 
 For even more info, go to http://sdlemu.ngemu.com or send use an e-mail to the
 following e-mail address: sdlemu AT ngemu DOT com.
index abd3b731b76a6da7c1f2fbef4a4c91c1b4f771e5..1ca9044550e7b9f2e3554f46becdf85040decdf0 100644 (file)
@@ -122,18 +122,25 @@ at the beginning of this file.
 After obtaining the Atari Jaguar boot ROM (and/or CD boot ROM) and several game
 ROMs you can now use Virtual Jaguar using the following command:
 
-./vj [romfile] [-switches]
+./virtualjaguar [romfile] [-switches]
 
 The context of ROMFILE is the filename of the an Atari Jaguar ROM dump (can be
 either compressed or uncompressed). You can also use switches. By just typing
-./vj -? (or ./vj -help) you get an overview of the options you can use. WIN32
-users should look into the stdout.txt in the directory they ran Virtual Jaguar
-for that information.
+./virtualjaguar -? (or ./virtualjaguar -help) you get an overview of the
+options you can use. WIN32 users should look into the stdout.txt in the
+directory they ran Virtual Jaguar for that information. Also, WIN32 users
+should be aware that if their ROM filenames contain any spaces, you will have
+to enclose the ROMFILE in double quotes for Virtual Jaguar to function
+properly.
+
+Note that running Virtual Jaguar this way will cause the emulator to exit
+completely upon pressing the ESC key. If this is not what you want, then omit
+the ROMFILE and it will bring up a nice GUI instead.
 
 If you prefer a nice GUI instead of typing in command lines, you can either
-type ./vj or double click on the Virtual Jaguar executable. If you have a
-directory full of ROM files, you can tell Virtual Jaguar where they are by
-editing the appropriate line in the vj.cfg file (it assumes a ROMs directory
+type ./virtualjaguar or double click on the Virtual Jaguar executable. If you
+have a directory full of ROM files, you can tell Virtual Jaguar where they are
+by editing the appropriate line in the vj.cfg file (it assumes a ROMs directory
 under the directory where VJ lives) so that they show up when you pick the
 "Load" option from the "File" menu.
 
@@ -193,8 +200,10 @@ released the sources to the public. We couldn't have done it without you!
 
 SDLEMU
 
-Stuff to add in:
 
- - How to run ROMs from the command line with spaces in the names (quoting)
- - The behavior of the emulator when running from the command line (passed in ROM
-   vs. non)
+*** Stuff to add in:
+
+ o  Documentation needs a rewrite, more or less, as the GUI is now front and
+    center. Need to update the docs to reflect this change.
+ o  Document the new "solid" zip file archive mechanism which allows putting
+    artwork into a "ROM".
index 442f8e76385e5705306d58f09699aac4bf436f0c..080ab8b749bdcce66a0ab25460ea43cc351f6776 100644 (file)
@@ -4,7 +4,7 @@ Virtual Jaguar v2.0.0 GCC/SDL
 * Switched GUI to Qt. And there was much rejoicing. ;-) [Shamus]
 * Added detection code to fish out files from inside ZIP archives. What this
   means is that now you can have other goodies inside of your ROM ZIP like
-  labels, box art, and overlays. [Shamus]
+  labels, box art, and overlays. See README for details. [Shamus]
 
 
 Virtual Jaguar v1.1.0 GCC/SDL (r299 - Never officially released)
index 3f8e9f38aa4db90d16a1b8af6c0fd2bc011c505a..3f3918ecdcfa0af7dcbafb8d2415751d0c923039 100644 (file)
@@ -49,9 +49,10 @@ RomIdentifier romList[] = {
        { 0x3C044941, "Skyhammer (World)", "skyhammer.jpg", FF_ROM },
        { 0x40E1A1D0, "Air Cars (World)", "air-cars.jpg", FF_ROM },
        { 0x42A13EC5, "Soccer Kid (World)", "soccer-kid.jpg", FF_ROM },
+       { 0x45AA46BA, "Space War 2000 (World)", "", FF_ROM },
        { 0x47EBC158, "Theme Park (World)", "theme-park.jpg", FF_ROM },
        { 0x4899628F, "Hover Strike (World)", "hover-strike.jpg", FF_ROM },
-       { 0x53DF6440, "Space War 2000 (World)", "", FF_ROM },
+       { 0x53DF6440, "Space War 2000 (World) (OVERDUMP)", "", FF_ROM },
        { 0x55A0669C, "[BIOS] Atari Jaguar Developer CD (World)", "", FF_BIOS },
        { 0x58272540, "Syndicate (World)", "syndicate.jpg", FF_ROM },
        { 0x5A101212, "Sensible Soccer - International Edition (World)", "sensible-soccer.jpg", FF_ROM },
index 150a2753c66101fddd5009d239a4808e2bdbf4ea..f2ed0accdf86dca0cf6c30e7c9eb8808fb946d3f 100644 (file)
@@ -53,7 +53,8 @@ Data strategy:
 
 //could use Window as well...
 //FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
-FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Window)
+FilePickerWindow::FilePickerWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Window),
+       currentFile("")
 {
        setWindowTitle(tr("Insert Cartridge..."));
 
@@ -138,6 +139,11 @@ printf("VSB size: %u, %u\n", sbSize3.width(), sbSize3.height());
        )));
        data->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
        dataLayout->addWidget(data);
+
+       insertCart = new QPushButton(QIcon(":/res/generic.png"), "", this);
+       insertCart->setDefault(true);                           // We want this button to be the default
+       insertCart->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
+       dataLayout->addWidget(insertCart);
 #else
        QLabel * text2 = new QLabel(QString(tr(
                "<table>"
@@ -161,6 +167,8 @@ New sizes: 373x172 (label), 420x340 (cart)
 //     QItemSelectionModel * ism = fileList->selectionModel();
 //     connect(ism, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
        connect(fileList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(UpdateSelection(const QModelIndex &, const QModelIndex &)));
+
+       connect(insertCart, SIGNAL(clicked()), this, SLOT(LoadButtonPressed()));
 }
 
 //
@@ -188,6 +196,13 @@ printf("FilePickerWindow(2): Found match [%s]...\n", romList[index].name);
                model->AddData(index, str, QImage(), size);
 }
 
+void FilePickerWindow::LoadButtonPressed(void)
+{
+       // TODO: Get the text of the current selection, call the MainWin slot for loading
+       emit(RequestLoad(currentFile));
+       this->hide();
+}
+
 //
 // This slot gets called when the QListView gets clicked on. Updates
 // the cart graphic and accompanying text.
@@ -201,12 +216,17 @@ void FilePickerWindow::UpdateSelection(const QModelIndex & current, const QModel
 //     printf("FPW: %s\n", s.toAscii().data());
        unsigned long fileSize = current.model()->data(current, Qt::WhatsThisRole).toUInt();
 #else
-       QString s = current.model()->data(current, FLM_FILENAME).toString();
+//     QString s = current.model()->data(current, FLM_FILENAME).toString();
+       currentFile = current.model()->data(current, FLM_FILENAME).toString();
        unsigned long i = current.model()->data(current, FLM_INDEX).toUInt();
        QImage label = current.model()->data(current, FLM_LABEL).value<QImage>();
        unsigned long fileSize = current.model()->data(current, FLM_FILESIZE).toUInt();
 //     printf("FPW: %s\n", s.toAscii().data());
 #endif
+
+//hm.
+//currentFile = s;
+
 //373x172 is label size...
        if (!label.isNull())
        {
@@ -222,11 +242,23 @@ void FilePickerWindow::UpdateSelection(const QModelIndex & current, const QModel
 //Though this should probably be done when this is loaded, instead of every time here...
 //QImage scaledImg = label.scaled(373, 172, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
 //painter.drawPixmap(23, 87, QPixmap::fromImage(scaledImg));
+               // Now, looks like it is...
                painter.drawPixmap(23, 87, QPixmap::fromImage(label));
 //             painter.drawPixmap(23, 87, 373, 172, QPixmap::fromImage(label));
                painter.end();
                cartImage->setPixmap(QPixmap::fromImage(cart));
        }
+       else
+       {
+               // We should try to be intelligent with our updates here, and only redraw when
+               // we're going from a selection with a label to a selection without. Now, we
+               // redraw regardless.
+               QImage cart(":/res/cart-blank.png");
+               QPainter painter(&cart);
+               painter.drawPixmap(23, 87, QPixmap::fromImage(QImage(":/res/label-blank.png")));
+               painter.end();
+               cartImage->setPixmap(QPixmap::fromImage(cart));
+       }
 
 //1048576
 //2097152
index 16edee964c614c6b6348c09879dc54821e35123e..3ab470b17f0a1235c25c9610f222ab29444fc319 100644 (file)
@@ -23,11 +23,16 @@ class FilePickerWindow: public QWidget
                void AddFileToList(unsigned long index);
                void AddFileToList2(unsigned long index, QString, QImage *, unsigned long size);
                void UpdateSelection(const QModelIndex &, const QModelIndex &);
+               void LoadButtonPressed(void);
+
+       signals:
+               void RequestLoad(QString);
 
        protected:
 //             void PopulateList(void);
 
        private:
+               QString currentFile;
                QListWidget * fileList2;
                FileThread * fileThread;
                FileListModel * model;
@@ -35,4 +40,5 @@ class FilePickerWindow: public QWidget
                QLabel * cartImage;
                QLabel * title;
                QLabel * data;
+               QPushButton * insertCart;
 };
index 0c3567116d0664cbb82644d8f92ae670ff56be74..4f9dcce2e8576ea89525adf5ea984197a09e571d 100644 (file)
@@ -63,7 +63,7 @@
 // We'll make the VJ core modular so that it doesn't matter what GUI is in
 // use, we can drop it in anywhere and use it as-is.
 
-MainWin::MainWin()
+MainWin::MainWin(): showUntunedTankCircuit(true)
 {
        videoWidget = new GLWidget(this);
        setCentralWidget(videoWidget);
@@ -133,6 +133,9 @@ MainWin::MainWin()
        filePickAct->setStatusTip(tr("Insert a cartridge into Virtual Jaguar"));
        connect(filePickAct, SIGNAL(triggered()), this, SLOT(InsertCart()));
 
+       // Misc. connections...
+       connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
+
        // Create menus & toolbars
 
        fileMenu = menuBar()->addMenu(tr("&File"));
@@ -145,6 +148,7 @@ MainWin::MainWin()
 
        toolbar = addToolBar(tr("Stuff"));
        toolbar->addAction(powerAct);
+       toolbar->addAction(filePickAct);
        toolbar->addSeparator();
        toolbar->addAction(x1Act);
        toolbar->addAction(x2Act);
@@ -175,6 +179,10 @@ MainWin::MainWin()
        connect(timer, SIGNAL(timeout()), this, SLOT(Timer()));
        timer->start(20);
 
+       // NOTE: Keyboards/joysticks will *not* work until SDL is brought back in, or
+       //       the key handling is improved in Qt...
+       // Wait a minute... it seems they already are... So why no keyboard love?
+
 #ifdef VJ_RELEASE_VERSION
        WriteLog("Virtual Jaguar %s (Last full build was on %s %s)\n", VJ_RELEASE_VERSION, __DATE__, __TIME__);
 #else
@@ -210,12 +218,14 @@ WriteLog("About to attempt to load BIOSes...\n");
 //     JaguarLoadFile("./software/Rayman (World).j64");
 //     JaguarLoadFile("./software/I-War (World).j64");
 //     JaguarLoadFile("./software/Alien vs Predator (World).j64");
-       JaguarLoadFile("./software/Rayman (USA, Europe).zip");
+//no   JaguarLoadFile("./software/battlesphere.bin");
+//     JaguarLoadFile("./software/Battle Sphere Gold (World).j64");
+//     JaguarLoadFile("./software/Rayman (USA, Europe).zip");
 //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();
+//WriteLog("GUI: Resetting Jaguar...\n");
+//     JaguarReset();
 }
 
 void MainWin::closeEvent(QCloseEvent * event)
@@ -236,23 +246,27 @@ void MainWin::Timer(void)
        if (!running)
                return;
 
-#if 0
-       // Random hash & trash
-       // We try to simulate an untuned tank circuit here... :-)
-       for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
+       if (showUntunedTankCircuit)
        {
-               for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
+               // Random hash & trash
+               // We try to simulate an untuned tank circuit here... :-)
+               for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
                {
-                       videoWidget->buffer[(y * videoWidget->textureWidth) + x] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;// | (rand() & 0xFF);//0x000000FF;
-//                     buffer[(y * textureWidth) + x] = x*y;
+                       for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
+                       {
+                               videoWidget->buffer[(y * videoWidget->textureWidth) + x] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;// | (rand() & 0xFF);//0x000000FF;
+       //                      buffer[(y * textureWidth) + x] = x*y;
+                       }
                }
        }
-#else
-       JaguarExecuteNew();
-//     memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->rasterWidth);
-       memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t));
-//     memcpy(surface->pixels, backbuffer, TOMGetVideoModeWidth() * TOMGetVideoModeHeight() * 4);
-#endif
+       else
+       {
+               // Otherwise, run the Jaguar simulation
+               JaguarExecuteNew();
+//             memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->rasterWidth);
+               memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t));
+//             memcpy(surface->pixels, backbuffer, TOMGetVideoModeWidth() * TOMGetVideoModeHeight() * 4);
+       }
 
        videoWidget->updateGL();
 }
@@ -441,6 +455,19 @@ void MainWin::InsertCart(void)
        filePickWin->show();
 }
 
+void MainWin::LoadSoftware(QString file)
+{
+       running = false;                                                        //  Prevent bad things(TM) from happening...
+       SET32(jaguarMainRAM, 0, 0x00200000);                    // Set top of stack...
+       showUntunedTankCircuit = (JaguarLoadFile(file.toAscii().data()) ? false : true);
+//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();
+       running = true;
+}
+
 void MainWin::ResizeMainWindow(void)
 {
        videoWidget->setFixedSize(zoomLevel * 320, zoomLevel * (vjs.hardwareTypeNTSC ? 240 : 256));
index c1ea616ff212ae56df4fc13017270905e00f0dd4..820b860b807a09dc397301fc09e860d685b86c3a 100644 (file)
@@ -40,6 +40,9 @@ class MainWin: public QMainWindow
                void ShowAboutWin(void);
                void InsertCart(void);
 
+//     public slots:
+               void LoadSoftware(QString);
+
        private:
                void ResizeMainWindow(void);
                void ReadSettings(void);
@@ -52,6 +55,7 @@ class MainWin: public QMainWindow
                QTimer * timer;
                bool running;
                int zoomLevel;
+               bool showUntunedTankCircuit;
 
                QMenu * fileMenu;
                QMenu * helpMenu;