From 34eb947551354f437ed67e2f0a3b88e186f47561 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Mon, 20 Oct 2008 19:36:30 +0000 Subject: [PATCH] Added temporary patch to remove libcdio dependency. --- Makefile | 5 ++++- docs/INSTALL | 16 +++++++-------- docs/README | 33 ++++++++++++++++-------------- docs/TODO | 2 ++ src/cdintf.cpp | 54 ++++++++++++++++++++++++++++---------------------- src/dac.cpp | 12 ++++++++++- 6 files changed, 73 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 1d40ba8..3746100 100644 --- a/Makefile +++ b/Makefile @@ -51,13 +51,16 @@ TARGET = vj # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2 CFLAGS = -MMD -Wall -Wno-switch -O2 -D$(SYSTYPE) -ffast-math -fomit-frame-pointer `sdl-config --cflags` CPPFLAGS = -MMD -Wall -Wno-switch -Wno-non-virtual-dtor -O2 -D$(SYSTYPE) \ - -ffast-math -fomit-frame-pointer `sdl-config --cflags` -g + -DHAVE_LIB_CDIO -ffast-math -fomit-frame-pointer `sdl-config --cflags` -g # -fomit-frame-pointer `sdl-config --cflags` -g # -fomit-frame-pointer `sdl-config --cflags` -DLOG_UNMAPPED_MEMORY_ACCESSES LDFLAGS = LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lcdio +# Comment out the above and uncomment below if you don't have libcdio. +# Also, remove the "-DHAVE_LIB_CDIO" from CPPFLAGS above. +#LIBS = -L/usr/local/lib -L/usr/lib `sdl-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) INCS = -I. -I./src -I/usr/local/include -I/usr/include diff --git a/docs/INSTALL b/docs/INSTALL index 21badfa..556aaea 100644 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -9,13 +9,13 @@ REQUIREMENTS: To compile Virtual Jaguar you need to check if you have the minimum requirements for compiling the sources: -- GCC v2.95 or v3.x; -- SDL v1.2.5 or higher; -- ZLIB v1.1.4 +- 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); other OSs may - work to but you may need to change some items in the Makefile and compile - script. + 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 available on the Internet. We can't include the boot ROM since it's still @@ -25,16 +25,16 @@ copyrighted. COMPILING: ---------- -If you sure you have the minimum software requirements, you can safely compile +If you sure you have the minimum software requirements, you can compile Virtual Jaguar by issuing the following command in the directory where you decompressed the source: -./compile +make 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. diff --git a/docs/README b/docs/README index 6b86b3f..81b890c 100644 --- a/docs/README +++ b/docs/README @@ -14,19 +14,21 @@ 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. This software -requires the use of the Atari Jaguar (CD) boot ROM 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 +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 +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. -This software is released under the GPL. For more information I direct you to -the GPL.TXT. You may hack/change the code anyway you like. You 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. +This software is released under the GPL v2 or later. For more information I +direct you to the GPL.TXT. You may hack/change the code anyway you like. You +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. +their respective companies and/or successors in interest. ---------------------------------------------------------------- - IMPORTANT NOTE ABOUT JAGUAR FILE FORMATS--READ THIS OR ELSE! - @@ -68,8 +70,8 @@ higher address than a Jaguar cartridge. The fourth type, the .bin file, is simply a Jaguar executable with no header. Since these files contain no information about where they load and execute, Virtual Jaguar does not support this file type. Go bug the author to release -either a file with headers or a file in Alpine ROM format. Virtual Jaguar is -not omniscient! ;) +either a file with proper headers or a file in Alpine ROM format. Virtual +Jaguar is not omniscient (yet)! ;) There is a fifth type of file that is supported by Virtual Jaguar, the .j64 file, which is simply a 1, 2, or 4 Meg dump of a Jaguar cartridge ROM which @@ -82,7 +84,7 @@ loads at $800000 in the Jaguar memory space. Virtual Jaguar is software dedicated to emulating the Atari Jaguar hardware on 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. +on 25 June 2003. Virtual Jaguar GCC/SDL is not only a port of the MS Visual C++/SDL sourcecode but has also been extended and rewritten so that we can enjoy Atari Jaguar @@ -122,7 +124,8 @@ use Virtual Jaguar using the following command: The context of ROMFILE is the filename of the an Atari Jaguar ROM dump (can be either compressed or uncompressed). You can also use switches. By just typing ./vj -? (or ./vj -help) you get an overview of the options you can use. WIN32 -users should look into the stdout.txt for that information. +users should look into the stdout.txt in the directory they ran Virtual Jaguar +for that information. If you prefer a nice GUI instead of typing in command lines, you can either type ./vj or double click on the Virtual Jaguar executable. If you have a @@ -173,13 +176,13 @@ anymore. ;) ----------- If you find bugs, enhance the code or simply have questions, drop us an e-mail -at sdlemu AT ngemu DOT com or drop a message on the SDLEMU Official Forum. +at sdlemu AT ngemu DOT com or drop a message on the SDLEMU Official Forum. More information about this project (releases/WIP) can be found at the official Virtual Jaguar website [http://www.icculus.org/virtualjaguar] and on the SDLEMU website [http://sdlemu.ngemu.com]. -We hope you enjoy the emulator and will use it wisely! +We hope you enjoy the emulator and will use it wisely! Special thanks go to guys over at ngemu.com and #ngemu (EFNET). Thanks also to David Raingeard of Potato Emulation who originally developed this emulator and diff --git a/docs/TODO b/docs/TODO index d16dfaf..aab644d 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,6 +1,8 @@ Stuff to add/fix for the next release of Virtual Jaguar ------------------------------------------------------- +- Fix DSP code so that it doesn't hang in a spinlock waiting for the sound + buffer to empty. Probably a CS lock contention issue. [Shamus] - Make sure that VJ doesn't crash if the useJaguarBIOS key is set to 1 and the BIOS file isn't available. [Shamus] - Create an EEPROMs directory (or whatever is in EEPROMPath[]) if it doesn't diff --git a/src/cdintf.cpp b/src/cdintf.cpp index fbf227f..2f54be5 100644 --- a/src/cdintf.cpp +++ b/src/cdintf.cpp @@ -3,37 +3,24 @@ // // by James L. Hammons // -// This file is basically a shell to keep the front-end clean and also pull in the -// appropriate back-end code depending on which target is being compiled for. +// This now uses the supposedly cross-platform libcdio to do the necessary +// low-level CD twiddling we need that libsdl can't do currently. Jury is +// still out on whether or not to make this a conditional compilation or not. // +// Comment this out if you don't have libcdio installed +// (Actually, this is defined in the Makefile to prevent having to edit +// things too damn much. Jury is still out whether or not to make this +// change permanent.) +//#define HAVE_LIB_CDIO + #include "cdintf.h" // Every OS has to implement these +#ifdef HAVE_LIB_CDIO #include // Now using OS agnostic CD access routines! -#include "log.h" - -// Not any more! -#if 0 - -// OS dependent implementations - -#if defined(__GCCWIN32__) - -#include "cdintf_win32.cpp" - -#elif defined(__GCCUNIX__) - #if defined(_OSX_) - -#include "cdintf_osx.cpp" - - #else - -#include "cdintf_linux.cpp" - - #endif #endif +#include "log.h" -#endif /* static void TestCDIO(void) @@ -59,33 +46,42 @@ static void TestCDIO(void) // *** OK, here's where we're going to attempt to put the platform agnostic CD interface *** // +#ifdef HAVE_LIB_CDIO static CdIo_t * cdioPtr = NULL; +#endif bool CDIntfInit(void) { +#ifdef HAVE_LIB_CDIO cdioPtr = cdio_open(NULL, DRIVER_DEVICE); if (cdioPtr == NULL) { +#endif WriteLog("CDINTF: No suitable CD-ROM driver found.\n"); return false; +#ifdef HAVE_LIB_CDIO } WriteLog("CDINTF: Successfully opened CD-ROM interface.\n"); return true; +#endif } void CDIntfDone(void) { WriteLog("CDINTF: Shutting down CD-ROM subsystem.\n"); +#ifdef HAVE_LIB_CDIO if (cdioPtr) cdio_destroy(cdioPtr); +#endif } bool CDIntfReadBlock(uint32 sector, uint8 * buffer) { +#warning !!! FIX !!! CDIntfReadBlock not implemented! // !!! FIX !!! WriteLog("CDINTF: ReadBlock unimplemented!\n"); return false; @@ -93,6 +89,7 @@ bool CDIntfReadBlock(uint32 sector, uint8 * buffer) uint32 CDIntfGetNumSessions(void) { +#warning !!! FIX !!! CDIntfGetNumSessions not implemented! // !!! FIX !!! // Still need relevant code here... !!! FIX !!! return 2; @@ -100,12 +97,14 @@ uint32 CDIntfGetNumSessions(void) void CDIntfSelectDrive(uint32 driveNum) { +#warning !!! FIX !!! CDIntfSelectDrive not implemented! // !!! FIX !!! WriteLog("CDINTF: SelectDrive unimplemented!\n"); } uint32 CDIntfGetCurrentDrive(void) { +#warning !!! FIX !!! CDIntfGetCurrentDrive not implemented! // !!! FIX !!! WriteLog("CDINTF: GetCurrentDrive unimplemented!\n"); return 0; @@ -113,16 +112,22 @@ uint32 CDIntfGetCurrentDrive(void) const uint8 * CDIntfGetDriveName(uint32 driveNum) { +#warning !!! FIX !!! CDIntfGetDriveName driveNum is currently ignored! // driveNum is currently ignored... !!! FIX !!! +#ifdef HAVE_LIB_CDIO uint8 * driveName = (uint8 *)cdio_get_default_device(cdioPtr); WriteLog("CDINTF: The drive name for the current driver is %s.\n", driveName); return driveName; +#else + return (uint8 *)"NONE"; +#endif } uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset) { +#warning !!! FIX !!! CDIntfGetSessionInfo not implemented! // !!! FIX !!! WriteLog("CDINTF: GetSessionInfo unimplemented!\n"); return 0xFF; @@ -130,6 +135,7 @@ uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset) uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset) { +#warning !!! FIX !!! CDIntfTrackInfo not implemented! // !!! FIX !!! WriteLog("CDINTF: GetTrackInfo unimplemented!\n"); return 0xFF; diff --git a/src/dac.cpp b/src/dac.cpp index 4b4bfab..59019f8 100644 --- a/src/dac.cpp +++ b/src/dac.cpp @@ -11,6 +11,14 @@ // work correctly...! Perhaps just need to set up SSI stuff so BUTCH doesn't get // confused... +// ALSO: Need to implement some form of proper locking to replace the clusterfuck +// that is the current spinlock implementation. Since the DSP is a separate +// entity, could we get away with running it in the sound IRQ? + +// ALSO: It may be a good idea to physically separate the left and right buffers +// to prevent things like the DSP filling only one side and such. Do such +// mono modes exist on the Jag? Seems to according to Super Burnout. + #include "dac.h" #include "SDL.h" @@ -331,6 +339,8 @@ WriteLog("Tail=%X, Head=%X", rtail, rhead); { if (SDL_OpenAudio(&desired, NULL) < 0) // NULL means SDL guarantees what we want { +// This is bad, Bad, BAD !!! DON'T ABORT BECAUSE WE DIDN'T GET OUR FREQ! !!! FIX !!! +#warning !!! FIX !!! Aborting because of SDL audio problem is bad! WriteLog("DAC: Failed to initialize SDL sound: %s.\nDesired freq: %u\nShutting down!\n", SDL_GetError(), desired.freq); log_done(); exit(1); @@ -382,5 +392,5 @@ uint16 DACReadWord(uint32 offset, uint32 who/*= UNKNOWN*/) else if (offset == RRXD + 2) return rrxd; - return 0xFFFF; // May need SSTAT as well... (but may be a Jaguar II only feature) + return 0xFFFF; // May need SSTAT as well... (but may be a Jaguar II only feature) } -- 2.37.2