From f45b4acc547ca85d9af9efa37d8caa68c20a42e6 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Tue, 21 Jun 2011 06:02:47 +0000 Subject: [PATCH] Fixed GUI to be able to load carts, updated documentation. --- Makefile | 10 +++---- docs/INSTALL | 20 +++++++------- docs/README | 31 +++++++++++++-------- docs/WHATSNEW | 2 +- src/filedb.cpp | 3 ++- src/gui/filepicker.cpp | 36 +++++++++++++++++++++++-- src/gui/filepicker.h | 6 +++++ src/gui/mainwin.cpp | 61 ++++++++++++++++++++++++++++++------------ src/gui/mainwin.h | 4 +++ 9 files changed, 127 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 895a0ab..73f27aa 100644 --- 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 diff --git a/docs/INSTALL b/docs/INSTALL index 94c054c..6947f49 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -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. diff --git a/docs/README b/docs/README index abd3b73..1ca9044 100644 --- a/docs/README +++ b/docs/README @@ -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". diff --git a/docs/WHATSNEW b/docs/WHATSNEW index 442f8e7..080ab8b 100644 --- a/docs/WHATSNEW +++ b/docs/WHATSNEW @@ -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) diff --git a/src/filedb.cpp b/src/filedb.cpp index 3f8e9f3..3f3918e 100644 --- a/src/filedb.cpp +++ b/src/filedb.cpp @@ -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 }, diff --git a/src/gui/filepicker.cpp b/src/gui/filepicker.cpp index 150a275..f2ed0ac 100644 --- a/src/gui/filepicker.cpp +++ b/src/gui/filepicker.cpp @@ -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( "" @@ -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(); 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 diff --git a/src/gui/filepicker.h b/src/gui/filepicker.h index 16edee9..3ab470b 100644 --- a/src/gui/filepicker.h +++ b/src/gui/filepicker.h @@ -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; }; diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index 0c35671..4f9dcce 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -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; xrasterWidth; x++) + if (showUntunedTankCircuit) { - for(uint32_t y=0; yrasterHeight; y++) + // Random hash & trash + // We try to simulate an untuned tank circuit here... :-) + for(uint32_t x=0; xrasterWidth; 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; yrasterHeight; 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)); diff --git a/src/gui/mainwin.h b/src/gui/mainwin.h index c1ea616..820b860 100644 --- a/src/gui/mainwin.h +++ b/src/gui/mainwin.h @@ -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; -- 2.37.2