add/update code comments, minor refactor

This commit is contained in:
dborth 2008-09-12 05:28:40 +00:00
parent 55795bcacf
commit 2ac740bf64
42 changed files with 472 additions and 885 deletions

View File

@ -14,7 +14,7 @@
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨' `¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
SNES9x GX is a Super Nintendo emulator for the Wii based on the PC emulator 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. 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 It was updated for the Wii by michniewski and is currently being maintained
by michniewski and Tantric. by michniewski and Tantric.
@ -25,6 +25,7 @@ michniewski
- added: Superscope/mouse/justifier support, with Wii remote - added: Superscope/mouse/justifier support, with Wii remote
Tantric 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, - added: cheats menu! Loads .CHT file from /snes9x/cheats folder,
.CHT file name must match file name of ROM .CHT file name must match file name of ROM
- added: load/save preference selector. ROM, SRAM, Freeze, and preferences - added: load/save preference selector. ROM, SRAM, Freeze, and preferences

View File

@ -1,12 +1,16 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Audio RAM
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ *
* aram.cpp
*
* Gamecube Audio RAM storage
***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <string.h> #include <string.h>
#include "aram.h" #include "aram.h"
#define ARAM_READ 1 #define ARAM_READ 1
@ -15,11 +19,11 @@
#define TEMPSIZE 32768 #define TEMPSIZE 32768
static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32); static char tempbuffer[TEMPSIZE] ATTRIBUTE_ALIGN (32);
/** /****************************************************************************
* ARAMPut * ARAMPut
* *
* Move data from MAIN memory to ARAM * Move data from MAIN memory to ARAM
*/ ***************************************************************************/
void void
ARAMPut (char *src, char *dst, int len) ARAMPut (char *src, char *dst, int len)
{ {
@ -28,11 +32,11 @@ ARAMPut (char *src, char *dst, int len)
while (AR_GetDMAStatus()); while (AR_GetDMAStatus());
} }
/** /****************************************************************************
* ARAMFetch * ARAMFetch
* *
* This function will move data from ARAM to MAIN memory * This function will move data from ARAM to MAIN memory
*/ ***************************************************************************/
void void
ARAMFetch (char *dst, char *src, int len) ARAMFetch (char *dst, char *src, int len)
{ {
@ -41,11 +45,11 @@ ARAMFetch (char *dst, char *src, int len)
while (AR_GetDMAStatus ()); while (AR_GetDMAStatus ());
} }
/** /****************************************************************************
* ARAMFetchSlow * ARAMFetchSlow
* *
* Required as SNES memory may NOT be 32-byte aligned * Required as SNES memory may NOT be 32-byte aligned
*/ ***************************************************************************/
void void
ARAMFetchSlow (char *dst, char *src, int len) ARAMFetchSlow (char *dst, char *src, int len)
{ {

View File

@ -1,10 +1,13 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Audio RAM
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ *
* aram.h
*
* Gamecube Audio RAM storage
***************************************************************************/
#ifndef _GCARAMI_ #ifndef _GCARAMI_
#define _GCARAMI_ #define _GCARAMI_

View File

@ -1,17 +1,20 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Audio
*
* Audio is fixed to 32Khz/16bit/Stereo
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ *
* audio.cpp
*
* Audio driver
* Audio is fixed to 32Khz/16bit/Stereo
***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
#include "debug.h" #include "debug.h"
@ -40,65 +43,65 @@ lwpq_t audioqueue;
lwp_t athread; lwp_t athread;
static uint8 astack[AUDIOSTACK]; static uint8 astack[AUDIOSTACK];
/** /****************************************************************************
* Audio Threading * Audio Threading
*/ ***************************************************************************/
static void * static void *
AudioThread (void *arg) AudioThread (void *arg)
{ {
LWP_InitQueue (&audioqueue); LWP_InitQueue (&audioqueue);
while (1) while (1)
{
whichab ^= 1;
if (ConfigRequested)
memset (soundbuffer[whichab], 0, AUDIOBUFFER);
else
{ {
so.samples_mixed_so_far = so.play_position = 0; whichab ^= 1;
S9xMixSamples (soundbuffer[whichab], AUDIOBUFFER >> 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 * MixSamples
* This continually calls S9xMixSamples On each DMA Completion * This continually calls S9xMixSamples On each DMA Completion
*/ ***************************************************************************/
static void static void
GCMixSamples () GCMixSamples ()
{ {
AUDIO_StopDMA (); AUDIO_StopDMA ();
DCFlushRange (soundbuffer[whichab], AUDIOBUFFER); DCFlushRange (soundbuffer[whichab], AUDIOBUFFER);
AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER); AUDIO_InitDMA ((u32) soundbuffer[whichab], AUDIOBUFFER);
AUDIO_StartDMA (); AUDIO_StartDMA ();
LWP_ThreadSignal (audioqueue); LWP_ThreadSignal (audioqueue);
} }
/** /****************************************************************************
* InitGCAudio * InitGCAudio
*/ ***************************************************************************/
void void
InitGCAudio () InitGCAudio ()
{ {
AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ); AUDIO_SetDSPSampleRate (AI_SAMPLERATE_32KHZ);
AUDIO_RegisterDMACallback (GCMixSamples); AUDIO_RegisterDMACallback (GCMixSamples);
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80); LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 80);
} }
/** /****************************************************************************
* AudioStart * AudioStart
* *
* Called to kick off the Audio Queue * Called to kick off the Audio Queue
*/ ***************************************************************************/
void void
AudioStart () AudioStart ()
{ {
GCMixSamples (); GCMixSamples ();
} }

View File

@ -1,12 +1,13 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Audio
*
* Audio is fixed to 32Khz/16bit/Stereo
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ *
* audio.h
*
* Audio driver
* Audio is fixed to 32Khz/16bit/Stereo
***************************************************************************/
void InitGCAudio (); void InitGCAudio ();
void AudioStart (); void AudioStart ();

View File

@ -1,29 +1,28 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Wii/Gamecube Port
* michniewski August 2008 * michniewski August 2008
* *
* button_mapping.c * button_mapping.c
* *
* Controller button mapping * Controller button mapping
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <unistd.h> #include <unistd.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "button_mapping.h" #include "button_mapping.h"
/*** /****************************************************************************
* Controller Button Descriptions: * Controller Button Descriptions:
* used for identifying which buttons have been pressed when configuring * used for identifying which buttons have been pressed when configuring
* and for displaying the name of said button * and for displaying the name of said button
***/ ***************************************************************************/
CtrlrMap ctrlr_def[4] = { CtrlrMap ctrlr_def[4] = {
// Nunchuk btn def // Nunchuk btn def

View File

@ -1,13 +1,12 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Wii/Gamecube Port
* michniewski August 2008 * michniewski August 2008
* *
* button_mapping.h * button_mapping.h
* *
* Controller button mapping * Controller button mapping
****************************************************************************/ ***************************************************************************/
#ifndef BTN_MAP_H #ifndef BTN_MAP_H
#define BTN_MAP_H #define BTN_MAP_H

View File

@ -1,14 +1,12 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* Tantric August 2008 * Tantric August 2008
* *
* cheatmgr.cpp * cheatmgr.cpp
* *
* Cheat handling * Cheat handling
****************************************************************************/ ***************************************************************************/
#include "memmap.h" #include "memmap.h"
#include "cheats.h" #include "cheats.h"
@ -27,7 +25,7 @@ extern unsigned char savebuffer[];
* *
* Loads cheat file from save buffer * Loads cheat file from save buffer
* Custom version of S9xLoadCheatFile() * Custom version of S9xLoadCheatFile()
****************************************************************************/ ***************************************************************************/
bool8 NGCLoadCheatFile (int length) bool8 NGCLoadCheatFile (int length)
{ {
@ -61,7 +59,7 @@ bool8 NGCLoadCheatFile (int length)
* *
* Erases any prexisting cheats, loads cheats from a cheat file * Erases any prexisting cheats, loads cheats from a cheat file
* Called when a ROM is first loaded * Called when a ROM is first loaded
****************************************************************************/ ***************************************************************************/
void void
SetupCheats() SetupCheats()
{ {

View File

@ -1,12 +1,11 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Wii/Gamecube Port
* Tantric August 2008 * Tantric August 2008
* *
* cheatmgr.h * cheatmgr.h
* *
* Cheat handling * Cheat handling
****************************************************************************/ ***************************************************************************/
void SetupCheats(); void SetupCheats();

View File

@ -1,11 +1,15 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube DVD
* *
* softdev July 2006 * softdev July 2006
* svpe & crunchy2 June 2007 * svpe & crunchy2 June 2007
****************************************************************************/ * Tantric September 2008
*
* dvd.cpp
*
* DVD I/O functions
***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -43,12 +47,12 @@ unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32);
unsigned char dvdbuffer[2048]; unsigned char dvdbuffer[2048];
/** /****************************************************************************
* dvd_read * dvd_read
* *
* The only DVD function we need - you gotta luv gc-linux self-boots! * The only DVD function we need - you gotta luv gc-linux self-boots!
* returns: 1 - ok ; 0 - error * returns: 1 - ok ; 0 - error
*/ ***************************************************************************/
int int
dvd_read (void *dst, unsigned int len, u64 offset) 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); 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 #ifdef HW_DOL
@ -106,12 +111,12 @@ dvd_read (void *dst, unsigned int len, u64 offset)
#define PVDROOT 0x9c #define PVDROOT 0x9c
static int IsJoliet = 0; static int IsJoliet = 0;
/** /****************************************************************************
* Primary Volume Descriptor * Primary Volume Descriptor
* *
* The PVD should reside between sector 16 and 31. * The PVD should reside between sector 16 and 31.
* This is for single session DVD only. * This is for single session DVD only.
*/ ***************************************************************************/
int int
getpvd () getpvd ()
{ {
@ -174,7 +179,7 @@ getpvd ()
* TestDVD() * TestDVD()
* *
* Tests if a ISO9660 DVD is inserted and available * Tests if a ISO9660 DVD is inserted and available
****************************************************************************/ ***************************************************************************/
bool TestDVD() bool TestDVD()
{ {
@ -193,12 +198,12 @@ bool TestDVD()
return true; return true;
} }
/** /****************************************************************************
* getentry * getentry
* *
* Support function to return the next file entry, if any * Support function to return the next file entry, if any
* Declared static to avoid accidental external entry. * Declared static to avoid accidental external entry.
*/ ***************************************************************************/
static int diroffset = 0; static int diroffset = 0;
static int static int
getentry (int entrycount) getentry (int entrycount)
@ -304,7 +309,7 @@ getentry (int entrycount)
return 0; return 0;
} }
/** /****************************************************************************
* parseDVDdirectory * parseDVDdirectory
* *
* This function will parse the directory tree. * This function will parse the directory tree.
@ -312,7 +317,7 @@ getentry (int entrycount)
* getpvd, a previous parse or a menu selection. * getpvd, a previous parse or a menu selection.
* *
* The return value is number of files collected, or 0 on failure. * The return value is number of files collected, or 0 on failure.
*/ ***************************************************************************/
int int
ParseDVDdirectory () ParseDVDdirectory ()
{ {
@ -356,12 +361,12 @@ ParseDVDdirectory ()
return filecount; return filecount;
} }
/** /****************************************************************************
* DirectorySearch * DirectorySearch
* *
* Searches for the directory name specified within the current directory * Searches for the directory name specified within the current directory
* Returns the index of the directory, or -1 if not found * Returns the index of the directory, or -1 if not found
*/ ***************************************************************************/
int DirectorySearch(char dir[512]) int DirectorySearch(char dir[512])
{ {
for (int i = 0; i < maxfiles; i++ ) for (int i = 0; i < maxfiles; i++ )
@ -370,13 +375,13 @@ int DirectorySearch(char dir[512])
return -1; return -1;
} }
/** /****************************************************************************
* SwitchDVDFolder * SwitchDVDFolder
* *
* Recursively searches for any directory path 'dir' specified * Recursively searches for any directory path 'dir' specified
* Also loads the directory contents via ParseDVDdirectory() * Also loads the directory contents via ParseDVDdirectory()
* It relies on dvddir, dvddirlength, and filelist being pre-populated * It relies on dvddir, dvddirlength, and filelist being pre-populated
*/ ***************************************************************************/
bool SwitchDVDFolder(char * dir, int maxDepth) bool SwitchDVDFolder(char * dir, int maxDepth)
{ {
if(maxDepth > 8) // only search to a max depth of 8 levels if(maxDepth > 8) // only search to a max depth of 8 levels
@ -434,7 +439,7 @@ bool SwitchDVDFolder(char origdir[])
* dvddirlength. * dvddirlength.
* *
* The buffer parameter should re-use the initial ROM buffer. * The buffer parameter should re-use the initial ROM buffer.
****************************************************************************/ ***************************************************************************/
int int
LoadDVDFile (unsigned char *buffer) LoadDVDFile (unsigned char *buffer)
@ -485,7 +490,7 @@ LoadDVDFile (unsigned char *buffer)
* memcard interface. * memcard interface.
* *
* libOGC tends to foul up if you don't, and sometimes does if you do! * libOGC tends to foul up if you don't, and sometimes does if you do!
****************************************************************************/ ***************************************************************************/
#ifdef HW_DOL #ifdef HW_DOL
void uselessinquiry () void uselessinquiry ()
{ {
@ -501,6 +506,10 @@ void uselessinquiry ()
while (dvd[7] & 1); while (dvd[7] & 1);
} }
/****************************************************************************
* dvd_motor_off( )
* Turns off DVD drive motor so it doesn't make noise (Gamecube only)
***************************************************************************/
void dvd_motor_off( ) void dvd_motor_off( )
{ {
dvd[0] = 0x2e; dvd[0] = 0x2e;
@ -518,11 +527,11 @@ void dvd_motor_off( )
dvd[1] = 0; dvd[1] = 0;
} }
/** /****************************************************************************
* dvd_driveid * dvd_driveid
* *
* Gets and returns the dvd driveid * Gets and returns the dvd driveid
**/ ***************************************************************************/
int dvd_driveid() int dvd_driveid()
{ {
@ -546,6 +555,11 @@ int dvd_driveid()
#endif #endif
/****************************************************************************
* SetDVDDriveType()
*
* Sets the DVD drive ID for use to determine disc size (1.5 GB or 4.7 GB)
***************************************************************************/
void SetDVDDriveType() void SetDVDDriveType()
{ {
#ifdef HW_RVL #ifdef HW_RVL

View File

@ -1,11 +1,14 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube DVD
* *
* softdev July 2006 * softdev July 2006
* svpe & crunchy2 June 2007 * svpe & crunchy2 June 2007
****************************************************************************/ * Tantric September 2008
*
* dvd.h
*
* DVD I/O functions
***************************************************************************/
#ifndef _NGCDVD_ #ifndef _NGCDVD_
#define _NGCDVD_ #define _NGCDVD_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
@ -9,8 +7,9 @@
* *
* fileop.cpp * fileop.cpp
* *
* File operations * FAT File operations
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -39,7 +38,7 @@ extern FILEENTRIES filelist[MAXFILES];
/**************************************************************************** /****************************************************************************
* fat_is_mounted * fat_is_mounted
* to check whether FAT media are detected. * to check whether FAT media are detected.
****************************************************************************/ ***************************************************************************/
bool FatIsMounted(PARTITION_INTERFACE partition) { bool FatIsMounted(PARTITION_INTERFACE partition) {
char prefix[] = "fatX:/"; char prefix[] = "fatX:/";
@ -56,7 +55,7 @@ bool FatIsMounted(PARTITION_INTERFACE partition) {
* changeFATInterface * changeFATInterface
* Checks if the device (method) specified is available, and * Checks if the device (method) specified is available, and
* sets libfat to use the device * sets libfat to use the device
****************************************************************************/ ***************************************************************************/
bool ChangeFATInterface(int method, bool silent) bool ChangeFATInterface(int method, bool silent)
{ {
bool devFound = false; bool devFound = false;
@ -110,7 +109,7 @@ bool ChangeFATInterface(int method, bool silent)
/*************************************************************************** /***************************************************************************
* Browse FAT subdirectories * Browse FAT subdirectories
***************************************************************************/ **************************************************************************/
int int
ParseFATdirectory(int method) ParseFATdirectory(int method)
{ {
@ -171,7 +170,7 @@ ParseFATdirectory(int method)
/**************************************************************************** /****************************************************************************
* LoadFATFile * LoadFATFile
****************************************************************************/ ***************************************************************************/
int int
LoadFATFile (char *filename, int length) LoadFATFile (char *filename, int length)
{ {
@ -225,7 +224,7 @@ LoadFATFile (char *filename, int length)
/**************************************************************************** /****************************************************************************
* Load savebuffer from FAT file * Load savebuffer from FAT file
****************************************************************************/ ***************************************************************************/
int int
LoadBufferFromFAT (char *filepath, bool silent) LoadBufferFromFAT (char *filepath, bool silent)
{ {
@ -261,7 +260,7 @@ LoadBufferFromFAT (char *filepath, bool silent)
/**************************************************************************** /****************************************************************************
* Write savebuffer to FAT card file * Write savebuffer to FAT card file
****************************************************************************/ ***************************************************************************/
int int
SaveBufferToFAT (char *filepath, int datasize, bool silent) SaveBufferToFAT (char *filepath, int datasize, bool silent)
{ {

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
@ -9,7 +7,7 @@
* *
* fileop.h * fileop.h
* *
* File operations * FAT File operations
****************************************************************************/ ****************************************************************************/
#ifndef _FATFILESC_ #ifndef _FATFILESC_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* svpe June 2007 * svpe June 2007
@ -11,7 +9,8 @@
* filesel.cpp * filesel.cpp
* *
* Generic file routines - reading, writing, browsing * Generic file routines - reading, writing, browsing
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -60,8 +59,9 @@ FILEENTRIES filelist[MAXFILES];
unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32); unsigned char savebuffer[SAVEBUFFERSIZE] ATTRIBUTE_ALIGN (32);
/**************************************************************************** /****************************************************************************
* ClearSaveBuffer ()
* Clear the savebuffer * Clear the savebuffer
****************************************************************************/ ***************************************************************************/
void void
ClearSaveBuffer () ClearSaveBuffer ()
{ {
@ -118,8 +118,9 @@ int autoSaveMethod()
} }
} }
/*************************************************************************** /****************************************************************************
* Update curent directory name * UpdateDirName()
* Update curent directory name for file browser
***************************************************************************/ ***************************************************************************/
int UpdateDirName(int method) int UpdateDirName(int method)
{ {
@ -176,7 +177,7 @@ int UpdateDirName(int method)
} }
} }
/*************************************************************************** /****************************************************************************
* FileSortCallback * FileSortCallback
* *
* Quick sort callback to sort file entries with the following order: * Quick sort callback to sort file entries with the following order:
@ -207,7 +208,7 @@ int FileSortCallback(const void *f1, const void *f2)
* StripExt * StripExt
* *
* Strips an extension from a filename * Strips an extension from a filename
****************************************************************************/ ***************************************************************************/
void StripExt(char* returnstring, char * inputstring) void StripExt(char* returnstring, char * inputstring)
{ {
@ -223,7 +224,7 @@ void StripExt(char* returnstring, char * inputstring)
* FileSelector * FileSelector
* *
* Let user select a file from the listing * Let user select a file from the listing
****************************************************************************/ ***************************************************************************/
int FileSelector (int method) int FileSelector (int method)
{ {
u32 p = 0; u32 p = 0;
@ -455,7 +456,7 @@ int FileSelector (int method)
* OpenDVD * OpenDVD
* *
* Function to load a DVD directory and display to user. * Function to load a DVD directory and display to user.
****************************************************************************/ ***************************************************************************/
int int
OpenDVD (int method) OpenDVD (int method)
{ {
@ -504,7 +505,7 @@ OpenDVD (int method)
* OpenSMB * OpenSMB
* *
* Function to load from an SMB share * Function to load from an SMB share
****************************************************************************/ ***************************************************************************/
int int
OpenSMB (int method) OpenSMB (int method)
{ {
@ -533,7 +534,7 @@ OpenSMB (int method)
* OpenFAT * OpenFAT
* *
* Function to load from FAT * Function to load from FAT
****************************************************************************/ ***************************************************************************/
int int
OpenFAT (int method) OpenFAT (int method)
{ {
@ -562,7 +563,7 @@ OpenFAT (int method)
/**************************************************************************** /****************************************************************************
* OpenROM * OpenROM
* Opens device specified by method, displays a list of ROMS * Opens device specified by method, displays a list of ROMS
****************************************************************************/ ***************************************************************************/
int int
OpenROM (int method) OpenROM (int method)

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007-July 2007 * crunchy2 May 2007-July 2007
@ -11,12 +9,10 @@
* *
* Snapshots Memory File System * Snapshots Memory File System
* *
* This is a single global memory file controller. Don't even think of opening two * This is a single global memory file controller.
* at the same time ! * 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.
****************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -50,11 +46,11 @@ static int bufoffset;
char freezecomment[2][32]; char freezecomment[2][32];
/** /****************************************************************************
* GetMem * GetMem
* *
* Return x bytes from memory buffer * Return x bytes from memory buffer
*/ ***************************************************************************/
int int
GetMem (char *buffer, int len) GetMem (char *buffer, int len)
{ {
@ -64,11 +60,11 @@ GetMem (char *buffer, int len)
return len; return len;
} }
/** /****************************************************************************
* PutMem * PutMem
* *
* Put some values in memory buffer * Put some values in memory buffer
*/ ***************************************************************************/
static void static void
PutMem (char *buffer, int len) PutMem (char *buffer, int len)
{ {
@ -85,9 +81,11 @@ NGCFreezeBlock (char *name, uint8 * block, int size)
PutMem ((char *) block, size); PutMem ((char *) block, size);
} }
/** /****************************************************************************
* NGCFreezeMembuffer * NGCFreezeMembuffer
*/ *
* Copies a snapshot of Snes9x state into memory
***************************************************************************/
static int static int
NGCFreezeMemBuffer () NGCFreezeMemBuffer ()
{ {
@ -109,7 +107,7 @@ NGCFreezeMemBuffer ()
sprintf (buffer, "%s:%04d\n", SNAPSHOT_MAGIC, SNAPSHOT_VERSION); sprintf (buffer, "%s:%04d\n", SNAPSHOT_MAGIC, SNAPSHOT_VERSION);
PutMem (buffer, strlen (buffer)); 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); Memory.ROMFilename, 0);
PutMem (buffer, strlen (buffer) + 1); PutMem (buffer, strlen (buffer) + 1);
@ -120,11 +118,11 @@ NGCFreezeMemBuffer ()
} }
/** /****************************************************************************
* NGCFreezeGame * NGCFreezeGame
* *
* Do freeze game for Nintendo Gamecube * Do freeze game for Nintendo Gamecube
*/ ***************************************************************************/
int int
NGCFreezeGame (int method, bool8 silent) NGCFreezeGame (int method, bool8 silent)
{ {
@ -209,9 +207,9 @@ NGCFreezeGame (int method, bool8 silent)
return 0; return 0;
} }
/** /****************************************************************************
* NGCUnFreezeBlock * NGCUnFreezeBlock
*/ ***************************************************************************/
int int
NGCUnFreezeBlock (char *name, uint8 * block, int size) NGCUnFreezeBlock (char *name, uint8 * block, int size)
{ {
@ -246,9 +244,9 @@ NGCUnFreezeBlock (char *name, uint8 * block, int size)
return SUCCESS; return SUCCESS;
} }
/** /****************************************************************************
* NGCUnfreezeGame * NGCUnfreezeGame
*/ ***************************************************************************/
int int
NGCUnfreezeGame (int method, bool8 silent) NGCUnfreezeGame (int method, bool8 silent)
{ {

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007-July 2007 * crunchy2 May 2007-July 2007
@ -11,12 +9,9 @@
* *
* Snapshots Memory File System * Snapshots Memory File System
* *
* This is a single global memory file controller. Don't even think of opening two * This is a single global memory file controller.
* at the same time ! * 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.
****************************************************************************/
#ifndef _NGCMEMFILE_ #ifndef _NGCMEMFILE_
#define _NGCMEMFILE_ #define _NGCMEMFILE_

View File

@ -1,10 +0,0 @@
/****************************************************************************
* gctime.h
****************************************************************************/
extern "C" {
long long gettime();
u32 diff_usec(long long start,long long end);
}

View File

@ -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 <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -25,7 +37,7 @@ extern int ConfigRequested;
* Controller Functions * Controller Functions
* *
* The following map the NGC Pads to the *NEW* controller system. * The following map the NGC Pads to the *NEW* controller system.
****************************************************************************/ ***************************************************************************/
#define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \ #define ASSIGN_BUTTON_TRUE( keycode, snescmd ) \
S9xMapButton( keycode, cmd = S9xGetCommandT(snescmd), true) 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 ***/ /*** Justifier : wiimote button mapping ***/
unsigned int wmjustmap[] = { WPAD_BUTTON_A, WPAD_BUTTON_B, WPAD_BUTTON_PLUS }; 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) s8 WPAD_StickX(u8 chan,u8 right)
{ {
float mag = 0.0; float mag = 0.0;
@ -125,6 +143,12 @@ s8 WPAD_StickX(u8 chan,u8 right)
return (s8)(val * 128.0f); return (s8)(val * 128.0f);
} }
/****************************************************************************
* WPAD_StickY
*
* Get Y value from Wii Joystick (classic, nunchuk) input
***************************************************************************/
s8 WPAD_StickY(u8 chan, u8 right) s8 WPAD_StickY(u8 chan, u8 right)
{ {
float mag = 0.0; 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_x[5] = {0,0,0,0,0};
static int cursor_y[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) void UpdateCursorPosition (int pad, int &pos_x, int &pos_y)
{ {
#define SCOPEPADCAL 20 #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) void decodepad (int pad)
{ {
int i, offset; int i, offset;
@ -424,8 +458,10 @@ void decodepad (int pad)
/**************************************************************************** /****************************************************************************
* NGCReportButtons * NGCReportButtons
*
* Called on each rendered frame * Called on each rendered frame
****************************************************************************/ * Our way of putting controller input into Snes9x
***************************************************************************/
void NGCReportButtons () void NGCReportButtons ()
{ {
s8 gc_px = PAD_SubStickX (0); s8 gc_px = PAD_SubStickX (0);
@ -521,10 +557,9 @@ void SetControllers ()
} }
} }
/**************************************************************************** /****************************************************************************
* Set the default mapping for NGC * Set the default mapping for NGC
****************************************************************************/ ***************************************************************************/
void SetDefaultButtonMap () void SetDefaultButtonMap ()
{ {
int maxcode = 0x10; int maxcode = 0x10;

View File

@ -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_ #ifndef _INPUT_H_
#define _INPUT_H_ #define _INPUT_H_
@ -18,8 +29,6 @@ extern unsigned int wmmousemap[];
extern unsigned int gcjustmap[]; extern unsigned int gcjustmap[];
extern unsigned int wmjustmap[]; extern unsigned int wmjustmap[];
//START_EXTERN_C
s8 WPAD_StickX(u8 chan,u8 right); s8 WPAD_StickX(u8 chan,u8 right);
s8 WPAD_StickY(u8 chan, u8 right); s8 WPAD_StickY(u8 chan, u8 right);
@ -29,6 +38,4 @@ void NGCReportButtons ();
void SetControllers (); void SetControllers ();
void SetDefaultButtonMap (); void SetDefaultButtonMap ();
//END_EXTERN_C
#endif #endif

View File

@ -1,14 +1,15 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May-June 2007 * crunchy2 May-June 2007
* Tantric September 2008
* *
* memcardop.cpp * memcardop.cpp
* *
* Memory Card Routines. * Memory Card routines
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -52,7 +53,7 @@ card_stat CardStatus;
* *
* Wrapper to search through the files on the card. * Wrapper to search through the files on the card.
* Returns TRUE if found. * Returns TRUE if found.
****************************************************************************/ ***************************************************************************/
int int
CardFileExists (char *filename, int slot) CardFileExists (char *filename, int slot)
{ {
@ -74,7 +75,7 @@ CardFileExists (char *filename, int slot)
* TestCard * TestCard
* *
* Checks to see if a card is in the card slot specified * Checks to see if a card is in the card slot specified
****************************************************************************/ ***************************************************************************/
bool TestCard(int slot, bool silent) bool TestCard(int slot, bool silent)
{ {
// Memory Cards do not work in Wii mode - disable // 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. * Mounts the memory card in the given slot.
* Returns the result of the last attempted CARD_Mount command. * Returns the result of the last attempted CARD_Mount command.
****************************************************************************/ ***************************************************************************/
int MountCard(int cslot, bool silent) int MountCard(int cslot, bool silent)
{ {
int ret = -1; int ret = -1;
@ -139,7 +140,7 @@ int MountCard(int cslot, bool silent)
/**************************************************************************** /****************************************************************************
* Verify Memory Card file against buffer * Verify Memory Card file against buffer
****************************************************************************/ ***************************************************************************/
int int
VerifyMCFile (unsigned char *buf, int slot, char *filename, int datasize) 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; return 0;
} }
/**************************************************************************** /****************************************************************************
* Load savebuffer from Memory Card file * Load savebuffer from Memory Card file
****************************************************************************/ ***************************************************************************/
int int
LoadBufferFromMC (unsigned char *buf, int slot, char *filename, bool8 silent) 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 * Write savebuffer to Memory Card file
****************************************************************************/ ***************************************************************************/
int int
SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool8 silent) 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; 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 ***/ if ( (s32)blocks > CardFile.len ) /*** new data is longer ***/
{ {
CARD_Close (&CardFile); CARD_Close (&CardFile);
@ -457,5 +432,3 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
return 0; return 0;
} }

View File

@ -1,14 +1,14 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * 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_ #ifndef _NGCMCSAVE_
#define _NGCMCSAVE_ #define _NGCMCSAVE_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May-June 2007 * crunchy2 May-June 2007
@ -9,8 +7,9 @@
* *
* menu.cpp * menu.cpp
* *
* Menu flow routines * Menu flow routines - handles all menu logic
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -19,12 +18,10 @@
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#ifdef WII_DVD #ifdef WII_DVD
#ifdef __cplusplus
extern "C" { extern "C" {
#include <di/di.h> #include <di/di.h>
} }
#endif #endif
#endif
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
@ -69,7 +66,7 @@ extern unsigned long ARAM_ROMSIZE;
/**************************************************************************** /****************************************************************************
* Reboot / Exit * Reboot / Exit
****************************************************************************/ ***************************************************************************/
#ifndef HW_RVL #ifndef HW_RVL
#define PSOSDLOADID 0x7c6000a6 #define PSOSDLOADID 0x7c6000a6
@ -89,7 +86,7 @@ void Reboot()
/**************************************************************************** /****************************************************************************
* Load Manager * Load Manager
****************************************************************************/ ***************************************************************************/
int int
LoadManager () LoadManager ()
@ -115,7 +112,7 @@ LoadManager ()
/**************************************************************************** /****************************************************************************
* Preferences Menu * Preferences Menu
****************************************************************************/ ***************************************************************************/
static int prefmenuCount = 16; static int prefmenuCount = 16;
static char prefmenu[][50] = { static char prefmenu[][50] = {
@ -334,7 +331,7 @@ PreferencesMenu ()
/**************************************************************************** /****************************************************************************
* Cheat Menu * Cheat Menu
****************************************************************************/ ***************************************************************************/
static int cheatmenuCount = 0; static int cheatmenuCount = 0;
static char cheatmenu[MAX_CHEATS][50]; static char cheatmenu[MAX_CHEATS][50];
static char cheatmenuvalue[MAX_CHEATS][50]; static char cheatmenuvalue[MAX_CHEATS][50];
@ -512,7 +509,7 @@ void CheatMenu()
/**************************************************************************** /****************************************************************************
* Game Options Menu * Game Options Menu
****************************************************************************/ ***************************************************************************/
int int
GameMenu () GameMenu ()
@ -610,10 +607,10 @@ GameMenu ()
/**************************************************************************** /****************************************************************************
* Controller Configuration * Controller Configuration
* *
* Snes9x 1.50 uses a cmd system to work out which button has been pressed. * 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 * Here, I simply move the designated value to the gcpadmaps array, which
* on updating the cmd sequences. * saves on updating the cmd sequences.
****************************************************************************/ ***************************************************************************/
u32 u32
GetInput (u16 ctrlr_type) GetInput (u16 ctrlr_type)
{ {
@ -936,7 +933,7 @@ ConfigureControllers ()
/**************************************************************************** /****************************************************************************
* Main Menu * Main Menu
****************************************************************************/ ***************************************************************************/
int menucount = 7; int menucount = 7;
char menuitems[][50] = { char menuitems[][50] = {
"Choose Game", "Controller Configuration", "Preferences", "Choose Game", "Controller Configuration", "Preferences",

View File

@ -1,10 +1,14 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ * crunchy2 May-June 2007
* Tantric August 2008
*
* menu.h
*
* Menu flow routines - handles all menu logic
***************************************************************************/
#ifndef _NGCMENU_ #ifndef _NGCMENU_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 June 2007 * crunchy2 June 2007
@ -17,7 +15,8 @@
* **WARNING*** * **WARNING***
* *
* ONLY USE GUARANTEED PATENT FREE FONTS. * ONLY USE GUARANTEED PATENT FREE FONTS.
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -65,7 +64,7 @@ u32 getrgb( u32 ycbr, u32 low );
/**************************************************************************** /****************************************************************************
* Initialisation of libfreetype * Initialisation of libfreetype
****************************************************************************/ ***************************************************************************/
int int
FT_Init () FT_Init ()
{ {
@ -94,7 +93,7 @@ FT_Init ()
* setfontsize * setfontsize
* *
* Set the screen font size in pixels * Set the screen font size in pixels
****************************************************************************/ ***************************************************************************/
void void
setfontsize (int pixelsize) setfontsize (int pixelsize)
{ {
@ -107,9 +106,9 @@ setfontsize (int pixelsize)
} }
/**************************************************************************** /****************************************************************************
* DrawCharacter * DrawCharacter
* Draws a single character on the screen * Draws a single character on the screen
****************************************************************************/ ***************************************************************************/
static void static void
DrawCharacter (FT_Bitmap * bmp, FT_Int x, FT_Int y) 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 * DrawText
* *
* Place the font bitmap on the screen * Place the font bitmap on the screen
****************************************************************************/ ***************************************************************************/
void void
DrawText (int x, int y, char *text) DrawText (int x, int y, char *text)
{ {
@ -207,7 +206,7 @@ DrawText (int x, int y, char *text)
* setfontcolour * setfontcolour
* *
* Uses RGB triple values. * Uses RGB triple values.
****************************************************************************/ ***************************************************************************/
void void
setfontcolour (u8 r, u8 g, u8 b) setfontcolour (u8 r, u8 g, u8 b)
{ {
@ -222,7 +221,7 @@ setfontcolour (u8 r, u8 g, u8 b)
* Display credits, legal copyright and licence * Display credits, legal copyright and licence
* *
* THIS MUST NOT BE REMOVED IN ANY DERIVATIVE WORK. * THIS MUST NOT BE REMOVED IN ANY DERIVATIVE WORK.
****************************************************************************/ ***************************************************************************/
void void
Credits () Credits ()
{ {
@ -280,7 +279,7 @@ Credits ()
* Simply converts RGB to Y1CbY2Cr format * Simply converts RGB to Y1CbY2Cr format
* *
* I got this from a pastebin, so thanks to whoever originally wrote it! * I got this from a pastebin, so thanks to whoever originally wrote it!
****************************************************************************/ ***************************************************************************/
unsigned int unsigned int
getcolour (u8 r1, u8 g1, u8 b1) getcolour (u8 r1, u8 g1, u8 b1)
@ -308,7 +307,9 @@ getcolour (u8 r1, u8 g1, u8 b1)
/**************************************************************************** /****************************************************************************
* Unpackbackdrop * Unpackbackdrop
****************************************************************************/ *
* Decompress menu background and store it in ARAM or memory
***************************************************************************/
void void
unpackbackdrop () unpackbackdrop ()
{ {
@ -346,7 +347,7 @@ unpackbackdrop ()
/**************************************************************************** /****************************************************************************
* Wait for user to press A * Wait for user to press A
****************************************************************************/ ***************************************************************************/
void void
WaitButtonA () WaitButtonA ()
{ {
@ -361,7 +362,7 @@ WaitButtonA ()
/**************************************************************************** /****************************************************************************
* Wait for user to press A or B. Returns 0 = B; 1 = A * Wait for user to press A or B. Returns 0 = B; 1 = A
****************************************************************************/ ***************************************************************************/
int int
WaitButtonAB () WaitButtonAB ()
@ -400,7 +401,7 @@ WaitButtonAB ()
/**************************************************************************** /****************************************************************************
* Show a prompt * Show a prompt
****************************************************************************/ ***************************************************************************/
void void
WaitPrompt (char *msg) 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 * Show a prompt with choice of two options. Returns 1 if A button was pressed
and 0 if B button was pressed. and 0 if B button was pressed.
****************************************************************************/ ***************************************************************************/
int int
WaitPromptChoice (char *msg, char *bmsg, char *amsg) WaitPromptChoice (char *msg, char *bmsg, char *amsg)
{ {
@ -445,7 +446,7 @@ WaitPromptChoice (char *msg, char *bmsg, char *amsg)
/**************************************************************************** /****************************************************************************
* Show an action in progress * Show an action in progress
****************************************************************************/ ***************************************************************************/
void void
ShowAction (char *msg) ShowAction (char *msg)
{ {
@ -463,7 +464,7 @@ ShowAction (char *msg)
/**************************************************************************** /****************************************************************************
* Generic Menu Routines * Generic Menu Routines
****************************************************************************/ ***************************************************************************/
void void
DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsize, int x) 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 * Help function to find the next visible menu item on the list
* Supports menu wrap-around * Supports menu wrap-around
****************************************************************************/ ***************************************************************************/
int FindMenuItem(char items[][50], int maxitems, int currentItem, int direction) 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 * Call this with the menu array defined in menu.cpp
* It's here to keep all the font / interface stuff together. * It's here to keep all the font / interface stuff together.
****************************************************************************/ ***************************************************************************/
int menu = 0; int menu = 0;
int int
@ -631,7 +632,7 @@ RunMenu (char items[][50], int maxitems, char *title, int fontsize, int x)
* Showfile screen * Showfile screen
* *
* Display the file selection to the user * Display the file selection to the user
****************************************************************************/ ***************************************************************************/
void void
ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection) ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
@ -693,7 +694,7 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
* Cheats screen * Cheats screen
* *
* Displays a scrollable list of cheats to the user * Displays a scrollable list of cheats to the user
****************************************************************************/ ***************************************************************************/
void void
ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, int selection) 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 * ROM Information Screen
****************************************************************************/ ***************************************************************************/
void RomInfo() void RomInfo()
{ {
@ -827,7 +828,7 @@ void RomInfo()
* DrawLine * DrawLine
* *
* Quick'n'Dirty Bresenham line drawing routine. * Quick'n'Dirty Bresenham line drawing routine.
****************************************************************************/ ***************************************************************************/
#define SIGN(x) ((x<0)?-1:((x>0)?1:0)) #define SIGN(x) ((x<0)?-1:((x>0)?1:0))
void void
@ -912,7 +913,7 @@ DrawLine (int x1, int y1, int x2, int y2, u8 r, u8 g, u8 b)
* Progress Bar * Progress Bar
* *
* Show the user what's happening * Show the user what's happening
****************************************************************************/ ***************************************************************************/
void void
ShowProgress (char *msg, int done, int total) ShowProgress (char *msg, int done, int total)
{ {
@ -944,7 +945,7 @@ ShowProgress (char *msg, int done, int total)
/**************************************************************************** /****************************************************************************
* DrawPolygon * DrawPolygon
****************************************************************************/ ***************************************************************************/
void void
DrawPolygon (int vertices, int varray[], u8 r, u8 g, u8 b) 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); varray[(vertices << 1) - 1], r, g, b);
} }
/***************************************************************************** /****************************************************************************
* Draw Line Fast * Draw Line Fast
* *
* This routine requires that start and endx are 32bit aligned. * This routine requires that start and endx are 32bit aligned.
* It tries to perform a semi-transparency over the existing image. * It tries to perform a semi-transparency over the existing image.
*****************************************************************************/ ***************************************************************************/
#define SRCWEIGHT 0.7f #define SRCWEIGHT 0.7f
#define DSTWEIGHT (1.0f - SRCWEIGHT) #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. * Ok, I'm useless with Y1CBY2CR colour.
* So convert back to RGB so I can work with it -;) * So convert back to RGB so I can work with it -;)
****************************************************************************/ ***************************************************************************/
u32 getrgb( u32 ycbr, u32 low ) u32 getrgb( u32 ycbr, u32 low )
{ {
u8 r,g,b; u8 r,g,b;

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 June 2007 * crunchy2 June 2007
@ -17,7 +15,7 @@
* **WARNING*** * **WARNING***
* *
* ONLY USE GUARANTEED PATENT FREE FONTS. * ONLY USE GUARANTEED PATENT FREE FONTS.
****************************************************************************/ ***************************************************************************/
#ifndef _NGCMENUDRAW_ #ifndef _NGCMENUDRAW_
#define _NGCMENUDRAW_ #define _NGCMENUDRAW_

View File

@ -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 <gccore.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*** 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;
}

View File

@ -1,13 +1,13 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port * Tantric September 2008
* crunchy2 April 2007-July 2007
* *
* preferences.cpp * preferences.cpp
* *
* Preferences save/load preferences utilities * Preferences save/load to XML file
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -43,7 +43,7 @@ char prefscomment[2][32];
* Prepare Preferences Data * Prepare Preferences Data
* *
* This sets up the save buffer for saving. * This sets up the save buffer for saving.
****************************************************************************/ ***************************************************************************/
mxml_node_t *xml; mxml_node_t *xml;
mxml_node_t *data; mxml_node_t *data;
mxml_node_t *section; 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) void loadXMLSetting(char * var, const char * name)
{ {
item = mxmlFindElement(xml, xml, "setting", "name", name, MXML_DESCEND); 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")); *var = atoi(mxmlElementGetAttr(item, "value"));
} }
/****************************************************************************
* loadXMLController
*
* Load XML elements into variables for a controller mapping
***************************************************************************/
void loadXMLController(unsigned int controller[], const char * name) void loadXMLController(unsigned int controller[], const char * name)
{ {
item = mxmlFindElement(xml, xml, "controller", "name", name, MXML_DESCEND); 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 bool
decodePrefsData (int method) decodePrefsData (int method)
{ {
@ -297,7 +312,7 @@ decodePrefsData (int method)
/**************************************************************************** /****************************************************************************
* Save Preferences * Save Preferences
****************************************************************************/ ***************************************************************************/
bool bool
SavePrefs (int method, bool silent) SavePrefs (int method, bool silent)
{ {
@ -346,7 +361,7 @@ SavePrefs (int method, bool silent)
/**************************************************************************** /****************************************************************************
* Load Preferences from specified method * Load Preferences from specified method
****************************************************************************/ ***************************************************************************/
bool bool
LoadPrefsFromMethod (int method) LoadPrefsFromMethod (int method)
{ {
@ -385,7 +400,7 @@ LoadPrefsFromMethod (int method)
/**************************************************************************** /****************************************************************************
* Load Preferences * Load Preferences
* Checks sources consecutively until we find a preference file * Checks sources consecutively until we find a preference file
****************************************************************************/ ***************************************************************************/
bool LoadPrefs() bool LoadPrefs()
{ {
ShowAction ((char*) "Loading preferences..."); ShowAction ((char*) "Loading preferences...");

View File

@ -1,13 +1,12 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port * Tantric September 2008
* crunchy2 April 2007
* *
* preferences.cpp * preferences.h
* *
* Preferences save/load preferences utilities * Preferences save/load to XML file
****************************************************************************/ ***************************************************************************/
bool SavePrefs (int method, bool silent); bool SavePrefs (int method, bool silent);
bool LoadPrefs (); bool LoadPrefs ();

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
@ -12,7 +10,7 @@
* Configuration parameters are here for easy maintenance. * Configuration parameters are here for easy maintenance.
* Refer to Snes9x.h for all combinations. * Refer to Snes9x.h for all combinations.
* The defaults used here are taken directly from porting.html * The defaults used here are taken directly from porting.html
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include "snes9x.h" #include "snes9x.h"

View File

@ -1,15 +1,16 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007
* Tantric September 2008
* *
* s9xconfig.h * 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. * Refer to Snes9x.h for all combinations.
* The defaults used here are taken directly from porting.html * The defaults used here are taken directly from porting.html
****************************************************************************/ ***************************************************************************/
#ifndef _S9XCONFIG_ #ifndef _S9XCONFIG_

View File

@ -1,158 +1,16 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
* Tantric September 2008
* *
* s9xsupport.cpp * s9xsupport.cpp
* *
* This file contains the supporting functions defined in porting.html, with * This file contains the supporting functions defined in porting.html, with
* others taken from unix/x11.cpp and unix/unix.cpp * 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 <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -173,7 +31,6 @@
#include "spc7110.h" #include "spc7110.h"
#include "controls.h" #include "controls.h"
#include "gctime.h"
#include "snes9xGX.h" #include "snes9xGX.h"
#include "video.h" #include "video.h"
#include "audio.h" #include "audio.h"
@ -183,6 +40,12 @@ extern u32 FrameTimer;
long long prev; long long prev;
long long now; long long now;
extern "C" {
long long gettime();
u32 diff_usec(long long start,long long end);
}
/*** Miscellaneous Functions ***/ /*** Miscellaneous Functions ***/
void void
@ -259,7 +122,7 @@ S9xToggleSoundChannel (int c)
* OpenSoundDevice * OpenSoundDevice
* *
* Main initialisation for NGC sound system * Main initialisation for NGC sound system
****************************************************************************/ ***************************************************************************/
bool8 bool8
S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size) S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
{ {
@ -431,3 +294,29 @@ S9xLoadSDD1Data ()
return; 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;
}

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
@ -11,6 +9,7 @@
* *
* SMB support routines * SMB support routines
****************************************************************************/ ****************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,12 +1,11 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Wii/Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
* Tantric August 2008 * Tantric August 2008
* *
* smbop.h * smbload.h
* *
* SMB support routines * SMB support routines
****************************************************************************/ ****************************************************************************/

View File

@ -1,157 +1,15 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007-July 2007 * crunchy2 May 2007-July 2007
* Tantric September 2008
* *
* snes9xGX.cpp * snes9xGX.cpp
* *
* This file controls overall program flow. Most things start and end here! * 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 <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -166,12 +24,10 @@
#include <fat.h> #include <fat.h>
#ifdef WII_DVD #ifdef WII_DVD
#ifdef __cplusplus
extern "C" { extern "C" {
#include <di/di.h> #include <di/di.h>
} }
#endif #endif
#endif
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
@ -197,7 +53,6 @@ extern "C" {
#include "sram.h" #include "sram.h"
#include "freeze.h" #include "freeze.h"
#include "preferences.h" #include "preferences.h"
#include "gctime.h"
#include "button_mapping.h" #include "button_mapping.h"
#include "fileop.h" #include "fileop.h"
#include "input.h" #include "input.h"
@ -217,7 +72,7 @@ extern void fat_enable_readahead_all();
/**************************************************************************** /****************************************************************************
* setFrameTimerMethod() * setFrameTimerMethod()
* change frametimer method depending on whether ROM is NTSC or PAL * change frametimer method depending on whether ROM is NTSC or PAL
****************************************************************************/ ***************************************************************************/
extern u8 vmode_60hz; extern u8 vmode_60hz;
int timerstyle; int timerstyle;
@ -245,13 +100,9 @@ void setFrameTimerMethod()
/**************************************************************************** /****************************************************************************
* Emulation loop * 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(); 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; extern uint32 prevRenderedFrameCount;
void void
@ -259,9 +110,9 @@ emulate ()
{ {
S9xSetSoundMute (TRUE); S9xSetSoundMute (TRUE);
AudioStart (); 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) while (1)
{ {
@ -336,12 +187,12 @@ emulate ()
* 8. Initialise Snes9x Graphics subsystem * 8. Initialise Snes9x Graphics subsystem
* 9. Let's Party! * 9. Let's Party!
* *
* NB: The SNES ROM is now delivered from ARAM. (AR_SNESROM) * The SNES ROM is delivered from ARAM. (AR_SNESROM)
* Any method of loading a ROM, RAM, DVD, SMB, SDCard, * Any method of loading a ROM - RAM, DVD, SMB, SDCard, etc
* MUST place the unpacked ROM at this location. * MUST place the unpacked ROM at this location.
* This provides a single consistent interface in memmap.cpp. * This provides a single consistent interface in memmap.cpp.
* Refer to that file if you need to change it. * Refer to that file if you need to change it.
****************************************************************************/ ***************************************************************************/
int int
main () main ()
{ {
@ -424,20 +275,17 @@ main ()
} }
else else
{ {
/*** Load ROM ***/ // Load ROM
save_flags = CPU.Flags; save_flags = CPU.Flags;
if (!Memory.LoadROM ("VIRTUAL.ROM")) if (!Memory.LoadROM ("VIRTUAL.ROM"))
while (1); while (1);
CPU.Flags = save_flags; CPU.Flags = save_flags;
/*** Load SRAM ***/
//Memory.LoadSRAM ("DVD");
} }
/*** Emulate ***/ // Emulate
emulate (); emulate ();
/*** NO! - We're never leaving here ! ***/ // NO! - We're never leaving here!
while (1); while (1);
return 0; return 0;
} }

View File

@ -1,14 +1,14 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007-July 2007 * crunchy2 May 2007-July 2007
* Tantric September 2008
* *
* snes9xGX.h * snes9xGX.h
* *
* This file controls overall program flow. Most things start and end here! * This file controls overall program flow. Most things start and end here!
****************************************************************************/ ***************************************************************************/
#ifndef _SNES9XGX_H_ #ifndef _SNES9XGX_H_
#define _SNES9XGX_H_ #define _SNES9XGX_H_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* crunchy2 April 2007-July 2007 * crunchy2 April 2007-July 2007
* Tantric September 2008 * Tantric September 2008
@ -9,7 +7,8 @@
* sram.cpp * sram.cpp
* *
* SRAM save/load/import/export handling * SRAM save/load/import/export handling
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -36,9 +35,9 @@ char sramcomment[2][32];
/**************************************************************************** /****************************************************************************
* Prepare SRAM Save Data * Prepare SRAM Save Data
* *
* This sets up the save buffer for saving in a format compatible with * This sets up the savebuffer for saving in a format compatible with
* snes9x on other platforms. This is used when saving to SD / USB / SMB. * snes9x on other platforms.
****************************************************************************/ ***************************************************************************/
int int
preparesavedata (int method) preparesavedata (int method)
{ {
@ -91,7 +90,7 @@ preparesavedata (int method)
/**************************************************************************** /****************************************************************************
* Decode Save Data * Decode Save Data
****************************************************************************/ ***************************************************************************/
void void
decodesavedata (int method, int readsize) decodesavedata (int method, int readsize)
{ {
@ -143,7 +142,7 @@ decodesavedata (int method, int readsize)
/**************************************************************************** /****************************************************************************
* Load SRAM * Load SRAM
****************************************************************************/ ***************************************************************************/
int int
LoadSRAM (int method, bool silent) LoadSRAM (int method, bool silent)
{ {
@ -192,7 +191,7 @@ LoadSRAM (int method, bool silent)
/**************************************************************************** /****************************************************************************
* Save SRAM * Save SRAM
****************************************************************************/ ***************************************************************************/
bool bool
SaveSRAM (int method, bool silent) SaveSRAM (int method, bool silent)
{ {

View File

@ -1,13 +1,13 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Nintendo Gamecube Port * crunchy2 April 2007-July 2007
* crunchy2 April 2007 * Tantric September 2008
* *
* sram.cpp * sram.cpp
* *
* SRAM save/load/import/export handling * SRAM save/load/import/export handling
****************************************************************************/ ***************************************************************************/
bool SaveSRAM (int method, bool silent); bool SaveSRAM (int method, bool silent);
int LoadSRAM (int method, bool silent); int LoadSRAM (int method, bool silent);

View File

@ -1,10 +1,14 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Unzip - borrowed from the GPP
* *
* softdev July 2006 * softdev July 2006
****************************************************************************/ * Tantric September 2008
*
* unzip.cpp
*
* File unzip routines
***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,9 +1,12 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.50 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Gamecube Unzip - borrowed from the GPP
* *
* softdev July 2006 * softdev July 2006
* Tantric September 2008
*
* unzip.h
*
* File unzip routines
****************************************************************************/ ****************************************************************************/
#ifndef _UNZIP_ #ifndef _UNZIP_
#define _UNZIP_ #define _UNZIP_

View File

@ -1,7 +1,5 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
@ -9,7 +7,8 @@
* video.cpp * video.cpp
* *
* Video routines * Video routines
****************************************************************************/ ***************************************************************************/
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include <stdio.h> #include <stdio.h>
@ -248,7 +247,7 @@ GXRModeObj *tvmodes[4] = {
#ifdef VIDEO_THREADING #ifdef VIDEO_THREADING
/**************************************************************************** /****************************************************************************
* VideoThreading * VideoThreading
****************************************************************************/ ***************************************************************************/
#define TSTACK 16384 #define TSTACK 16384
lwpq_t videoblankqueue; lwpq_t videoblankqueue;
lwp_t vbthread; lwp_t vbthread;
@ -261,7 +260,7 @@ static unsigned char vbstack[TSTACK];
* vertical blank. * vertical blank.
* *
* Putting LWP to good use :) * Putting LWP to good use :)
****************************************************************************/ ***************************************************************************/
static void * static void *
vbgetback (void *arg) vbgetback (void *arg)
{ {
@ -280,7 +279,7 @@ vbgetback (void *arg)
* *
* libOGC provides a nice wrapper for LWP access. * libOGC provides a nice wrapper for LWP access.
* This function sets up a new local queue and attaches the thread to it. * This function sets up a new local queue and attaches the thread to it.
****************************************************************************/ ***************************************************************************/
void void
InitVideoThread () InitVideoThread ()
{ {
@ -298,7 +297,7 @@ InitVideoThread ()
* *
* Stock code to copy the GX buffer to the current display mode. * Stock code to copy the GX buffer to the current display mode.
* Also increments the frameticker, as it's called for each vb. * Also increments the frameticker, as it's called for each vb.
****************************************************************************/ ***************************************************************************/
static void static void
copy_to_xfb (u32 arg) copy_to_xfb (u32 arg)
{ {
@ -316,7 +315,7 @@ copy_to_xfb (u32 arg)
/**************************************************************************** /****************************************************************************
* Scaler Support Functions * Scaler Support Functions
****************************************************************************/ ***************************************************************************/
static void static void
draw_init () draw_init ()
{ {
@ -376,7 +375,7 @@ draw_square (Mtx v)
* StartGX * StartGX
* *
* This function initialises the GX. * This function initialises the GX.
****************************************************************************/ ***************************************************************************/
static void static void
StartGX () StartGX ()
{ {
@ -426,7 +425,7 @@ StartGX ()
* UpdatePadsCB * UpdatePadsCB
* *
* called by postRetraceCallback in InitGCVideo - scans gcpad and wpad * called by postRetraceCallback in InitGCVideo - scans gcpad and wpad
****************************************************************************/ ***************************************************************************/
void void
UpdatePadsCB () UpdatePadsCB ()
{ {
@ -441,7 +440,7 @@ UpdatePadsCB ()
* *
* This function MUST be called at startup. * This function MUST be called at startup.
* - also sets up menu video mode * - also sets up menu video mode
****************************************************************************/ ***************************************************************************/
void void
InitGCVideo () InitGCVideo ()
{ {
@ -535,9 +534,9 @@ InitGCVideo ()
} }
/**************************************************************************** /****************************************************************************
* ResetVideo_Emu * ResetVideo_Emu
* *
* reset the video/rendering mode for the emulator rendering * Reset the video/rendering mode for the emulator rendering
****************************************************************************/ ****************************************************************************/
void void
ResetVideo_Emu () ResetVideo_Emu ()
@ -656,9 +655,9 @@ ResetVideo_Emu ()
} }
/**************************************************************************** /****************************************************************************
* ResetVideo_Menu * ResetVideo_Menu
* *
* reset the video/rendering mode for the menu * Reset the video/rendering mode for the menu
****************************************************************************/ ****************************************************************************/
void void
ResetVideo_Menu () ResetVideo_Menu ()
@ -693,7 +692,7 @@ ResetVideo_Menu ()
* MakeTexture * MakeTexture
* *
* Proper GNU Asm rendition of the above, converted by shagkur. - Thanks! * Proper GNU Asm rendition of the above, converted by shagkur. - Thanks!
****************************************************************************/ ***************************************************************************/
void void
MakeTexture (const void *src, void *dst, s32 width, s32 height) 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 * Update Video
****************************************************************************/ ***************************************************************************/
uint32 prevRenderedFrameCount = 0; uint32 prevRenderedFrameCount = 0;
extern bool CheckVideo; extern bool CheckVideo;
@ -840,7 +839,7 @@ update_video (int width, int height)
// FIX // FIX
/**************************************************************************** /****************************************************************************
* Zoom Functions * Zoom Functions
****************************************************************************/ ***************************************************************************/
void void
zoom (float speed) zoom (float speed)
{ {
@ -871,7 +870,7 @@ zoom_reset ()
/**************************************************************************** /****************************************************************************
* Drawing screen * Drawing screen
****************************************************************************/ ***************************************************************************/
void void
clearscreen (int colour) clearscreen (int colour)
{ {
@ -899,12 +898,10 @@ showscreen ()
* setGFX * setGFX
* *
* Setup the global GFX information for Snes9x * Setup the global GFX information for Snes9x
****************************************************************************/ ***************************************************************************/
void void
setGFX () setGFX ()
{ {
GFX.Screen = (unsigned short *) snes9xgfx; GFX.Screen = (unsigned short *) snes9xgfx;
GFX.Pitch = 1024; GFX.Pitch = 1024;
} }

View File

@ -1,14 +1,13 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 * Snes9x 1.51 Nintendo Wii/Gamecube Port
*
* Nintendo Wii/Gamecube Port
* *
* softdev July 2006 * softdev July 2006
* *
* video.h * video.h
* *
* Video routines * Video routines
****************************************************************************/ ***************************************************************************/
#ifndef _GCVIDEOH_ #ifndef _GCVIDEOH_
#define _GCVIDEOH_ #define _GCVIDEOH_