From 2ac740bf6424dabf13dae70a760dbcb75e2621e9 Mon Sep 17 00:00:00 2001 From: dborth Date: Fri, 12 Sep 2008 05:28:40 +0000 Subject: [PATCH] add/update code comments, minor refactor --- README.txt | 3 +- source/ngc/aram.cpp | 24 +++-- source/ngc/aram.h | 11 ++- source/ngc/audio.cpp | 77 ++++++++------- source/ngc/audio.h | 13 +-- source/ngc/button_mapping.c | 17 ++-- source/ngc/button_mapping.h | 5 +- source/ngc/cheatmgr.cpp | 10 +- source/ngc/cheatmgr.h | 5 +- source/ngc/dvd.cpp | 90 +++++++++-------- source/ngc/dvd.h | 11 ++- source/ngc/fileop.cpp | 21 ++-- source/ngc/fileop.h | 6 +- source/ngc/filesel.cpp | 29 +++--- source/ngc/filesel.h | 4 +- source/ngc/freeze.cpp | 42 ++++---- source/ngc/freeze.h | 13 +-- source/ngc/gctime.h | 10 -- source/ngc/input.cpp | 45 ++++++++- source/ngc/input.h | 15 ++- source/ngc/memcardop.cpp | 49 +++------- source/ngc/memcardop.h | 12 +-- source/ngc/menu.cpp | 31 +++--- source/ngc/menu.h | 12 ++- source/ngc/menudraw.cpp | 65 ++++++------- source/ngc/menudraw.h | 6 +- source/ngc/ngc-missing.cpp | 181 ----------------------------------- source/ngc/preferences.cpp | 37 ++++--- source/ngc/preferences.h | 11 +-- source/ngc/s9xconfig.cpp | 6 +- source/ngc/s9xconfig.h | 9 +- source/ngc/s9xsupport.cpp | 183 +++++++---------------------------- source/ngc/smbop.cpp | 5 +- source/ngc/smbop.h | 5 +- source/ngc/snes9xGX.cpp | 186 ++++-------------------------------- source/ngc/snes9xGX.h | 6 +- source/ngc/sram.cpp | 19 ++-- source/ngc/sram.h | 8 +- source/ngc/unzip.cpp | 12 ++- source/ngc/unzip.h | 9 +- source/ngc/video.cpp | 47 +++++---- source/ngc/video.h | 7 +- 42 files changed, 472 insertions(+), 885 deletions(-) delete mode 100644 source/ngc/gctime.h delete mode 100644 source/ngc/ngc-missing.cpp diff --git a/README.txt b/README.txt index d74179f..35dea23 100644 --- a/README.txt +++ b/README.txt @@ -14,7 +14,7 @@ `จ•จจจจจ จจจจจจจจจจจจจจจจ จจจจจจจจจจจจจจจ จจจจจจจจจจจจจจจจจจจจ จจจจจจจจจจจจจ' SNES9x GX is a Super Nintendo emulator for the Wii based on the PC emulator -SNES9x 1.50 (http://snes9x.ipherswipsite.com/). SoftDev is responsible for +SNES9x 1.51 (http://snes9x.ipherswipsite.com/). SoftDev is responsible for the original SNES9x 1.50 GameCube port, whose work was continued by crunchy2. It was updated for the Wii by michniewski and is currently being maintained by michniewski and Tantric. @@ -25,6 +25,7 @@ michniewski - added: Superscope/mouse/justifier support, with Wii remote Tantric +- added: now uses SNES 1.51 core (thanks to eke-eke for help with this) - added: cheats menu! Loads .CHT file from /snes9x/cheats folder, .CHT file name must match file name of ROM - added: load/save preference selector. ROM, SRAM, Freeze, and preferences diff --git a/source/ngc/aram.cpp b/source/ngc/aram.cpp index b79b6ac..e64a312 100644 --- a/source/ngc/aram.cpp +++ b/source/ngc/aram.cpp @@ -1,12 +1,16 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Audio RAM + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * + * aram.cpp + * + * Gamecube Audio RAM storage + ***************************************************************************/ + #include #include + #include "aram.h" #define ARAM_READ 1 @@ -15,11 +19,11 @@ #define TEMPSIZE 32768 static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32); -/** +/**************************************************************************** * ARAMPut * * Move data from MAIN memory to ARAM - */ + ***************************************************************************/ void ARAMPut (char *src, char *dst, int len) { @@ -28,11 +32,11 @@ ARAMPut (char *src, char *dst, int len) while (AR_GetDMAStatus()); } -/** +/**************************************************************************** * ARAMFetch * * This function will move data from ARAM to MAIN memory - */ + ***************************************************************************/ void ARAMFetch (char *dst, char *src, int len) { @@ -41,11 +45,11 @@ ARAMFetch (char *dst, char *src, int len) while (AR_GetDMAStatus ()); } -/** +/**************************************************************************** * ARAMFetchSlow * * Required as SNES memory may NOT be 32-byte aligned - */ + ***************************************************************************/ void ARAMFetchSlow (char *dst, char *src, int len) { diff --git a/source/ngc/aram.h b/source/ngc/aram.h index e3a7124..cb18fac 100644 --- a/source/ngc/aram.h +++ b/source/ngc/aram.h @@ -1,10 +1,13 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Audio RAM + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * + * aram.h + * + * Gamecube Audio RAM storage + ***************************************************************************/ + #ifndef _GCARAMI_ #define _GCARAMI_ diff --git a/source/ngc/audio.cpp b/source/ngc/audio.cpp index f9e7f1f..4ef225f 100644 --- a/source/ngc/audio.cpp +++ b/source/ngc/audio.cpp @@ -1,17 +1,20 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Audio - * - * Audio is fixed to 32Khz/16bit/Stereo + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * + * audio.cpp + * + * Audio driver + * Audio is fixed to 32Khz/16bit/Stereo + ***************************************************************************/ + #include #include #include #include #include + #include "snes9x.h" #include "memmap.h" #include "debug.h" @@ -40,65 +43,65 @@ lwpq_t audioqueue; lwp_t athread; static uint8 astack[AUDIOSTACK]; -/** +/**************************************************************************** * Audio Threading - */ + ***************************************************************************/ static void * AudioThread (void *arg) { - LWP_InitQueue (&audioqueue); + LWP_InitQueue (&audioqueue); - while (1) - { - whichab ^= 1; - if (ConfigRequested) - memset (soundbuffer[whichab], 0, AUDIOBUFFER); - else + while (1) { - so.samples_mixed_so_far = so.play_position = 0; - S9xMixSamples (soundbuffer[whichab], AUDIOBUFFER >> 1); + whichab ^= 1; + if (ConfigRequested) + memset (soundbuffer[whichab], 0, AUDIOBUFFER); + else + { + so.samples_mixed_so_far = so.play_position = 0; + S9xMixSamples (soundbuffer[whichab], AUDIOBUFFER >> 1); + } + LWP_ThreadSleep (audioqueue); } - LWP_ThreadSleep (audioqueue); - } - return NULL; + return NULL; } -/** +/**************************************************************************** * MixSamples - * This continually calls S9xMixSamples On each DMA Completion - */ + * This continually calls S9xMixSamples On each DMA Completion + ***************************************************************************/ static void GCMixSamples () { - AUDIO_StopDMA (); + AUDIO_StopDMA (); - DCFlushRange (soundbuffer[whichab], AUDIOBUFFER); - AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER); - AUDIO_StartDMA (); + DCFlushRange (soundbuffer[whichab], AUDIOBUFFER); + AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER); + AUDIO_StartDMA (); - LWP_ThreadSignal (audioqueue); + LWP_ThreadSignal (audioqueue); } -/** - * InitGCAudio - */ +/**************************************************************************** + * InitGCAudio + ***************************************************************************/ void InitGCAudio () { - AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ); - AUDIO_RegisterDMACallback (GCMixSamples); + AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ); + AUDIO_RegisterDMACallback (GCMixSamples); - LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80); + LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80); } -/** +/**************************************************************************** * AudioStart * * Called to kick off the Audio Queue - */ + ***************************************************************************/ void AudioStart () { - GCMixSamples (); + GCMixSamples (); } diff --git a/source/ngc/audio.h b/source/ngc/audio.h index 9054046..19433f7 100644 --- a/source/ngc/audio.h +++ b/source/ngc/audio.h @@ -1,12 +1,13 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Audio - * - * Audio is fixed to 32Khz/16bit/Stereo + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * + * audio.h + * + * Audio driver + * Audio is fixed to 32Khz/16bit/Stereo + ***************************************************************************/ void InitGCAudio (); void AudioStart (); diff --git a/source/ngc/button_mapping.c b/source/ngc/button_mapping.c index d6d8528..83d097a 100644 --- a/source/ngc/button_mapping.c +++ b/source/ngc/button_mapping.c @@ -1,29 +1,28 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Wii/Gamecube Port * michniewski August 2008 * * button_mapping.c * * Controller button mapping - ****************************************************************************/ + ***************************************************************************/ #include #include #include #include - #include #include #include + #include "button_mapping.h" -/*** -* Controller Button Descriptions: -* used for identifying which buttons have been pressed when configuring -* and for displaying the name of said button -***/ +/**************************************************************************** + * Controller Button Descriptions: + * used for identifying which buttons have been pressed when configuring + * and for displaying the name of said button + ***************************************************************************/ CtrlrMap ctrlr_def[4] = { // Nunchuk btn def diff --git a/source/ngc/button_mapping.h b/source/ngc/button_mapping.h index e9b211d..178dfc2 100644 --- a/source/ngc/button_mapping.h +++ b/source/ngc/button_mapping.h @@ -1,13 +1,12 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Wii/Gamecube Port * michniewski August 2008 * * button_mapping.h * * Controller button mapping - ****************************************************************************/ + ***************************************************************************/ #ifndef BTN_MAP_H #define BTN_MAP_H diff --git a/source/ngc/cheatmgr.cpp b/source/ngc/cheatmgr.cpp index c7768c4..eb7931d 100644 --- a/source/ngc/cheatmgr.cpp +++ b/source/ngc/cheatmgr.cpp @@ -1,14 +1,12 @@ /**************************************************************************** - * Snes9x 1.51 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * Tantric August 2008 * * cheatmgr.cpp * * Cheat handling - ****************************************************************************/ + ***************************************************************************/ #include "memmap.h" #include "cheats.h" @@ -27,7 +25,7 @@ extern unsigned char savebuffer[]; * * Loads cheat file from save buffer * Custom version of S9xLoadCheatFile() - ****************************************************************************/ + ***************************************************************************/ bool8 NGCLoadCheatFile (int length) { @@ -61,7 +59,7 @@ bool8 NGCLoadCheatFile (int length) * * Erases any prexisting cheats, loads cheats from a cheat file * Called when a ROM is first loaded - ****************************************************************************/ + ***************************************************************************/ void SetupCheats() { diff --git a/source/ngc/cheatmgr.h b/source/ngc/cheatmgr.h index fe6243e..6ff8130 100644 --- a/source/ngc/cheatmgr.h +++ b/source/ngc/cheatmgr.h @@ -1,12 +1,11 @@ /**************************************************************************** - * Snes9x 1.51 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Wii/Gamecube Port * Tantric August 2008 * * cheatmgr.h * * Cheat handling - ****************************************************************************/ + ***************************************************************************/ void SetupCheats(); diff --git a/source/ngc/dvd.cpp b/source/ngc/dvd.cpp index 098ff60..d0e1373 100644 --- a/source/ngc/dvd.cpp +++ b/source/ngc/dvd.cpp @@ -1,11 +1,15 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube DVD + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * svpe & crunchy2 June 2007 - ****************************************************************************/ + * Tantric September 2008 + * + * dvd.cpp + * + * DVD I/O functions + ***************************************************************************/ + #include #include #include @@ -43,12 +47,12 @@ unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32); unsigned char dvdbuffer[2048]; - /** - * dvd_read - * - * The only DVD function we need - you gotta luv gc-linux self-boots! - * returns: 1 - ok ; 0 - error - */ +/**************************************************************************** + * dvd_read + * + * The only DVD function we need - you gotta luv gc-linux self-boots! + * returns: 1 - ok ; 0 - error + ***************************************************************************/ int dvd_read (void *dst, unsigned int len, u64 offset) { @@ -60,7 +64,8 @@ dvd_read (void *dst, unsigned int len, u64 offset) DCInvalidateRange ((void *) buffer, len); - if(offset < 0x57057C00 || (isWii && offset < 0x118244F00LL)) // don't read past the end of the DVD + // don't read past the end of the DVD (1.5 GB for GC DVD, 4.7 GB for DVD) + if(offset < 0x57057C00 || (isWii && offset < 0x118244F00LL)) { #ifdef HW_DOL @@ -106,12 +111,12 @@ dvd_read (void *dst, unsigned int len, u64 offset) #define PVDROOT 0x9c static int IsJoliet = 0; -/** +/**************************************************************************** * Primary Volume Descriptor * * The PVD should reside between sector 16 and 31. * This is for single session DVD only. - */ + ***************************************************************************/ int getpvd () { @@ -174,7 +179,7 @@ getpvd () * TestDVD() * * Tests if a ISO9660 DVD is inserted and available - ****************************************************************************/ + ***************************************************************************/ bool TestDVD() { @@ -193,12 +198,12 @@ bool TestDVD() return true; } -/** +/**************************************************************************** * getentry * * Support function to return the next file entry, if any * Declared static to avoid accidental external entry. - */ + ***************************************************************************/ static int diroffset = 0; static int getentry (int entrycount) @@ -304,7 +309,7 @@ getentry (int entrycount) return 0; } -/** +/**************************************************************************** * parseDVDdirectory * * This function will parse the directory tree. @@ -312,7 +317,7 @@ getentry (int entrycount) * getpvd, a previous parse or a menu selection. * * The return value is number of files collected, or 0 on failure. - */ + ***************************************************************************/ int ParseDVDdirectory () { @@ -356,12 +361,12 @@ ParseDVDdirectory () return filecount; } -/** -* DirectorySearch -* -* Searches for the directory name specified within the current directory -* Returns the index of the directory, or -1 if not found -*/ +/**************************************************************************** + * DirectorySearch + * + * Searches for the directory name specified within the current directory + * Returns the index of the directory, or -1 if not found + ***************************************************************************/ int DirectorySearch(char dir[512]) { for (int i = 0; i < maxfiles; i++ ) @@ -370,13 +375,13 @@ int DirectorySearch(char dir[512]) return -1; } -/** -* SwitchDVDFolder -* -* Recursively searches for any directory path 'dir' specified -* Also loads the directory contents via ParseDVDdirectory() -* It relies on dvddir, dvddirlength, and filelist being pre-populated -*/ +/**************************************************************************** + * SwitchDVDFolder + * + * Recursively searches for any directory path 'dir' specified + * Also loads the directory contents via ParseDVDdirectory() + * It relies on dvddir, dvddirlength, and filelist being pre-populated + ***************************************************************************/ bool SwitchDVDFolder(char * dir, int maxDepth) { if(maxDepth > 8) // only search to a max depth of 8 levels @@ -434,7 +439,7 @@ bool SwitchDVDFolder(char origdir[]) * dvddirlength. * * The buffer parameter should re-use the initial ROM buffer. - ****************************************************************************/ + ***************************************************************************/ int LoadDVDFile (unsigned char *buffer) @@ -485,7 +490,7 @@ LoadDVDFile (unsigned char *buffer) * memcard interface. * * libOGC tends to foul up if you don't, and sometimes does if you do! - ****************************************************************************/ + ***************************************************************************/ #ifdef HW_DOL void uselessinquiry () { @@ -501,6 +506,10 @@ void uselessinquiry () while (dvd[7] & 1); } +/**************************************************************************** + * dvd_motor_off( ) + * Turns off DVD drive motor so it doesn't make noise (Gamecube only) + ***************************************************************************/ void dvd_motor_off( ) { dvd[0] = 0x2e; @@ -518,11 +527,11 @@ void dvd_motor_off( ) dvd[1] = 0; } -/** - * dvd_driveid - * - * Gets and returns the dvd driveid -**/ +/**************************************************************************** + * dvd_driveid + * + * Gets and returns the dvd driveid + ***************************************************************************/ int dvd_driveid() { @@ -546,6 +555,11 @@ int dvd_driveid() #endif +/**************************************************************************** + * SetDVDDriveType() + * + * Sets the DVD drive ID for use to determine disc size (1.5 GB or 4.7 GB) + ***************************************************************************/ void SetDVDDriveType() { #ifdef HW_RVL diff --git a/source/ngc/dvd.h b/source/ngc/dvd.h index 9dfe705..6ec2a74 100644 --- a/source/ngc/dvd.h +++ b/source/ngc/dvd.h @@ -1,11 +1,14 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube DVD + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * svpe & crunchy2 June 2007 - ****************************************************************************/ + * Tantric September 2008 + * + * dvd.h + * + * DVD I/O functions + ***************************************************************************/ #ifndef _NGCDVD_ #define _NGCDVD_ diff --git a/source/ngc/fileop.cpp b/source/ngc/fileop.cpp index 172b4e6..a0abfa8 100644 --- a/source/ngc/fileop.cpp +++ b/source/ngc/fileop.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 @@ -9,8 +7,9 @@ * * fileop.cpp * - * File operations - ****************************************************************************/ + * FAT File operations + ***************************************************************************/ + #include #include #include @@ -39,7 +38,7 @@ extern FILEENTRIES filelist[MAXFILES]; /**************************************************************************** * fat_is_mounted * to check whether FAT media are detected. - ****************************************************************************/ + ***************************************************************************/ bool FatIsMounted(PARTITION_INTERFACE partition) { char prefix[] = "fatX:/"; @@ -56,7 +55,7 @@ bool FatIsMounted(PARTITION_INTERFACE partition) { * changeFATInterface * Checks if the device (method) specified is available, and * sets libfat to use the device -****************************************************************************/ + ***************************************************************************/ bool ChangeFATInterface(int method, bool silent) { bool devFound = false; @@ -110,7 +109,7 @@ bool ChangeFATInterface(int method, bool silent) /*************************************************************************** * Browse FAT subdirectories - ***************************************************************************/ + **************************************************************************/ int ParseFATdirectory(int method) { @@ -171,7 +170,7 @@ ParseFATdirectory(int method) /**************************************************************************** * LoadFATFile - ****************************************************************************/ + ***************************************************************************/ int LoadFATFile (char *filename, int length) { @@ -225,7 +224,7 @@ LoadFATFile (char *filename, int length) /**************************************************************************** * Load savebuffer from FAT file - ****************************************************************************/ + ***************************************************************************/ int LoadBufferFromFAT (char *filepath, bool silent) { @@ -261,7 +260,7 @@ LoadBufferFromFAT (char *filepath, bool silent) /**************************************************************************** * Write savebuffer to FAT card file - ****************************************************************************/ + ***************************************************************************/ int SaveBufferToFAT (char *filepath, int datasize, bool silent) { diff --git a/source/ngc/fileop.h b/source/ngc/fileop.h index 87cfaf9..af651a7 100644 --- a/source/ngc/fileop.h +++ b/source/ngc/fileop.h @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 @@ -9,7 +7,7 @@ * * fileop.h * - * File operations + * FAT File operations ****************************************************************************/ #ifndef _FATFILESC_ diff --git a/source/ngc/filesel.cpp b/source/ngc/filesel.cpp index 2edb6dc..8b908cf 100644 --- a/source/ngc/filesel.cpp +++ b/source/ngc/filesel.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * svpe June 2007 @@ -11,7 +9,8 @@ * filesel.cpp * * Generic file routines - reading, writing, browsing - ****************************************************************************/ + ***************************************************************************/ + #include #include #include @@ -60,8 +59,9 @@ FILEENTRIES filelist[MAXFILES]; unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32); /**************************************************************************** + * ClearSaveBuffer () * Clear the savebuffer - ****************************************************************************/ + ***************************************************************************/ void ClearSaveBuffer () { @@ -118,8 +118,9 @@ int autoSaveMethod() } } -/*************************************************************************** - * Update curent directory name +/**************************************************************************** + * UpdateDirName() + * Update curent directory name for file browser ***************************************************************************/ int UpdateDirName(int method) { @@ -176,7 +177,7 @@ int UpdateDirName(int method) } } -/*************************************************************************** +/**************************************************************************** * FileSortCallback * * Quick sort callback to sort file entries with the following order: @@ -207,7 +208,7 @@ int FileSortCallback(const void *f1, const void *f2) * StripExt * * Strips an extension from a filename -****************************************************************************/ + ***************************************************************************/ void StripExt(char* returnstring, char * inputstring) { @@ -223,7 +224,7 @@ void StripExt(char* returnstring, char * inputstring) * FileSelector * * Let user select a file from the listing -****************************************************************************/ + ***************************************************************************/ int FileSelector (int method) { u32 p = 0; @@ -455,7 +456,7 @@ int FileSelector (int method) * OpenDVD * * Function to load a DVD directory and display to user. -****************************************************************************/ + ***************************************************************************/ int OpenDVD (int method) { @@ -504,7 +505,7 @@ OpenDVD (int method) * OpenSMB * * Function to load from an SMB share -****************************************************************************/ + ***************************************************************************/ int OpenSMB (int method) { @@ -533,7 +534,7 @@ OpenSMB (int method) * OpenFAT * * Function to load from FAT - ****************************************************************************/ + ***************************************************************************/ int OpenFAT (int method) { @@ -562,7 +563,7 @@ OpenFAT (int method) /**************************************************************************** * OpenROM * Opens device specified by method, displays a list of ROMS - ****************************************************************************/ + ***************************************************************************/ int OpenROM (int method) diff --git a/source/ngc/filesel.h b/source/ngc/filesel.h index 744540c..bda1a04 100644 --- a/source/ngc/filesel.h +++ b/source/ngc/filesel.h @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 diff --git a/source/ngc/freeze.cpp b/source/ngc/freeze.cpp index ad9d98a..4d6f9b5 100644 --- a/source/ngc/freeze.cpp +++ b/source/ngc/freeze.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007-July 2007 @@ -11,12 +9,10 @@ * * Snapshots Memory File System * - * This is a single global memory file controller. Don't even think of opening two - * at the same time ! - * - * There's just enough here to do SnapShots - you should add anything else you - * need. - ****************************************************************************/ + * This is a single global memory file controller. + * Don't even think of opening two at the same time! + ***************************************************************************/ + #include #include #include @@ -50,11 +46,11 @@ static int bufoffset; char freezecomment[2][32]; -/** +/**************************************************************************** * GetMem * * Return x bytes from memory buffer - */ + ***************************************************************************/ int GetMem (char *buffer, int len) { @@ -64,11 +60,11 @@ GetMem (char *buffer, int len) return len; } -/** +/**************************************************************************** * PutMem * * Put some values in memory buffer - */ + ***************************************************************************/ static void PutMem (char *buffer, int len) { @@ -85,9 +81,11 @@ NGCFreezeBlock (char *name, uint8 * block, int size) PutMem ((char *) block, size); } -/** +/**************************************************************************** * NGCFreezeMembuffer - */ + * + * Copies a snapshot of Snes9x state into memory + ***************************************************************************/ static int NGCFreezeMemBuffer () { @@ -109,7 +107,7 @@ NGCFreezeMemBuffer () sprintf (buffer, "%s:%04d\n", SNAPSHOT_MAGIC, SNAPSHOT_VERSION); PutMem (buffer, strlen (buffer)); - sprintf (buffer, "NAM:%06d:%s%c", (int) strlen (Memory.ROMFilename) + 1, + sprintf (buffer, "NAM:%06d:%s%c", (int) strlen (Memory.ROMFilename) + 1, Memory.ROMFilename, 0); PutMem (buffer, strlen (buffer) + 1); @@ -120,11 +118,11 @@ NGCFreezeMemBuffer () } -/** +/**************************************************************************** * NGCFreezeGame * * Do freeze game for Nintendo Gamecube - */ + ***************************************************************************/ int NGCFreezeGame (int method, bool8 silent) { @@ -209,9 +207,9 @@ NGCFreezeGame (int method, bool8 silent) return 0; } -/** +/**************************************************************************** * NGCUnFreezeBlock - */ + ***************************************************************************/ int NGCUnFreezeBlock (char *name, uint8 * block, int size) { @@ -246,9 +244,9 @@ NGCUnFreezeBlock (char *name, uint8 * block, int size) return SUCCESS; } -/** +/**************************************************************************** * NGCUnfreezeGame - */ + ***************************************************************************/ int NGCUnfreezeGame (int method, bool8 silent) { diff --git a/source/ngc/freeze.h b/source/ngc/freeze.h index 8188854..d10a8bd 100644 --- a/source/ngc/freeze.h +++ b/source/ngc/freeze.h @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007-July 2007 @@ -11,12 +9,9 @@ * * Snapshots Memory File System * - * This is a single global memory file controller. Don't even think of opening two - * at the same time ! - * - * There's just enough here to do SnapShots - you should add anything else you - * need. - ****************************************************************************/ + * This is a single global memory file controller. + * Don't even think of opening two at the same time! + ***************************************************************************/ #ifndef _NGCMEMFILE_ #define _NGCMEMFILE_ diff --git a/source/ngc/gctime.h b/source/ngc/gctime.h deleted file mode 100644 index 247d156..0000000 --- a/source/ngc/gctime.h +++ /dev/null @@ -1,10 +0,0 @@ -/**************************************************************************** - * gctime.h - ****************************************************************************/ - -extern "C" { - -long long gettime(); -u32 diff_usec(long long start,long long end); - -} diff --git a/source/ngc/input.cpp b/source/ngc/input.cpp index 35ab613..2fa95c8 100644 --- a/source/ngc/input.cpp +++ b/source/ngc/input.cpp @@ -1,3 +1,15 @@ +/**************************************************************************** + * Snes9x 1.51 Nintendo Wii/Gamecube Port + * + * softdev July 2006 + * crunchy2 May-June 2007 + * Tantric September 2008 + * + * input.cpp + * + * Wii/Gamecube controller management + ***************************************************************************/ + #include #include #include @@ -25,7 +37,7 @@ extern int ConfigRequested; * Controller Functions * * The following map the NGC Pads to the *NEW* controller system. - ****************************************************************************/ + ***************************************************************************/ #define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \ S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true) @@ -83,6 +95,12 @@ unsigned int gcjustmap[] = { PAD_BUTTON_A, PAD_BUTTON_B, PAD_BUTTON_START }; /*** Justifier : wiimote button mapping ***/ unsigned int wmjustmap[] = { WPAD_BUTTON_A, WPAD_BUTTON_B, WPAD_BUTTON_PLUS }; +/**************************************************************************** + * WPAD_StickX + * + * Get X value from Wii Joystick (classic, nunchuk) input + ***************************************************************************/ + s8 WPAD_StickX(u8 chan,u8 right) { float mag = 0.0; @@ -125,6 +143,12 @@ s8 WPAD_StickX(u8 chan,u8 right) return (s8)(val * 128.0f); } +/**************************************************************************** + * WPAD_StickY + * + * Get Y value from Wii Joystick (classic, nunchuk) input + ***************************************************************************/ + s8 WPAD_StickY(u8 chan, u8 right) { float mag = 0.0; @@ -171,6 +195,12 @@ s8 WPAD_StickY(u8 chan, u8 right) static int cursor_x[5] = {0,0,0,0,0}; static int cursor_y[5] = {0,0,0,0,0}; +/**************************************************************************** + * UpdateCursorPosition + * + * Updates X/Y coordinates for Superscope/mouse/justifier position + ***************************************************************************/ + void UpdateCursorPosition (int pad, int &pos_x, int &pos_y) { #define SCOPEPADCAL 20 @@ -233,8 +263,12 @@ void UpdateCursorPosition (int pad, int &pos_x, int &pos_y) } /**************************************************************************** - * This is the joypad algorithm submitted by Krullo. + * decodepad + * + * Reads the changes (buttons pressed, etc) from a controller and reports + * these changes to Snes9x ****************************************************************************/ + void decodepad (int pad) { int i, offset; @@ -424,8 +458,10 @@ void decodepad (int pad) /**************************************************************************** * NGCReportButtons + * * Called on each rendered frame - ****************************************************************************/ + * Our way of putting controller input into Snes9x + ***************************************************************************/ void NGCReportButtons () { s8 gc_px = PAD_SubStickX (0); @@ -521,10 +557,9 @@ void SetControllers () } } - /**************************************************************************** * Set the default mapping for NGC - ****************************************************************************/ + ***************************************************************************/ void SetDefaultButtonMap () { int maxcode = 0x10; diff --git a/source/ngc/input.h b/source/ngc/input.h index 63082a8..86beb8f 100644 --- a/source/ngc/input.h +++ b/source/ngc/input.h @@ -1,3 +1,14 @@ +/**************************************************************************** + * Snes9x 1.51 Nintendo Wii/Gamecube Port + * + * softdev July 2006 + * crunchy2 May-June 2007 + * Tantric September 2008 + * + * input.h + * + * Wii/Gamecube controller management + ***************************************************************************/ #ifndef _INPUT_H_ #define _INPUT_H_ @@ -18,8 +29,6 @@ extern unsigned int wmmousemap[]; extern unsigned int gcjustmap[]; extern unsigned int wmjustmap[]; -//START_EXTERN_C - s8 WPAD_StickX(u8 chan,u8 right); s8 WPAD_StickY(u8 chan, u8 right); @@ -29,6 +38,4 @@ void NGCReportButtons (); void SetControllers (); void SetDefaultButtonMap (); -//END_EXTERN_C - #endif diff --git a/source/ngc/memcardop.cpp b/source/ngc/memcardop.cpp index ba0436a..167e3d9 100644 --- a/source/ngc/memcardop.cpp +++ b/source/ngc/memcardop.cpp @@ -1,14 +1,15 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 * crunchy2 May-June 2007 + * Tantric September 2008 * * memcardop.cpp * - * Memory Card Routines. - ****************************************************************************/ + * Memory Card routines + ***************************************************************************/ + #include #include #include @@ -52,7 +53,7 @@ card_stat CardStatus; * * Wrapper to search through the files on the card. * Returns TRUE if found. - ****************************************************************************/ + ***************************************************************************/ int CardFileExists (char *filename, int slot) { @@ -74,7 +75,7 @@ CardFileExists (char *filename, int slot) * TestCard * * Checks to see if a card is in the card slot specified - ****************************************************************************/ + ***************************************************************************/ bool TestCard(int slot, bool silent) { // Memory Cards do not work in Wii mode - disable @@ -119,7 +120,7 @@ bool TestCard(int slot, bool silent) * * Mounts the memory card in the given slot. * Returns the result of the last attempted CARD_Mount command. - ****************************************************************************/ + ***************************************************************************/ int MountCard(int cslot, bool silent) { int ret = -1; @@ -139,7 +140,7 @@ int MountCard(int cslot, bool silent) /**************************************************************************** * Verify Memory Card file against buffer - ****************************************************************************/ + ***************************************************************************/ int VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize) { @@ -217,10 +218,9 @@ VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize) return 0; } - /**************************************************************************** * Load savebuffer from Memory Card file - ****************************************************************************/ + ***************************************************************************/ int LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent) { @@ -285,7 +285,7 @@ LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent) /**************************************************************************** * Write savebuffer to Memory Card file - ****************************************************************************/ + ***************************************************************************/ int SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent) { @@ -325,31 +325,6 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool return 0; } -// if ( (s32)blocks < CardFile.len ) /*** new data is shorter ***/ -// { -// CARD_Close (&CardFile); -// -// /*** Delete the existing longer file ***/ -// CardError = CARD_Delete(slot, filename); -// if (CardError) -// { -// CARD_Unmount (slot); -// WaitPrompt((char*) "Unable to delete existing file!"); -// return 0; -// } -// -// /*** Create new, shorter file ***/ -// CardError = CARD_Create (slot, filename, blocks, &CardFile); -// if (CardError) -// { -// CARD_Unmount (slot); -// WaitPrompt((char*) "Unable to create updated card file!"); -// return 0; -// } -// -// } -// else - if ( (s32)blocks > CardFile.len ) /*** new data is longer ***/ { CARD_Close (&CardFile); @@ -457,5 +432,3 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool return 0; } - - diff --git a/source/ngc/memcardop.h b/source/ngc/memcardop.h index 86119ff..9ff1112 100644 --- a/source/ngc/memcardop.h +++ b/source/ngc/memcardop.h @@ -1,14 +1,14 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 - * crunchy2 May 2007 + * crunchy2 May-June 2007 + * Tantric September 2008 * - * memcardop.h + * memcardop.cpp * - * Memory Card Routines. - ****************************************************************************/ + * Memory Card routines + ***************************************************************************/ #ifndef _NGCMCSAVE_ #define _NGCMCSAVE_ diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 52f4a27..43f980d 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.51 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May-June 2007 @@ -9,8 +7,9 @@ * * menu.cpp * - * Menu flow routines - ****************************************************************************/ + * Menu flow routines - handles all menu logic + ***************************************************************************/ + #include #include #include @@ -19,12 +18,10 @@ #include #ifdef WII_DVD -#ifdef __cplusplus extern "C" { #include } #endif -#endif #include "snes9x.h" #include "memmap.h" @@ -69,7 +66,7 @@ extern unsigned long ARAM_ROMSIZE; /**************************************************************************** * Reboot / Exit - ****************************************************************************/ + ***************************************************************************/ #ifndef HW_RVL #define PSOSDLOADID 0x7c6000a6 @@ -89,7 +86,7 @@ void Reboot() /**************************************************************************** * Load Manager - ****************************************************************************/ + ***************************************************************************/ int LoadManager () @@ -115,7 +112,7 @@ LoadManager () /**************************************************************************** * Preferences Menu - ****************************************************************************/ + ***************************************************************************/ static int prefmenuCount = 16; static char prefmenu[][50] = { @@ -334,7 +331,7 @@ PreferencesMenu () /**************************************************************************** * Cheat Menu - ****************************************************************************/ + ***************************************************************************/ static int cheatmenuCount = 0; static char cheatmenu[MAX_CHEATS][50]; static char cheatmenuvalue[MAX_CHEATS][50]; @@ -512,7 +509,7 @@ void CheatMenu() /**************************************************************************** * Game Options Menu - ****************************************************************************/ + ***************************************************************************/ int GameMenu () @@ -610,10 +607,10 @@ GameMenu () /**************************************************************************** * Controller Configuration * - * Snes9x 1.50 uses a cmd system to work out which button has been pressed. - * Here, I simply move the designated value to the gcpadmaps array, which saves - * on updating the cmd sequences. - ****************************************************************************/ + * Snes9x 1.51 uses a cmd system to work out which button has been pressed. + * Here, I simply move the designated value to the gcpadmaps array, which + * saves on updating the cmd sequences. + ***************************************************************************/ u32 GetInput (u16 ctrlr_type) { @@ -936,7 +933,7 @@ ConfigureControllers () /**************************************************************************** * Main Menu - ****************************************************************************/ + ***************************************************************************/ int menucount = 7; char menuitems[][50] = { "Choose Game", "Controller Configuration", "Preferences", diff --git a/source/ngc/menu.h b/source/ngc/menu.h index 17b5fc5..c7a02c2 100644 --- a/source/ngc/menu.h +++ b/source/ngc/menu.h @@ -1,10 +1,14 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * crunchy2 May-June 2007 + * Tantric August 2008 + * + * menu.h + * + * Menu flow routines - handles all menu logic + ***************************************************************************/ #ifndef _NGCMENU_ diff --git a/source/ngc/menudraw.cpp b/source/ngc/menudraw.cpp index 4fefc86..f5d333a 100644 --- a/source/ngc/menudraw.cpp +++ b/source/ngc/menudraw.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 June 2007 @@ -17,7 +15,8 @@ * **WARNING*** * * ONLY USE GUARANTEED PATENT FREE FONTS. - ****************************************************************************/ + ***************************************************************************/ + #include #include #include @@ -65,7 +64,7 @@ u32 getrgb( u32 ycbr, u32 low ); /**************************************************************************** * Initialisation of libfreetype - ****************************************************************************/ + ***************************************************************************/ int FT_Init () { @@ -94,7 +93,7 @@ FT_Init () * setfontsize * * Set the screen font size in pixels - ****************************************************************************/ + ***************************************************************************/ void setfontsize (int pixelsize) { @@ -107,9 +106,9 @@ setfontsize (int pixelsize) } /**************************************************************************** -* DrawCharacter -* Draws a single character on the screen - ****************************************************************************/ + * DrawCharacter + * Draws a single character on the screen + ***************************************************************************/ static void DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y) { @@ -151,7 +150,7 @@ DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y) * DrawText * * Place the font bitmap on the screen - ****************************************************************************/ + ***************************************************************************/ void DrawText (int x, int y, char *text) { @@ -207,7 +206,7 @@ DrawText (int x, int y, char *text) * setfontcolour * * Uses RGB triple values. - ****************************************************************************/ + ***************************************************************************/ void setfontcolour (u8 r, u8 g, u8 b) { @@ -222,7 +221,7 @@ setfontcolour (u8 r, u8 g, u8 b) * Display credits, legal copyright and licence * * THIS MUST NOT BE REMOVED IN ANY DERIVATIVE WORK. - ****************************************************************************/ + ***************************************************************************/ void Credits () { @@ -280,7 +279,7 @@ Credits () * Simply converts RGB to Y1CbY2Cr format * * I got this from a pastebin, so thanks to whoever originally wrote it! - ****************************************************************************/ + ***************************************************************************/ unsigned int getcolour (u8 r1, u8 g1, u8 b1) @@ -308,7 +307,9 @@ getcolour (u8 r1, u8 g1, u8 b1) /**************************************************************************** * Unpackbackdrop - ****************************************************************************/ + * + * Decompress menu background and store it in ARAM or memory + ***************************************************************************/ void unpackbackdrop () { @@ -346,7 +347,7 @@ unpackbackdrop () /**************************************************************************** * Wait for user to press A - ****************************************************************************/ + ***************************************************************************/ void WaitButtonA () { @@ -361,7 +362,7 @@ WaitButtonA () /**************************************************************************** * Wait for user to press A or B. Returns 0 = B; 1 = A - ****************************************************************************/ + ***************************************************************************/ int WaitButtonAB () @@ -400,7 +401,7 @@ WaitButtonAB () /**************************************************************************** * Show a prompt - ****************************************************************************/ + ***************************************************************************/ void WaitPrompt (char *msg) { @@ -422,7 +423,7 @@ WaitPrompt (char *msg) /**************************************************************************** * Show a prompt with choice of two options. Returns 1 if A button was pressed and 0 if B button was pressed. - ****************************************************************************/ + ***************************************************************************/ int WaitPromptChoice (char *msg, char *bmsg, char *amsg) { @@ -445,7 +446,7 @@ WaitPromptChoice (char *msg, char *bmsg, char *amsg) /**************************************************************************** * Show an action in progress - ****************************************************************************/ + ***************************************************************************/ void ShowAction (char *msg) { @@ -463,7 +464,7 @@ ShowAction (char *msg) /**************************************************************************** * Generic Menu Routines - ****************************************************************************/ + ***************************************************************************/ void DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsize, int x) { @@ -530,7 +531,7 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz * * Help function to find the next visible menu item on the list * Supports menu wrap-around - ****************************************************************************/ + ***************************************************************************/ int FindMenuItem(char items[][50], int maxitems, int currentItem, int direction) { @@ -552,7 +553,7 @@ int FindMenuItem(char items[][50], int maxitems, int currentItem, int direction) * * Call this with the menu array defined in menu.cpp * It's here to keep all the font / interface stuff together. - ****************************************************************************/ + ***************************************************************************/ int menu = 0; int @@ -631,7 +632,7 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x) * Showfile screen * * Display the file selection to the user -****************************************************************************/ + ***************************************************************************/ void ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection) @@ -693,7 +694,7 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection) * Cheats screen * * Displays a scrollable list of cheats to the user -****************************************************************************/ + ***************************************************************************/ void ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection) @@ -740,7 +741,7 @@ ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, i /**************************************************************************** * ROM Information Screen - ****************************************************************************/ + ***************************************************************************/ void RomInfo() { @@ -827,7 +828,7 @@ void RomInfo() * DrawLine * * Quick'n'Dirty Bresenham line drawing routine. - ****************************************************************************/ + ***************************************************************************/ #define SIGN(x) ((x<0)?-1:((x>0)?1:0)) void @@ -912,7 +913,7 @@ DrawLine (int x1, int y1, int x2, int y2, u8 r, u8 g, u8 b) * Progress Bar * * Show the user what's happening - ****************************************************************************/ + ***************************************************************************/ void ShowProgress (char *msg, int done, int total) { @@ -944,7 +945,7 @@ ShowProgress (char *msg, int done, int total) /**************************************************************************** * DrawPolygon - ****************************************************************************/ + ***************************************************************************/ void DrawPolygon (int vertices, int varray[], u8 r, u8 g, u8 b) { @@ -960,12 +961,12 @@ DrawPolygon (int vertices, int varray[], u8 r, u8 g, u8 b) varray[(vertices << 1) - 1], r, g, b); } -/***************************************************************************** +/**************************************************************************** * Draw Line Fast * * This routine requires that start and endx are 32bit aligned. * It tries to perform a semi-transparency over the existing image. - *****************************************************************************/ + ***************************************************************************/ #define SRCWEIGHT 0.7f #define DSTWEIGHT (1.0f - SRCWEIGHT) @@ -1017,10 +1018,10 @@ void DrawLineFast( int startx, int endx, int y, u8 r, u8 g, u8 b ) } } -/***************************************************************************** +/**************************************************************************** * Ok, I'm useless with Y1CBY2CR colour. * So convert back to RGB so I can work with it -;) - ****************************************************************************/ + ***************************************************************************/ u32 getrgb( u32 ycbr, u32 low ) { u8 r,g,b; diff --git a/source/ngc/menudraw.h b/source/ngc/menudraw.h index a80f866..81621f9 100644 --- a/source/ngc/menudraw.h +++ b/source/ngc/menudraw.h @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 June 2007 @@ -17,7 +15,7 @@ * **WARNING*** * * ONLY USE GUARANTEED PATENT FREE FONTS. - ****************************************************************************/ + ***************************************************************************/ #ifndef _NGCMENUDRAW_ #define _NGCMENUDRAW_ diff --git a/source/ngc/ngc-missing.cpp b/source/ngc/ngc-missing.cpp deleted file mode 100644 index d387d34..0000000 --- a/source/ngc/ngc-missing.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Port - * softdev July 2006 - * - * ngc_missing.cpp - * - * This file contains the missing low-level file I/O function definitions. - * Note that these are DUMMY functions, and only allow Snes9x to - * compile. Where possible, they will return an error signal. - ****************************************************************************/ - -/**************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com), - Nach (n-a-c-h@users.sourceforge.net), and - zones (kasumitokoduck@yahoo.com) - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com) - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley, - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman - - S-RTC C emulator code - (c) Copyright 2001-2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight, - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound DSP emulator code is derived from SNEeSe and OpenSPC: - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x filter - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*****************************************************************************/ - -#include -#include -#include -#include - -/*** splitpath function ***/ -void -_splitpath (char const *buffer, char *drive, char *dir, char *fname, - char *ext) -{ - return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/ -} - -void -_makepath (char *filename, const char *drive, const char *dir, - const char *fname, const char *ext) -{ - return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/ -} - -char * -S9xBasename (char *name) -{ - return name; -} diff --git a/source/ngc/preferences.cpp b/source/ngc/preferences.cpp index e26e44d..680c8a6 100644 --- a/source/ngc/preferences.cpp +++ b/source/ngc/preferences.cpp @@ -1,13 +1,13 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port - * crunchy2 April 2007-July 2007 + * Tantric September 2008 * * preferences.cpp * - * Preferences save/load preferences utilities - ****************************************************************************/ + * Preferences save/load to XML file + ***************************************************************************/ + #include #include #include @@ -43,7 +43,7 @@ char prefscomment[2][32]; * Prepare Preferences Data * * This sets up the save buffer for saving. - ****************************************************************************/ + ***************************************************************************/ mxml_node_t *xml; mxml_node_t *data; mxml_node_t *section; @@ -191,8 +191,11 @@ preparePrefsData (int method) /**************************************************************************** - * Decode Preferences Data - ****************************************************************************/ + * loadXMLSetting + * + * Load XML elements into variables for an individual variable + ***************************************************************************/ + void loadXMLSetting(char * var, const char * name) { item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND); @@ -212,6 +215,12 @@ void loadXMLSetting(bool8 * var, const char * name) *var = atoi(mxmlElementGetAttr(item, "value")); } +/**************************************************************************** + * loadXMLController + * + * Load XML elements into variables for a controller mapping + ***************************************************************************/ + void loadXMLController(unsigned int controller[], const char * name) { item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND); @@ -228,6 +237,12 @@ void loadXMLController(unsigned int controller[], const char * name) } } +/**************************************************************************** + * decodePrefsData + * + * Decodes preferences - parses XML and loads preferences into the variables + ***************************************************************************/ + bool decodePrefsData (int method) { @@ -297,7 +312,7 @@ decodePrefsData (int method) /**************************************************************************** * Save Preferences - ****************************************************************************/ + ***************************************************************************/ bool SavePrefs (int method, bool silent) { @@ -346,7 +361,7 @@ SavePrefs (int method, bool silent) /**************************************************************************** * Load Preferences from specified method - ****************************************************************************/ + ***************************************************************************/ bool LoadPrefsFromMethod (int method) { @@ -385,7 +400,7 @@ LoadPrefsFromMethod (int method) /**************************************************************************** * Load Preferences * Checks sources consecutively until we find a preference file - ****************************************************************************/ + ***************************************************************************/ bool LoadPrefs() { ShowAction ((char*) "Loading preferences..."); diff --git a/source/ngc/preferences.h b/source/ngc/preferences.h index f00b4a5..ff83c32 100644 --- a/source/ngc/preferences.h +++ b/source/ngc/preferences.h @@ -1,13 +1,12 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port - * crunchy2 April 2007 + * Tantric September 2008 * - * preferences.cpp + * preferences.h * - * Preferences save/load preferences utilities - ****************************************************************************/ + * Preferences save/load to XML file + ***************************************************************************/ bool SavePrefs (int method, bool silent); bool LoadPrefs (); diff --git a/source/ngc/s9xconfig.cpp b/source/ngc/s9xconfig.cpp index 0520607..1c6c27e 100644 --- a/source/ngc/s9xconfig.cpp +++ b/source/ngc/s9xconfig.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.51 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 @@ -12,7 +10,7 @@ * Configuration parameters are here for easy maintenance. * Refer to Snes9x.h for all combinations. * The defaults used here are taken directly from porting.html - ****************************************************************************/ + ***************************************************************************/ #include #include "snes9x.h" diff --git a/source/ngc/s9xconfig.h b/source/ngc/s9xconfig.h index 0d3b929..3f10c31 100644 --- a/source/ngc/s9xconfig.h +++ b/source/ngc/s9xconfig.h @@ -1,15 +1,16 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 + * crunchy2 May 2007 + * Tantric September 2008 * * s9xconfig.h * - * Configuration parameters have been moved here for easier maintenance. + * Configuration parameters are here for easy maintenance. * Refer to Snes9x.h for all combinations. * The defaults used here are taken directly from porting.html - ****************************************************************************/ + ***************************************************************************/ #ifndef _S9XCONFIG_ diff --git a/source/ngc/s9xsupport.cpp b/source/ngc/s9xsupport.cpp index 02b5a68..5097afa 100644 --- a/source/ngc/s9xsupport.cpp +++ b/source/ngc/s9xsupport.cpp @@ -1,158 +1,16 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 * crunchy2 May 2007 + * Tantric September 2008 * * s9xsupport.cpp * * This file contains the supporting functions defined in porting.html, with * others taken from unix/x11.cpp and unix/unix.cpp - ****************************************************************************/ + ***************************************************************************/ -/**************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com), - Nach (n-a-c-h@users.sourceforge.net), and - zones (kasumitokoduck@yahoo.com) - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com) - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley, - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman - - S-RTC C emulator code - (c) Copyright 2001-2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight, - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound DSP emulator code is derived from SNEeSe and OpenSPC: - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x filter - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*****************************************************************************/ #include #include #include @@ -173,7 +31,6 @@ #include "spc7110.h" #include "controls.h" -#include "gctime.h" #include "snes9xGX.h" #include "video.h" #include "audio.h" @@ -183,6 +40,12 @@ extern u32 FrameTimer; long long prev; long long now; +extern "C" { + +long long gettime(); +u32 diff_usec(long long start,long long end); + +} /*** Miscellaneous Functions ***/ void @@ -259,7 +122,7 @@ S9xToggleSoundChannel (int c) * OpenSoundDevice * * Main initialisation for NGC sound system - ****************************************************************************/ + ***************************************************************************/ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size) { @@ -431,3 +294,29 @@ S9xLoadSDD1Data () return; } + +/**************************************************************************** + * Note that these are DUMMY functions, and only allow Snes9x to + * compile. Where possible, they will return an error signal. + ***************************************************************************/ + +/*** splitpath function ***/ +void +_splitpath (char const *buffer, char *drive, char *dir, char *fname, + char *ext) +{ + return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/ +} + +void +_makepath (char *filename, const char *drive, const char *dir, + const char *fname, const char *ext) +{ + return; /*** Do nothing - NGC code should NEVER call a function which relies on it ***/ +} + +char * +S9xBasename (char *name) +{ + return name; +} diff --git a/source/ngc/smbop.cpp b/source/ngc/smbop.cpp index a348e35..d3876ac 100644 --- a/source/ngc/smbop.cpp +++ b/source/ngc/smbop.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 @@ -11,6 +9,7 @@ * * SMB support routines ****************************************************************************/ + #include #include #include diff --git a/source/ngc/smbop.h b/source/ngc/smbop.h index 1989252..7f66035 100644 --- a/source/ngc/smbop.h +++ b/source/ngc/smbop.h @@ -1,12 +1,11 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Wii/Gamecube Port * softdev July 2006 * crunchy2 May 2007 * Tantric August 2008 * - * smbop.h + * smbload.h * * SMB support routines ****************************************************************************/ diff --git a/source/ngc/snes9xGX.cpp b/source/ngc/snes9xGX.cpp index 873ca5e..67a0ce0 100644 --- a/source/ngc/snes9xGX.cpp +++ b/source/ngc/snes9xGX.cpp @@ -1,157 +1,15 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 * crunchy2 May 2007-July 2007 + * Tantric September 2008 * * snes9xGX.cpp * * This file controls overall program flow. Most things start and end here! - ****************************************************************************/ + ***************************************************************************/ -/**************************************************************************** - Snes9x - Portable Super Nintendo Entertainment System (TM) emulator. - - (c) Copyright 1996 - 2002 Gary Henderson (gary.henderson@ntlworld.com) and - Jerremy Koot (jkoot@snes9x.com) - - (c) Copyright 2002 - 2004 Matthew Kendora - - (c) Copyright 2002 - 2005 Peter Bortas (peter@bortas.org) - - (c) Copyright 2004 - 2005 Joel Yliluoma (http://iki.fi/bisqwit/) - - (c) Copyright 2001 - 2006 John Weidman (jweidman@slip.net) - - (c) Copyright 2002 - 2006 Brad Jorsch (anomie@users.sourceforge.net), - funkyass (funkyass@spam.shaw.ca), - Kris Bleakley (codeviolation@hotmail.com), - Nach (n-a-c-h@users.sourceforge.net), and - zones (kasumitokoduck@yahoo.com) - - BS-X C emulator code - (c) Copyright 2005 - 2006 Dreamer Nom, - zones - - C4 x86 assembler and some C emulation code - (c) Copyright 2000 - 2003 _Demo_ (_demo_@zsnes.com), - Nach, - zsKnight (zsknight@zsnes.com) - - C4 C++ code - (c) Copyright 2003 - 2006 Brad Jorsch, - Nach - - DSP-1 emulator code - (c) Copyright 1998 - 2006 _Demo_, - Andreas Naive (andreasnaive@gmail.com) - Gary Henderson, - Ivar (ivar@snes9x.com), - John Weidman, - Kris Bleakley, - Matthew Kendora, - Nach, - neviksti (neviksti@hotmail.com) - - DSP-2 emulator code - (c) Copyright 2003 John Weidman, - Kris Bleakley, - Lord Nightmare (lord_nightmare@users.sourceforge.net), - Matthew Kendora, - neviksti - - - DSP-3 emulator code - (c) Copyright 2003 - 2006 John Weidman, - Kris Bleakley, - Lancer, - z80 gaiden - - DSP-4 emulator code - (c) Copyright 2004 - 2006 Dreamer Nom, - John Weidman, - Kris Bleakley, - Nach, - z80 gaiden - - OBC1 emulator code - (c) Copyright 2001 - 2004 zsKnight, - pagefault (pagefault@zsnes.com), - Kris Bleakley, - Ported from x86 assembler to C by sanmaiwashi - - SPC7110 and RTC C++ emulator code - (c) Copyright 2002 Matthew Kendora with research by - zsKnight, - John Weidman, - Dark Force - - S-DD1 C emulator code - (c) Copyright 2003 Brad Jorsch with research by - Andreas Naive, - John Weidman - - S-RTC C emulator code - (c) Copyright 2001-2006 byuu, - John Weidman - - ST010 C++ emulator code - (c) Copyright 2003 Feather, - John Weidman, - Kris Bleakley, - Matthew Kendora - - Super FX x86 assembler emulator code - (c) Copyright 1998 - 2003 _Demo_, - pagefault, - zsKnight, - - Super FX C emulator code - (c) Copyright 1997 - 1999 Ivar, - Gary Henderson, - John Weidman - - Sound DSP emulator code is derived from SNEeSe and OpenSPC: - (c) Copyright 1998 - 2003 Brad Martin - (c) Copyright 1998 - 2006 Charles Bilyue' - - SH assembler code partly based on x86 assembler code - (c) Copyright 2002 - 2004 Marcus Comstedt (marcus@mc.pp.se) - - 2xSaI filter - (c) Copyright 1999 - 2001 Derek Liauw Kie Fa - - HQ2x filter - (c) Copyright 2003 Maxim Stepin (maxim@hiend3d.com) - - Specific ports contains the works of other authors. See headers in - individual files. - - Snes9x homepage: http://www.snes9x.com - - Permission to use, copy, modify and/or distribute Snes9x in both binary - and source form, for non-commercial purposes, is hereby granted without - fee, providing that this license information and copyright notice appear - with all copies and any derived work. - - This software is provided 'as-is', without any express or implied - warranty. In no event shall the authors be held liable for any damages - arising from the use of this software or it's derivatives. - - Snes9x is freeware for PERSONAL USE only. Commercial users should - seek permission of the copyright holders first. Commercial use includes, - but is not limited to, charging money for Snes9x or software derived from - Snes9x, including Snes9x or derivatives in commercial game bundles, and/or - using Snes9x as a promotion for your commercial product. - - The copyright holders request that bug fixes and improvements to the code - should be forwarded to them so everyone can benefit from the modifications - in future versions. - - Super NES and Super Nintendo Entertainment System are trademarks of - Nintendo Co., Limited and its subsidiary companies. -*****************************************************************************/ #include #include #include @@ -166,12 +24,10 @@ #include #ifdef WII_DVD -#ifdef __cplusplus extern "C" { #include } #endif -#endif #include "snes9x.h" #include "memmap.h" @@ -197,7 +53,6 @@ extern "C" { #include "sram.h" #include "freeze.h" #include "preferences.h" -#include "gctime.h" #include "button_mapping.h" #include "fileop.h" #include "input.h" @@ -217,7 +72,7 @@ extern void fat_enable_readahead_all(); /**************************************************************************** * setFrameTimerMethod() * change frametimer method depending on whether ROM is NTSC or PAL - ****************************************************************************/ + ***************************************************************************/ extern u8 vmode_60hz; int timerstyle; @@ -245,13 +100,9 @@ void setFrameTimerMethod() /**************************************************************************** * Emulation loop - * - * The 'clock' timer is long gone. - * System now only uses vbl as hardware clock, so force PAL50 if you need 50hz - ****************************************************************************/ -/* Eke-Eke: initialize frame Sync */ + ***************************************************************************/ extern void S9xInitSync(); -bool CheckVideo = 0; // for forcing video reset in video.cpp +bool CheckVideo = 0; // for forcing video reset in video.cpp extern uint32 prevRenderedFrameCount; void @@ -259,9 +110,9 @@ emulate () { S9xSetSoundMute (TRUE); AudioStart (); - S9xInitSync(); + S9xInitSync(); // Eke-Eke: initialize frame Sync - setFrameTimerMethod(); // set frametimer method every time a ROM is loaded + setFrameTimerMethod(); // set frametimer method every time a ROM is loaded while (1) { @@ -336,12 +187,12 @@ emulate () * 8. Initialise Snes9x Graphics subsystem * 9. Let's Party! * - * NB: The SNES ROM is now delivered from ARAM. (AR_SNESROM) - * Any method of loading a ROM, RAM, DVD, SMB, SDCard, - * MUST place the unpacked ROM at this location. - * This provides a single consistent interface in memmap.cpp. - * Refer to that file if you need to change it. - ****************************************************************************/ + * The SNES ROM is delivered from ARAM. (AR_SNESROM) + * Any method of loading a ROM - RAM, DVD, SMB, SDCard, etc + * MUST place the unpacked ROM at this location. + * This provides a single consistent interface in memmap.cpp. + * Refer to that file if you need to change it. + ***************************************************************************/ int main () { @@ -424,20 +275,17 @@ main () } else { - /*** Load ROM ***/ + // Load ROM save_flags = CPU.Flags; if (!Memory.LoadROM ("VIRTUAL.ROM")) while (1); CPU.Flags = save_flags; - - /*** Load SRAM ***/ - //Memory.LoadSRAM ("DVD"); } - /*** Emulate ***/ + // Emulate emulate (); - /*** NO! - We're never leaving here ! ***/ + // NO! - We're never leaving here! while (1); return 0; } diff --git a/source/ngc/snes9xGX.h b/source/ngc/snes9xGX.h index 108def5..1229cec 100644 --- a/source/ngc/snes9xGX.h +++ b/source/ngc/snes9xGX.h @@ -1,14 +1,14 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port * softdev July 2006 * crunchy2 May 2007-July 2007 + * Tantric September 2008 * * snes9xGX.h * * This file controls overall program flow. Most things start and end here! - ****************************************************************************/ + ***************************************************************************/ #ifndef _SNES9XGX_H_ #define _SNES9XGX_H_ diff --git a/source/ngc/sram.cpp b/source/ngc/sram.cpp index db6a9b5..26ede20 100644 --- a/source/ngc/sram.cpp +++ b/source/ngc/sram.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * crunchy2 April 2007-July 2007 * Tantric September 2008 @@ -9,7 +7,8 @@ * sram.cpp * * SRAM save/load/import/export handling - ****************************************************************************/ + ***************************************************************************/ + #include #include #include @@ -36,9 +35,9 @@ char sramcomment[2][32]; /**************************************************************************** * Prepare SRAM Save Data * - * This sets up the save buffer for saving in a format compatible with - * snes9x on other platforms. This is used when saving to SD / USB / SMB. - ****************************************************************************/ + * This sets up the savebuffer for saving in a format compatible with + * snes9x on other platforms. + ***************************************************************************/ int preparesavedata (int method) { @@ -91,7 +90,7 @@ preparesavedata (int method) /**************************************************************************** * Decode Save Data - ****************************************************************************/ + ***************************************************************************/ void decodesavedata (int method, int readsize) { @@ -143,7 +142,7 @@ decodesavedata (int method, int readsize) /**************************************************************************** * Load SRAM - ****************************************************************************/ + ***************************************************************************/ int LoadSRAM (int method, bool silent) { @@ -192,7 +191,7 @@ LoadSRAM (int method, bool silent) /**************************************************************************** * Save SRAM - ****************************************************************************/ + ***************************************************************************/ bool SaveSRAM (int method, bool silent) { diff --git a/source/ngc/sram.h b/source/ngc/sram.h index 83431a6..3e86ef3 100644 --- a/source/ngc/sram.h +++ b/source/ngc/sram.h @@ -1,13 +1,13 @@ /**************************************************************************** - * Snes9x 1.50 + * Snes9x 1.51 Nintendo Wii/Gamecube Port * - * Nintendo Gamecube Port - * crunchy2 April 2007 + * crunchy2 April 2007-July 2007 + * Tantric September 2008 * * sram.cpp * * SRAM save/load/import/export handling - ****************************************************************************/ + ***************************************************************************/ bool SaveSRAM (int method, bool silent); int LoadSRAM (int method, bool silent); diff --git a/source/ngc/unzip.cpp b/source/ngc/unzip.cpp index f7b3ec0..cf6c6b6 100644 --- a/source/ngc/unzip.cpp +++ b/source/ngc/unzip.cpp @@ -1,10 +1,14 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Unzip - borrowed from the GPP + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 - ****************************************************************************/ + * Tantric September 2008 + * + * unzip.cpp + * + * File unzip routines + ***************************************************************************/ + #include #include #include diff --git a/source/ngc/unzip.h b/source/ngc/unzip.h index ec50533..ade862c 100644 --- a/source/ngc/unzip.h +++ b/source/ngc/unzip.h @@ -1,9 +1,12 @@ /**************************************************************************** - * Snes9x 1.50 - * - * Nintendo Gamecube Unzip - borrowed from the GPP + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 + * Tantric September 2008 + * + * unzip.h + * + * File unzip routines ****************************************************************************/ #ifndef _UNZIP_ #define _UNZIP_ diff --git a/source/ngc/video.cpp b/source/ngc/video.cpp index 2af8f1d..8805686 100644 --- a/source/ngc/video.cpp +++ b/source/ngc/video.cpp @@ -1,7 +1,5 @@ /**************************************************************************** - * Snes9x 1.51 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * crunchy2 May 2007 @@ -9,7 +7,8 @@ * video.cpp * * Video routines - ****************************************************************************/ + ***************************************************************************/ + #include #include #include @@ -248,7 +247,7 @@ GXRModeObj *tvmodes[4] = { #ifdef VIDEO_THREADING /**************************************************************************** * VideoThreading - ****************************************************************************/ + ***************************************************************************/ #define TSTACK 16384 lwpq_t videoblankqueue; lwp_t vbthread; @@ -261,7 +260,7 @@ static unsigned char vbstack[TSTACK]; * vertical blank. * * Putting LWP to good use :) - ****************************************************************************/ + ***************************************************************************/ static void * vbgetback (void *arg) { @@ -280,7 +279,7 @@ vbgetback (void *arg) * * libOGC provides a nice wrapper for LWP access. * This function sets up a new local queue and attaches the thread to it. - ****************************************************************************/ + ***************************************************************************/ void InitVideoThread () { @@ -298,7 +297,7 @@ InitVideoThread () * * Stock code to copy the GX buffer to the current display mode. * Also increments the frameticker, as it's called for each vb. - ****************************************************************************/ + ***************************************************************************/ static void copy_to_xfb (u32 arg) { @@ -316,7 +315,7 @@ copy_to_xfb (u32 arg) /**************************************************************************** * Scaler Support Functions - ****************************************************************************/ + ***************************************************************************/ static void draw_init () { @@ -376,7 +375,7 @@ draw_square (Mtx v) * StartGX * * This function initialises the GX. - ****************************************************************************/ + ***************************************************************************/ static void StartGX () { @@ -426,7 +425,7 @@ StartGX () * UpdatePadsCB * * called by postRetraceCallback in InitGCVideo - scans gcpad and wpad - ****************************************************************************/ + ***************************************************************************/ void UpdatePadsCB () { @@ -441,7 +440,7 @@ UpdatePadsCB () * * This function MUST be called at startup. * - also sets up menu video mode - ****************************************************************************/ + ***************************************************************************/ void InitGCVideo () { @@ -535,9 +534,9 @@ InitGCVideo () } /**************************************************************************** -* ResetVideo_Emu -* -* reset the video/rendering mode for the emulator rendering + * ResetVideo_Emu + * + * Reset the video/rendering mode for the emulator rendering ****************************************************************************/ void ResetVideo_Emu () @@ -656,9 +655,9 @@ ResetVideo_Emu () } /**************************************************************************** -* ResetVideo_Menu -* -* reset the video/rendering mode for the menu + * ResetVideo_Menu + * + * Reset the video/rendering mode for the menu ****************************************************************************/ void ResetVideo_Menu () @@ -693,7 +692,7 @@ ResetVideo_Menu () * MakeTexture * * Proper GNU Asm rendition of the above, converted by shagkur. - Thanks! - ****************************************************************************/ + ***************************************************************************/ void MakeTexture (const void *src, void *dst, s32 width, s32 height) { @@ -736,7 +735,7 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height) /**************************************************************************** * Update Video - ****************************************************************************/ + ***************************************************************************/ uint32 prevRenderedFrameCount = 0; extern bool CheckVideo; @@ -840,7 +839,7 @@ update_video (int width, int height) // FIX /**************************************************************************** * Zoom Functions - ****************************************************************************/ + ***************************************************************************/ void zoom (float speed) { @@ -871,7 +870,7 @@ zoom_reset () /**************************************************************************** * Drawing screen - ****************************************************************************/ + ***************************************************************************/ void clearscreen (int colour) { @@ -899,12 +898,10 @@ showscreen () * setGFX * * Setup the global GFX information for Snes9x - ****************************************************************************/ + ***************************************************************************/ void setGFX () { GFX.Screen = (unsigned short *) snes9xgfx; GFX.Pitch = 1024; } - - diff --git a/source/ngc/video.h b/source/ngc/video.h index 63b8589..6ceb44d 100644 --- a/source/ngc/video.h +++ b/source/ngc/video.h @@ -1,14 +1,13 @@ /**************************************************************************** - * Snes9x 1.51 - * - * Nintendo Wii/Gamecube Port + * Snes9x 1.51 Nintendo Wii/Gamecube Port * * softdev July 2006 * * video.h * * Video routines - ****************************************************************************/ + ***************************************************************************/ + #ifndef _GCVIDEOH_ #define _GCVIDEOH_