update comments

This commit is contained in:
dborth 2009-03-28 19:03:35 +00:00
parent 9d3f522588
commit de13cf6927
20 changed files with 228 additions and 147 deletions

View File

@ -94,6 +94,11 @@ InitAudio ()
LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150); LWP_CreateThread (&athread, AudioThread, NULL, astack, AUDIOSTACK, 150);
} }
/****************************************************************************
* SwitchAudioMode
*
* Switches between menu sound and emulator sound
***************************************************************************/
void void
SwitchAudioMode(int mode) SwitchAudioMode(int mode)
{ {
@ -117,6 +122,12 @@ SwitchAudioMode(int mode)
} }
} }
/****************************************************************************
* ShutdownAudio
*
* Shuts down audio subsystem. Useful to avoid unpleasant sounds if a
* crash occurs during shutdown.
***************************************************************************/
void ShutdownAudio() void ShutdownAudio()
{ {
#ifndef NO_SOUND #ifndef NO_SOUND

View File

@ -2,6 +2,7 @@
* Snes9x 1.51 Nintendo Wii/Gamecube Port * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* michniewski August 2008 * michniewski August 2008
* Tantric 2008-2009
* *
* button_mapping.c * button_mapping.c
* *

View File

@ -2,6 +2,7 @@
* Snes9x 1.51 Nintendo Wii/Gamecube Port * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* michniewski August 2008 * michniewski August 2008
* Tantric 2008-2009
* *
* button_mapping.h * button_mapping.h
* *

View File

@ -3,7 +3,7 @@
* *
* softdev July 2006 * softdev July 2006
* svpe & crunchy2 June 2007 * svpe & crunchy2 June 2007
* Tantric September 2008 * Tantric 2008-2009
* *
* dvd.cpp * dvd.cpp
* *
@ -144,7 +144,6 @@ static int dvd_buffered_read(void *dst, u32 len, u64 offset)
* This function relies on dvddir (file offset) being prepopulated! * This function relies on dvddir (file offset) being prepopulated!
* returns: 1 - ok ; 0 - error * returns: 1 - ok ; 0 - error
***************************************************************************/ ***************************************************************************/
int dvd_safe_read(void *dst_v, u32 len, u64 fileoffset) int dvd_safe_read(void *dst_v, u32 len, u64 fileoffset)
{ {
u64 offset = dvddir + fileoffset; u64 offset = dvddir + fileoffset;
@ -321,7 +320,6 @@ getpvd ()
* *
* Tests if a ISO9660 DVD is inserted and available, and mounts it * Tests if a ISO9660 DVD is inserted and available, and mounts it
***************************************************************************/ ***************************************************************************/
bool MountDVD(bool silent) bool MountDVD(bool silent)
{ {
bool res = false; bool res = false;
@ -364,7 +362,6 @@ bool MountDVD(bool silent)
* 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 static int
getentry (int entrycount, unsigned char dvdbuffer[]) getentry (int entrycount, unsigned char dvdbuffer[])
{ {
@ -548,7 +545,6 @@ ParseDVDdirectory ()
* SetDVDdirectory * SetDVDdirectory
* Set the current DVD file offset * Set the current DVD file offset
***************************************************************************/ ***************************************************************************/
void SetDVDdirectory(u64 dir, int length) void SetDVDdirectory(u64 dir, int length)
{ {
dvddir = dir; dvddir = dir;
@ -647,7 +643,6 @@ bool SwitchDVDFolder(char origdir[])
* This function will load a file from DVD * This function will load a file from DVD
* It assumes dvddir and dvddirlength are prepopulated * It assumes dvddir and dvddirlength are prepopulated
***************************************************************************/ ***************************************************************************/
int int
LoadDVDFileOffset (unsigned char *buffer, int length) LoadDVDFileOffset (unsigned char *buffer, int length)
{ {
@ -719,7 +714,6 @@ done:
* It will attempt to find the offset of the file, and if successful it * It will attempt to find the offset of the file, and if successful it
* will populate dvddir and dvddirlength, and load the file * will populate dvddir and dvddirlength, and load the file
***************************************************************************/ ***************************************************************************/
int int
LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent) LoadDVDFile(char * buffer, char *filepath, int datasize, bool silent)
{ {

View File

@ -3,7 +3,7 @@
* *
* softdev July 2006 * softdev July 2006
* svpe & crunchy2 June 2007 * svpe & crunchy2 June 2007
* Tantric September 2008 * Tantric 2008-2009
* *
* dvd.h * dvd.h
* *
@ -25,7 +25,6 @@ int dvd_safe_read (void *dst, unsigned int len, u64 offset);
void SetDVDDriveType(); void SetDVDDriveType();
#ifdef HW_DOL #ifdef HW_DOL
void dvd_motor_off (); void dvd_motor_off ();
void uselessinquiry ();
#endif #endif
#endif #endif

View File

@ -7,7 +7,7 @@
* Michniewski 2008 * Michniewski 2008
* Tantric 2008-2009 * Tantric 2008-2009
* *
* filesel.cpp * filebrowser.cpp
* *
* Generic file routines - reading, writing, browsing * Generic file routines - reading, writing, browsing
***************************************************************************/ ***************************************************************************/
@ -306,7 +306,6 @@ int FileSortCallback(const void *f1, const void *f2)
* If the file is a zip, we will check the file extension / file size of the * If the file is a zip, we will check the file extension / file size of the
* first file inside * first file inside
***************************************************************************/ ***************************************************************************/
static bool IsValidROM(int method) static bool IsValidROM(int method)
{ {
// file size should be between 96K and 8MB // file size should be between 96K and 8MB
@ -357,7 +356,6 @@ static bool IsValidROM(int method)
* *
* Checks if the specified file is a 7z * Checks if the specified file is a 7z
***************************************************************************/ ***************************************************************************/
bool IsSz() bool IsSz()
{ {
if (strlen(browserList[browser.selIndex].filename) > 4) if (strlen(browserList[browser.selIndex].filename) > 4)
@ -376,7 +374,6 @@ bool IsSz()
* *
* Strips an extension from a filename * Strips an extension from a filename
***************************************************************************/ ***************************************************************************/
void StripExt(char* returnstring, char * inputstring) void StripExt(char* returnstring, char * inputstring)
{ {
char* loc_dot; char* loc_dot;
@ -391,7 +388,11 @@ void StripExt(char* returnstring, char * inputstring)
*loc_dot = 0; // strip file extension *loc_dot = 0; // strip file extension
} }
// 7z file - let's open it up to select a file inside /****************************************************************************
* BrowserLoadSz
*
* Opens the selected 7z file, and parses a listing of the files within
***************************************************************************/
int BrowserLoadSz(int method) int BrowserLoadSz(int method)
{ {
char filepath[MAXPATHLEN]; char filepath[MAXPATHLEN];
@ -417,6 +418,11 @@ int BrowserLoadSz(int method)
return szfiles; return szfiles;
} }
/****************************************************************************
* BrowserLoadFile
*
* Loads the selected ROM
***************************************************************************/
int BrowserLoadFile(int method) int BrowserLoadFile(int method)
{ {
char filepath[1024]; char filepath[1024];
@ -483,7 +489,11 @@ done:
return loaded; return loaded;
} }
/* update current directory and set new entry list if directory has changed */ /****************************************************************************
* BrowserChangeFolder
*
* Update current directory and set new entry list if directory has changed
***************************************************************************/
int BrowserChangeFolder(int method) int BrowserChangeFolder(int method)
{ {
if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave if(inSz && browser.selIndex == 0) // inside a 7z, requesting to leave
@ -521,7 +531,6 @@ int BrowserChangeFolder(int method)
* OpenROM * OpenROM
* Displays a list of ROMS on load device * Displays a list of ROMS on load device
***************************************************************************/ ***************************************************************************/
int int
OpenGameList () OpenGameList ()
{ {

View File

@ -6,13 +6,13 @@
* Michniewski 2008 * Michniewski 2008
* Tantric 2008-2009 * Tantric 2008-2009
* *
* filesel.h * filebrowser.h
* *
* Generic file routines - reading, writing, browsing * Generic file routines - reading, writing, browsing
****************************************************************************/ ****************************************************************************/
#ifndef _NGCFILESEL_ #ifndef _FILEBROWSER_H_
#define _NGCFILESEL_ #define _FILEBROWSER_H_
#include <unistd.h> #include <unistd.h>
#include <gccore.h> #include <gccore.h>

View File

@ -9,8 +9,6 @@
***************************************************************************/ ***************************************************************************/
#include "gui.h" #include "gui.h"
#include "snes9xGX.h"
#include "filelist.h"
static int currentSize = 0; static int currentSize = 0;
static int presetSize = 0; static int presetSize = 0;

View File

@ -735,6 +735,4 @@ void SetDefaultButtonMap ()
ASSIGN_BUTTON_FALSE (maxcode++, "Screenshot"); ASSIGN_BUTTON_FALSE (maxcode++, "Screenshot");
SetControllers(); SetControllers();
} }

View File

@ -10,8 +10,8 @@
* Memory Card routines * Memory Card routines
***************************************************************************/ ***************************************************************************/
#ifndef _NGCMCSAVE_ #ifndef _MEMCARDOP_
#define _NGCMCSAVE_ #define _MEMCARDOP_
int ParseMCDirectory (int slot); int ParseMCDirectory (int slot);
int LoadMCFile (char *buf, int slot, char *filename, bool silent); int LoadMCFile (char *buf, int slot, char *filename, bool silent);

View File

@ -42,7 +42,6 @@ extern "C" {
#include "networkop.h" #include "networkop.h"
#include "memcardop.h" #include "memcardop.h"
#include "fileop.h" #include "fileop.h"
#include "dvd.h" #include "dvd.h"
#include "s9xconfig.h" #include "s9xconfig.h"
#include "sram.h" #include "sram.h"
@ -53,7 +52,6 @@ extern "C" {
#include "input.h" #include "input.h"
#include "patch.h" #include "patch.h"
#include "filter.h" #include "filter.h"
#include "filelist.h" #include "filelist.h"
#include "gui/gui.h" #include "gui/gui.h"
#include "menu.h" #include "menu.h"
@ -947,10 +945,10 @@ static void ControllerWindowUpdate(void * ptr, int dir)
{ {
GCSettings.Controller += dir; GCSettings.Controller += dir;
if(GCSettings.Controller > CTRL_LENGTH-1) if(GCSettings.Controller > CTRL_PAD4)
GCSettings.Controller = 0; GCSettings.Controller = CTRL_MOUSE;
else if(GCSettings.Controller < 0) if(GCSettings.Controller < CTRL_MOUSE)
GCSettings.Controller = CTRL_LENGTH-1; GCSettings.Controller = CTRL_PAD4;
settingText->SetText(ctrlName[GCSettings.Controller]); settingText->SetText(ctrlName[GCSettings.Controller]);
b->ResetState(); b->ResetState();
@ -962,7 +960,7 @@ static void ControllerWindowRightClick(void * ptr) { ControllerWindowUpdate(ptr,
static void ControllerWindow() static void ControllerWindow()
{ {
GuiWindow * w = new GuiWindow(250,250); GuiWindow * w = new GuiWindow(300,250);
w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE); w->SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
GuiTrigger trigA; GuiTrigger trigA;

View File

@ -21,7 +21,6 @@ void InfoPrompt(const char * msg);
void ShowAction (const char *msg); void ShowAction (const char *msg);
void CancelAction(); void CancelAction();
void ShowProgress (const char *msg, int done, int total); void ShowProgress (const char *msg, int done, int total);
void ShutoffRumble();
enum enum
{ {

View File

@ -65,24 +65,55 @@ void UpdateCheck()
item = mxmlFindElement(xml, xml, "app", "version", NULL, MXML_DESCEND); item = mxmlFindElement(xml, xml, "app", "version", NULL, MXML_DESCEND);
if(item) // a version entry exists if(item) // a version entry exists
{ {
const char * versionstr = mxmlElementGetAttr(item, "version"); const char * version = mxmlElementGetAttr(item, "version");
if(versionstr) if(version && strlen(version) == 5)
{ {
int version = atoi(versionstr); int verMajor = version[0] - '0';
int currVersion = atoi(APPVERSION); int verMinor = version[2] - '0';
int verPoint = version[4] - '0';
int curMajor = APPVERSION[0] - '0';
int curMinor = APPVERSION[2] - '0';
int curPoint = APPVERSION[4] - '0';
if(version > currVersion) // a new version is available // check that the versioning is valid and is a newer version
if((verMajor >= 0 && verMajor <= 9 &&
verMinor >= 0 && verMinor <= 9 &&
verPoint >= 0 && verPoint <= 9) &&
(verMajor > curMajor ||
verMinor > curMinor ||
verPoint > curPoint))
{ {
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND); item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
if(item) if(item)
{ {
snprintf(updateURL, 128, "%s", mxmlElementGetAttr(item, "url")); const char * tmp = mxmlElementGetAttr(item, "url");
if(tmp)
{
snprintf(updateURL, 128, "%s", tmp);
updateFound = true; updateFound = true;
} }
} }
} }
} }
else // temporary, for compatibility
{
int versionnum = atoi(version);
if(versionnum > 10) // 010
{
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
if(item)
{
const char * tmp = mxmlElementGetAttr(item, "url");
if(tmp)
{
snprintf(updateURL, 128, "%s", tmp);
updateFound = true;
}
}
}
}
}
mxmlDelete(xml); mxmlDelete(xml);
} }
} }

View File

@ -256,9 +256,28 @@ decodePrefsData (int method)
{ {
const char * version = mxmlElementGetAttr(item, "version"); const char * version = mxmlElementGetAttr(item, "version");
if(version) if(version && strlen(version) == 5)
{ {
result = true; // assume version is valid // this code assumes version in format X.X.X
// XX.X.X, X.XX.X, or X.X.XX will NOT work
int verMajor = version[0] - '0';
int verMinor = version[2] - '0';
int verPoint = version[4] - '0';
int curMajor = APPVERSION[0] - '0';
int curMinor = APPVERSION[2] - '0';
int curPoint = APPVERSION[4] - '0';
// first we'll check that the versioning is valid
if(!(verMajor >= 0 && verMajor <= 9 &&
verMinor >= 0 && verMinor <= 9 &&
verPoint >= 0 && verPoint <= 9))
result = false;
else if(verPoint < 8 && verMajor == 1) // less than version 1.0.8
result = false; // reset settings (sorry, should update settings instead)
else if(verMajor > curMajor || verMinor > curMinor || verPoint > curPoint) // some future version
result = false; // reset settings
else
result = true;
} }
} }

View File

@ -22,10 +22,11 @@
struct SGCSettings GCSettings; struct SGCSettings GCSettings;
/**************************************************************************** /****************************************************************************
* FixInvalidSettings
*
* Attempts to correct at least some invalid settings - the ones that * Attempts to correct at least some invalid settings - the ones that
* might cause crashes * might cause crashes
***************************************************************************/ ***************************************************************************/
void FixInvalidSettings() void FixInvalidSettings()
{ {
if(!(GCSettings.ZoomLevel > 0.5 && GCSettings.ZoomLevel < 1.5)) if(!(GCSettings.ZoomLevel > 0.5 && GCSettings.ZoomLevel < 1.5))
@ -38,8 +39,15 @@ void FixInvalidSettings()
GCSettings.MusicVolume = 40; GCSettings.MusicVolume = 40;
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100)) if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
GCSettings.SFXVolume = 40; GCSettings.SFXVolume = 40;
if(GCSettings.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_MOUSE)
GCSettings.Controller = CTRL_PAD2;
} }
/****************************************************************************
* DefaultSettings
*
* Sets all the defaults!
***************************************************************************/
void void
DefaultSettings () DefaultSettings ()
{ {
@ -67,15 +75,15 @@ DefaultSettings ()
GCSettings.smbpwd[19] = 0; GCSettings.smbpwd[19] = 0;
GCSettings.smbshare[19] = 0; GCSettings.smbshare[19] = 0;
GCSettings.Controller = 0; GCSettings.Controller = CTRL_PAD2;
GCSettings.ZoomLevel = 1.0; // zoom level GCSettings.ZoomLevel = 1.0; // zoom level
GCSettings.render = 2; // Unfiltered GCSettings.render = 2; // Unfiltered
GCSettings.widescreen = 0; // no aspect ratio correction GCSettings.widescreen = 0; // no aspect ratio correction
GCSettings.FilterMethod = FILTER_NONE; // no hq2x GCSettings.FilterMethod = FILTER_NONE; // no hq2x
GCSettings.xshift = 0; // video shift GCSettings.xshift = 0; // horizontal video shift
GCSettings.yshift = 0; GCSettings.yshift = 0; // vertical video shift
GCSettings.WiimoteOrientation = 0; GCSettings.WiimoteOrientation = 0;
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
@ -144,4 +152,3 @@ DefaultSettings ()
Settings.ForceDSP1 = 0; Settings.ForceDSP1 = 0;
Settings.ForceNoDSP1 = 0; Settings.ForceNoDSP1 = 0;
} }

View File

@ -14,7 +14,6 @@
***************************************************************************/ ***************************************************************************/
#ifndef _S9XCONFIG_ #ifndef _S9XCONFIG_
#define _S9XCONFIG_ #define _S9XCONFIG_
void FixInvalidSettings(); void FixInvalidSettings();

View File

@ -303,11 +303,11 @@ static void * InitThread (void *arg)
// Allocate SNES Memory // Allocate SNES Memory
if (!Memory.Init ()) if (!Memory.Init ())
while (1); ExitApp();
// Allocate APU // Allocate APU
if (!S9xInitAPU ()) if (!S9xInitAPU ())
while (1); ExitApp();
// Set Pixel Renderer to match 565 // Set Pixel Renderer to match 565
S9xSetRenderPixelFormat (RGB565); S9xSetRenderPixelFormat (RGB565);
@ -318,7 +318,7 @@ static void * InitThread (void *arg)
// Initialise Graphics // Initialise Graphics
setGFX (); setGFX ();
if (!S9xGraphicsInit ()) if (!S9xGraphicsInit ())
while (1); ExitApp();
// Check if DVD drive belongs to a Wii // Check if DVD drive belongs to a Wii
SetDVDDriveType(); SetDVDDriveType();

View File

@ -20,7 +20,7 @@
#include "filelist.h" #include "filelist.h"
#define APPNAME "Snes9x GX" #define APPNAME "Snes9x GX"
#define APPVERSION "009" #define APPVERSION "4.0.0"
#define PREF_FILE_NAME "settings.xml" #define PREF_FILE_NAME "settings.xml"
#define NOTSILENT 0 #define NOTSILENT 0
@ -58,8 +58,8 @@ enum
CTRL_LENGTH CTRL_LENGTH
}; };
const char ctrlName[6][20] = const char ctrlName[6][24] =
{ "SNES Controller", "SNES Mouse", "Superscope", "Justifier", "SNES Pad (2)", "SNES Pad (4)" }; { "SNES Controller", "SNES Mouse", "Superscope", "Justifier", "SNES Controllers (2)", "SNES Controllers (4)" };
struct SGCSettings{ struct SGCSettings{
int AutoLoad; int AutoLoad;

View File

@ -388,7 +388,7 @@ draw_square (Mtx v)
/**************************************************************************** /****************************************************************************
* StartGX * StartGX
* *
* This function initialises the GX. * Initialises GX and sets it up for use
***************************************************************************/ ***************************************************************************/
static void static void
StartGX () StartGX ()
@ -409,6 +409,11 @@ StartGX ()
vheight = 100; vheight = 100;
} }
/****************************************************************************
* StopGX
*
* Stops GX (when exiting)
***************************************************************************/
void StopGX() void StopGX()
{ {
GX_AbortFrame(); GX_AbortFrame();
@ -859,13 +864,10 @@ setGFX ()
} }
/**************************************************************************** /****************************************************************************
* GX Menu drawing routines * TakeScreenshot
*
* Copies the current screen into a GX texture
***************************************************************************/ ***************************************************************************/
/**
* Make a snapshot of the screen in a texture.
* @return A pointer to a texture representing the screen or NULL if an error occurs.
*/
void TakeScreenshot() void TakeScreenshot()
{ {
int texSize = vmode->fbWidth * vmode->efbHeight * 4; int texSize = vmode->fbWidth * vmode->efbHeight * 4;
@ -960,6 +962,11 @@ ResetVideo_Menu ()
GX_SetAlphaUpdate(GX_TRUE); GX_SetAlphaUpdate(GX_TRUE);
} }
/****************************************************************************
* Menu_Render
*
* Renders everything current sent to GX, and flushes video
***************************************************************************/
void Menu_Render() void Menu_Render()
{ {
GX_DrawDone (); GX_DrawDone ();
@ -973,7 +980,13 @@ void Menu_Render()
VIDEO_WaitVSync(); VIDEO_WaitVSync();
} }
void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alpha) /****************************************************************************
* Menu_DrawImg
*
* Draws the specified image on screen using GX
***************************************************************************/
void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[],
f32 degrees, f32 scaleX, f32 scaleY, u8 alpha)
{ {
if(data == NULL) if(data == NULL)
return; return;
@ -1023,6 +1036,11 @@ void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degr
GX_SetVtxDesc (GX_VA_TEX0, GX_NONE); GX_SetVtxDesc (GX_VA_TEX0, GX_NONE);
} }
/****************************************************************************
* Menu_DrawRectangle
*
* Draws a rectangle at the specified coordinates using GX
***************************************************************************/
void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled) void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled)
{ {
u8 fmt; u8 fmt;

View File

@ -10,7 +10,6 @@
***************************************************************************/ ***************************************************************************/
#ifndef _GCVIDEOH_ #ifndef _GCVIDEOH_
#define _GCVIDEOH_ #define _GCVIDEOH_
#include <ogcsys.h> #include <ogcsys.h>