mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
improve device thread, change pref loading
This commit is contained in:
parent
9efd02061f
commit
6d288c1c90
@ -1,5 +1,3 @@
|
|||||||
VERSION := 006
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# Clear the implicit built in rules
|
# Clear the implicit built in rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -17,7 +15,7 @@ include $(DEVKITPPC)/gamecube_rules
|
|||||||
# SOURCES is a list of directories containing source code
|
# SOURCES is a list of directories containing source code
|
||||||
# INCLUDES is a list of directories containing extra header files
|
# INCLUDES is a list of directories containing extra header files
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := snes9xgx-$(VERSION)-gc
|
TARGET := snes9xgx-gc
|
||||||
TARGETDIR := executables
|
TARGETDIR := executables
|
||||||
BUILD := build_gc
|
BUILD := build_gc
|
||||||
SOURCES := source/snes9x source/ngc source/sz
|
SOURCES := source/snes9x source/ngc source/sz
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
VERSION := 006
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# Clear the implicit built in rules
|
# Clear the implicit built in rules
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
@ -17,7 +15,7 @@ include $(DEVKITPPC)/wii_rules
|
|||||||
# SOURCES is a list of directories containing source code
|
# SOURCES is a list of directories containing source code
|
||||||
# INCLUDES is a list of directories containing extra header files
|
# INCLUDES is a list of directories containing extra header files
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
TARGET := snes9xgx-$(VERSION)-wii
|
TARGET := snes9xgx-wii
|
||||||
TARGETDIR := executables
|
TARGETDIR := executables
|
||||||
BUILD := build_wii
|
BUILD := build_wii
|
||||||
SOURCES := source/snes9x source/ngc source/sz
|
SOURCES := source/snes9x source/ngc source/sz
|
||||||
@ -110,7 +108,6 @@ $(BUILD):
|
|||||||
@[ -d $@ ] || mkdir -p $@
|
@[ -d $@ ] || mkdir -p $@
|
||||||
@[ -d $(TARGETDIR) ] || mkdir -p $(TARGETDIR)
|
@[ -d $(TARGETDIR) ] || mkdir -p $(TARGETDIR)
|
||||||
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii
|
@make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile.wii
|
||||||
@rm -fr $(OUTPUT).elf
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
clean:
|
clean:
|
||||||
|
@ -176,9 +176,6 @@ bool MountFAT(int method)
|
|||||||
|
|
||||||
sprintf(rootdir, "%s:/", name);
|
sprintf(rootdir, "%s:/", name);
|
||||||
|
|
||||||
// isInserted doesn't work properly for USB - so we will force a shutdown
|
|
||||||
//unmountRequired[METHOD_USB] = true;
|
|
||||||
|
|
||||||
if(unmountRequired[method])
|
if(unmountRequired[method])
|
||||||
{
|
{
|
||||||
unmountRequired[method] = false;
|
unmountRequired[method] = false;
|
||||||
@ -329,19 +326,27 @@ ParseDirectory()
|
|||||||
u32
|
u32
|
||||||
LoadSzFile(char * filepath, unsigned char * rbuffer)
|
LoadSzFile(char * filepath, unsigned char * rbuffer)
|
||||||
{
|
{
|
||||||
u32 size;
|
u32 size = 0;
|
||||||
|
|
||||||
|
// stop checking if devices were removed/inserted
|
||||||
|
// since we're loading a file
|
||||||
|
LWP_SuspendThread (devicethread);
|
||||||
|
|
||||||
file = fopen (filepath, "rb");
|
file = fopen (filepath, "rb");
|
||||||
if (file > 0)
|
if (file > 0)
|
||||||
{
|
{
|
||||||
size = SzExtractFile(filelist[selection].offset, rbuffer);
|
size = SzExtractFile(filelist[selection].offset, rbuffer);
|
||||||
fclose (file);
|
fclose (file);
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WaitPrompt("Error opening file");
|
WaitPrompt("Error opening file");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go back to checking if devices were inserted/removed
|
||||||
|
LWP_ResumeThread (devicethread);
|
||||||
|
|
||||||
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -370,6 +375,10 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// stop checking if devices were removed/inserted
|
||||||
|
// since we're loading a file
|
||||||
|
LWP_SuspendThread (devicethread);
|
||||||
|
|
||||||
// add device to filepath
|
// add device to filepath
|
||||||
char fullpath[1024];
|
char fullpath[1024];
|
||||||
sprintf(fullpath, "%s%s", rootdir, filepath);
|
sprintf(fullpath, "%s%s", rootdir, filepath);
|
||||||
@ -428,6 +437,9 @@ LoadFile (char * rbuffer, char *filepath, u32 length, int method, bool silent)
|
|||||||
WaitPrompt("Error loading file!");
|
WaitPrompt("Error loading file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go back to checking if devices were inserted/removed
|
||||||
|
LWP_ResumeThread (devicethread);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,6 +472,10 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
|
|||||||
|
|
||||||
if (datasize)
|
if (datasize)
|
||||||
{
|
{
|
||||||
|
// stop checking if devices were removed/inserted
|
||||||
|
// since we're saving a file
|
||||||
|
LWP_SuspendThread (devicethread);
|
||||||
|
|
||||||
// add device to filepath
|
// add device to filepath
|
||||||
char fullpath[1024];
|
char fullpath[1024];
|
||||||
sprintf(fullpath, "%s%s", rootdir, filepath);
|
sprintf(fullpath, "%s%s", rootdir, filepath);
|
||||||
@ -478,6 +494,9 @@ SaveFile (char * buffer, char *filepath, u32 datasize, int method, bool silent)
|
|||||||
unmountRequired[method] = true;
|
unmountRequired[method] = true;
|
||||||
WaitPrompt ("Error saving file!");
|
WaitPrompt ("Error saving file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go back to checking if devices were inserted/removed
|
||||||
|
LWP_ResumeThread (devicethread);
|
||||||
}
|
}
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
@ -35,5 +35,6 @@ u32 SaveFile(char filepath[], u32 datasize, int method, bool silent);
|
|||||||
extern char currFATdir[MAXPATHLEN];
|
extern char currFATdir[MAXPATHLEN];
|
||||||
extern FILE * file;
|
extern FILE * file;
|
||||||
extern bool unmountRequired[];
|
extern bool unmountRequired[];
|
||||||
|
extern lwp_t devicethread;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -976,7 +976,7 @@ PreferencesMenu ()
|
|||||||
|
|
||||||
case -1: /*** Button B ***/
|
case -1: /*** Button B ***/
|
||||||
case 4:
|
case 4:
|
||||||
SavePrefs(GCSettings.SaveMethod, SILENT);
|
SavePrefs(SILENT);
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -312,16 +312,15 @@ decodePrefsData (int method)
|
|||||||
* Save Preferences
|
* Save Preferences
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
bool
|
bool
|
||||||
SavePrefs (int method, bool silent)
|
SavePrefs (bool silent)
|
||||||
{
|
{
|
||||||
char filepath[1024];
|
char filepath[1024];
|
||||||
int datasize;
|
int datasize;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
// there's no point in saving SMB settings TO SMB, because then we'll have no way to load them the next time!
|
// We'll save using the first available method (probably SD) since this
|
||||||
// so instead we'll save using whatever other method is available (eg: SD)
|
// is the method preferences will be loaded from by default
|
||||||
if(method == METHOD_AUTO || method == METHOD_SMB)
|
int method = autoSaveMethod();
|
||||||
method = autoSaveMethod();
|
|
||||||
|
|
||||||
if(!MakeFilePath(filepath, FILE_PREF, method))
|
if(!MakeFilePath(filepath, FILE_PREF, method))
|
||||||
return false;
|
return false;
|
||||||
|
@ -8,5 +8,5 @@
|
|||||||
* Preferences save/load to XML file
|
* Preferences save/load to XML file
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
bool SavePrefs (int method, bool silent);
|
bool SavePrefs (bool silent);
|
||||||
bool LoadPrefs ();
|
bool LoadPrefs ();
|
||||||
|
@ -213,6 +213,10 @@ emulate ()
|
|||||||
|
|
||||||
if (ConfigRequested)
|
if (ConfigRequested)
|
||||||
{
|
{
|
||||||
|
// go back to checking if devices were inserted/removed
|
||||||
|
// since we're entering the menu
|
||||||
|
LWP_ResumeThread (devicethread);
|
||||||
|
|
||||||
// change to menu video mode
|
// change to menu video mode
|
||||||
ResetVideo_Menu ();
|
ResetVideo_Menu ();
|
||||||
|
|
||||||
@ -252,7 +256,7 @@ emulate ()
|
|||||||
MainMenu (2); // go to game menu
|
MainMenu (2); // go to game menu
|
||||||
|
|
||||||
// save zoom level
|
// save zoom level
|
||||||
SavePrefs(GCSettings.SaveMethod, SILENT);
|
SavePrefs(SILENT);
|
||||||
|
|
||||||
FrameTimer = 0;
|
FrameTimer = 0;
|
||||||
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
|
setFrameTimerMethod (); // set frametimer method every time a ROM is loaded
|
||||||
@ -273,6 +277,10 @@ emulate ()
|
|||||||
|
|
||||||
CheckVideo = 1; // force video update
|
CheckVideo = 1; // force video update
|
||||||
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
prevRenderedFrameCount = IPPU.RenderedFramesCount;
|
||||||
|
|
||||||
|
// stop checking if devices were removed/inserted
|
||||||
|
// since we're starting emulation again
|
||||||
|
LWP_SuspendThread (devicethread);
|
||||||
}//if ConfigRequested
|
}//if ConfigRequested
|
||||||
|
|
||||||
}//while
|
}//while
|
||||||
|
Loading…
Reference in New Issue
Block a user