]> Shamusworld >> Repos - virtualjaguar/commitdiff
Virtual Jaguar 2.0.0 release. 2.0.0
authorShamus Hammons <jlhamm@acm.org>
Wed, 12 Oct 2011 13:25:59 +0000 (13:25 +0000)
committerShamus Hammons <jlhamm@acm.org>
Wed, 12 Oct 2011 13:25:59 +0000 (13:25 +0000)
19 files changed:
Makefile
docs/WHATSNEW
jaguarcore.mak
musashi.mak
res/help.html
src/file.cpp
src/gui/about.cpp
src/gui/about.h
src/gui/app.cpp
src/gui/glwidget.cpp
src/gui/help.cpp
src/gui/help.h
src/gui/mainwin.cpp
src/jaguar.cpp
src/jaguar.h
src/op.cpp
src/tom.cpp
src/tom.h
virtualjaguar.pro

index ac749dba8551d18ef7414cb4de0333d0c579c49e..4061bb1add815d50c9fb8fbb7917d20fb9e83939 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,10 +23,10 @@ all: prepare virtualjaguar
 
 prepare:
        @echo -e "\033[01;33m***\033[00;32m Preparing to compile Virtual Jaguar...\033[00m"
-#      @echo "#define VJ_RELEASE_VERSION \"v2.0.0\"" > src/version.h
-#      @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
-       @echo "#define VJ_RELEASE_VERSION \"SVN `svn info | grep -i revision`\"" > src/version.h
-       @echo "#define VJ_RELEASE_SUBVERSION \"2.0.0 Prerelease\"" >> src/version.h
+       @echo "#define VJ_RELEASE_VERSION \"v2.0.0\"" > src/version.h
+       @echo "#define VJ_RELEASE_SUBVERSION \"Final\"" >> src/version.h
+#      @echo "#define VJ_RELEASE_VERSION \"SVN `svn info | grep -i revision`\"" > src/version.h
+#      @echo "#define VJ_RELEASE_SUBVERSION \"2.0.0 Prerelease\"" >> src/version.h
 
 virtualjaguar: sources libs makefile-qt
        @echo -e "\033[01;33m***\033[00;32m Making Virtual Jaguar GUI...\033[00m"
index bb53efa6266d68b9744e53ab0556d31247c764a3..4a6c48f3c9a763ec60eb45c5ac17278111517e7e 100644 (file)
@@ -4,7 +4,7 @@ Virtual Jaguar v2.0.0 GCC/Qt
 * 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. See README for details. [Shamus]
+  labels, box art, and overlays. See built-in help for details. [Shamus]
 * Various usability improvements, too many to list here. ;-) [Shamus]
 * Various compatibility improvements to the Jaguar core, too many to list
   here. ;-) [Shamus]
index 85fbccaea7a219e55ed1802af0476c7fff205c4e..7d0ef6f68281d30ea5c39f7172606544612978b1 100644 (file)
@@ -18,7 +18,7 @@ SDLLIBTYPE := --libs
 
 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"    # Should catch both 'darwin' and 'darwin7.0'
 
-SYSTYPE    := __GCCUNIX__ -D_OSX_
+SYSTYPE    := __GCCUNIX__ -D__THINK_STUPID__
 SDLLIBTYPE := --static-libs
 
 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux"              # Linux
index 1e0d3eb1c0fddcbae88155995a58014c7b13f773..869b19b92b52e113f78fed91b8e2c414c6f72e3c 100644 (file)
@@ -3,7 +3,7 @@
 #
 # by James L. Hammons
 #
-# This software is licensed under the GPL v3 or any later version. See the
+# This makefile is licensed under the GPL v3 or any later version. See the
 # file GPLv3 for details. ;-)
 #
 
index c9bd8ccdceb32876d1227a9839094c77009f91f2..5ae288fb144c5374844007ad772bc0e40efc98d2 100644 (file)
@@ -7,7 +7,248 @@
 <body>
 <h1><i>Virtual Jaguar:</i> The Documentation</h1>
 
