- added: option to disable AA filtering (snes graphics 'crisper', AA now default OFF)

- added: mapped zooming and turbo mode to classic controller
- added: preliminary usb support (loading)
- changed: sram and freezes now saved by filename, not internal romname. If you have multiple versions of the same game, you can now have srams and freezes for each version. A prompt to convert to the new naming is provided for sram only.
- changed: by default, autoload/save sram and freeze enabled
This commit is contained in:
michniewski 2008-08-06 02:31:44 +00:00
parent 26b7c62aca
commit edf269f97d
22 changed files with 409 additions and 324 deletions

View File

@ -1,10 +1,10 @@
.PHONY = all wii gc wii-clean gc-clean wii-run gc-run mca mcb sd smb mca-clean mcb-clean sd-clean smb-clean specials specials-clean .PHONY = all wii gc wii-clean gc-clean wii-run gc-run specials specials-clean specials-wii specials-gc specials-wii-clean specials-gc-clean
VERSION := 003 VERSION := 004
all: wii gc all: wii gc
clean: wii-clean gc-clean clean: wii-clean gc-clean specials-clean
wii: wii:
$(MAKE) -f Makefile.wii $(MAKE) -f Makefile.wii
@ -26,39 +26,35 @@ gc-run:
# Custom Quicksave Versions # Custom Quicksave Versions
specials: sd mcb mca smb specials: specials-wii specials-gc
specials-clean: mca-clean mcb-clean smb-clean sd-clean specials-clean: specials-wii-clean specials-gc-clean
mca: specials-wii:
touch source/ngc/snes9xGX.h touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.wii $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.wii
touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.gc
mca-clean:
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
mcb:
touch source/ngc/snes9xGX.h touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.wii $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.wii
touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.gc
mcb-clean:
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
sd:
touch source/ngc/snes9xGX.h touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.wii $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.wii
specials-gc:
touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.gc
touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.gc
touch source/ngc/snes9xGX.h touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.gc $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.gc
sd-clean:
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
smb:
touch source/ngc/snes9xGX.h touch source/ngc/snes9xGX.h
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=4" "LOADTYPE:='"SMB"'" "VERSION:=$(VERSION)" -f Makefile.gc $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=4" "LOADTYPE:='"SMB"'" "VERSION:=$(VERSION)" -f Makefile.gc
smb-clean:
specials-wii-clean:
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.wii clean
specials-gc-clean:
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=0" "LOADTYPE:='"MCSLOTA"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=1" "LOADTYPE:='"MCSLOTB"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=3" "LOADTYPE:='"SD"'" "VERSION:=$(VERSION)" -f Makefile.gc clean
$(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=4" "LOADTYPE:='"SMB"'" "VERSION:=$(VERSION)" -f Makefile.gc clean $(MAKE) "CUSTOMFLAGS:=-DQUICK_SAVE_SLOT=4" "LOADTYPE:='"SMB"'" "VERSION:=$(VERSION)" -f Makefile.gc clean

View File

@ -9,8 +9,8 @@ endif
include $(DEVKITPPC)/gamecube_rules include $(DEVKITPPC)/gamecube_rules
LOADTYPE = '"sd"' LOADTYPE = "sd"
VERSION = '"version"' VERSION = "version"
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output

View File

@ -9,9 +9,8 @@ endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
LOADTYPE = "sd"
LOADTYPE = '"sd"' VERSION = "version"
VERSION = '"version"'
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output

View File

@ -10,13 +10,24 @@
­———————————————————————————————————————————————————————————————————————•ßrK• ­———————————————————————————————————————————————————————————————————————•ßrK•
×—–­—–­—–­—–­ –­—–­—–­—–­—–­—–­—–­—–­—–­—–­— ­—–­—–­—–­—–­—–­—–­—–­—-­—–­-–•¬ ×—–­—–­—–­—–­ –­—–­—–­—–­—–­—–­—–­—–­—–­—–­— ­—–­—–­—–­—–­—–­—–­—–­—-­—–­-–•¬
|0O×øo· SNES9XGX v003 ·oø×O0| |0O×øo· SNES9XGX v004 ·oø×O0|
`¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨' `¨•¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨ ¨¨¨¨¨¨¨¨¨¨¨¨¨'
PLEASE NOTE: THIS DOCUMENT IS A WORK IN PROGRESS PLEASE NOTE: THIS DOCUMENT IS A WORK IN PROGRESS
[What's New 003] [What's New 004]
- added: option to disable AA filtering
(snes graphics 'crisper', AA now default OFF)
- added: mapped zooming and turbo mode to classic controller
- added: preliminary usb support (loading)
- changed: sram and freezes now saved by filename, not internal romname.
If you have multiple versions of the same game, you can now have
srams and freezes for each version. A prompt to convert to the
new naming is provided for sram only.
- changed: by default, autoload/save sram and freeze enabled
[What Was New 003]
- added: alphabetical file sorting - added: alphabetical file sorting
- added: background logo/backdrop + nicer menus - added: background logo/backdrop + nicer menus
- added: scrolling in ROM selector - added: scrolling in ROM selector
@ -77,11 +88,11 @@ SRAM to any location).
filename preferences/sram autoloading location filename preferences/sram autoloading location
------------------------- ------------------------------------- ------------------------- -------------------------------------
snes9xGX-003-sd-xxxx.dol SD card snes9xGX-00x-sd-xxxx.dol SD card
snes9xGX-003-mcslota-xxxx.dol Memory card in slot A snes9xGX-00x-mcslota-xxxx.dol Memory card in slot A
snes9xGX-003-mcslotb-xxxx.dol Memory card in slot B snes9xGX-00x-mcslotb-xxxx.dol Memory card in slot B
snes9xGX-003-smb-xxxx.dol SMB share (see SMB section below) snes9xGX-00x-smb-xxxx.dol SMB share (see SMB section below)
snes9xGX-003-noload-xxxx.dol none - doesn't load prefs nor autosave SRAM // snes9xGX-00x-noload-xxxx.dol none - doesn't load prefs nor autosave SRAM
The last part of the filename (shown above as xxxx), denotes the wii and gamecube The last part of the filename (shown above as xxxx), denotes the wii and gamecube
versions. versions.

View File

