diff --git a/source/ngc/gui/gui.h b/source/ngc/gui/gui.h index 3a806a3..c5b4761 100644 --- a/source/ngc/gui/gui.h +++ b/source/ngc/gui/gui.h @@ -32,6 +32,8 @@ #define SCROLL_LOOP_DELAY 3 #define PAGESIZE 8 #define SAVELISTSIZE 6 +#define MAX_SAVES 20 +#define MAX_OPTIONS 30 typedef void (*UpdateCallback)(void * e); @@ -351,8 +353,8 @@ class GuiFileBrowser : public GuiElement typedef struct _optionlist { int length; - char name[150][50]; - char value[150][50]; + char name[MAX_OPTIONS][150]; + char value[MAX_OPTIONS][150]; } OptionList; class GuiOptionBrowser : public GuiElement @@ -406,11 +408,11 @@ class GuiOptionBrowser : public GuiElement typedef struct _savelist { int length; - char filename[20][255]; - GuiImageData * previewImg[20]; - char date[20][50]; - char time[10][50]; - int type[20]; + char filename[MAX_SAVES][256]; + GuiImageData * previewImg[MAX_SAVES]; + char date[MAX_SAVES][20]; + char time[MAX_SAVES][10]; + int type[MAX_SAVES]; int files[2][100]; } SaveList; diff --git a/source/ngc/gui/gui_button.cpp b/source/ngc/gui/gui_button.cpp index e1a1a1f..45fcf45 100644 --- a/source/ngc/gui/gui_button.cpp +++ b/source/ngc/gui/gui_button.cpp @@ -168,11 +168,12 @@ void GuiButton::Update(GuiTrigger * t) } } } - else if(state == STATE_SELECTED) + else { - state = STATE_DEFAULT; + if(state == STATE_SELECTED) + state = STATE_DEFAULT; - if(effectsOver && !effects) + if(effectTarget == effectTargetOver && effectAmount == effectAmountOver) { // initiate effects (in reverse) effects = effectsOver; diff --git a/source/ngc/menu.cpp b/source/ngc/menu.cpp index 97e99c5..b69f067 100644 --- a/source/ngc/menu.cpp +++ b/source/ngc/menu.cpp @@ -1463,7 +1463,7 @@ static int MenuGameSaves(int action) if(saves.type[j] != -1) { int n = -1; - char tmp[300]; + char tmp[256]; strncpy(tmp, browserList[i].filename, 255); tmp[len2-4] = 0; @@ -1472,7 +1472,7 @@ static int MenuGameSaves(int action) else if(len2 - len == 6) n = atoi(&tmp[len2-6]); - if(n > 0 && n < 100) + if(n > 0 && n < MAX_SAVES) saves.files[saves.type[j]][n] = 1; strncpy(saves.filename[j], browserList[i].filename, 255); @@ -1486,20 +1486,7 @@ static int MenuGameSaves(int action) AllocSaveBuffer(); if(LoadFile(scrfile, GCSettings.SaveMethod, SILENT)) - { saves.previewImg[j] = new GuiImageData(savebuffer); - } - /*char scrfile2[1024]; - sprintf(scrfile, "%s/%s.png", GCSettings.SaveFolder, tmp); - sprintf(scrfile2, "%s/resave/%s.png", GCSettings.SaveFolder, tmp); - - AllocSaveBuffer(); - int scrsize = LoadFile(scrfile, GCSettings.SaveMethod, SILENT); - if(scrsize > 0) - { - //saves.previewImg[j] = new GuiImageData(savebuffer); - SaveFile(scrfile2, scrsize, GCSettings.SaveMethod, SILENT); - }*/ FreeSaveBuffer(); } strftime(saves.date[j], 20, "%a %b %d", &browserList[j].mtime);