small bugfixes

This commit is contained in:
dborth 2009-03-30 08:22:55 +00:00
parent 9331e69277
commit 5536c374e3
8 changed files with 69 additions and 51 deletions

View File

@ -40,6 +40,8 @@ void FixInvalidSettings()
GCSettings.SFXVolume = 40; GCSettings.SFXVolume = 40;
if(GCSettings.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_ZAPPER) if(GCSettings.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_ZAPPER)
GCSettings.Controller = CTRL_PAD2; GCSettings.Controller = CTRL_PAD2;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 2;
} }
/**************************************************************************** /****************************************************************************

View File

@ -57,9 +57,9 @@ struct SGCSettings{
int AutoSave; int AutoSave;
int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB) int LoadMethod; // For ROMS: Auto, SD, DVD, USB, Network (SMB)
int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB int SaveMethod; // For SRAM, Freeze, Prefs: Auto, SD, Memory Card Slot A, Memory Card Slot B, USB, SMB
char LoadFolder[200]; // Path to game files char LoadFolder[256]; // Path to game files
char SaveFolder[200]; // Path to save files char SaveFolder[256]; // Path to save files
char CheatFolder[200]; // Path to cheat files char CheatFolder[256]; // Path to cheat files
char smbip[16]; char smbip[16];
char smbuser[20]; char smbuser[20];

View File

@ -40,7 +40,7 @@ char rootdir[10];
static char szpath[MAXPATHLEN]; static char szpath[MAXPATHLEN];
static bool inSz = false; static bool inSz = false;
char romFilename[200]; char romFilename[256];
int nesGameType; int nesGameType;
/**************************************************************************** /****************************************************************************

View File

@ -15,7 +15,7 @@
#include <unistd.h> #include <unistd.h>
#define MAXJOLIET 255 #define MAXJOLIET 255
#define MAXDISPLAY 50 #define MAXDISPLAY 35
typedef struct typedef struct
{ {

View File

@ -625,7 +625,6 @@ ResetVideo_Emu ()
// reconfigure VI // reconfigure VI
VIDEO_Configure (rmode); VIDEO_Configure (rmode);
VIDEO_ClearFrameBuffer (rmode, xfb[whichfb], COLOR_BLACK);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();
if (rmode->viTVMode & VI_NON_INTERLACE) if (rmode->viTVMode & VI_NON_INTERLACE)
@ -634,6 +633,9 @@ ResetVideo_Emu ()
while (VIDEO_GetNextField()) while (VIDEO_GetNextField())
VIDEO_WaitVSync(); VIDEO_WaitVSync();
GXColor background = {0, 0, 0, 255};
GX_SetCopyClear (background, 0x00ffffff);
// reconfigure GX // reconfigure GX
GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1); GX_SetViewport (0, 0, rmode->fbWidth, rmode->efbHeight, 0, 1);
GX_SetDispCopyYScale ((f32) rmode->xfbHeight / (f32) rmode->efbHeight); GX_SetDispCopyYScale ((f32) rmode->xfbHeight / (f32) rmode->efbHeight);

View File

@ -478,11 +478,12 @@ typedef struct _keytype {
class GuiKeyboard : public GuiWindow class GuiKeyboard : public GuiWindow
{ {
public: public:
GuiKeyboard(char * t); GuiKeyboard(char * t, u16 m);
~GuiKeyboard(); ~GuiKeyboard();
void Update(GuiTrigger * t); void Update(GuiTrigger * t);
char kbtextstr[100]; char kbtextstr[100];
protected: protected:
u16 kbtextmaxlen;
Key keys[4][10]; Key keys[4][10];
int shift; int shift;
int caps; int caps;

View File

@ -14,7 +14,7 @@
* Constructor for the GuiKeyboard class. * Constructor for the GuiKeyboard class.
*/ */
GuiKeyboard::GuiKeyboard(char * t) GuiKeyboard::GuiKeyboard(char * t, u16 max)
{ {
width = 540; width = 540;
height = 400; height = 400;
@ -26,6 +26,7 @@ GuiKeyboard::GuiKeyboard(char * t)
alignmentVert = ALIGN_MIDDLE; alignmentVert = ALIGN_MIDDLE;
strncpy(kbtextstr, t, 100); strncpy(kbtextstr, t, 100);
kbtextstr[100] = 0; kbtextstr[100] = 0;
kbtextmaxlen = max;
Key thekeys[4][10] = { Key thekeys[4][10] = {
{ {
@ -236,8 +237,11 @@ void GuiKeyboard::Update(GuiTrigger * t)
if(keySpace->GetState() == STATE_CLICKED) if(keySpace->GetState() == STATE_CLICKED)
{ {
kbtextstr[strlen(kbtextstr)] = ' '; if(strlen(kbtextstr) < kbtextmaxlen)
kbText->SetText(kbtextstr); {
kbtextstr[strlen(kbtextstr)] = ' ';
kbText->SetText(kbtextstr);
}
keySpace->SetState(STATE_SELECTED); keySpace->SetState(STATE_SELECTED);
} }
else if(keyBack->GetState() == STATE_CLICKED) else if(keyBack->GetState() == STATE_CLICKED)
@ -272,14 +276,18 @@ void GuiKeyboard::Update(GuiTrigger * t)
if(keyBtn[i][j]->GetState() == STATE_CLICKED) if(keyBtn[i][j]->GetState() == STATE_CLICKED)
{ {
if(shift || caps) if(strlen(kbtextstr) < kbtextmaxlen)
{ {
kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift; if(shift || caps)
if(shift) shift ^= 1; {
kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift;
if(shift) shift ^= 1;
}
else
{
kbtextstr[strlen(kbtextstr)] = keys[i][j].ch;
}
} }
else
kbtextstr[strlen(kbtextstr)] = keys[i][j].ch;
kbText->SetText(kbtextstr); kbText->SetText(kbtextstr);
keyBtn[i][j]->SetState(STATE_SELECTED); keyBtn[i][j]->SetState(STATE_SELECTED);
} }

View File

@ -482,11 +482,11 @@ void AutoSave()
} }
} }
static void OnScreenKeyboard(char * var) static void OnScreenKeyboard(char * var, u16 maxlen)
{ {
int save = -1; int save = -1;
GuiKeyboard keyboard(var); GuiKeyboard keyboard(var, maxlen);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM); GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png); GuiImageData btnOutline(button_png);
@ -2767,10 +2767,11 @@ static int MenuSettingsFile()
int ret; int ret;
int i = 0; int i = 0;
OptionList options; OptionList options;
sprintf(options.name[i++], "Load Method"); sprintf(options.name[i++], "Load Device");
sprintf(options.name[i++], "Save Device");
sprintf(options.name[i++], "Load Folder"); sprintf(options.name[i++], "Load Folder");
sprintf(options.name[i++], "Save Method");
sprintf(options.name[i++], "Save Folder"); sprintf(options.name[i++], "Save Folder");
sprintf(options.name[i++], "Cheats Folder");
sprintf(options.name[i++], "Auto Load"); sprintf(options.name[i++], "Auto Load");
sprintf(options.name[i++], "Auto Save"); sprintf(options.name[i++], "Auto Save");
sprintf(options.name[i++], "Verify MC Saves"); sprintf(options.name[i++], "Verify MC Saves");
@ -2806,7 +2807,7 @@ static int MenuSettingsFile()
GuiOptionBrowser optionBrowser(552, 248, &options); GuiOptionBrowser optionBrowser(552, 248, &options);
optionBrowser.SetPosition(0, 108); optionBrowser.SetPosition(0, 108);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
optionBrowser.SetCol2Position(180); optionBrowser.SetCol2Position(185);
HaltGui(); HaltGui();
GuiWindow w(screenwidth, screenheight); GuiWindow w(screenwidth, screenheight);
@ -2849,7 +2850,7 @@ static int MenuSettingsFile()
GCSettings.SaveMethod++; GCSettings.SaveMethod++;
if(GCSettings.SaveMethod == METHOD_MC_SLOTB) if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
GCSettings.SaveMethod++; GCSettings.SaveMethod++;
options.name[6][0] = 0; options.name[7][0] = 0;
#endif #endif
// correct load/save methods out of bounds // correct load/save methods out of bounds
@ -2858,67 +2859,71 @@ static int MenuSettingsFile()
if(GCSettings.SaveMethod > 6) if(GCSettings.SaveMethod > 6)
GCSettings.SaveMethod = 0; GCSettings.SaveMethod = 0;
if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (options.value[0],"Auto"); if (GCSettings.LoadMethod == METHOD_AUTO) sprintf (options.value[0],"Auto Detect");
else if (GCSettings.LoadMethod == METHOD_SD) sprintf (options.value[0],"SD"); else if (GCSettings.LoadMethod == METHOD_SD) sprintf (options.value[0],"SD");
else if (GCSettings.LoadMethod == METHOD_USB) sprintf (options.value[0],"USB"); else if (GCSettings.LoadMethod == METHOD_USB) sprintf (options.value[0],"USB");
else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (options.value[0],"DVD"); else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (options.value[0],"DVD");
else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (options.value[0],"Network"); else if (GCSettings.LoadMethod == METHOD_SMB) sprintf (options.value[0],"Network");
sprintf (options.value[1], "%s", GCSettings.LoadFolder); if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (options.value[1],"Auto Detect");
else if (GCSettings.SaveMethod == METHOD_SD) sprintf (options.value[1],"SD");
else if (GCSettings.SaveMethod == METHOD_USB) sprintf (options.value[1],"USB");
else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (options.value[1],"Network");
else if (GCSettings.SaveMethod == METHOD_MC_SLOTA) sprintf (options.value[1],"MC Slot A");
else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (options.value[1],"MC Slot B");
if (GCSettings.SaveMethod == METHOD_AUTO) sprintf (options.value[2],"Auto"); snprintf (options.value[2], 256, "%s", GCSettings.LoadFolder);
else if (GCSettings.SaveMethod == METHOD_SD) sprintf (options.value[2],"SD"); snprintf (options.value[3], 256, "%s", GCSettings.SaveFolder);
else if (GCSettings.SaveMethod == METHOD_USB) sprintf (options.value[2],"USB"); snprintf (options.value[4], 256, "%s", GCSettings.CheatFolder);
else if (GCSettings.SaveMethod == METHOD_SMB) sprintf (options.value[2],"Network");
else if (GCSettings.SaveMethod == METHOD_MC_SLOTA) sprintf (options.value[2],"MC Slot A");
else if (GCSettings.SaveMethod == METHOD_MC_SLOTB) sprintf (options.value[2],"MC Slot B");
sprintf (options.value[3], "%s", GCSettings.SaveFolder); if (GCSettings.AutoLoad == 0) sprintf (options.value[5],"Off");
else if (GCSettings.AutoLoad == 1) sprintf (options.value[5],"SRAM");
if (GCSettings.AutoLoad == 0) sprintf (options.value[4],"Off"); else if (GCSettings.AutoLoad == 2) sprintf (options.value[5],"Snapshot");
else if (GCSettings.AutoLoad == 1) sprintf (options.value[4],"SRAM");
else if (GCSettings.AutoLoad == 2) sprintf (options.value[4],"Snapshot");
if (GCSettings.AutoSave == 0) sprintf (options.value[5],"Off"); if (GCSettings.AutoSave == 0) sprintf (options.value[5],"Off");
else if (GCSettings.AutoSave == 1) sprintf (options.value[5],"SRAM"); else if (GCSettings.AutoSave == 1) sprintf (options.value[6],"SRAM");
else if (GCSettings.AutoSave == 2) sprintf (options.value[5],"Snapshot"); else if (GCSettings.AutoSave == 2) sprintf (options.value[6],"Snapshot");
else if (GCSettings.AutoSave == 3) sprintf (options.value[5],"Both"); else if (GCSettings.AutoSave == 3) sprintf (options.value[6],"Both");
sprintf (options.value[6], "%s", GCSettings.VerifySaves == true ? "On" : "Off"); sprintf (options.value[7], "%s", GCSettings.VerifySaves == true ? "On" : "Off");
ret = optionBrowser.GetClickedOption(); ret = optionBrowser.GetClickedOption();
switch (ret) switch (ret)
{ {
case 0: case 0:
GCSettings.LoadMethod ++; GCSettings.LoadMethod++;
break; break;
case 1: case 1:
OnScreenKeyboard(GCSettings.LoadFolder); GCSettings.SaveMethod++;
break; break;
case 2: case 2:
GCSettings.SaveMethod ++; OnScreenKeyboard(GCSettings.LoadFolder, 256);
break; break;
case 3: case 3:
OnScreenKeyboard(GCSettings.SaveFolder); OnScreenKeyboard(GCSettings.SaveFolder, 256);
break; break;
case 4: case 4:
GCSettings.AutoLoad ++; OnScreenKeyboard(GCSettings.CheatFolder, 256);
break;
case 5:
GCSettings.AutoLoad++;
if (GCSettings.AutoLoad > 2) if (GCSettings.AutoLoad > 2)
GCSettings.AutoLoad = 0; GCSettings.AutoLoad = 0;
break; break;
case 5: case 6:
GCSettings.AutoSave ++; GCSettings.AutoSave++;
if (GCSettings.AutoSave > 3) if (GCSettings.AutoSave > 3)
GCSettings.AutoSave = 0; GCSettings.AutoSave = 0;
break; break;
case 6: case 7:
GCSettings.VerifySaves ^= 1; GCSettings.VerifySaves ^= 1;
break; break;
} }
@ -3137,19 +3142,19 @@ static int MenuSettingsNetwork()
switch (ret) switch (ret)
{ {
case 0: case 0:
OnScreenKeyboard(GCSettings.smbip); OnScreenKeyboard(GCSettings.smbip, 16);
break; break;
case 1: case 1:
OnScreenKeyboard(GCSettings.smbshare); OnScreenKeyboard(GCSettings.smbshare, 20);
break; break;
case 2: case 2:
OnScreenKeyboard(GCSettings.smbuser); OnScreenKeyboard(GCSettings.smbuser, 20);
break; break;
case 3: case 3:
OnScreenKeyboard(GCSettings.smbpwd); OnScreenKeyboard(GCSettings.smbpwd, 20);
break; break;
} }