@ -90,78 +90,6 @@ WPAD_BUTTON_HOME, "HOME",
0, "" 0, ""
}; };
/*
// Nunchuk btn def
ctrlr_def[0].type = CTRLR_NUNCHUK;
ctrlr_def[0].num_btns = 13;
ctrlr_def[0].map[] = { WPAD_BUTTON_DOWN, "DOWN",
WPAD_BUTTON_UP, "UP",
WPAD_BUTTON_LEFT, "LEFT",
WPAD_BUTTON_RIGHT, "RIGHT",
WPAD_BUTTON_A, "A",
WPAD_BUTTON_B, "B",
WPAD_BUTTON_1, "1",
WPAD_BUTTON_2, "2",
WPAD_BUTTON_PLUS, "PLUS",
WPAD_BUTTON_MINUS, "MINUS",
WPAD_BUTTON_HOME, "HOME",
WPAD_NUNCHUK_BUTTON_Z, "Z",
WPAD_NUNCHUK_BUTTON_C, "C"
};
// Classic btn def
ctrlr_def[1].type = CTRLR_CLASSIC;
ctrlr_def[1].num_btns = 15;
ctrlr_def[1].map[] = { WPAD_CLASSIC_BUTTON_DOWN, "DOWN",
WPAD_CLASSIC_BUTTON_UP, "UP",
WPAD_CLASSIC_BUTTON_LEFT, "LEFT",
WPAD_CLASSIC_BUTTON_RIGHT, "RIGHT",
WPAD_CLASSIC_BUTTON_A, "A",
WPAD_CLASSIC_BUTTON_B, "B",
WPAD_CLASSIC_BUTTON_X, "X",
WPAD_CLASSIC_BUTTON_Y, "Y",
WPAD_CLASSIC_BUTTON_PLUS, "PLUS",
WPAD_CLASSIC_BUTTON_MINUS, "MINUS",
WPAD_CLASSIC_BUTTON_HOME, "HOME",
WPAD_CLASSIC_BUTTON_FULL_L, "L TRIG",
WPAD_CLASSIC_BUTTON_FULL_R, "R TRIG",
WPAD_CLASSIC_BUTTON_ZL, "ZL",
WPAD_CLASSIC_BUTTON_ZR, "ZR",
};
// Gamecube controller btn def
ctrlr_def[2].type = CTRLR_GCPAD;
ctrlr_def[2].num_btns = 13;
ctrlr_def[2].map[] = { PAD_BUTTON_DOWN, "DOWN",
PAD_BUTTON_UP, "UP",
PAD_BUTTON_LEFT, "LEFT",
PAD_BUTTON_RIGHT, "RIGHT",
PAD_BUTTON_A, "A",
PAD_BUTTON_B, "B",
PAD_BUTTON_X, "X",
PAD_BUTTON_Y, "Y",
PAD_BUTTON_MENU, "MENU",
PAD_BUTTON_START, "START",
PAD_BUTTON_L, "L TRIG",
PAD_BUTTON_R, "R TRIG",
PAD_BUTTON_Z, "Z",
};
// Wiimote btn def
ctrlr_def[3].type = CTRLR_WIIMOTE;
ctrlr_def[3].num_btns = 11;
ctrlr_def[3].map[] = { WPAD_BUTTON_DOWN, "DOWN",
WPAD_BUTTON_UP, "UP",
WPAD_BUTTON_LEFT, "LEFT",
WPAD_BUTTON_RIGHT, "RIGHT",
WPAD_BUTTON_A, "A",
WPAD_BUTTON_B, "B",
WPAD_BUTTON_1, "1",
WPAD_BUTTON_2, "2",
WPAD_BUTTON_PLUS, "PLUS",
WPAD_BUTTON_MINUS, "MINUS",
WPAD_BUTTON_HOME, "HOME"
};
// end buttonmaps
*/
/*** /***
* Default controller maps * Default controller maps
* button press on left, and corresponding snes button on right * button press on left, and corresponding snes button on right

View File

@ -13,6 +13,9 @@
#include <string.h> #include <string.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include <fat.h>
#include <sys/dir.h>
#include "snes9x.h" #include "snes9x.h"
#include "memmap.h" #include "memmap.h"
#include "debug.h" #include "debug.h"
@ -43,7 +46,8 @@ int havedir = 0;
int hasloaded = 0; int hasloaded = 0;
int loadtype = 0; int loadtype = 0;
int LoadDVDFile (unsigned char *buffer); int LoadDVDFile (unsigned char *buffer);
int haveSDdir = 0; bool haveSDdir = 0;
bool haveUSBdir = 0;
extern unsigned long ARAM_ROMSIZE; extern unsigned long ARAM_ROMSIZE;
extern int screenheight; extern int screenheight;
@ -91,7 +95,7 @@ ShowFiles (int offset, int selection)
{ {
/*** Highlighted text entry ***/ /*** Highlighted text entry ***/
for ( w = 0; w < 20; w++ ) for ( w = 0; w < 20; w++ )
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 ); DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
@ -128,6 +132,18 @@ int SNESROMSOffset()
return 0; return 0;
} }
void strip_ext(char* inputstring, char* returnstring)
{
char* loc_dot;
strcpy (returnstring, inputstring);
loc_dot = strrchr(returnstring,'.');
if (loc_dot != NULL)
*loc_dot = '\0'; // strip file extension
return;
}
/** /**
* FileSelector * FileSelector
* *
@ -146,7 +162,9 @@ FileSelector ()
int redraw = 1; int redraw = 1;
int selectit = 0; int selectit = 0;
float mag = 0; float mag = 0;
float mag2 = 0;
u16 ang = 0; u16 ang = 0;
u16 ang2 = 0;
int scroll_delay = 0; int scroll_delay = 0;
bool move_selection = 0; bool move_selection = 0;
#define SCROLL_INITIAL_DELAY 15 #define SCROLL_INITIAL_DELAY 15
@ -165,7 +183,7 @@ FileSelector ()
#ifdef HW_RVL #ifdef HW_RVL
wp = WPAD_ButtonsDown (0); wp = WPAD_ButtonsDown (0);
wh = WPAD_ButtonsHeld (0); wh = WPAD_ButtonsHeld (0);
wpad_get_analogues(0, &mag, &ang); // get joystick info from wii expansions wpad_get_analogues(0, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions
#else #else
wp = 0; wp = 0;
wh = 0; wh = 0;
@ -183,27 +201,36 @@ FileSelector ()
selectit = 0; selectit = 0;
if (filelist[selection].flags) /*** This is directory ***/ if (filelist[selection].flags) /*** This is directory ***/
{ {
if (loadtype == LOAD_SDC) if (loadtype == LOAD_SDC || loadtype == LOAD_USB)
{ {
/* memorize last entries list, actual root directory and selection for next access */ /* memorize last entries list, actual root directory and selection for next access */
haveSDdir = 1; if (loadtype == LOAD_SDC)
haveSDdir = 1;
else
haveUSBdir = 1;
/* update current directory and set new entry list if directory has changed */ /* update current directory and set new entry list if directory has changed */
int status = updateSDdirname(); int status = updateFATdirname();
if (status == 1) // ok, open directory if (status == 1) // ok, open directory
{ {
maxfiles = parseSDdirectory(); maxfiles = parseFATdirectory();
if (!maxfiles) if (!maxfiles)
{ {
WaitPrompt ((char*) "Error reading directory !"); WaitPrompt ((char*) "Error reading directory !");
haverom = 1; // quit SD menu haverom = 1; // quit SD menu
haveSDdir = 0; // reset everything at next access if (loadtype == LOAD_SDC) // reset everything at next access
haveSDdir = 0;
else
haveUSBdir = 0;
} }
} }
else if (status == -1) // directory name too long else if (status == -1) // directory name too long
{ {
haverom = 1; // quit SD menu haverom = 1; // quit SD menu
haveSDdir = 0; // reset everything at next access if (loadtype == LOAD_SDC) // reset everything at next access
haveSDdir = 0;
else
haveUSBdir = 0;
} }
} }
else else
@ -224,6 +251,9 @@ FileSelector ()
{ {
rootdir = filelist[selection].offset; rootdir = filelist[selection].offset;
rootdirlength = filelist[selection].length; rootdirlength = filelist[selection].length;
/*** store the filename (used for sram/freeze naming) ***/
strip_ext(filelist[selection].filename, Memory.ROMFilename); // store stripped filename in Memory.ROMFilename
switch (loadtype) switch (loadtype)
{ {
@ -234,11 +264,11 @@ FileSelector ()
case LOAD_SMB: case LOAD_SMB:
/*** Load from SMB ***/ /*** Load from SMB ***/
ARAM_ROMSIZE = ARAM_ROMSIZE = LoadSMBFile (filelist[selection].filename,
LoadSMBFile (filelist[selection].filename,
filelist[selection].length); filelist[selection].length);
break; break;
case LOAD_USB:
case LOAD_SDC: case LOAD_SDC:
/*** Load from SD Card ***/ /*** Load from SD Card ***/
/* memorize last entries list, actual root directory and selection for next access */ /* memorize last entries list, actual root directory and selection for next access */
@ -391,7 +421,8 @@ OpenDVD ()
if (havedir == 0) if (havedir == 0)
{ {
offset = selection = 0; /* reset file selector */ offset = selection = 0; /* reset file selector */
haveSDdir = 0; /* prevent conflicts with SDCARD file selector */ haveSDdir = 0; /* prevent conflicts with SDCARD, USB file selector */
haveUSBdir = 0;
if ((maxfiles = parsedirectory ())) if ((maxfiles = parsedirectory ()))
{ {
@ -435,6 +466,53 @@ OpenSMB ()
return 0; return 0;
} }
// is_mounted
//
// to check whether FAT media are detected.
bool fat_is_mounted(PARTITION_INTERFACE partition) {
char prefix[] = "fatX:/";
prefix[3] = partition + '0';
DIR_ITER *dir = diropen(prefix);
if (dir) {
dirclose(dir);
return true;
}
return false;
}
void fat_enable_readahead_all() {
int i;
for (i=1; i <= 4; ++i) {
if (fat_is_mounted((PARTITION_INTERFACE)i)) fatEnableReadAhead((PARTITION_INTERFACE)i, 64, 128);
}
}
bool fat_remount(PARTITION_INTERFACE partition) {
//ShowAction("remounting...");
/* // removed to make usb work...
if (fat_is_mounted(partition))
{
fatUnmount(partition);
}
*/
fatMountNormalInterface(partition, 8);
fatSetDefaultInterface(partition);
//fatEnableReadAhead(partition, 64, 128);
if (fat_is_mounted(partition))
{
//ShowAction("remount successful.");
sleep(1);
return 1;
} else {
ShowAction("FAT mount failed.");
sleep(1);
return 0;
}
}
/** /**
* OpenSD * OpenSD
* *
@ -447,18 +525,89 @@ OpenSD ()
char buf[50] = ""; char buf[50] = "";
loadtype = LOAD_SDC; loadtype = LOAD_SDC;
/*
fatUnmount(PI_INTERNAL_SD);
fatMountNormalInterface(PI_INTERNAL_SD,8);
//fatEnableReadAhead(PI_INTERNAL_SD, 64, 128);
fatSetDefaultInterface(PI_INTERNAL_SD);
//chdir("fat0:/");
*/
#ifdef HW_RVL
// only remount on wii
if (!fat_remount (PI_INTERNAL_SD))
return 0;
#endif
if (haveSDdir == 0) if (haveSDdir == 0)
{ {
/* don't mess with DVD entries */ /* don't mess with DVD entries */
havedir = 0; // gamecube only havedir = 0;
haveUSBdir = 0;
/* change current dir to snes roms directory */ /* change current dir to snes roms directory */
sprintf ( currSDdir, "%s/%s", ROOTSDDIR, SNESROMDIR ); sprintf ( currSDdir, "%s/%s", ROOTSDDIR, SNESROMDIR );
/* Parse initial root directory and get entries list */ /* Parse initial root directory and get entries list */
if ((maxfiles = parseSDdirectory ())) if ((maxfiles = parseFATdirectory ()))
{
/* Select an entry */
return FileSelector ();
}
else
{
/* no entries found */
sprintf (msg, "No Files Found!");
WaitPrompt (msg);
return 0;
}
}
/* Retrieve previous entries list and made a new selection */
else
return FileSelector ();
return 0;
}
/**
* OpenUSB
*
* Function to load from a USB device (wii only)
*/
int
OpenUSB ()
{
char msg[80];
char buf[50] = "";
/*
//fatUnmount(PI_USBSTORAGE);
fatUnmount(PI_INTERNAL_SD);
//if(!fatMountNormalInterface(PI_USBSTORAGE,8))
// return 0;
//fatEnableReadAhead(PI_USBSTORAGE, 64, 128);
fatSetDefaultInterface(PI_USBSTORAGE);
*/
#ifdef HW_RVL
// make compiler happy
if (!fat_remount (PI_USBSTORAGE))
return 0;
#endif
loadtype = LOAD_USB;
if (haveUSBdir == 0)
{
/* don't mess with DVD, SDCARD entries */
havedir = 0;
haveSDdir = 0;
/* change current dir to snes roms directory */
sprintf ( currSDdir, "%s/%s", ROOTSDDIR, SNESROMDIR );
/* Parse initial root directory and get entries list */
if ((maxfiles = parseFATdirectory ()))
{ {
/* Select an entry */ /* Select an entry */
return FileSelector (); return FileSelector ();

View File

@ -13,11 +13,13 @@
int OpenDVD (); int OpenDVD ();
int OpenSMB (); int OpenSMB ();
int OpenSD (); int OpenSD ();
int OpenUSB ();
#define LOAD_DVD 1 #define LOAD_DVD 1
#define LOAD_SMB 2 #define LOAD_SMB 2
#define LOAD_SDC 4 #define LOAD_SDC 4
#define ROOTSDDIR "fat:/" #define LOAD_USB 8
#define ROOTSDDIR "fat3:/"
#define SNESROMDIR "snes9x/roms" #define SNESROMDIR "snes9x/roms"
#define SNESSAVEDIR "snes9x/saves" #define SNESSAVEDIR "snes9x/saves"

View File

@ -534,7 +534,7 @@ DrawMenu (char items[][20], char *title, int maxitems, int selected, int fontsiz
if (title != NULL) if (title != NULL)
DrawText (-1, 60, title); DrawText (-1, 60, title);
setfontsize (12); setfontsize (12);
DrawText (510, screenheight - 20, "Snes9x GX 003"); DrawText (510, screenheight - 20, "Snes9x GX 004");
//#endif //#endif
setfontsize (fontsize); // set font size setfontsize (fontsize); // set font size
@ -579,7 +579,9 @@ RunMenu (char items[][20], int maxitems, char *title, int fontsize)
int ret = 0; int ret = 0;
signed char a; signed char a;
float mag = 0; float mag = 0;
float mag2 = 0;
u16 ang = 0; u16 ang = 0;
u16 ang2 = 0;
//while (!(PAD_ButtonsDown (0) & PAD_BUTTON_B) && (quit == 0)) //while (!(PAD_ButtonsDown (0) & PAD_BUTTON_B) && (quit == 0))
while (quit == 0) while (quit == 0)
@ -593,7 +595,7 @@ RunMenu (char items[][20], int maxitems, char *title, int fontsize)
p = PAD_ButtonsDown (0); p = PAD_ButtonsDown (0);
#ifdef HW_RVL #ifdef HW_RVL
wp = WPAD_ButtonsDown (0); wp = WPAD_ButtonsDown (0);
wpad_get_analogues(0, &mag, &ang); // get joystick info from wii expansions wpad_get_analogues(0, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions
#else #else
wp = 0; wp = 0;
#endif #endif

View File

@ -46,6 +46,8 @@ card_dir CardDir;
card_file CardFile; card_file CardFile;
card_stat CardStatus; card_stat CardStatus;
extern void uselessinquiry();
/**************************************************************************** /****************************************************************************
* Clear the savebuffer * Clear the savebuffer
@ -92,14 +94,16 @@ int MountCard(int cslot)
int ret; int ret;
int tries; int tries;
EXI_ProbeReset();
EXI_ProbeReset();
/*** Mount the card ***/
//Mount the card
ret = CARD_Mount (cslot, SysArea, NULL); ret = CARD_Mount (cslot, SysArea, NULL);
tries = 0; tries = 0;
while ( tries < 3 && ret == CARD_ERROR_IOERROR ) while ( tries < 3 && ret == CARD_ERROR_IOERROR )
{ {
EXI_ProbeReset ();
if (cslot == CARD_SLOTA) if (cslot == CARD_SLOTA)
WaitPrompt((char*) "Replug card in slot A!"); WaitPrompt((char*) "Replug card in slot A!");
else else
@ -113,6 +117,7 @@ int MountCard(int cslot)
tries = 0; tries = 0;
while ( tries < 5 && ret == CARD_ERROR_NOCARD ) while ( tries < 5 && ret == CARD_ERROR_NOCARD )
{ {
EXI_ProbeReset ();
ShowAction ((char*) "Mounting card..."); ShowAction ((char*) "Mounting card...");
CARD_Unmount (cslot); CARD_Unmount (cslot);
usleep(500000); // wait half second usleep(500000); // wait half second
@ -125,6 +130,7 @@ int MountCard(int cslot)
tries = 0; tries = 0;
while ( tries < 5 && ret == CARD_ERROR_UNLOCKED ) while ( tries < 5 && ret == CARD_ERROR_UNLOCKED )
{ {
EXI_ProbeReset ();
ShowAction ((char*) "Waiting for unlock..."); ShowAction ((char*) "Waiting for unlock...");
usleep(500000); // wait half second usleep(500000); // wait half second
ShowAction ((char*) ""); ShowAction ((char*) "");
@ -468,14 +474,31 @@ SaveBufferToMC (unsigned char *buf, int slot, char *filename, int datasize, bool
void void
LoadSRAMFromMC (int slot, int silent) LoadSRAMFromMC (int slot, int silent)
{ {
char filename[128]; char filename[MAXPATHLEN];
int offset = 0;
ShowAction ((char*) "Loading SRAM from MC..."); ShowAction ((char*) "Loading SRAM from MC...");
/*** Build SRAM filename ***/
sprintf (filename, "%s.srm", Memory.ROMName);
int offset = LoadBufferFromMC (savebuffer, slot, filename, silent); // check for 'old' version of sram
sprintf (filename, "%s.srm", Memory.ROMName); // Build old SRAM filename
offset = LoadBufferFromMC (savebuffer, slot, filename, silent); // load file
if (offset > 0) // old sram found
{
if (WaitPromptChoice ((char*)"Old SRAM found. Convert and delete?", (char*)"Cancel", (char*)"Do it"))
{
decodesavedata (offset);
CARD_Delete (slot, filename); // delete old sram
SaveSRAMToMC (slot, silent);
}
}
//
/*** Build SRAM filename ***/
sprintf (filename, "%s.srm", Memory.ROMFilename);
offset = LoadBufferFromMC (savebuffer, slot, filename, silent);
if ( offset > 0 ) if ( offset > 0 )
{ {
@ -504,7 +527,7 @@ SaveSRAMToMC (int slot, int silent)
ShowAction ((char*) "Saving SRAM to MC..."); ShowAction ((char*) "Saving SRAM to MC...");
/*** Build SRAM filename ***/ /*** Build SRAM filename ***/
sprintf (filename, "%s.srm", Memory.ROMName); sprintf (filename, "%s.srm", Memory.ROMFilename);
datasize = prepareMCsavedata (); datasize = prepareMCsavedata ();
offset = SaveBufferToMC (savebuffer, slot, filename, datasize, silent); offset = SaveBufferToMC (savebuffer, slot, filename, datasize, silent);

View File

@ -47,7 +47,7 @@ extern unsigned char savebuffer[];
static int bufoffset; static int bufoffset;
static char membuffer[MEMBUFFER]; static char membuffer[MEMBUFFER];
char freezecomment[2][32] = { {"Snes9x GX 003 Freeze"}, {"Freeze"} }; char freezecomment[2][32] = { {"Snes9x GX 004 Freeze"}, {"Freeze"} };
/** /**
@ -144,14 +144,14 @@ NGCFreezeGame (int where, bool8 silent)
if (where == 4) if (where == 4)
{ {
/*** Freeze to SMB ***/ /*** Freeze to SMB ***/
sprintf (filename, "/%s/%s.frz", SNESSAVEDIR, Memory.ROMName); sprintf (filename, "/%s/%s.frz", SNESSAVEDIR, Memory.ROMFilename);
} }
else if (where == 2 || where == 3) else if (where == 2 || where == 3)
{ {
/*** Freeze to SDCard in slot A or slot B ***/ /*** Freeze to SDCard in slot A or slot B ***/
#ifdef SDUSE_LFN #ifdef SDUSE_LFN
sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMName); sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMFilename);
#else #else
/*** Until we have LFN on SD ... ***/ /*** Until we have LFN on SD ... ***/
sprintf (filename, "%s/%s/%08x.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32); sprintf (filename, "%s/%s/%08x.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32);
@ -160,7 +160,7 @@ NGCFreezeGame (int where, bool8 silent)
else else
{ {
/*** Freeze to MC in slot A or slot B ***/ /*** Freeze to MC in slot A or slot B ***/
sprintf (filename, "%s.snz", Memory.ROMName); sprintf (filename, "%s.snz", Memory.ROMFilename);
} }
S9xSetSoundMute (TRUE); S9xSetSoundMute (TRUE);
@ -345,7 +345,7 @@ NGCUnfreezeGame (int from, bool8 silent)
if (from == 4) if (from == 4)
{ {
/*** From SMB ***/ /*** From SMB ***/
sprintf (filename, "\\%s\\%s.frz", SNESSAVEDIR, Memory.ROMName); sprintf (filename, "\\%s\\%s.frz", SNESSAVEDIR, Memory.ROMFilename);
ConnectSMB (); ConnectSMB ();
/*** Read the file into memory ***/ /*** Read the file into memory ***/
@ -379,7 +379,7 @@ NGCUnfreezeGame (int from, bool8 silent)
{ {
#ifdef SDUSE_LFN #ifdef SDUSE_LFN
sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMName); sprintf (filename, "%s/%s/%s.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMFilename);
#else #else
/*** From SDCard ***/ /*** From SDCard ***/
sprintf (filename, "%s/%s/%08x.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32); sprintf (filename, "%s/%s/%08x.frz", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32);
@ -417,7 +417,7 @@ NGCUnfreezeGame (int from, bool8 silent)
{ {
ShowAction ((char*) "Loading freeze file..."); ShowAction ((char*) "Loading freeze file...");
sprintf (filename, "%s.snz", Memory.ROMName); sprintf (filename, "%s.snz", Memory.ROMFilename);
int ret = LoadBufferFromMC ( savebuffer, from, filename, silent ); int ret = LoadBufferFromMC ( savebuffer, from, filename, silent );
if ( ret ) if ( ret )

View File

@ -53,7 +53,7 @@ extern unsigned long ARAM_ROMSIZE;
void Reboot() { void Reboot() {
#ifdef __wii__ #ifdef HW_RVL
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0); SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
#else #else
#define SOFTRESET_ADR ((volatile u32*)0xCC003024) #define SOFTRESET_ADR ((volatile u32*)0xCC003024)
@ -149,9 +149,9 @@ FreezeManager ()
/**************************************************************************** /****************************************************************************
* Load Manager * Load Manager
****************************************************************************/ ****************************************************************************/
int loadmancountwii = 2; int loadmancountwii = 3;
char loadmanwii[][20] = { "Load from SD", char loadmanwii[][20] = { "Load from SD",
"Return to previous" "Load from USB", "Return to previous"
}; };
int loadmancount = 4; int loadmancount = 4;
char loadman[][20] = { "Load from SD", char loadman[][20] = { "Load from SD",
@ -168,15 +168,32 @@ LoadManager ()
while (quit == 0) while (quit == 0)
{ {
if ( isWii ) /* Wii menu */ #ifdef HW_RVL
{ /* Wii menu */
ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager"); ret = RunMenu (loadmanwii, loadmancountwii, (char*)"Load Manager");
if (ret >= loadmancountwii-1)
ret = loadmancount-1; switch (ret)
} {
else /* Gamecube menu */ case 0:
ret = RunMenu (loadman, loadmancount, (char*)"Load Manager"); /*** Load from SD ***/
quit = OpenSD ();
break;
case 1:
/*** Load from USB ***/
quit = OpenUSB ();
break;
case -1: /*** Button B ***/
case 2:
retval = 0;
quit = 1;
break;
}
#else
/* Gamecube menu */
ret = RunMenu (loadman, loadmancount, (char*)"Load Manager");
switch (ret) switch (ret)
{ {
case 0: case 0:
@ -199,7 +216,8 @@ LoadManager ()
retval = 0; retval = 0;
quit = 1; quit = 1;
break; break;
} }
#endif
} }
/*** /***
@ -313,12 +331,12 @@ SaveManager ()
/**************************************************************************** /****************************************************************************
* Emulator Options * Emulator Options
****************************************************************************/ ****************************************************************************/
static int emuCount = 11; static int emuCount = 12;
static char emulatorOptions[][20] = { "Reverse Stereo OFF", static char emulatorOptions[][20] = { "Reverse Stereo OFF",
"Interp. Sound ON", "Transparency ON", "FPS Display OFF", "Interp. Sound ON", "Transparency ON", "FPS Display OFF",
"MultiTap 5 OFF", "C-Stick Zoom OFF", "MultiTap 5 OFF", "C-Stick Zoom OFF",
"Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF", "Auto Load OFF", "Auto Save OFF", "Verify MC Saves OFF",
"Save Prefs Now", "Return to previous" "Video Filtering OFF", "Save Prefs Now", "Return to previous"
}; };
void void
@ -360,34 +378,32 @@ EmulatorOptions ()
sprintf (emulatorOptions[8], "Verify MC Saves %s", sprintf (emulatorOptions[8], "Verify MC Saves %s",
GCSettings.VerifySaves == true ? " ON" : "OFF"); GCSettings.VerifySaves == true ? " ON" : "OFF");
sprintf (emulatorOptions[9], "Video Filtering %s",
GCSettings.render == true ? " ON" : "OFF");
ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options"); ret = RunMenu (emulatorOptions, emuCount, (char*)"Emulator Options");
switch (ret) switch (ret)
{ {
case 0: case 0:
Settings.ReverseStereo = Settings.ReverseStereo ^= 1;
(Settings.ReverseStereo == false ? true : false);
break; break;
case 1: case 1:
Settings.InterpolatedSound = Settings.InterpolatedSound ^= 1;
(Settings.InterpolatedSound == false ? true : false);
break; break;
case 2: case 2:
Settings.Transparency = Settings.Transparency ^= 1;
(Settings.Transparency == false ? true : false);
break; break;
case 3: case 3:
Settings.DisplayFrameRate = Settings.DisplayFrameRate ^= 1;
(Settings.DisplayFrameRate == false ? true : false);
break; break;
case 4: case 4:
Settings.MultiPlayer5Master = Settings.MultiPlayer5Master ^= 1;
(Settings.MultiPlayer5Master == false ? true : false);
if (Settings.MultiPlayer5Master) if (Settings.MultiPlayer5Master)
{ {
@ -400,8 +416,7 @@ EmulatorOptions ()
break; break;
case 5: case 5:
GCSettings.NGCZoom = GCSettings.NGCZoom ^= 1;
(GCSettings.NGCZoom == false ? true : false);
break; break;
case 6: case 6:
@ -417,16 +432,19 @@ EmulatorOptions ()
break; break;
case 8: case 8:
GCSettings.VerifySaves = GCSettings.VerifySaves ^= 1;
(GCSettings.VerifySaves == false ? true : false);
break; break;
case 9: case 9:
GCSettings.render ^= 1;
break;
case 10:
quickSavePrefs(NOTSILENT); quickSavePrefs(NOTSILENT);
break; break;
case -1: /*** Button B ***/ case -1: /*** Button B ***/
case 10: case 11:
quit = 1; quit = 1;
break; break;
@ -824,7 +842,7 @@ mainmenu ()
case 7: case 7:
/*** Exit to Loader ***/ /*** Exit to Loader ***/
#ifdef __wii__ #ifdef HW_RVL
exit(0); exit(0);
#else // gamecube #else // gamecube
if (psoid[0] == PSOSDLOADID) if (psoid[0] == PSOSDLOADID)
@ -856,4 +874,5 @@ mainmenu ()
VIDEO_WaitVSync(); VIDEO_WaitVSync();
#endif #endif
ReInitGCVideo(); // update video after reading settings
} }

View File

@ -31,7 +31,7 @@ extern unsigned int wmpadmap[];
extern unsigned int ccpadmap[]; extern unsigned int ccpadmap[];
extern unsigned int ncpadmap[]; extern unsigned int ncpadmap[];
#define PREFSVERSTRING "Snes9x GX 003 Prefs" #define PREFSVERSTRING "Snes9x GX 004 Prefs"
char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} }; char prefscomment[2][32] = { {PREFSVERSTRING}, {"Preferences"} };

View File

@ -203,8 +203,8 @@ DefaultSettings ()
/*** SDD1 - Star Ocean Returns -;) ***/ /*** SDD1 - Star Ocean Returns -;) ***/
Settings.SDD1Pack = true; Settings.SDD1Pack = true;
GCSettings.AutoLoad = 0; GCSettings.AutoLoad = 1;
GCSettings.AutoSave = 0; GCSettings.AutoSave = 1;
strncpy (GCSettings.gcip, GC_IP, 15); strncpy (GCSettings.gcip, GC_IP, 15);
strncpy (GCSettings.gwip, GW_IP, 15); strncpy (GCSettings.gwip, GW_IP, 15);
@ -218,6 +218,7 @@ DefaultSettings ()
GCSettings.NGCZoom = 0; GCSettings.NGCZoom = 0;
GCSettings.VerifySaves = 0; GCSettings.VerifySaves = 0;
GCSettings.render = 0;
Settings.ForceNTSC = 0; Settings.ForceNTSC = 0;
Settings.ForcePAL = 0; Settings.ForcePAL = 0;

View File

@ -32,6 +32,8 @@ char currSDdir[MAXPATHLEN];
extern int offset; extern int offset;
extern int selection; extern int selection;
extern int loadtype;
extern FILEENTRIES filelist[MAXFILES]; extern FILEENTRIES filelist[MAXFILES];
/*************************************************************************** /***************************************************************************
@ -62,9 +64,9 @@ static int FileSortCallback(const void *f1, const void *f2)
} }
/*************************************************************************** /***************************************************************************
* Update SDCARD curent directory name * Update FAT (sdcard, usb) curent directory name
***************************************************************************/ ***************************************************************************/
int updateSDdirname() int updateFATdirname()
{ {
int size=0; int size=0;
char *test; char *test;
@ -115,9 +117,9 @@ int updateSDdirname()
} }
/*************************************************************************** /***************************************************************************
* Browse SDCARD subdirectories * Browse FAT (sdcard, usb) subdirectories
***************************************************************************/ ***************************************************************************/
int parseSDdirectory() { int parseFATdirectory() {
int nbfiles = 0; int nbfiles = 0;
DIR_ITER *sddir; DIR_ITER *sddir;
char filename[MAXPATHLEN]; char filename[MAXPATHLEN];
@ -130,7 +132,13 @@ int parseSDdirectory() {
/* open the directory */ /* open the directory */
sddir = diropen(currSDdir); sddir = diropen(currSDdir);
if (sddir == NULL) { if (sddir == NULL) {
sprintf(currSDdir,"%s",ROOTSDDIR); // if we can't open the previous dir, open root dir /*** if we can't open the previous dir, open root dir ***/
if (loadtype == LOAD_USB)
sprintf(currSDdir,"fat4:/");
else // LOAD_SDC
//sprintf(currSDdir,"%s",ROOTSDDIR);
sprintf(currSDdir,"fat3:/");
sddir = diropen(currSDdir); sddir = diropen(currSDdir);
WaitPrompt(msg); WaitPrompt(msg);
if (sddir == NULL) { if (sddir == NULL) {
@ -164,7 +172,8 @@ int parseSDdirectory() {
/**************************************************************************** /****************************************************************************
* LoadSDFile * LoadSDFile
****************************************************************************/ ****************************************************************************/
extern int haveSDdir; extern bool haveSDdir;
extern bool haveUSBdir;
int int
LoadSDFile (char *filename, int length) LoadSDFile (char *filename, int length)
{ {
@ -183,9 +192,10 @@ LoadSDFile (char *filename, int length)
{ {
WaitPrompt((char*) "Maximum Filename Length reached !"); WaitPrompt((char*) "Maximum Filename Length reached !");
haveSDdir = 0; // reset everything before next access haveSDdir = 0; // reset everything before next access
haveUSBdir = 0;
return -1; return -1;
} }
handle = fopen (filepath, "rb"); handle = fopen (filepath, "rb");
if (handle > 0) if (handle > 0)
{ {
@ -306,7 +316,7 @@ void SaveSRAMToSD (bool silent)
ShowAction ((char*) "Saving SRAM to SD..."); ShowAction ((char*) "Saving SRAM to SD...");
#ifdef SDUSE_LFN #ifdef SDUSE_LFN
sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMName); sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMFilename);
#else #else
sprintf (filepath, "%s/%s/%08x.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32); sprintf (filepath, "%s/%s/%08x.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32);
#endif #endif
@ -332,13 +342,29 @@ void SaveSRAMToSD (bool silent)
void void
LoadSRAMFromSD (bool silent) LoadSRAMFromSD (bool silent)
{ {
char filepath[1024]; char filepath[MAXPATHLEN];
int offset = 0; int offset = 0;
ShowAction ((char*) "Loading SRAM from SD..."); ShowAction ((char*) "Loading SRAM from SD...");
// check for 'old' version of sram
sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMName); // Build old SRAM filename
offset = LoadBufferFromSD (filepath, silent); // load file
if (offset > 0) // old sram found
{
if (WaitPromptChoice ((char*)"Old SRAM found. Convert and delete?", (char*)"Cancel", (char*)"Do it"))
{
decodesavedata (offset);
remove (filepath); // delete old sram
SaveSRAMToSD (silent);
}
}
//
#ifdef SDUSE_LFN #ifdef SDUSE_LFN
sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMName); sprintf (filepath, "%s/%s/%s.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMFilename);
#else #else
sprintf (filepath, "%s/%s/%08x.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32); sprintf (filepath, "%s/%s/%08x.srm", ROOTSDDIR, SNESSAVEDIR, Memory.ROMCRC32);
#endif #endif

View File

@ -22,8 +22,8 @@
#include <unistd.h> #include <unistd.h>
static int FileSortCallback(const void *f1, const void *f2); static int FileSortCallback(const void *f1, const void *f2);
int updateSDdirname(); int updateFATdirname();
int parseSDdirectory(); int parseFATdirectory();
int LoadSDFile (char *filename, int length); int LoadSDFile (char *filename, int length);
void SaveSRAMToSD (bool silent); void SaveSRAMToSD (bool silent);
void LoadSRAMFromSD (bool silent); void LoadSRAMFromSD (bool silent);

View File

@ -381,7 +381,7 @@ SaveSRAMToSMB (bool8 silent)
int datasize; int datasize;
int offset; int offset;
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName); sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMFilename);
if (!silent) if (!silent)
ShowAction ((char*) "Saving SRAM to SMB..."); ShowAction ((char*) "Saving SRAM to SMB...");
@ -409,7 +409,7 @@ LoadSRAMFromSMB (bool8 silent)
char filepath[1024]; char filepath[1024];
int offset; int offset;
sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMName); sprintf (filepath, "%s\\%s.srm", SNESSAVEDIR, Memory.ROMFilename);
ShowAction ((char*) "Loading SRAM from SMB..."); ShowAction ((char*) "Loading SRAM from SMB...");
offset = LoadBufferFromSMB (filepath, silent); offset = LoadBufferFromSMB (filepath, silent);

View File

@ -11,7 +11,6 @@
****************************************************************************/ ****************************************************************************/
#ifndef _NGCSMB_ #ifndef _NGCSMB_
#define _NGCSMB_ #define _NGCSMB_
void ConnectSMB (); void ConnectSMB ();
@ -36,5 +35,4 @@ typedef struct
} }
SMBINFO; SMBINFO;
#endif #endif

View File

@ -198,6 +198,8 @@ extern int FrameTimer;
extern long long prev; extern long long prev;
extern unsigned int timediffallowed; extern unsigned int timediffallowed;
extern void fat_enable_readahead_all();
/**************************************************************************** /****************************************************************************
* Controller Functions * Controller Functions
* *
@ -298,7 +300,9 @@ decodepad (int pad)
u32 jp, wp; u32 jp, wp;
float t; float t;
float mag = 0; float mag = 0;
float mag2 = 0;
u16 ang = 0; u16 ang = 0;
u16 ang2 = 0;
u32 exp_type; u32 exp_type;
/*** Do analogue updates ***/ /*** Do analogue updates ***/
@ -306,7 +310,7 @@ decodepad (int pad)
y = PAD_StickY (pad); y = PAD_StickY (pad);
jp = PAD_ButtonsHeld (pad); jp = PAD_ButtonsHeld (pad);
#ifdef HW_RVL #ifdef HW_RVL
exp_type = wpad_get_analogues(pad, &mag, &ang); // get joystick info from wii expansions exp_type = wpad_get_analogues(pad, &mag, &ang, &mag2, &ang2); // get joystick info from wii expansions
wp = WPAD_ButtonsHeld (pad); // wiimote wp = WPAD_ButtonsHeld (pad); // wiimote
#else #else
wp = 0; wp = 0;
@ -438,7 +442,12 @@ NGCReportButtons ()
s8 gc_py = PAD_SubStickY (0); s8 gc_py = PAD_SubStickY (0);
u16 gc_pb = PAD_ButtonsHeld (0); u16 gc_pb = PAD_ButtonsHeld (0);
#ifdef HW_RVL #ifdef HW_RVL
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote float mag1 = 0;
float mag2 = 0;
u16 ang1 = 0;
u16 ang2 = 0;
u32 wm_pb = WPAD_ButtonsHeld (0); // wiimote / expansion button info
wpad_get_analogues(0, &mag1, &ang1, &mag2, &ang2); // get joystick info from wii expansions
#endif #endif
/*** Check for video zoom ***/ /*** Check for video zoom ***/
@ -446,9 +455,19 @@ NGCReportButtons ()
{ {
if (gc_py < -18 || gc_py > 18) if (gc_py < -18 || gc_py > 18)
zoom ((float) gc_py / -18); zoom ((float) gc_py / -18);
#ifdef HW_RVL
if ( mag2>0.2 && (ang2>340 || ang2<20) ) // classic rjs up
zoom ((float) mag2 / -0.2);
if ( mag2>0.2 && (ang2>160 && ang2<200) ) // classic rjs down
zoom ((float) mag2 / 0.2);
#endif
} }
Settings.TurboMode = (gc_px > 70); Settings.TurboMode = ( (gc_px > 70)
#ifdef HW_RVL
|| (mag2>JOY_THRESHOLD && ang2>75 && ang2<115)
#endif
); // RIGHT on c-stick and on classic ctrlr right joystick
/*** Check for menu: /*** Check for menu:
CStick left CStick left
@ -512,9 +531,9 @@ NGCReportButtons ()
* gets the analogue stick magnitude and angle values ( * gets the analogue stick magnitude and angle values (
* from classic or nunchuk expansions) * from classic or nunchuk expansions)
****************************************************************************/ ****************************************************************************/
u32 wpad_get_analogues(int pad, float* mag, u16* ang) u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2)
{ {
*mag = *ang = 0; *mag1 = *ang1 = *mag2 = *ang2 = 0;
u32 exp_type = 0; u32 exp_type = 0;
#ifdef HW_RVL #ifdef HW_RVL
struct expansion_t exp; struct expansion_t exp;
@ -525,13 +544,15 @@ u32 wpad_get_analogues(int pad, float* mag, u16* ang)
WPAD_Expansion(pad, &exp); // expansion connected. get info WPAD_Expansion(pad, &exp); // expansion connected. get info
if (exp_type == WPAD_EXP_CLASSIC) if (exp_type == WPAD_EXP_CLASSIC)
{ {
*ang = exp.classic.ljs.ang; // left cc joystick *ang1 = exp.classic.ljs.ang; // left cc joystick
*mag = exp.classic.ljs.mag; *mag1 = exp.classic.ljs.mag;
*ang2 = exp.classic.rjs.ang; // right cc joystick
*mag2 = exp.classic.rjs.mag;
} }
else if (exp_type == WPAD_EXP_NUNCHUK) else if (exp_type == WPAD_EXP_NUNCHUK)
{ {
*ang = exp.nunchuk.js.ang; // nunchuk joystick *ang1 = exp.nunchuk.js.ang; // nunchuk joystick
*mag = exp.nunchuk.js.mag; *mag1 = exp.nunchuk.js.mag;
} }
} }
#endif #endif
@ -677,8 +698,8 @@ main ()
/*** Initialize libFAT and SD cards ***/ /*** Initialize libFAT and SD cards ***/
fatInitDefault(); fatInitDefault();
//sdio_Startup(); // wii front sd //fatInit(8192, false);
//sdgecko_initIODefault(); // sd gecko //fat_enable_readahead_all();
/*** Initialize DVD subsystem ***/ /*** Initialize DVD subsystem ***/

View File

@ -180,6 +180,8 @@ struct SGCSettings{
char smbshare[20]; char smbshare[20];
bool8 NGCZoom; bool8 NGCZoom;
uint8 VerifySaves; uint8 VerifySaves;
u16 render; // 0 - original, 1 - no AA
u32 QuickSaveSlot; // -1 Disabled - no prefs are loaded, 0 Memory card in slot A, 1 Memory card in slot B, 2 SD card in slot A, 3 SD card in slot B, 4 SMB share, 5 USB
}; };
START_EXTERN_C START_EXTERN_C
@ -187,7 +189,7 @@ extern struct SGCSettings GCSettings;
extern unsigned short saveicon[1024]; extern unsigned short saveicon[1024];
extern bool8 isWii; extern bool8 isWii;
extern u32 wpad_get_analogues(int pad, float* mag, u16* ang); extern u32 wpad_get_analogues(int pad, float* mag1, u16* ang1, float* mag2, u16* ang2);
END_EXTERN_C END_EXTERN_C
#define JOY_THRESHOLD 0.70 // for wii (expansion) analogues #define JOY_THRESHOLD 0.70 // for wii (expansion) analogues

View File

@ -28,7 +28,7 @@ extern int padcal;
extern unsigned short gcpadmap[]; extern unsigned short gcpadmap[];
//extern unsigned short padmap[4]; //extern unsigned short padmap[4];
char sramcomment[2][32] = { {"Snes9x GX 003 SRAM"}, {"Savegame"} }; char sramcomment[2][32] = { {"Snes9x GX 004 SRAM"}, {"Savegame"} };
/**************************************************************************** /****************************************************************************
* Prepare Memory Card SRAM Save Data * Prepare Memory Card SRAM Save Data

View File

@ -29,6 +29,7 @@
//#include "spc7110.h" //#include "spc7110.h"
//#include "controls.h" //#include "controls.h"
#include "aram.h" #include "aram.h"
#include "snes9xGX.h"
//#include "video.h" //#include "video.h"
/*** Snes9x GFX Buffer ***/ /*** Snes9x GFX Buffer ***/
@ -382,6 +383,28 @@ InitGCVideo ()
*/ */
} }
void ReInitGCVideo()
{
Mtx p;
GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
GX_SetDispCopyYScale ((f32) vmode->xfbHeight / (f32) vmode->efbHeight);
GX_SetScissor (0, 0, vmode->fbWidth, vmode->efbHeight);
GX_SetDispCopySrc (0, 0, vmode->fbWidth, vmode->efbHeight);
GX_SetDispCopyDst (vmode->fbWidth, vmode->xfbHeight);
GX_SetCopyFilter (vmode->aa, vmode->sample_pattern, GCSettings.render ? GX_TRUE : GX_FALSE,
vmode->vfilter);
GX_SetFieldMode (vmode->field_rendering,
((vmode->viHeight ==
2 * vmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetPixelFmt (GX_PF_RGB8_Z24, GX_ZC_LINEAR);
// GX_CopyDisp (xfb[whichfb], GX_TRUE);
guPerspective (p, 60, 1.33F, 10.0F, 1000.0F);
GX_LoadProjectionMtx (p, GX_PERSPECTIVE);
}
/**************************************************************************** /****************************************************************************
* Drawing screen * Drawing screen
****************************************************************************/ ****************************************************************************/
@ -420,85 +443,6 @@ setGFX ()
GFX.Pitch = 1024; GFX.Pitch = 1024;
} }
#ifndef NGCC
#if 0
/****************************************************************************
* MakeTexture
*
* GC requires RGB565 colour tiles of 4 x 4 pixels.
* Ok, apparently the pipeline stalls waiting for the indexed register to update.
* Solution : Use R9 to mirror R4
*
* THIS IS NOW UNUSED, BUT LEFT HERE SO I CAN TINKER -;)
****************************************************************************/
void
MakeTexture (char *src, /*** R3 Pointer to source ***/
char *dst, /*** R4 Pointer to output ***/
int width, /*** R5 Width ***/
int height, /*** R6 Height ***/
int w1, /*** R7 Worker ***/
int w2, /*** R8 Worker ***/
int w3, /*** R9 Worker ***/
int w4) /*** R10 Worker ***/
{
/*** How many tiles per row ***/
asm ("srwi 5,5,2"); /*** Width / 4 == Tiles ***/
asm ("srwi 6,6,2"); /*** Height / 4 == Tiles ***/
asm ("mr 9,4"); /*** Mirror R4 ***/
asm ("subi 4,4,8"); /*** Adjust R4 for index update ***/
asm ("subi 9,9,4"); /*** Adjust R9 for index update ***/
/*** Outer loop ***/
asm ("DoAllTiles:");
asm ("mtctr 5"); /*** Will loop for this number of tiles across ***/
asm ("mr 8,3"); /*** Preserve current source position ***/
asm ("DoOneTile:");
/*** Store 4 Horizontal Pixels - ROW 1 ***/
asm ("lwz 7,0(3)");
asm ("stwu 7,8(4)");
asm ("lwz 10,4(3)");
asm ("stwu 10,8(9)");
/*** Store 4 Horizontal Pixels - ROW 2 ***/
asm ("lwz 7,1024(3)");
asm ("stwu 7,8(4)");
asm ("lwz 10,1028(3)");
asm ("stwu 10,8(9)");
/*** Store 4 Horizontal Pixels - ROW 3 ***/
asm ("lwz 7,2048(3)");
asm ("stwu 7,8(4)");
asm ("lwz 10,2052(3)");
asm ("stwu 10,8(9)");
/*** Store 4 Horizontal Pixels - ROW 4 ***/
asm ("lwz 7,3072(3)");
asm ("stwu 7,8(4)");
asm ("lwz 10,3076(3)");
asm ("stwu 10,8(9)");
/*** Move along 4 pixels ***/
asm ("addi 3,3,8");
/*** Repeat for next tile ***/
asm ("bdnz DoOneTile");
/*** Update R3 to be 4 rows down ***/
asm ("mr 3,8");
asm ("addi 3,3,4096");
/*** Decrement Outer Tile loop ***/
asm ("subi 6,6,1");
asm ("cmpwi 6,0");
asm ("bne DoAllTiles");
}
#endif
/**************************************************************************** /****************************************************************************
* MakeTexture * MakeTexture
* *
@ -544,8 +488,6 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height)
"r" (height)); "r" (height));
} }
#endif
/**************************************************************************** /****************************************************************************
* Update Video * Update Video
****************************************************************************/ ****************************************************************************/
@ -584,46 +526,11 @@ update_video (int width, int height)
GX_SetTevOp (GX_TEVSTAGE0, GX_DECAL); GX_SetTevOp (GX_TEVSTAGE0, GX_DECAL);
GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); GX_SetTevOrder (GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
#ifdef NGCC
int h, w;
int *dst = (int *) texturemem;
int *src = (int *) GFX.Screen;
int hpos;
/*** Pitch for screen, regardless of size is always the same ***/
for (h = 0; h < vheight; h += 4)
{
for (w = 0; w < (vwidth >> 1); w += 2)
{
hpos = w;
*dst++ = src[hpos++];
*dst++ = src[hpos];
hpos = w + 256;
*dst++ = src[hpos++];
*dst++ = src[hpos];
hpos = w + 512;
*dst++ = src[hpos++];
*dst++ = src[hpos];
hpos = w + 768;
*dst++ = src[hpos++];
*dst++ = src[hpos];
}
src += GFX.Pitch;
}
#else
MakeTexture ((char *) GFX.Screen, (char *) texturemem, vwidth, vheight); MakeTexture ((char *) GFX.Screen, (char *) texturemem, vwidth, vheight);
#endif
DCFlushRange (texturemem, TEX_WIDTH * TEX_HEIGHT * 2); DCFlushRange (texturemem, TEX_WIDTH * TEX_HEIGHT * 2);

View File

@ -17,6 +17,7 @@
#include "snes9x.h" #include "snes9x.h"
void InitGCVideo (); void InitGCVideo ();
void ReInitGCVideo();
void clearscreen (int colour = COLOR_WHITE); void clearscreen (int colour = COLOR_WHITE);
void showscreen (); void showscreen ();
void setGFX (); void setGFX ();