-<i>Coming Soon!</i>
+<h2><i>Virtual Jaguar</i> Quick Start</h2>
+
+<p>Welcome to <i>Virtual Jaguar!</i> If this is your first time using <i>Virtual Jaguar</i>, you can get a feel for what it is and does by doing the following:
+
+<ul>
+<li>Select &ldquo;Insert Cartridge&rdquo; from the &ldquo;Jaguar&rdquo; menu, or press the &ldquo;Insert Cartridge&rdquo; toolbar button.</li>
+<li>In the dialog that shows up, you will see the pack-in title of <i>Downfall</i> which is brought to you courtesy of <b>Reboot</b> (<a href="http://reboot.atari.org">http://reboot.atari.org</a>).</li>
+<li>Click on the <i>Insert</i> button in the lower right hand corner of the dialog or simply press the <b>Enter</b> key on your keyboard.</li>
+<li>In a few moments, the <i>Downfall</i> title screen should show in the <i>Virtual Jaguar</i> main window.</li>
+</ul>
+
+<p>To play, use the left and right keys (mapped to <b>Z</b> and <b>C</b> on your keyboard) and the the B button (mapped to <b>K</b> on your keyboard). You can pause <i>Virtual Jaguar</i> by selecting &ldquo;Pause&rdquo; from the &ldquo;Jaguar&rdquo; menu, pressing the &ldquo;Pause&rdquo; toolbar button, or by pressing the <b>Esc</b> key on your keyboard. You can quit <i>Virtual Jaguar</i> by selecting &ldquo;Exit&rdquo; from the &ldquo;Jaguar&rdquo; menu, or by pressing <b>Ctrl</b> + <b>Q</b> on your keyboard.</p>
+
+<h2>System Requirements</h2>
+
+<p><i>Virtual Jaguar</i> should be able to run on most late model computers equipped with an OpenGL compliant video card. It requires a lot of raw <i>oomph</i> in it&rsquo;s present form to run well; do not be surprised if it doesn&rsquo;t run at 100% speed with all the options, such as sound and DSP, turned on. Certain subsystems of the Jaguar are not optimized yet and as such take more time than they would if they were optimized. To run <i>Virtual Jaguar</i> at full speed with all options on, we recommend using liquid nitrogen. At least until we get it properly optimized. ;-)</p>
+
+<h2><i>Virtual Jaguar</i> In Depth</h2>
+
+<p>This version of <i>Virtual Jaguar</i> has been redesigned with a modern GUI and as such should be fairly easy to use and understand. However, some options may not do what you expect: What follows is an exhaustive look at what the various toolbar buttons and menu options do.</p>
+
+<h2>The Toolbar</h2>
+
+<p>The main <i>Virtual Jaguar</i> toolbar contains the following buttons:</p>
+
+<ul>
+<li>Power</li>
+<li>Pause</li>
+<li>Insert Cartridge</li>
+<li>Use CD Unit</li>
+<li>Scale x1</li>
+<li>Scale x2</li>
+<li>Scale x3</li>
+<li>NTSC</li>
+<li>PAL</li>
+<li>Blur</li>
+</ul>
+
+<p>Here&rsquo;s what they do.</p>
+
+<h3>Power</h3>
+
+<p>This toolbar button acts just like the power switch on a real Jaguar, complete with untuned tank circuit noise showing on the screen when the emulated Jaguar is turned off. Some options only take effect after the power has been cycled, such as the NTSC/PAL switches, or the &ldquo;Use Jaguar BIOS&rdquo; option in the Configuration dialog.</p>
+
+<h3>Pause</h3>
+
+<p>Pressing the Pause toolbar button will pause execution of the emulated Jaguar. Note that most games have a pause feature that is built into the game; this feature is separate from and will override any built-in game pause feature. Also, the emulator will go into pause mode if the power is on when you activate the &ldquo;Insert Cartridge&rdquo; dialog. Pressing the <b>Esc</b> key will also activate this option. Selecting this option in any of the ways listed above, while in pause mode, will take it out of pause mode.</p>
+
+<h3>Insert Cartridge</h3>
+
+<p>Pressing the Insert Cartridge button will bring up the Insert Cartridge dialog; it can also be launched by pressing <b>Ctrl</b> + <b>I</b> on your keyboard. On the left side of the dialog will be a list of software that <i>Virtual Jaguar</i> recognizes from the directory you tell it to look into (see the &ldquo;Configure&rdquo; menu option and the &ldquo;General&rdquo; tab, &ldquo;Software&rdquo; item for more information). Selecting an item in the list will bring up some information about the software on the right side of the dialog, if <i>Virtual Jaguar</i> knows about it. Pressing the icon in the lower right hand side of the dialog will then cause <i>Virtual Jaguar</i> to attempt to run the selected item. <i>Virtual Jaguar</i> cycles the power when it attempts to run the software you select.</p>
+
+<p>There are also some keyboard shortcuts that come with the Insert Cartridge dialog: Pressing a letter key will highlight the nearest item in the list that starts with that letter. Pressing more than one letter key in quick succession will narrow in on the item that matches those letter keys pressed. Pressing the <b>Esc</b> key will dismiss the dialog without attempting to load anything, and pressing the <b>Enter</b> key is the same as pressing the icon in the lower right hand side of the dialog.</p>
+
+<h3>Use CD Unit</h3>
+
+<p>Pressing this toolbar button will virtually plug in a Jaguar CD unit into the emulated Jaguar. It will not take effect until the power has been cycled.</p>
+
+<p>As of the release date for this emulator, this option <b>DOES NOT WORK</b> 100% the way it&rsquo;s intended to: When it&rsquo;s working correctly, selecting this option will allow you to insert a Jaguar CD game into your computer&rsquo;s CD/DVD drive and play it as if it were on a real Jaguar. For now, you can see the CD BIOS make pretty patterns on your screen if you use it.</p>
+
+<p>Note that once this is working as it should, the DSP will be required to be <b>enabled</b> for it to work properly. It <b>WILL NOT WORK</b> properly without the DSP.</p>
+
+<h3>Scale x1</h3>
+
+<p>Selecting this toolbar button will cause the screen to be displayed with pixels that are sized 1 to 1 with your display; this will give you a very small display.</p>
+
+<h3>Scale x2</h3>
+
+<p>This will cause the screen to be displayed with pixels that are sized 2 to 1 with your display.</p>
+
+<h3>Scale x3</h3>
+
+<p>This will cause the screen to be displayed with pixels that are sized 3 to 1 with your display; this should yield a fairly large display.</p>
+
+<h3>NTSC</h3>
+
+<p>Selecting this item will cause the emulated Jaguar to behave as if it were an NTSC type Jaguar, running at 60 Hz. This option will shrink the screen immediately but will not take effect until the emulated Jaguar has been power cycled.</p>
+
+<h3>PAL</h3>
+
+<p>Selecting this item will cause the emulated Jaguar to behave as if it were an PAL type Jaguar, running at 50 Hz. As an added bonus, you also get a few extra scan lines as compared with NTSC mode; some games will even utilize this extra screen real estate. This option will enlarge the screen immediately but will not take effect until the emulated Jaguar has been power cycled.</p>
+
+<h3>Blur</h3>
+
+<p>Normally, the emulated Jaguar&rsquo;s display shows pixels that are razor sharp and is what you would likely see if the Jaguar was hooked up to a high quality monitor. Selecting this item will cause the emulated Jaguar&rsquo;s display to be averaged, resulting in a screen that looks slightly blurry&mdash;more like what you would expect to see if the Jaguar was hooked up to a television. This is an aesthetic option that some people prefer; you may or may not like it.</p>
+
+
+<h2>Jaguar Menu</h2>
+
+<p>This menu has the following options:</p>
+
+<ul>
+<li>Power</li>
+<li>Pause</li>
+<li>Insert Cartridge...</li>
+<li>Use CD Unit</li>
+<li>Configure</li>
+<li>Exit</li>
+</ul>
+
+<p><b>Power</b> does the same as the toolbar button; see the &ldquo;Power&rdquo; toolbar button description for details.</p>
+
+<p><b>Pause</b> does the same as the toolbar button; see the &ldquo;Pause&rdquo; toolbar button description for details.</p>
+
+<p><b>Insert Cartridge...</b> does the same as the toolbar button; see the &ldquo;Insert Cartridge&rdquo; toolbar button description for details.</p>
+
+<p><b>Use CD Unit</b> does the same as the toolbar button; see the &ldquo;Use CD Unit&rdquo; toolbar button description for details.</p>
+
+<p><b>Configure</b> launches the Configure dialog. A full description is given in the &ldquo;Configure Dialog&rdquo; section below.</p>
+
+<p><b>Exit</b> quits <i>Virtual Jaguar</i> immediately. You can also quit <i>Virtual Jaguar</i> by pressing <b>Ctrl</b> + <b>Q</b> on your keyboard.</p>
+
+<h2>Help Menu</h2>
+
+<p>This menu has the following options:</p>
+
+<ul>
+<li>Contents</li>
+<li>About</li>
+</ul>
+
+<p>The <b>Contents</b> is what you&rsquo;re reading right now. The voice you are hearing in your head is probably your own, though we can&rsquo;t guarantee that. ;-) This dialog can be dismissed by clicking on the &ldquo;X&rdquo; in the upper corner of the dialog, or by pressing the <b>Esc</b> key on your keyboard.</p>
+
+<p>The <b>About</b> option shows a credits dialog. It can be dismissed by clicking on the &ldquo;X&rdquo; in the upper corner of the dialog, or by pressing the <b>Esc</b> key on your keyboard.</p>
+
+<h2>The Configure Dialog</h2>
+
+<p>The Configure dialog has the following tabs:</p>
+
+<ul>
+<li>General</li>
+<li>Controller #1</li>
+<li>Controller #2</li>
+</ul>
+
+<h2>General Tab</h2>
+
+<p>Under the General tab, there are the following options:</p>
+
+<ul>
+<li>EEPROMs</li>
+<li>Software</li>
+<li>Enable Jaguar BIOS</li>
+<li>Enable GPU</li>
+<li>Enable DSP</li>
+<li>Enable audio playback</li>
+<li>Show all files in file chooser</li>
+</ul>
+
+<p>Here&rsquo;s what they do.</p>
+
+<h3>EEPROMs</h3>
+
+<p>This field holds the location on your filesystem where your EEPROM files will live (see the &ldquo;EEPROMs&rdquo; section below for details). The path can be either absolute or relative; if relative, it will be relative to where the <i>Virtual Jaguar</i> executable is located on your filesystem.</p>
+
+<h3>Software</h3>
+
+<p>This field holds the location on your filesystem where your Jaguar software files will live (see the &ldquo;Software&rdquo; section below for details). The path can be either absolute or relative; if relative, it will be relative to where the <i>Virtual Jaguar</i> executable is located on your filesystem.</p>
+
+<h3>Enable Jaguar BIOS</h3>
+
+<p>Checking this option will cause the emulated Jaguar to run with the built-in system BIOS upon powering on. This is usually not necessary, but some games will not run correctly without it. Note that this option will only affect cartridge images; it has no effect on Alpine ROMs or homebrew files.</p>
+
+<h3>Enable GPU</h3>
+
+<p>The GPU is one of the three main processors in the Jaguar, and checking this option enables it. Most software will not work without this.</p>
+
+<h3>Enable DSP</h3>
+
+<p>The DSP is one of the three main processors in the Jaguar, and checking this option enables it. Much software will work without it, however, there is some software that will not.</p>
+
+<h3>Enable audio playback</h3>
+
+<p>Checking this option will allow <i>Virtual Jaguar</i> to attempt to output sound to your sound card. It will <b>not</b> output <b>any</b> sound without the DSP being enabled.</p>
+
+<h3>Show all files in file chooser</h3>
+
+<p>Normally the &ldquo;Insert Cartridge...&rdquo; dialog will ignore any files it encounters that it doesn&rsquo;t know how to deal with. You can override this behavior by checking this option. However, this will <b>not</b> cause <i>Virtual Jaguar</i> to be able to load such files.</p>
+
+<h2>Controller Tab</h2>
+
+<p>Under the Controller tab, there are the following options:</p>
+
+<ul>
+<li>A picture of a Jaguar controller showing which keys are defined</li>
+<li>A button labeled &ldquo;Define All Keys&rdquo;</li>
+</ul>
+
+<p>Hovering over a letter on the picture of the Jaguar controller will highlight it; clicking on the letter will let you redefine that key. If you prefer, you can define all the keys at once by clicking on the &ldquo;Define All Keys&rdquo; button. It will then step through each button on the controller, one at a time, and wait for you to press the key that you wish to set it to. You can exit the key redefinition process at any time by pressing the <b>Esc</b> key on your keyboard.</p>
+
+<h2>EEPROMs</h2>
+
+<p>EEPROMs (Electrically Erasable Programmable Read Only Memory) were typically installed on Jaguar cartridges to save high scores and the like, and <i>Virtual Jaguar</i> emulates this. The EEPROMs are keyed to specific games by making a CRC32 checksum of the game and using this as a filename. If an EEPROM file does not exist, it is created when the emulated Jaguar writes to it. The EEPROM files are stored in the location specified by the &ldquo;EEPROMs&rdquo; field of the Configuration dialog, under the &ldquo;General&rdquo; tab.</p>
+
+<h2>Software</h2>
+
+<p>Software can be either uncompressed or stored in a ZIP file. <i>Virtual Jaguar</i> looks for software in the location specified by the &ldquo;Software&rdquo; field in the Configuration dialog, under the &ldquo;General&rdquo; tab.</p>
+
+<p><i>Virtual Jaguar</i> is a bit picky about file formats, but tries its best to figure out what you&rsquo;re trying to feed it. In general, if the file is a ROM image, or an Alpine image, <i>Virtual Jaguar</i> will recognize and utilize it. If it&rsquo;s a file meant to load into the emulated Jaguar&rsquo;s RAM space, <i>Virtual Jaguar</i> will load and run it as long as the file contains proper headers. A headerless file of this kind (as opposed to a cartridge or Alpine ROM image) is useless; it contains no information to help <i>Virtual Jaguar</i> know how to load and run it. There is no excuse for this kind of file to exist other than programmer laziness: So, if a file is not recognized by <i>Virtual Jaguar</i>, complain to the author and ask <i>politely</i> for a file with headers. :-)</p>
+
+<h2>Some Issues You May Encounter</h2>
+
+<p>Most of the time <i>Virtual Jaguar</i> tries to do the right thing with what you tell it to do. There are some options, however, that would be more annoying to use if <i>Virtual Jaguar</i> got in the way and forced you to do the right thing, so, in those places where it&rsquo;s possible to tell <i>Virtual Jaguar</i> to do bad things, it will willingly oblige.</p>
+
+<p>One of these areas is the NTSC/PAL switch: If you toggle it while the Jaguar is running, most likely it will not do what you want. For the NTSC/PAL switch to have any real effect, you need to power cycle the Jaguar to see it.</p>
+
+<p>Also, some cartridge based games will not work without either the DSP enabled, the BIOS enabled, or both. <i>Virtual Jaguar</i> will let you attempt to run those games with those options disabled, but the result probably won&rsquo;t be what you want.</p>
+
+<h2>Jaguar Programmer&rsquo;s Zone</h2>
+
+<p><i>Virtual Jaguar</i> has a mode available that makes it more convenient for developers to use. In order to use this mode, you must start <i>Virtual Jaguar</i> with the --alpine option.</p>
+
+<p>When started in this mode, an Alpine tab is made available in the configuration dialog which gives you the following options:</p>
+
+<ul>
+<li>ROM to load</li>
+<li>ABS to load</li>
+</ul>
+
+<p><b>ROM to load</b> is the path to a Jaguar executable file that will be loaded into the Jaguar&rsquo;s cartridge memory space at $800000 (Alpine ROM images will load at $802000). As a convenience to coders, this file can be of any length, as long as it fits into the cartridge memory space (a file of this type is treated as an Alpine ROM and is loaded at $802000). The file thus loaded into memory will not be executed.</p>
+
+<p><b>ABS to load</b> is the path to a Jaguar executable file that will be loaded in the Jaguar&rsquo;s main RAM. This file must have valid headers, otherwise <i>Virtual Jaguar</i> won&rsquo;t be able to load it. Assuming the file exists and has the correct headers in it, it will be loaded and run when <i>Virtual Jaguar</i> is first run.</p>
+
+<p>The aforementioned options will only work when <i>Virtual Jaguar</i> is run in Alpine mode, that is, when the --alpine flag is passed in. If you do not pass in the --alpine flag, <i>Virtual Jaguar</i> will run as it normally does, i.e., as a stock Jaguar, and nothing will be loaded by default.</p>
+
+<h2>For The Curious</h2>
+
+<p>If you&rsquo;re wondering why some cartridges have labels in the &ldquo;Insert Cartridge...&rdquo; dialog and some don&rsquo;t, read on...</p>
+
+<p><i>Virtual Jaguar</i> looks at your ZIP file as a container&mdash;if it finds what it expects in the ZIP, it will use it. For example, label images: If you put an image file of a cartridge label in the ZIP file with your ROM image, <i>Virtual Jaguar</i> will use that image in the &ldquo;Insert Cartridge...&rdquo; dialog&mdash;assuming it&rsquo;s a valid image file. The image should be 365 x 168 for it to show up on the big cartridge image without any scaling; any bigger is just a waste of space and <i>Virtual Jaguar</i> will scale it down to 365 x 168 anyway.</p>
+
+<p>Using the ZIP file as a container this way opens up some exciting possibilities: Box art, overlays and documentation can be included and future versions of <i>Virtual Jaguar</i> will be able to utilize them.</p>
+
+<h2>Legal Nigglings</h2>
+
+<p>Or, as it&rsquo;s more commonly known, the disclaimer: <i>&ldquo;O liability, I do disclaim thee!&rdquo;</i></p>
+
+<p>Trademarks used in <i>Virtual Jaguar</i> and/or this documentation are the property of their respective owners. The user(s) of <i>Virtual Jaguar</i> assumes all risk associated with using the software; the authors are not responsible for anything the user(s) does with said software or what happens to the user(s) as a result of using this software.</p>
+
+<p><i>Virtual Jaguar</i> is Free (as in Libre) software and is licensed under the GPL version 3. You should have recieved a copy of the license with this software; if you did not, you may view a copy at <a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>. A copy of the source code is available at <a href="http://icculus.org/virtualjaguar">http://icculus.org/virtualjaguar</a>.</p>
+
+<p><i>Downfall</i> is &copy; 2011 <b>Reboot</b>, All Rights Reserved. Distribution of <i>Downfall</i> with <i>Virtual Jaguar</i> has been graciously authorized by <b>Reboot</b>, and may not be distributed as part of any other package.</p>
 
 </body>
 </html>
