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"
* 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]
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
#
# 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. ;-)
#
<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 “Insert Cartridge” from the “Jaguar” menu, or press the “Insert Cartridge” 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 “Pause” from the “Jaguar” menu, pressing the “Pause” toolbar button, or by pressing the <b>Esc</b> key on your keyboard. You can quit <i>Virtual Jaguar</i> by selecting “Exit” from the “Jaguar” 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’s present form to run well; do not be surprised if it doesn’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’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 “Use Jaguar BIOS” 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 “Insert Cartridge” 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 “Configure” menu option and the “General” tab, “Software” 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’s intended to: When it’s working correctly, selecting this option will allow you to insert a Jaguar CD game into your computer’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’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’s display to be averaged, resulting in a screen that looks slightly blurry—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 “Power” toolbar button description for details.</p>
+
+<p><b>Pause</b> does the same as the toolbar button; see the “Pause” toolbar button description for details.</p>
+
+<p><b>Insert Cartridge...</b> does the same as the toolbar button; see the “Insert Cartridge” toolbar button description for details.</p>
+
+<p><b>Use CD Unit</b> does the same as the toolbar button; see the “Use CD Unit” toolbar button description for details.</p>
+
+<p><b>Configure</b> launches the Configure dialog. A full description is given in the “Configure Dialog” 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’re reading right now. The voice you are hearing in your head is probably your own, though we can’t guarantee that. ;-) This dialog can be dismissed by clicking on the “X” 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 “X” 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’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 “EEPROMs” 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 “Software” 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 “Insert Cartridge...” dialog will ignore any files it encounters that it doesn’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 “Define All Keys”</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 “Define All Keys” 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 “EEPROMs” field of the Configuration dialog, under the “General” 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 “Software” field in the Configuration dialog, under the “General” tab.</p>
+
+<p><i>Virtual Jaguar</i> is a bit picky about file formats, but tries its best to figure out what you’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’s a file meant to load into the emulated Jaguar’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’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’t be what you want.</p>
+
+<h2>Jaguar Programmer’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’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’s main RAM. This file must have valid headers, otherwise <i>Virtual Jaguar</i> won’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’re wondering why some cartridges have labels in the “Insert Cartridge...” dialog and some don’t, read on...</p>
+
+<p><i>Virtual Jaguar</i> looks at your ZIP file as a container—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 “Insert Cartridge...” dialog—assuming it’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’s more commonly known, the disclaimer: <i>“O liability, I do disclaim thee!”</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 © 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>
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;
// 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
// 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:
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>"
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>"
text = new QLabel(s);
layout->addWidget(text);
}
+
+void AboutWindow::keyPressEvent(QKeyEvent * e)
+{
+ if (e->key() == Qt::Key_Escape || e->key() == Qt::Key_Return)
+ hide();
+}
public:
AboutWindow(QWidget * parent = 0);
+ protected:
+ void keyPressEvent(QKeyEvent *);
+
private:
QVBoxLayout * layout;
QLabel * text;
"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");
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()
{
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);
}
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);
}
}
// Who When What
// --- ---------- -------------------------------------------------------------
// JLH 08/01/2011 Created this file
+// JLH 10/08/2011 Added Esc & Return as exit keys
//
// STILL TO DO:
// 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
public:
HelpWindow(QWidget * parent = 0);
+ protected:
+ void keyPressEvent(QKeyEvent *);
+
private:
QVBoxLayout * layout;
QTextBrowser * text;
-// QLabel * text;
-// QLabel * image;
};
#endif // __HELP_H__
// - 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.
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 ));
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:
// 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
{
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;
}
}
}
{
// 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();
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;
}
}
{
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();
}
}
{
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
}
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
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];
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);
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
WriteLog("..................\n");
- if (TOMIRQEnabled(IRQ_VBLANK))
+ if (TOMIRQEnabled(IRQ_VIDEO))
{
WriteLog("video int: enabled\n");
JaguarDasm(JaguarGetHandler(64), 0x200);
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
//
//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);
// New timer base code stuffola...
InitializeEventList();
- TOMResetBackbuffer(backbuffer);
// SetCallbackTime(ScanlineCallback, 63.5555);
SetCallbackTime(ScanlineCallback, 31.77775);
// SetCallbackTime(RenderCallback, 33303.082); // # Scanlines * scanline time
// 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
JaguarDasm(0x802000, 6000);
WriteLog("\n");//*/
#endif
+/* WriteLog("\n\nM68000 disassembly at $080000...\n");
+ JaguarDasm(0x080000, 10000);
+ WriteLog("\n");//*/
}
//
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);//*/
{
// 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...
//
// 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
}
HandleNextEvent();
-
-// if (keystate[SDLK_ESCAPE])
-// break;
-
-// SDL_PumpEvents(); // Needed to keep the keystate current...
}
while (!frameDone);
}
//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...
// 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
}
#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);
// 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
//
// 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)
{
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)
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;
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",
}
-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:
//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)
{
}
#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...
//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
{
/*
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);
for(uint32 i=0; i<tomWidth; i++)
*currentLineBuffer++ = pixel;
}
-
-#warning "!!! Need to move this to an interface file !!! FIX !!!"
-// TOMBackbuffer += GetSDLScreenWidthInPixels();
- TOMBackbuffer += tomDeviceWidth;
}
}
// 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);
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);
void TOMSetPendingVideoInt(void);
void TOMResetPIT(void);
-//uint32 TOMGetSDLScreenPitch(void);
-void TOMResetBackbuffer(uint32 * backbuffer);
-
// Exported variables
extern uint32 tomWidth;
extern uint32 tomTimerDivider;
extern int32 tomTimerCounter;
-extern uint32 tomDeviceWidth;
+extern uint32 screenPitch;
+extern uint32 * screenBuffer;
#endif // __TOM_H__
# 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)