mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-24 03:29:22 +01:00
small bugfixes
This commit is contained in:
parent
eb19288847
commit
138b496bd9
@ -474,11 +474,12 @@ typedef struct _keytype {
|
||||
class GuiKeyboard : public GuiWindow
|
||||
{
|
||||
public:
|
||||
GuiKeyboard(char * t);
|
||||
GuiKeyboard(char * t, u16 m);
|
||||
~GuiKeyboard();
|
||||
void Update(GuiTrigger * t);
|
||||
char kbtextstr[100];
|
||||
protected:
|
||||
u16 kbtextmaxlen;
|
||||
Key keys[4][10];
|
||||
int shift;
|
||||
int caps;
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Constructor for the GuiKeyboard class.
|
||||
*/
|
||||
|
||||
GuiKeyboard::GuiKeyboard(char * t)
|
||||
GuiKeyboard::GuiKeyboard(char * t, u16 max)
|
||||
{
|
||||
width = 540;
|
||||
height = 400;
|
||||
@ -25,6 +25,7 @@ GuiKeyboard::GuiKeyboard(char * t)
|
||||
alignmentVert = ALIGN_MIDDLE;
|
||||
strncpy(kbtextstr, t, 100);
|
||||
kbtextstr[100] = 0;
|
||||
kbtextmaxlen = max;
|
||||
|
||||
Key thekeys[4][10] = {
|
||||
{
|
||||
@ -234,9 +235,12 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
||||
}
|
||||
|
||||
if(keySpace->GetState() == STATE_CLICKED)
|
||||
{
|
||||
if(strlen(kbtextstr) < kbtextmaxlen)
|
||||
{
|
||||
kbtextstr[strlen(kbtextstr)] = ' ';
|
||||
kbText->SetText(kbtextstr);
|
||||
}
|
||||
keySpace->SetState(STATE_SELECTED);
|
||||
}
|
||||
else if(keyBack->GetState() == STATE_CLICKED)
|
||||
@ -270,6 +274,8 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
||||
keyTxt[i][j]->SetText(txt);
|
||||
|
||||
if(keyBtn[i][j]->GetState() == STATE_CLICKED)
|
||||
{
|
||||
if(strlen(kbtextstr) < kbtextmaxlen)
|
||||
{
|
||||
if(shift || caps)
|
||||
{
|
||||
@ -277,8 +283,10 @@ void GuiKeyboard::Update(GuiTrigger * t)
|
||||
if(shift) shift ^= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
kbtextstr[strlen(kbtextstr)] = keys[i][j].ch;
|
||||
|
||||
}
|
||||
}
|
||||
kbText->SetText(kbtextstr);
|
||||
keyBtn[i][j]->SetState(STATE_SELECTED);
|
||||
}
|
||||
|
@ -498,11 +498,11 @@ void AutoSave()
|
||||
}
|
||||
}
|
||||
|
||||
static void OnScreenKeyboard(char * var)
|
||||
static void OnScreenKeyboard(char * var, u16 maxlen)
|
||||
{
|
||||
int save = -1;
|
||||
|
||||
GuiKeyboard keyboard(var);
|
||||
GuiKeyboard keyboard(var, maxlen);
|
||||
|
||||
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
|
||||
GuiImageData btnOutline(button_png);
|
||||
@ -562,8 +562,7 @@ static void OnScreenKeyboard(char * var)
|
||||
|
||||
if(save)
|
||||
{
|
||||
strncpy(var, keyboard.kbtextstr, 100);
|
||||
var[100] = 0;
|
||||
snprintf(var, maxlen, "%s", keyboard.kbtextstr);
|
||||
}
|
||||
|
||||
HaltGui();
|
||||
@ -2819,10 +2818,11 @@ static int MenuSettingsFile()
|
||||
int ret;
|
||||
int i = 0;
|
||||
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++], "Save Method");
|
||||
sprintf(options.name[i++], "Save Folder");
|
||||
sprintf(options.name[i++], "Cheats Folder");
|
||||
sprintf(options.name[i++], "Auto Load");
|
||||
sprintf(options.name[i++], "Auto Save");
|
||||
sprintf(options.name[i++], "Verify MC Saves");
|
||||
@ -2858,7 +2858,7 @@ static int MenuSettingsFile()
|
||||
GuiOptionBrowser optionBrowser(552, 248, &options);
|
||||
optionBrowser.SetPosition(0, 108);
|
||||
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
optionBrowser.SetCol2Position(180);
|
||||
optionBrowser.SetCol2Position(185);
|
||||
|
||||
HaltGui();
|
||||
GuiWindow w(screenwidth, screenheight);
|
||||
@ -2901,7 +2901,7 @@ static int MenuSettingsFile()
|
||||
GCSettings.SaveMethod++;
|
||||
if(GCSettings.SaveMethod == METHOD_MC_SLOTB)
|
||||
GCSettings.SaveMethod++;
|
||||
options.name[6][0] = 0;
|
||||
options.name[7][0] = 0;
|
||||
#endif
|
||||
|
||||
// correct load/save methods out of bounds
|
||||
@ -2910,67 +2910,71 @@ static int MenuSettingsFile()
|
||||
if(GCSettings.SaveMethod > 6)
|
||||
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_USB) sprintf (options.value[0],"USB");
|
||||
else if (GCSettings.LoadMethod == METHOD_DVD) sprintf (options.value[0],"DVD");
|
||||
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");
|
||||
else if (GCSettings.SaveMethod == METHOD_SD) sprintf (options.value[2],"SD");
|
||||
else if (GCSettings.SaveMethod == METHOD_USB) sprintf (options.value[2],"USB");
|
||||
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");
|
||||
snprintf (options.value[2], 256, "%s", GCSettings.LoadFolder);
|
||||
snprintf (options.value[3], 256, "%s", GCSettings.SaveFolder);
|
||||
snprintf (options.value[4], 256, "%s", GCSettings.CheatFolder);
|
||||
|
||||
sprintf (options.value[3], "%s", GCSettings.SaveFolder);
|
||||
|
||||
if (GCSettings.AutoLoad == 0) sprintf (options.value[4],"Off");
|
||||
else if (GCSettings.AutoLoad == 1) sprintf (options.value[4],"SRAM");
|
||||
else if (GCSettings.AutoLoad == 2) sprintf (options.value[4],"Snapshot");
|
||||
if (GCSettings.AutoLoad == 0) sprintf (options.value[5],"Off");
|
||||
else if (GCSettings.AutoLoad == 1) sprintf (options.value[5],"SRAM");
|
||||
else if (GCSettings.AutoLoad == 2) sprintf (options.value[5],"Snapshot");
|
||||
|
||||
if (GCSettings.AutoSave == 0) sprintf (options.value[5],"Off");
|
||||
else if (GCSettings.AutoSave == 1) sprintf (options.value[5],"SRAM");
|
||||
else if (GCSettings.AutoSave == 2) sprintf (options.value[5],"Snapshot");
|
||||
else if (GCSettings.AutoSave == 3) sprintf (options.value[5],"Both");
|
||||
else if (GCSettings.AutoSave == 1) sprintf (options.value[6],"SRAM");
|
||||
else if (GCSettings.AutoSave == 2) sprintf (options.value[6],"Snapshot");
|
||||
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();
|
||||
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
GCSettings.LoadMethod ++;
|
||||
GCSettings.LoadMethod++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
OnScreenKeyboard(GCSettings.LoadFolder);
|
||||
GCSettings.SaveMethod++;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
GCSettings.SaveMethod ++;
|
||||
OnScreenKeyboard(GCSettings.LoadFolder, 256);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
OnScreenKeyboard(GCSettings.SaveFolder);
|
||||
OnScreenKeyboard(GCSettings.SaveFolder, 256);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
GCSettings.AutoLoad ++;
|
||||
OnScreenKeyboard(GCSettings.CheatFolder, 256);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
GCSettings.AutoLoad++;
|
||||
if (GCSettings.AutoLoad > 2)
|
||||
GCSettings.AutoLoad = 0;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
GCSettings.AutoSave ++;
|
||||
case 6:
|
||||
GCSettings.AutoSave++;
|
||||
if (GCSettings.AutoSave > 3)
|
||||
GCSettings.AutoSave = 0;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
GCSettings.VerifySaves ^= 1;
|
||||
break;
|
||||
}
|
||||
@ -3189,19 +3193,19 @@ static int MenuSettingsNetwork()
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
OnScreenKeyboard(GCSettings.smbip);
|
||||
OnScreenKeyboard(GCSettings.smbip, 16);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
OnScreenKeyboard(GCSettings.smbshare);
|
||||
OnScreenKeyboard(GCSettings.smbshare, 20);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
OnScreenKeyboard(GCSettings.smbuser);
|
||||
OnScreenKeyboard(GCSettings.smbuser, 20);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
OnScreenKeyboard(GCSettings.smbpwd);
|
||||
OnScreenKeyboard(GCSettings.smbpwd, 20);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ void FixInvalidSettings()
|
||||
GCSettings.SFXVolume = 40;
|
||||
if(GCSettings.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_MOUSE)
|
||||
GCSettings.Controller = CTRL_PAD2;
|
||||
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
|
||||
GCSettings.render = 2;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -66,9 +66,9 @@ struct SGCSettings{
|
||||
int AutoSave;
|
||||
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
|
||||
char LoadFolder[200]; // Path to game files
|
||||
char SaveFolder[200]; // Path to save files
|
||||
char CheatFolder[200]; // Path to cheat files
|
||||
char LoadFolder[256]; // Path to game files
|
||||
char SaveFolder[256]; // Path to save files
|
||||
char CheatFolder[256]; // Path to cheat files
|
||||
|
||||
char smbip[16];
|
||||
char smbuser[20];
|
||||
|
Loading…
Reference in New Issue
Block a user