index 22f3c8fee3d709645ffe7942fb71a2a74d296e12..7fd96ef59edaad467be216dbc7e9875928aac9c7 100644 (file)
@@ -126,9 +126,11 @@ bool JaguarLoadFile(char * path)
        EepromInit();
        jaguarRunAddress = 0x802000;                                    // For non-BIOS runs, this is true
        int fileType = ParseFileType(buffer[0], buffer[1], jaguarROMSize);
+       jaguarCartInserted = false;
 
        if (fileType == JST_ROM)
        {
+               jaguarCartInserted = true;
                memcpy(jagMemSpace + 0x800000, buffer, jaguarROMSize);
                delete[] buffer;
                return true;
@@ -369,7 +371,8 @@ uint32 ParseFileType(uint8 header1, uint8 header2, uint32 size)
 
        // If the file size is divisible by 1M, we probably have an regular ROM.
        // We can also check our CRC32 against the internal ROM database to be sure.
-       if ((size % 1048576) == 0)
+       // (We also check for the Memory Track cartridge size here as well...)
+       if ((size % 1048576) == 0 || size == 131072)
                return JST_ROM;
 
        // If the file size + 8192 bytes is divisible by 1M, we probably have an
index d964ed5ece2eb18fce8d34fe0d0c922cbfc8bef9..db688f47f18798e33e434a54b36c7e93c0d6e973 100644 (file)
@@ -11,6 +11,7 @@
 // JLH  01/21/2010  Created this file
 // JLH  01/22/2010  Fleshed out the credits a bit more
 // JLH  01/22/2010  Fixed centering and decorating of window
+// JLH  10/08/2011  Updated credits, added Esc & Return as exit keys
 //
 
 // STILL TO DO:
@@ -32,7 +33,6 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
        image->setPixmap(QPixmap(":/res/vj_title_small.png"));
        layout->addWidget(image);
 
-//     QString s = QString(tr("SVN %1<br>")).arg(__DATE__);
        QString s;// = QString("");
        s.append(tr(
                "<table>"
@@ -40,7 +40,8 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
                VJ_RELEASE_VERSION " (" VJ_RELEASE_SUBVERSION ")"
                "</td></tr>"
                "<tr><td align='right'><b>Coders: </b></td><td>James L. Hammons (shamus)<br>Niels Wagenaar (nwagenaar)<br>Carwin Jones (Caz)<br>Adam Green</td></tr>"
-               "<tr><td align='right'><b>Testers: </b></td><td>Guruma</td></tr>"
+               "<tr><td align='right'><b>Testers: </b></td><td>Cyrano Jones, Robert R, TheUMan, Dissection,<br>overridex, geormetal</td></tr>"
+               "<tr><td align='right'><b>Build Team: </b></td><td>ggn (win32)<br>goldenegg (MacOS)</td></tr>"
                "<tr><td align='right'><b>Homepage: </b></td><td>http://icculus.org/virtualjaguar/</td></tr>"
                "</table>"
                "<br><br>"
@@ -60,3 +61,9 @@ AboutWindow::AboutWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
        text = new QLabel(s);
        layout->addWidget(text);
 }
+
+void AboutWindow::keyPressEvent(QKeyEvent * e)
+{
+       if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
+               hide();
+}
index 854ebc88f5073ddaaa43be2a3e8194ce5f29b20b..e8e5771ad674e8d8513021dd66676eaa13796f71 100644 (file)
@@ -15,6 +15,9 @@ class AboutWindow: public QWidget
        public:
                AboutWindow(QWidget * parent = 0);
 
+       protected:
+               void keyPressEvent(QKeyEvent *);
+
        private:
                QVBoxLayout * layout;
                QLabel * text;
index f3481e9ab4e74736de0d01d9a2b91017addc7afb..aad90feb2b128db4e6982916d2356868f7ea6f01 100644 (file)
@@ -44,6 +44,13 @@ int main(int argc, char * argv[])
                                "enough demand for it. :-)\n");
                        return 0;
                }
