From: Shamus Hammons Date: Thu, 15 Jan 2009 19:17:28 +0000 (+0000) Subject: Preliminary state support X-Git-Tag: 2.0.0~39 X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04d8927f74bfce1ca8232a65b66c088e8a8406a;p=virtualjaguar Preliminary state support --- diff --git a/Makefile b/Makefile index d205e3b..af2d383 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ OBJS = \ obj/sdlemu_config.o \ obj/sdlemu_opengl.o \ obj/settings.o \ + obj/state.o \ obj/tom.o \ obj/unzip.o \ obj/video.o \ diff --git a/docs/INSTALL b/docs/INSTALL index 423d36c..94c054c 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -6,18 +6,17 @@ Virtual Jaguar v1.1.0 GCC/SDL release INSTALL REQUIREMENTS: ------------- -To compile Virtual Jaguar you need to check if you have the minimum -requirements for compiling the sources: - -- GCC v4.3.x or higher -- SDL v1.2.13 or higher -- ZLIB v1.2.3 -- libcdio v0.80 or higher -- OpenGL libraries -- supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw, MacOS); other OSs - may work to but you may need to change some items in the Makefile. - -Optionally you need a Atari Jaguar boot ROM (and/or CD boot ROM) which is +The minimum requirements for compiling Virtual Jaguar from source are: + + o GCC v4.3.x or higher + o SDL v1.2.13 or higher + o zlib v1.2.3 + o libcdio v0.80 or higher + o OpenGL libraries + o supported OS (BeOS, Linux, FreeBSD and WIN32 through mingw, MacOS); other + OSs may work to but you may need to change some items in the Makefile. + +Optionally you'll need an Atari Jaguar boot ROM (and/or CD boot ROM) which is available on the Internet. We can't include the boot ROM since it's still copyrighted. @@ -25,7 +24,7 @@ copyrighted. COMPILING: ---------- -If you sure you have the minimum software requirements, you can compile +Assuming that you meet the minimum software requirements, you can compile Virtual Jaguar by issuing the following command in the directory where you decompressed the source: @@ -35,8 +34,8 @@ Optionally you can manually strip vj[.exe] to downsize the binary. If you have upx in your path somewhere, you can uncomment the line in the makefile that executes upx so that you'll end up with a somewhat smaller binary. -That's it! You're done! You can now start the emulator with ./vj. See the -output for more details or consult the README file for more info. +That's it! You can now start the emulator with ./vj. See the output for more +details (or stdout.txt on Win32) or consult the README file for more info. For even more info, go to http://sdlemu.ngemu.com or send use an e-mail to the following e-mail address: sdlemu AT ngemu DOT com. diff --git a/docs/README b/docs/README index 81b890c..f109b8f 100644 --- a/docs/README +++ b/docs/README @@ -13,10 +13,10 @@ original work by David Raingeard of Potato Emulation. For requirements please consult the INSTALL file for more information about supported OS's and software requirements. -The use of this software is entirely at your own risk. We can't be held -responsible for damage done to you hardware and/or software. While it won't -rape your dog, it might do other nasty things. You have been warned. This -software requires the use of the Atari Jaguar (CD) boot ROM and/or Commercial +The use of this software is entirely at your own risk. While it won't rape +your dog, it might do other nasty things. We can't be held responsible for +damage done to you hardware and/or software. You have been warned! This +software may require the use of the Atari Jaguar boot ROMs and/or Commercial ROM images. You may only use the ROM images if you own the cartridges itself. The use of Commercial ROMs without owning the original cartridge is illegal in most countries and could result in fines and/or legal actions. @@ -27,8 +27,9 @@ may not commercially sell this software. If you make changes, release the source code to the public and send the changes you made to the original authors. -The products and brands used in these documents and/or sourcecode are owned by -their respective companies and/or successors in interest. +The products, trademarks and/or brands used in these documents and/or +sourcecode are owned by their respective companies and/or successors in +interest. ---------------------------------------------------------------- - IMPORTANT NOTE ABOUT JAGUAR FILE FORMATS--READ THIS OR ELSE! - @@ -86,14 +87,14 @@ a standard PC. The software was originally developed by David Raingeard of Potato Emulation [http://potato.emu-france.com] and was released under the GPL on 25 June 2003. -Virtual Jaguar GCC/SDL is not only a port of the MS Visual C++/SDL sourcecode +Virtual Jaguar GCC/SDL is not just a port of the MS Visual C++/SDL sourcecode but has also been extended and rewritten so that we can enjoy Atari Jaguar -emulation on every platform which uses the GCC compiler and that can make use -of the Simple Directmedia Layer library (SDL). +emulation on every platform that has a GCC compiler and a port of the Simple +Directmedia Layer library (SDL). Currently Virtual Jaguar GCC/SDL compiles on WIN32 using mingw, and several -UN*X based systems (BeOS, Linux and FreeBSD). It may run on other systems -as well but we can not guarantee that. +UN*X based systems (BeOS, Linux, FreeBSD and MacOS). It may run on other +systems as well but we can not guarantee that. The port was done by the SDLEMU crew (http://sdlemu.ngemu.com) and especially by Niels Wagenaar and Carwin Jones. A major portion of the rewrite was done by @@ -101,7 +102,8 @@ James L. Hammons. You may contact us by e-mail (sdlemu@ngemu.com) or leave a message on the SDLEMU Official Forum (see the website). Patches and bugfixes are particularly welcome! :) -More information about SDL can be found at http://www.libsdl.org. +More information about the incredible SDL libraries can be found at +http://www.libsdl.org. Thanks Sam--you rock! :) -------------------------------- - Using Virtual Jaguar GCC/SDL - @@ -110,14 +112,15 @@ More information about SDL can be found at http://www.libsdl.org. After compiling the binary (see INSTALL) you can now run original Atari Jaguar games. These games are distributed on cartridges and can therefore cannot be used on a PC (we're still waiting for that Jaguar-on-a-PCI-card that you plug -into your late model PC, complete with cartridge slot ;-). To use these games -on Virtual Jaguar GCC/SDL you need to get ROM images. Besides the ROM images -from commercial games you must also obtain the Atari Jaguar (CD) boot ROM -which you must copy to the BIOS directory. For legal issues concerning ROM -images please consult the DISCLAIMER at the beginning of this file. - -After obtaining the Atari Jaguar (CD) boot ROM and several ROMs you can now -use Virtual Jaguar using the following command: +into your late model PC, complete with cartridge slot and controller connectors +;-). To use these games on Virtual Jaguar GCC/SDL you need to get ROM images. +Besides the ROM images from commercial games, you may also need to obtain the +Atari Jaguar boot ROM (and/or CD boot ROM) which you must copy to the BIOS +directory. For legal issues concerning ROM images please consult the DISCLAIMER +at the beginning of this file. + +After obtaining the Atari Jaguar boot ROM (and/or CD boot ROM) and several game +ROMs you can now use Virtual Jaguar using the following command: ./vj [romfile] [-switches] diff --git a/src/objectp.h b/src/objectp.h index 130eb0f..20e7190 100644 --- a/src/objectp.h +++ b/src/objectp.h @@ -22,4 +22,8 @@ void OPSetCurrentObject(uint64 object); //void OPWriteByte(uint32, uint8, uint32 who = UNKNOWN); //void OPWriteWord(uint32, uint16, uint32 who = UNKNOWN); +// Exported variables + +extern uint8 objectp_running; + #endif // __OBJECTP_H__ diff --git a/src/state.cpp b/src/state.cpp new file mode 100644 index 0000000..7b6f3d4 --- /dev/null +++ b/src/state.cpp @@ -0,0 +1,16 @@ +// +// state.cpp: VJ machine state save/load support +// +// by James L. Hammons +// + +#include "state.h" + +bool SaveState(void) +{ +} + +bool LoadState(void) +{ +} + diff --git a/src/state.h b/src/state.h new file mode 100644 index 0000000..7ff7597 --- /dev/null +++ b/src/state.h @@ -0,0 +1,28 @@ +// +// state.h: Machine state save/load support +// +// by James L. Hammons +// + +#ifndef __STATE_H__ +#define __STATE_H__ + +//#include + +//#ifdef __cplusplus +//extern "C" { +//#endif + +//int LogInit(const char *); +//FILE * LogGet(void); +//void LogDone(void); +//void WriteLog(const char * text, ...); + +//#ifdef __cplusplus +//} +//#endif + +bool SaveState(void); +bool LoadState(void); + +#endif // __STATE_H__ diff --git a/src/tom.cpp b/src/tom.cpp index 03523bf..5c236a0 100644 --- a/src/tom.cpp +++ b/src/tom.cpp @@ -314,8 +314,6 @@ //(It's easier to do it here, though...) //#define TOM_DEBUG -extern uint8 objectp_running; - uint8 tomRam8[0x4000]; uint32 tomWidth, tomHeight; static uint32 tom_timer_prescaler; @@ -939,6 +937,7 @@ void TOMExecScanline(uint16 scanline, bool render) if (inActiveDisplayArea) { //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); else//TV type render @@ -959,21 +958,51 @@ void TOMExecScanline(uint16 scanline, bool render) uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1; uint8 mode = ((GET16(tomRam8, VMODE) & MODE) >> 1); bool varmod = GET16(tomRam8, VMODE) & VARMOD; -//The video texture line buffer ranges from 0 to 1279, with its left edge starting at LEFT_VISIBLE_HC. -//So, we need to start writing into the backbuffer at HDB1, using pwidth as our scaling factor. The -//way it generates its image on a real TV! +//The video texture line buffer ranges from 0 to 1279, with its left edge starting at +//LEFT_VISIBLE_HC. So, we need to start writing into the backbuffer at HDB1, using pwidth +//as our scaling factor. The way it generates its image on a real TV! + +//So, for example, if HDB1 is less than LEFT_VISIBLE_HC, then we have to figure out where +//in the VTLB that we start writing pixels from the Jaguar line buffer (VTLB start=0, +//JLB=something). +#if 0 +// +// 24 BPP mode rendering +// +void tom_render_24bpp_scanline(uint32 * backbuffer) +{ +//CHANGED TO 32BPP RENDERING + uint16 width = tomWidth; + uint8 * current_line_buffer = (uint8 *)&tomRam8[0x1800]; + + //New stuff--restrict our drawing... + uint8 pwidth = ((GET16(tomRam8, VMODE) & PWIDTH) >> 9) + 1; + //NOTE: May have to check HDB2 as well! + int16 startPos = GET16(tomRam8, HDB1) - (vjs.hardwareTypeNTSC ? LEFT_VISIBLE_HC : LEFT_VISIBLE_HC_PAL); // Get start position in HC ticks + startPos /= pwidth; + if (startPos < 0) + current_line_buffer += 4 * -startPos; + else +//This should likely be 4 instead of 2 (?--not sure) + backbuffer += 2 * startPos, width -= startPos; -//So, for example, if HDB1 is less than LEFT_VISIBLE_HC, then we have to figure out where in the VTLB -//that we start writing pixels from the Jaguar line buffer (VTLB start=0, JLB=something). + while (width) + { + uint32 g = *current_line_buffer++; + uint32 r = *current_line_buffer++; + current_line_buffer++; + uint32 b = *current_line_buffer++; + *backbuffer++ = 0xFF000000 | (b << 16) | (g << 8) | r; + width--; + } +} +#endif } } else { // If outside of VDB & VDE, then display the border color -/* int16 * currentLineBuffer = TOMBackbuffer; - uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1]; - uint16 pixel = ((r & 0xF8) << 7) | ((g & 0xF8) << 2) | (b >> 3);//*/ uint32 * currentLineBuffer = TOMBackbuffer; uint8 g = tomRam8[BORD1], r = tomRam8[BORD1 + 1], b = tomRam8[BORD2 + 1]; uint32 pixel = 0xFF000000 | (b << 16) | (g << 8) | r; @@ -982,7 +1011,6 @@ void TOMExecScanline(uint16 scanline, bool render) *currentLineBuffer++ = pixel; } -// TOMBackbuffer += GetSDLScreenPitch() / 2; // Returns bytes, but we need words TOMBackbuffer += GetSDLScreenWidthInPixels(); } } diff --git a/vj.cfg b/vj.cfg index cb4dc4c..68deaf2 100644 --- a/vj.cfg +++ b/vj.cfg @@ -29,6 +29,10 @@ fullscreen = 0 hardwareTypeNTSC = 1 +# Render type (experimental): 0 - regular/OpenGL, 1 - TV style + +renderType = 0 + # DSP options: 1 - use, 0 - don't use DSPEnabled = 0