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;
if(GCSettings.Controller > CTRL_PAD4 || GCSettings.Controller < CTRL_ZAPPER)
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 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];

View File

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

View File

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

View File

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

View File

@ -478,11 +478,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;

View File

@ -14,7 +14,7 @@
* Constructor for the GuiKeyboard class.
*/
GuiKeyboard::GuiKeyboard(char * t)
GuiKeyboard::GuiKeyboard(char * t, u16 max)
{
width = 540;
height = 400;
@ -26,6 +26,7 @@ GuiKeyboard::GuiKeyboard(char * t)
alignmentVert = ALIGN_MIDDLE;
strncpy(kbtextstr, t, 100);
kbtextstr[100] = 0;
kbtextmaxlen = max;
Key thekeys[4][10] = {
{
@ -236,8 +237,11 @@ void GuiKeyboard::Update(GuiTrigger * t)
if(keySpace->GetState() == STATE_CLICKED)
{
kbtextstr[strlen(kbtextstr)] = ' ';
kbText->SetText(kbtextstr);
if(strlen(kbtextstr) < kbtextmaxlen)
{
kbtextstr[strlen(kbtextstr)] = ' ';
kbText->SetText(kbtextstr);
}
keySpace->SetState(STATE_SELECTED);
}
else if(keyBack->GetState() == STATE_CLICKED)
@ -272,14 +276,18 @@ void GuiKeyboard::Update(GuiTrigger * t)
if(keyBtn[i][j]->GetState() == STATE_CLICKED)
{
if(shift || caps)
if(strlen(kbtextstr) < kbtextmaxlen)
{
kbtextstr[strlen(kbtextstr)] = keys[i][j].chShift;
if(shift) shift ^= 1;
if(shift || caps)
{
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);
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;
GuiKeyboard keyboard(var);
GuiKeyboard keyboard(var, maxlen);
GuiSound btnSoundOver(button_over_pcm, button_over_pcm_size, SOUND_PCM);
GuiImageData btnOutline(button_png);
@ -2767,10 +2767,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");
@ -2806,7 +2807,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);
@ -2849,7 +2850,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
@ -2858,67 +2859,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;
}
@ -3137,19 +3142,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;
}