+               if (strcmp(argv[1], "--yarrr") == 0)
+               {
+                       printf("\n");
+                       printf("Shiver me timbers!\n");
+                       printf("\n");
+                       return 0;
+               }
                if ((strcmp(argv[1], "--alpine") == 0) || (strcmp(argv[1], "-a") == 0))
                {
                        printf("Alpine Mode enabled.\n");
index 65ccd57982ccd7f7ea42d6658333c67e0e17fb5d..e09ebd2fac1c065ae84223371e613d6f9d4c0816 100644 (file)
 GLWidget::GLWidget(QWidget * parent/*= 0*/): QGLWidget(parent), texture(0),
        textureWidth(0), textureHeight(0), buffer(0), rasterWidth(320), rasterHeight(240)
 {
-//     tomDeviceWidth = rasterWidth;
-       tomDeviceWidth = 1024;  // It has to be the texture width...
-
-       // Set up the backbuffer
-       // To be safe, this should be 1280 * 625 * 2...
-       backbuffer = (uint32_t *)malloc(1280 * 625 * sizeof(uint32_t));
-//     memset(backbuffer, 0x44, rasterWidth *
-       memset(backbuffer, 0xFF, 1024 *
-               (vjs.hardwareTypeNTSC ? rasterHeight : VIRTUAL_SCREEN_HEIGHT_PAL)
-               * sizeof(uint32_t));
+       // Screen pitch has to be the texture width (in 32-bit pixels)...
+       JaguarSetScreenPitch(1024);
 }
 
 GLWidget::~GLWidget()
 {
-       free(backbuffer);
+//     free(backbuffer);
 }
 
 void GLWidget::initializeGL()
@@ -98,13 +90,9 @@ void GLWidget::resizeGL(int width, int height)
 {
        if (width > textureWidth || height > textureHeight)
        {
-//             textureWidth  = max(width,  textureWidth);
-//             textureHeight = max(height, textureHeight);
-// Seems that power of 2 sizes are still mandatory...
-               textureWidth  = 1024;//(width > textureWidth ? width : textureWidth);
-               textureHeight = 512;//(height > textureHeight ? height : textureHeight);
-//             textureWidth  = (width > textureWidth ? width : textureWidth);
-//             textureHeight = (height > textureHeight ? height : textureHeight);
+               // Seems that power of 2 sizes are still mandatory...
+               textureWidth  = 1024;
+               textureHeight = 512;
 #if 0
 printf("Resizing: new texture width/height = %i x %i\n", textureWidth, textureHeight);
 printf("Resizing: new raster width/height = %i x %i\n", rasterWidth, rasterHeight);
@@ -117,23 +105,15 @@ printf("Resizing: new raster width/height = %i x %i\n", rasterWidth, rasterHeigh
                }
 
                buffer = new uint32_t[textureWidth * textureHeight];
-#warning "!!! Remove all backbuffer stuff, since it's unneeded !!!"
-/*
-We do this here just as a quick 'n' dirty shortcut. We don't need a backbuffer,
-as OpenGL takes care of all that crap for us. This means we also have to fix the
-Jaguar core, giving it a setup function for setting things like the video buffer,
-etc.
-*/
-               backbuffer = buffer;
+               JaguarSetScreenBuffer(buffer);
 
 //???
-memset(buffer, 0x00, textureWidth * textureHeight * sizeof(uint32_t));
+memset(buffer, 0xFF, textureWidth * textureHeight * sizeof(uint32_t));
                glGenTextures(1, &texture);
                glBindTexture(GL_TEXTURE_2D, texture);
                glPixelStorei(GL_UNPACK_ROW_LENGTH, textureWidth);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-//             glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textureWidth, textureHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL);
                glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textureWidth, textureHeight, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, NULL);
        }
 }
index 8c8c98d588454673d67b1d45f18fb8f4bc5d960f..da2900954189995673e5b7a7e8089417b62b7ae6 100644 (file)
@@ -9,6 +9,7 @@
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
 // JLH  08/01/2011  Created this file
+// JLH  10/08/2011  Added Esc & Return as exit keys
 //
 
 // STILL TO DO:
@@ -28,41 +29,13 @@ HelpWindow::HelpWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog)
 //     layout->setSizeConstraint(QLayout::SetFixedSize);
        setLayout(layout);
 
-//     image = new QLabel();
-//     image->setAlignment(Qt::AlignRight);
-//     image->setPixmap(QPixmap(":/res/vj_title_small.png"));
-//     layout->addWidget(image);
-
        text = new QTextBrowser;
        text->setSource(QUrl("qrc:/res/help.html"));
        layout->addWidget(text);
 }
 
-#if 0
-label size is 365x168
-scaled(365, 168
-
-#include "htmlviewer.moc"
-HtmlViewerWindow *htmlViewerWindow;
-
-HtmlViewerWindow::HtmlViewerWindow() {
-  setObjectName("html-window");
-  resize(560, 480);
-  setGeometryString(&config().geometry.htmlViewerWindow);
-  application.windowList.add(this);
-
-  layout = new QVBoxLayout;
-  layout->setMargin(Style::WindowMargin);
-  layout->setSpacing(0);
-  setLayout(layout);
-
-  document = new QTextBrowser;
-  layout->addWidget(document);
-}
-
-void HtmlViewerWindow::show(const char *title, const char *htmlData) {
-  document->setHtml(string() << htmlData);
-  setWindowTitle(title);
-  Window::show();
+void HelpWindow::keyPressEvent(QKeyEvent * e)
+{
+       if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
+               hide();
 }
-#endif
index 7b4b48e1b4e2c5ce7986906c9003d05801db48eb..23aa947168383c860dfffc8b4a4bdf1114eb0aad 100644 (file)
@@ -15,11 +15,12 @@ class HelpWindow: public QWidget
        public:
                HelpWindow(QWidget * parent = 0);
 
+       protected:
+               void keyPressEvent(QKeyEvent *);
+
        private:
                QVBoxLayout * layout;
                QTextBrowser * text;
-//             QLabel * text;
-//             QLabel * image;
 };
 
 #endif // __HELP_H__
index 08693d01882415893540ffdaa5b964adcc38eac4..aab146c0e479f4dcf537febca9ba5f57114d52c5 100644 (file)
@@ -24,6 +24,7 @@
 // - Remove SDL dependencies (sound, mainly) from Jaguar core lib
 // - Fix inconsistency with trailing slashes in paths (eeproms needs one, software doesn't)
 //
+// SFDX CODE: 9XF9TUHFM2359
 
 // Uncomment this for debugging...
 //#define DEBUG
 #include <unistd.h>
 #endif
 
-// Uncomment this to use built-in BIOS/CD-ROM BIOS
-// You'll need a copy of jagboot.h & jagcd.h for this to work...!
-// Creating those is left as an exercise for the reader. ;-)
-//#define USE_BUILT_IN_BIOS
-
-//#ifdef USE_BUILT_IN_BIOS
-//#include "jagboot.h"
-//#include "jagcd.h"
-//#endif
-
 // The way BSNES controls things is by setting a timer with a zero
 // timeout, sleeping if not emulating anything. Seems there has to be a
 // better way.
@@ -86,7 +77,6 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        videoWidget = new GLWidget(this);
        setCentralWidget(videoWidget);
        setWindowIcon(QIcon(":/res/vj-icon.png"));
-//     setWindowTitle("Virtual Jaguar v2.0.0");
 
        QString title = QString(tr("Virtual Jaguar " VJ_RELEASE_VERSION ));
 
@@ -238,29 +228,13 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        connect(timer, SIGNAL(timeout()), this, SLOT(Timer()));
        timer->start(20);
 
+       // We set this initially, to make VJ behave somewhat as it would if no
+       // cart were inserted and the BIOS was set as active...
+       jaguarCartInserted = true;
        WriteLog("Virtual Jaguar %s (Last full build was on %s %s)\n", VJ_RELEASE_VERSION, __DATE__, __TIME__);
        WriteLog("VJ: Initializing jaguar subsystem...\n");
        JaguarInit();
 
-       // Get the BIOS ROM
-#ifdef USE_BUILT_IN_BIOS
-//     WriteLog("VJ: Using built in BIOS/CD BIOS...\n");
-//     memcpy(jaguarBootROM, jagBootROM, 0x20000);
-//     memcpy(jaguarCDBootROM, jagCDROM, 0x40000);
-////   BIOSLoaded = CDBIOSLoaded = true;
-//     biosAvailable |= (BIOS_NORMAL | BIOS_CD);
-#else
-// What would be nice here would be a way to check if the BIOS was loaded so that we
-// could disable the pushbutton on the Misc Options menu... !!! FIX !!! [DONE here, but needs to be fixed in GUI as well!]
-//     WriteLog("VJ: About to attempt to load BIOSes...\n");
-//This is short-circuiting the file finding thread... ??? WHY ???
-//Not anymore. Was related to a QImage object creation/corruption bug elsewhere.
-//     BIOSLoaded = (JaguarLoadROM(jaguarBootROM, vjs.jagBootPath) == 0x20000 ? true : false);
-//     WriteLog("VJ: BIOS is %savailable...\n", (BIOSLoaded ? "" : "not "));
-//     CDBIOSLoaded = (JaguarLoadROM(jaguarCDBootROM, vjs.CDBootPath) == 0x40000 ? true : false);
-//     WriteLog("VJ: CD BIOS is %savailable...\n", (CDBIOSLoaded ? "" : "not "));
-#endif
-
        filePickWin->ScanSoftwareFolder(allowUnknownSoftware);
 
        // Load up the default ROM if in Alpine mode:
@@ -280,6 +254,7 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
 
                // Attempt to load/run the ABS file...
                LoadSoftware(vjs.absROMPath);
+               memcpy(jagMemSpace + 0xE00000, jaguarDevBootROM2, 0x20000);     // Use the stub BIOS
        }
        else
                memcpy(jagMemSpace + 0xE00000, jaguarBootROM, 0x20000); // Otherwise, use the stock BIOS
@@ -449,8 +424,8 @@ void MainWin::Timer(void)
                {
                        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;
+                               videoWidget->buffer[(y * videoWidget->textureWidth) + x]
+                                       = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;
                        }
                }
        }
@@ -458,10 +433,6 @@ void MainWin::Timer(void)
        {
                // Otherwise, run the Jaguar simulation
                JaguarExecuteNew();
-////           memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->rasterWidth);
-//No longer needed--see glwidget.cpp for details!
-//             memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t));
-////           memcpy(surface->pixels, backbuffer, TOMGetVideoModeWidth() * TOMGetVideoModeHeight() * 4);
        }
 
        videoWidget->updateGL();
@@ -470,47 +441,40 @@ void MainWin::Timer(void)
 void MainWin::TogglePowerState(void)
 {
        powerButtonOn = !powerButtonOn;
+       running = true;
 
        // With the power off, we simulate white noise on the screen. :-)
        if (!powerButtonOn)
        {
+               useCDAct->setDisabled(false);
                pauseAct->setChecked(false);
                pauseAct->setDisabled(true);
                showUntunedTankCircuit = true;
-               running = true;
                // This is just in case the ROM we were playing was in a narrow or wide field mode,
                // so the untuned tank sim doesn't look wrong. :-)
                TOMReset();
        }
        else
        {
-//NOTE: Low hanging fruit: We can simplify this a lot...
+               useCDAct->setDisabled(true);
+               pauseAct->setChecked(false);
+               pauseAct->setDisabled(false);
+               showUntunedTankCircuit = false;
+
                // Otherwise, we prepare for running regular software...
-               if (!CDActive)
-               {
-                       showUntunedTankCircuit = false;//(cartridgeLoaded ? false : true);
-                       pauseAct->setChecked(false);
-                       pauseAct->setDisabled(false);//!cartridgeLoaded);
-               }
-               // Or, set up for the Jaguar CD
-               else
+               if (CDActive)
                {
 // Should check for cartridgeLoaded here as well...!
 // We can clear it when toggling CDActive on, so that when we power cycle it does the
 // expected thing. Otherwise, if we use the file picker to insert a cart, we expect
 // to run the cart! Maybe have a RemoveCart function that only works if the CD unit
 // is active?
-                       showUntunedTankCircuit = false;
-                       pauseAct->setChecked(false);
-                       pauseAct->setDisabled(false);
-                       memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000);
                        setWindowTitle(QString("Virtual Jaguar " VJ_RELEASE_VERSION
                                " - Now playing: Jaguar CD"));
                }
 
                WriteLog("GUI: Resetting Jaguar...\n");
                JaguarReset();
-               running = true;
        }
 }
 
@@ -522,14 +486,12 @@ void MainWin::ToggleRunState(void)
        {
                for(uint32_t i=0; i<(uint32_t)(videoWidget->textureWidth * 256); i++)
                {
-                       uint32_t pixel = backbuffer[i];
+                       uint32_t pixel = videoWidget->buffer[i];
                        uint8_t r = (pixel >> 24) & 0xFF, g = (pixel >> 16) & 0xFF, b = (pixel >> 8) & 0xFF;
                        pixel = ((r + g + b) / 3) & 0x00FF;
-                       backbuffer[i] = 0x000000FF | (pixel << 16) | (pixel << 8);
+                       videoWidget->buffer[i] = 0x000000FF | (pixel << 16) | (pixel << 8);
                }
 
-               memcpy(videoWidget->buffer, backbuffer, videoWidget->rasterHeight * videoWidget->textureWidth * sizeof(uint32_t));
-
                videoWidget->updateGL();
        }
 }
@@ -642,6 +604,12 @@ void MainWin::ToggleCDUsage(void)
        {
                powerAct->setDisabled(true);
        }
+#else
+       // Set up the Jaguar CD for execution, otherwise, clear memory
+       if (CDActive)
+               memcpy(jagMemSpace + 0x800000, jaguarCDBootROM, 0x40000);
+       else
+               memset(jagMemSpace + 0x800000, 0xFF, 0x40000);
 #endif
 }
 
@@ -820,90 +788,3 @@ void MainWin::WriteSettings(void)
        settings.setValue("p2k_pound", vjs.p2KeyBindings[BUTTON_d]);
        settings.setValue("p2k_star", vjs.p2KeyBindings[BUTTON_s]);
 }
-
-// Here's how Byuu does it...
-// I think I have it working now... :-)
-#if 0
-void Utility::resizeMainWindow()
-{
-  unsigned region = config().video.context->region;
-  unsigned multiplier = config().video.context->multiplier;
-  unsigned width = 256 * multiplier;
-  unsigned height = (region == 0 ? 224 : 239) * multiplier;
-
-  if(config().video.context->correctAspectRatio)
-  {
-    if(region == 0)
-       {
-      width = (double)width * config().video.ntscAspectRatio + 0.5;  //NTSC adjust
-    }
-       else
-       {
-      width = (double)width * config().video.palAspectRatio  + 0.5;  //PAL adjust
-    }
-  }
-
-  if(config().video.isFullscreen == false)
-  {
-    //get effective desktop work area region (ignore Windows taskbar, OS X dock, etc.)
-    QRect deskRect = QApplication::desktop()->availableGeometry(mainWindow);
-
-    //ensure window size will not be larger than viewable desktop area
-    constrainSize(height, width, deskRect.height()); //- frameHeight);
-    constrainSize(width, height, deskRect.width());  //- frameWidth );
-
-    mainWindow->canvas->setFixedSize(width, height);
-    mainWindow->show();
-  }
-  else
-  {
-    for(unsigned i = 0; i < 2; i++)
-       {
-      unsigned iWidth = width, iHeight = height;
-
-      constrainSize(iHeight, iWidth, mainWindow->canvasContainer->size().height());
-      constrainSize(iWidth, iHeight, mainWindow->canvasContainer->size().width());
-
-      //center canvas onscreen; ensure it is not larger than viewable area
-      mainWindow->canvas->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-      mainWindow->canvas->setFixedSize(iWidth, iHeight);
-      mainWindow->canvas->setMinimumSize(0, 0);
-
-      usleep(2000);
-      QApplication::processEvents();
-    }
-  }
-
-  //workaround for Qt/Xlib bug:
-  //if window resize occurs with cursor over it, Qt shows Qt::Size*DiagCursor;
-  //so force it to show Qt::ArrowCursor, as expected
-  mainWindow->setCursor(Qt::ArrowCursor);
-  mainWindow->canvasContainer->setCursor(Qt::ArrowCursor);
-  mainWindow->canvas->setCursor(Qt::ArrowCursor);
-
-  //workaround for DirectSound(?) bug:
-  //window resizing sometimes breaks audio sync, this call re-initializes it
-  updateAvSync();
-}
-
-void Utility::setScale(unsigned scale)
-{
-  config().video.context->multiplier = scale;
-  resizeMainWindow();
-  mainWindow->shrink();
-  mainWindow->syncUi();
-}
-
-void QbWindow::shrink()
-{
-  if(config().video.isFullscreen == false)
-  {
-    for(unsigned i = 0; i < 2; i++)
-       {
-      resize(0, 0);
-      usleep(2000);
-      QApplication::processEvents();
-    }
-  }
-}
-#endif
index d6e75db1a39824085f941239657ae1fb65948d28..268befde8a1066121820e6219c06a47cbf6bbde1 100644 (file)
@@ -67,11 +67,7 @@ extern uint8 jagMemSpace[];
 uint32 jaguar_active_memory_dumps = 0;
 
 uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress;
-
-bool BIOSLoaded = false;
-bool CDBIOSLoaded = false;
-
-uint32 * backbuffer;
+bool jaguarCartInserted = false;
 
 #ifdef CPU_DEBUG_MEMORY
 uint8 writeMemMax[0x400000], writeMemMin[0x400000];
@@ -114,7 +110,7 @@ void M68KInstructionHook(void)
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
-               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
+               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VIDEO)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
                M68K_show_context();
                LogDone();
                exit(0);
@@ -350,7 +346,7 @@ CD_switch:: -> $306C
                WriteLog("M68K: Top of stack: %08X. Stack trace:\n", JaguarReadLong(topOfStack));
                for(int i=0; i<10; i++)
                        WriteLog("%06X: %08X\n", topOfStack - (i * 4), JaguarReadLong(topOfStack - (i * 4)));
-               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VBLANK)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
+               WriteLog("Jaguar: VBL interrupt is %s\n", ((TOMIRQEnabled(IRQ_VIDEO)) && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled");
                M68K_show_context();
 
 //temp
@@ -1205,7 +1201,7 @@ void M68K_show_context(void)
 
        WriteLog("..................\n");
 
-       if (TOMIRQEnabled(IRQ_VBLANK))
+       if (TOMIRQEnabled(IRQ_VIDEO))
        {
                WriteLog("video int: enabled\n");
                JaguarDasm(JaguarGetHandler(64), 0x200);
@@ -1587,6 +1583,18 @@ void JaguarWriteLong(uint32 offset, uint32 data, uint32 who/*=UNKNOWN*/)
        JaguarWriteWord(offset+2, data & 0xFFFF, who);
 }
 
+void JaguarSetScreenBuffer(uint32 * buffer)
+{
+       // This is in TOM, but we set it here...
+       screenBuffer = buffer;
+}
+
+void JaguarSetScreenPitch(uint32 pitch)
+{
+       // This is in TOM, but we set it here...
+       screenPitch = pitch;
+}
+
 //
 // Jaguar console initialization
 //
@@ -1617,14 +1625,14 @@ void JaguarInit(void)
 //New timer based code stuffola...
 void ScanlineCallback(void);
 void RenderCallback(void);
-//extern uint32 * backbuffer;
 void JaguarReset(void)
 {
 //Need to change this so it uses the single RAM space and load the BIOS
 //into it somewhere...
 //Also, have to change this here and in JaguarReadXX() currently
        // Only use the system BIOS if it's available...! (it's always available now!)
-       if (vjs.useJaguarBIOS && !vjs.hardwareTypeAlpine)
+       // AND only if a jaguar cartridge has been inserted.
+       if (vjs.useJaguarBIOS && jaguarCartInserted && !vjs.hardwareTypeAlpine)
                memcpy(jaguarMainRAM, jagMemSpace + 0xE00000, 8);
        else
                SET32(jaguarMainRAM, 4, jaguarRunAddress);
@@ -1640,7 +1648,6 @@ void JaguarReset(void)
 
        // New timer base code stuffola...
        InitializeEventList();
-       TOMResetBackbuffer(backbuffer);
 //     SetCallbackTime(ScanlineCallback, 63.5555);
        SetCallbackTime(ScanlineCallback, 31.77775);
 //     SetCallbackTime(RenderCallback, 33303.082);     // # Scanlines * scanline time
@@ -1722,7 +1729,7 @@ void JaguarDone(void)
 
 //     WriteLog("Jaguar: CD BIOS version %04X\n", JaguarReadWord(0x3004));
        WriteLog("Jaguar: Interrupt enable = $%02X\n", TOMReadByte(0xF000E1, JAGUAR) & 0x1F);
-       WriteLog("Jaguar: Video interrupt is %s (line=%u)\n", ((TOMIRQEnabled(IRQ_VBLANK))
+       WriteLog("Jaguar: Video interrupt is %s (line=%u)\n", ((TOMIRQEnabled(IRQ_VIDEO))
                && (JaguarInterruptHandlerIsValid(64))) ? "enabled" : "disabled", TOMReadWord(0xF0004E, JAGUAR));
        M68K_show_context();
 //#endif
@@ -1770,6 +1777,9 @@ void JaguarDone(void)
        JaguarDasm(0x802000, 6000);
        WriteLog("\n");//*/
 #endif
+/*     WriteLog("\n\nM68000 disassembly at $080000...\n");
+       JaguarDasm(0x080000, 10000);
+       WriteLog("\n");//*/
 }
 
 //
@@ -1799,7 +1809,6 @@ void JaguarExecute(uint32 * backbuffer, bool render)
        uint32 M68KCyclesPerScanline = m68kClockRate / (vp * refreshRate);
        uint32 RISCCyclesPerScanline = m68kClockRate / (vp * refreshRate);
 
-       TOMResetBackbuffer(backbuffer);
 /*extern int effect_start;
 if (effect_start)
        WriteLog("JagExe: VP=%u, VI=%u, CPU CPS=%u, GPU CPS=%u\n", vp, vi, M68KCyclesPerScanline, RISCCyclesPerScanline);//*/
@@ -1809,14 +1818,12 @@ if (effect_start)
        {
                // Increment the horizontal count (why? RNG? Besides which, this is *NOT* cycle accurate!)
                TOMWriteWord(0xF00004, (TOMReadWord(0xF00004, JAGUAR) + 1) & 0x7FF, JAGUAR);
-
                TOMWriteWord(0xF00006, i, JAGUAR);                      // Write the VC
 
-//             if (i == vi)                                                            // Time for Vertical Interrupt?
 //Not sure if this is correct...
 //Seems to be, kinda. According to the JTRM, this should only fire on odd lines in non-interlace mode...
 //Which means that it normally wouldn't go when it's zero.
-               if (i == vi && i > 0 && TOMIRQEnabled(IRQ_VBLANK))      // Time for Vertical Interrupt?
+               if (i == vi && i > 0 && TOMIRQEnabled(IRQ_VIDEO))       // Time for Vertical Interrupt?
                {
                        // We don't have to worry about autovectors & whatnot because the Jaguar
                        // tells you through its HW registers who sent the interrupt...
@@ -1877,112 +1884,11 @@ uint8 * GetRamPtr(void)
 
 //
 // New Jaguar execution stack
+// This executes 1 frame's worth of code.
 //
-
-#if 0
-
-void JaguarExecuteNew(void)
-{
-       extern bool finished, showGUI;
-       extern bool debounceRunKey;
-       // Pass a message to the "joystick" code to debounce the ESC key...
-       debounceRunKey = true;
-       finished = false;
-/*     InitializeEventList();
-       TOMResetBackbuffer(backbuffer);
-//     SetCallbackTime(ScanlineCallback, 63.5555);
-       SetCallbackTime(ScanlineCallback, 31.77775);
-//     SetCallbackTime(RenderCallback, 33303.082);     // # Scanlines * scanline time
-//     SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time//*/
-//     uint8 * keystate = SDL_GetKeyState(NULL);
-
-       do
-       {
-               double timeToNextEvent = GetTimeToNextEvent();
-//WriteLog("JEN: Time to next event (%u) is %f usec (%u RISC cycles)...\n", nextEvent, timeToNextEvent, USEC_TO_RISC_CYCLES(timeToNextEvent));
-
-               m68k_execute(USEC_TO_M68K_CYCLES(timeToNextEvent));
-               gpu_exec(USEC_TO_RISC_CYCLES(timeToNextEvent));
-
-               if (vjs.DSPEnabled)
-               {
-                       if (vjs.usePipelinedDSP)
-                               DSPExecP2(USEC_TO_RISC_CYCLES(timeToNextEvent));        // Pipelined DSP execution (3 stage)...
-                       else
-                               DSPExec(USEC_TO_RISC_CYCLES(timeToNextEvent));          // Ordinary non-pipelined DSP
-               }
-
-               HandleNextEvent();
-
-//             if (keystate[SDLK_ESCAPE])
-//                     break;
-
-//         SDL_PumpEvents();   // Needed to keep the keystate current...
-       }
-       while (!finished);
-}
-
-void ScanlineCallback(void)
-{
-       uint16 vc = TOMReadWord(0xF00006, JAGUAR);
-       uint16 vp = TOMReadWord(0xF0003E, JAGUAR) + 1;
-       uint16 vi = TOMReadWord(0xF0004E, JAGUAR);
-//     uint16 vbb = TOMReadWord(0xF00040, JAGUAR);
-       vc++;
-
-       if (vc >= vp)
-               vc = 0;
-
-//WriteLog("SLC: Currently on line %u (VP=%u)...\n", vc, vp);
-       TOMWriteWord(0xF00006, vc, JAGUAR);
-
-//This is a crappy kludge, but maybe it'll work for now...
-//Maybe it's not so bad, since the IRQ happens on a scanline boundary...
-       if (vc == vi && vc > 0 && tom_irq_enabled(IRQ_VBLANK))  // Time for Vertical Interrupt?
-       {
-               // We don't have to worry about autovectors & whatnot because the Jaguar
-               // tells you through its HW registers who sent the interrupt...
-               tom_set_pending_video_int();
-               m68k_set_irq(2);
-       }
-
-       TOMExecScanline(vc, true);
-
-//Change this to VBB???
-//Doesn't seem to matter (at least for Flip Out & I-War)
-       if (vc == 0)
-//     if (vc == vbb)
-       {
-joystick_exec();
-
-               RenderBackbuffer();
-               TOMResetBackbuffer(backbuffer);
-       }//*/
-
-//     if (vc == 0)
-//             TOMResetBackbuffer(backbuffer);
-
-//     SetCallbackTime(ScanlineCallback, 63.5555);
-       SetCallbackTime(ScanlineCallback, 31.77775);
-}
-
-#else
-
 bool frameDone;
 void JaguarExecuteNew(void)
 {
-//     extern bool finished, showGUI;
-//     extern bool debounceRunKey;
-       // Pass a message to the "joystick" code to debounce the ESC key...
-//     debounceRunKey = true;
-//     finished = false;
-/*     InitializeEventList();
-       TOMResetBackbuffer(backbuffer);
-//     SetCallbackTime(ScanlineCallback, 63.5555);
-       SetCallbackTime(ScanlineCallback, 31.77775);
-//     SetCallbackTime(RenderCallback, 33303.082);     // # Scanlines * scanline time
-//     SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time//*/
-//     uint8 * keystate = SDL_GetKeyState(NULL);
        frameDone = false;
 
        do
@@ -2004,11 +1910,6 @@ void JaguarExecuteNew(void)
                }
 
                HandleNextEvent();
-
-//             if (keystate[SDLK_ESCAPE])
-//                     break;
-
-//         SDL_PumpEvents();   // Needed to keep the keystate current...
        }
        while (!frameDone);
 }
@@ -2029,7 +1930,7 @@ void ScanlineCallback(void)
 
 //This is a crappy kludge, but maybe it'll work for now...
 //Maybe it's not so bad, since the IRQ happens on a scanline boundary...
-       if (vc == vi && vc > 0 && TOMIRQEnabled(IRQ_VBLANK))    // Time for Vertical Interrupt?
+       if (vc == vi && vc > 0 && TOMIRQEnabled(IRQ_VIDEO))     // Time for Vertical Interrupt?
        {
                // We don't have to worry about autovectors & whatnot because the Jaguar
                // tells you through its HW registers who sent the interrupt...
@@ -2045,26 +1946,20 @@ void ScanlineCallback(void)
 //     if (vc == vbb)
        {
                JoystickExec();
-//We comment this out so that the GUI can manage this instead. Which is how it should be anyway.
-//             RenderBackbuffer();
-               TOMResetBackbuffer(backbuffer);
                frameDone = true;
        }//*/
 
-//     if (vc == 0)
-//             TOMResetBackbuffer(backbuffer);
-
 //     SetCallbackTime(ScanlineCallback, 63.5555);
        SetCallbackTime(ScanlineCallback, 31.77775);
 }
 
-#endif
-
 // This isn't currently used, but maybe it should be...
+/*
+Nah, the scanline based code is good enough, and runs in 1 frame. The GUI
+handles all the rest, so this isn't needed. :-P
+*/
 void RenderCallback(void)
 {
-//     RenderBackbuffer();
-       TOMResetBackbuffer(backbuffer);
 //     SetCallbackTime(RenderCallback, 33303.082);     // # Scanlines * scanline time
        SetCallbackTime(RenderCallback, 16651.541);     // # Scanlines * scanline time
 }
index 6342d455caf92f0ea22f2d266125d1b908770171..4d33afc34b6b5594132c424901a1c343a7a61fc5 100644 (file)
@@ -4,6 +4,8 @@
 #include "types.h"
 #include "memory.h"                                                    // For "UNKNOWN" enum
 
+void JaguarSetScreenBuffer(uint32 * buffer);
+void JaguarSetScreenPitch(uint32 pitch);
 void JaguarInit(void);
 void JaguarReset(void);
 void JaguarDone(void);
@@ -24,12 +26,10 @@ void JaguarExecuteNew(void);
 
 // Exports from JAGUAR.CPP
 
-extern bool BIOSLoaded;
-extern bool CDBIOSLoaded;
 extern int32 jaguarCPUInExec;
 extern uint32 jaguarMainROMCRC32, jaguarROMSize, jaguarRunAddress;
 extern char * jaguarEepromsPath;
-extern uint32 * backbuffer;
+extern bool jaguarCartInserted;
 
 // Various clock rates
 
index 2978c6dc9541b4ea8e48ce5f9a1cf56b621bcbff..9da791b4214565cc8103c9645bb73074b9323f99 100644 (file)
@@ -318,8 +318,6 @@ void DumpFixedObject(uint64 p0, uint64 p1)
 //
 // Object Processor main routine
 //
-//Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing
-//where we left off. !!! FIX !!!
 #warning "Need to fix this so that when an GPU object IRQ happens, we can pick up OP processing where we left off. !!! FIX !!!"
 void OPProcessList(int scanline, bool render)
 {
@@ -342,7 +340,7 @@ bool inhibit;
 int bitmapCounter = 0;
 // *** END OP PROCESSOR TESTING ONLY ***
 
-       uint32 opCyclesToRun = 10000;                                   // This is a pulled-out-of-the-air value (will need to be fixed, obviously!)
+       uint32 opCyclesToRun = 30000;                                   // This is a pulled-out-of-the-air value (will need to be fixed, obviously!)
 
 //     if (op_pointer) WriteLog(" new op list at 0x%.8x scanline %i\n",op_pointer,scanline);
        while (op_pointer)
@@ -454,7 +452,8 @@ WriteLog("    --> List end\n\n");
                                ypos = TOMReadWord(0xF00046, OP) / 2;                   // Get the VDB value
 #endif
 // Actually, no. Any item less than VDB will get only the lines that hang over VDB displayed.
-// So we need to fix this somehow... (and it has... in tom.cpp :-P)
+// Actually, this is incorrect. It seems that VDB value is wrong somewhere and that's
+// what's causing things to fuck up. Still no idea why.
 
                        uint32 height = (p0 & 0xFFC000) >> 14;
                        uint32 oldOPP = op_pointer - 8;
index ed47bf8043f79ac42a76052ab70aca2d8297811e..08832a8ce3ccb3b3ed9c304c26cd5ca3e54df7a9 100644 (file)
@@ -332,7 +332,11 @@ uint32 tomTimerDivider;
 int32 tomTimerCounter;
 uint16 tom_jerry_int_pending, tom_timer_int_pending, tom_object_int_pending,
        tom_gpu_int_pending, tom_video_int_pending;
-uint32 * TOMBackbuffer;
+
+// These are set by the "user" of the Jaguar core lib, since these are
+// OS/system dependent.
+uint32 * screenBuffer;
+uint32 screenPitch;
 
 static const char * videoMode_to_str[8] =
        { "16 BPP CRY", "24 BPP RGB", "16 BPP DIRECT", "16 BPP RGB",
@@ -755,22 +759,20 @@ void tom_render_16bpp_rgb_scanline(uint32 * backbuffer)
 }
 
 
-void TOMResetBackbuffer(uint32 * backbuffer)
+/*void TOMResetBackbuffer(uint32 * backbuffer)
 {
        TOMBackbuffer = backbuffer;
-}
+}*/
 
 //
 // Process a single scanline
 //
-uint32 tomDeviceWidth;//kludge
 void TOMExecScanline(uint16 scanline, bool render)
 {
        bool inActiveDisplayArea = true;
 
 //Interlacing is still not handled correctly here... !!! FIX !!!
        if (scanline & 0x01)                                                    // Execute OP only on even lines (non-interlaced only!)
-//     if (!(scanline & 0x01))                                                 // Execute OP only on even lines (non-interlaced only!)
                return;
 
 //Hm, it seems that the OP needs to execute from zero, so let's try it:
@@ -779,7 +781,9 @@ void TOMExecScanline(uint16 scanline, bool render)
 //this seems to cause a regression in certain games, like rayman
 //which means I have to dig thru the asic nets to see what's wrong...
 #if 1
+// 16 isn't enough, and neither is 32 for raptgun. 32 fucks up Rayman
        if (scanline >= (uint16)GET16(tomRam8, VDB) && scanline < (uint16)GET16(tomRam8, VDE))
+//     if (scanline >= ((uint16)GET16(tomRam8, VDB) - 32) && scanline < (uint16)GET16(tomRam8, VDE))
        {
                if (render)
                {
@@ -820,10 +824,11 @@ void TOMExecScanline(uint16 scanline, bool render)
        }
 #endif
 
-       // Try to take PAL into account...
+       // Try to take PAL into account... [We do now!]
 
        uint16 topVisible = (vjs.hardwareTypeNTSC ? TOP_VISIBLE_VC : TOP_VISIBLE_VC_PAL),
                bottomVisible = (vjs.hardwareTypeNTSC ? BOTTOM_VISIBLE_VC : BOTTOM_VISIBLE_VC_PAL);
+       uint32 * TOMCurrentLine = &(screenBuffer[((scanline - topVisible) / 2) * screenPitch]);
 
        // Here's our virtualized scanline code...
 
@@ -834,7 +839,8 @@ void TOMExecScanline(uint16 scanline, bool render)
 //NOTE: The following doesn't put BORDER color on the sides... !!! FIX !!!
 #warning "The following doesn't put BORDER color on the sides... !!! FIX !!!"
                        if (vjs.renderType == RT_NORMAL)
-                               scanline_render[TOMGetVideoMode()](TOMBackbuffer);
+//                             scanline_render[TOMGetVideoMode()](TOMBackbuffer);
+                               scanline_render[TOMGetVideoMode()](TOMCurrentLine);
                        else//TV type render
                        {
 /*
@@ -898,7 +904,7 @@ void tom_render_24bpp_scanline(uint32 * backbuffer)
                else
                {
                        // If outside of VDB & VDE, then display the border color
-                       uint32 * currentLineBuffer = TOMBackbuffer;
+                       uint32 * currentLineBuffer = TOMCurrentLine;
                        uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1];
 //Hm.                  uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r;
                        uint32 pixel = 0x000000FF | (r << 24) | (g << 16) | (b << 8);
@@ -906,10 +912,6 @@ void tom_render_24bpp_scanline(uint32 * backbuffer)
                        for(uint32 i=0; i<tomWidth; i++)
                                *currentLineBuffer++ = pixel;
                }
-
-#warning "!!! Need to move this to an interface file !!! FIX !!!"
-//             TOMBackbuffer += GetSDLScreenWidthInPixels();
-               TOMBackbuffer += tomDeviceWidth;
        }
 }
 
index 4d5eae94d2679e62c19c7da22f2c294bb1486163..59369d7bb17103112a0a1fcb469af3d221f2bc69 100644 (file)
--- a/src/tom.h
+++ b/src/tom.h
@@ -16,7 +16,7 @@
 
 // 68000 Interrupt bit positions (enabled at $F000E0)
 
-enum { IRQ_VBLANK = 0, IRQ_GPU, IRQ_OPFLAG, IRQ_TIMER, IRQ_DSP };
+enum { IRQ_VIDEO = 0, IRQ_GPU, IRQ_OPFLAG, IRQ_TIMER, IRQ_DSP };
 
 void TOMInit(void);
 void TOMReset(void);
@@ -27,7 +27,6 @@ uint16 TOMReadWord(uint32 offset, uint32 who = UNKNOWN);
 void TOMWriteByte(uint32 offset, uint8 data, uint32 who = UNKNOWN);
 void TOMWriteWord(uint32 offset, uint16 data, uint32 who = UNKNOWN);
 
-//void TOMExecScanline(int16 * backbuffer, int32 scanline, bool render);
 void TOMExecScanline(uint16 scanline, bool render);
 uint32 TOMGetVideoModeWidth(void);
 uint32 TOMGetVideoModeHeight(void);
@@ -49,9 +48,6 @@ void TOMSetPendingGPUInt(void);
 void TOMSetPendingVideoInt(void);
 void TOMResetPIT(void);
 
-//uint32 TOMGetSDLScreenPitch(void);
-void TOMResetBackbuffer(uint32 * backbuffer);
-
 // Exported variables
 
 extern uint32 tomWidth;
@@ -61,6 +57,7 @@ extern uint32 tomTimerPrescaler;
 extern uint32 tomTimerDivider;
 extern int32 tomTimerCounter;
 
-extern uint32 tomDeviceWidth;
+extern uint32 screenPitch;
+extern uint32 * screenBuffer;
 
 #endif // __TOM_H__
index 492b568d56e7f0ca5067d8c9b4a291a3bcaf386e..334f4b81176c8398aa6c83ea0819fbc6e26341ec 100644 (file)
@@ -26,7 +26,7 @@ UI_DIR      = obj
 
 # Platform specific defines
 win32     { DEFINES += __GCCWIN32__ }
-else:macx { DEFINES += __GCCUNIX__ _OSX_ }
+else:macx { DEFINES += __GCCUNIX__ __THINK_STUPID__ }
 else:unix { DEFINES += __GCCUNIX__ }
 
 # SDL (to link statically on Mac)