This commit is contained in:
dborth 2009-03-17 05:09:45 +00:00
parent bf1e7f19c5
commit 489463324d
12 changed files with 88 additions and 50 deletions

View File

@ -658,6 +658,7 @@ ftgxDataOffset FreeTypeGX::getOffset(wchar_t const *text) {
void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color) { void FreeTypeGX::copyTextureToFramebuffer(GXTexObj *texObj, f32 texWidth, f32 texHeight, int16_t screenX, int16_t screenY, GXColor color) {
GX_LoadTexObj(texObj, GX_TEXMAP0); GX_LoadTexObj(texObj, GX_TEXMAP0);
GX_InvalidateTexAll();
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE); GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);

View File

@ -76,7 +76,7 @@ dvd_read (void *dst, unsigned int len, u64 offset)
dvd[7] = 3; dvd[7] = 3;
// Enable reading with DMA // Enable reading with DMA
while (dvd[7] & 1) usleep(50); while (dvd[7] & 1);
// Ensure it has completed // Ensure it has completed
if (dvd[0] & 0x4) if (dvd[0] & 0x4)
@ -432,7 +432,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
if(dvddir == dvdrootdir) // at root already, don't show .. if(dvddir == dvdrootdir) // at root already, don't show ..
fname[0] = 0; fname[0] = 0;
else else
strcpy (fname, ".."); strcpy (fname, "Up One Level");
} }
else else
{ {
@ -742,7 +742,7 @@ void uselessinquiry ()
dvd[6] = 0x20; dvd[6] = 0x20;
dvd[7] = 1; dvd[7] = 1;
while (dvd[7] & 1) usleep(50); while (dvd[7] & 1);
} }
/**************************************************************************** /****************************************************************************
@ -759,7 +759,7 @@ void dvd_motor_off ()
dvd[5] = 0; dvd[5] = 0;
dvd[6] = 0; dvd[6] = 0;
dvd[7] = 1; // Do immediate dvd[7] = 1; // Do immediate
while (dvd[7] & 1) usleep(50); while (dvd[7] & 1);
/*** PSO Stops blackscreen at reload ***/ /*** PSO Stops blackscreen at reload ***/
dvd[0] = 0x14; dvd[0] = 0x14;
@ -785,7 +785,7 @@ int dvd_driveid()
dvd[6] = 0x20; dvd[6] = 0x20;
dvd[7] = 3; dvd[7] = 3;
while( dvd[7] & 1 ) usleep(50); while( dvd[7] & 1 );
DCFlushRange((void *)0x80000000, 32); DCFlushRange((void *)0x80000000, 32);

View File

@ -285,7 +285,7 @@ ParseDirectory()
ResetBrowser(); ResetBrowser();
// add device to path // add device to path
sprintf(fulldir, "%s%s", rootdir, browser.dir); sprintf(fulldir, "%s/%s", rootdir, browser.dir);
// open the directory // open the directory
dir = diropen(fulldir); dir = diropen(fulldir);

View File

@ -87,7 +87,7 @@ GuiKeyboard::GuiKeyboard(char * t)
kbText = new GuiText(kbtextstr, 22, (GXColor){0, 0, 0, 0xff}); kbText = new GuiText(kbtextstr, 22, (GXColor){0, 0, 0, 0xff});
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP); kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
kbText->SetPosition(0, 10); kbText->SetPosition(0, 13);
this->Append(kbText); this->Append(kbText);
key = new GuiImageData(keyboard_key_png); key = new GuiImageData(keyboard_key_png);

View File

@ -238,7 +238,11 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
int next, prev; int next, prev;
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list
int position = 136*(browser.pageIndex + selectedItem) / browser.numEntries; int position = 136*(listOffset+selectedItem)/options->length;
if(position > 130)
position = 136;
scrollbarBoxBtn->SetPosition(0,position+36); scrollbarBoxBtn->SetPosition(0,position+36);
arrowUpBtn->Update(t); arrowUpBtn->Update(t);
@ -288,7 +292,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
if(!focus) if(!focus)
return; // skip navigation return; // skip navigation
if(t->Down()) if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED)
{ {
next = this->FindMenuItem(optionIndex[selectedItem], 1); next = this->FindMenuItem(optionIndex[selectedItem], 1);
@ -306,8 +310,9 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
selectedItem++; selectedItem++;
} }
} }
arrowDownBtn->ResetState();
} }
else if(t->Up()) else if(t->Up() || arrowUpBtn->GetState() == STATE_CLICKED)
{ {
prev = this->FindMenuItem(optionIndex[selectedItem], -1); prev = this->FindMenuItem(optionIndex[selectedItem], -1);
@ -325,6 +330,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
selectedItem--; selectedItem--;
} }
} }
arrowUpBtn->ResetState();
} }
if(updateCB) if(updateCB)

View File

@ -115,6 +115,7 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
saveBtn[i]->SetTrigger(trigA); saveBtn[i]->SetTrigger(trigA);
saveBtn[i]->SetState(STATE_DISABLED); saveBtn[i]->SetState(STATE_DISABLED);
saveBtn[i]->SetEffectGrow(); saveBtn[i]->SetEffectGrow();
saveBtn[i]->SetVisible(false);
} }
} }
@ -221,7 +222,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
int i, len; int i, len;
char savetext[50]; char savetext[50];
// update the location of the scroll box based on the position in the option list // update the location of the scroll box based on the position in the option list
int position = 136*(selectedItem) / saves->length; int position = 136*(listOffset+selectedItem)/saves->length;
if(position > 130)
position = 136;
scrollbarBoxBtn->SetPosition(0,position+36); scrollbarBoxBtn->SetPosition(0,position+36);
arrowUpBtn->Update(t); arrowUpBtn->Update(t);
@ -267,7 +272,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
selectedItem -= 1; selectedItem -= 1;
} }
} }
else if(t->Down()) else if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED)
{ {
if(selectedItem >= SAVELISTSIZE-2) if(selectedItem >= SAVELISTSIZE-2)
{ {
@ -287,8 +292,9 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
{ {
selectedItem += 2; selectedItem += 2;
} }
arrowDownBtn->ResetState();
} }
else if(t->Up()) else if(t->Up() || arrowUpBtn->GetState() == STATE_CLICKED)
{ {
if(selectedItem < 2) if(selectedItem < 2)
{ {
@ -303,6 +309,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
{ {
selectedItem -= 2; selectedItem -= 2;
} }
arrowUpBtn->ResetState();
} }
endNavigation: endNavigation:

View File

@ -792,9 +792,9 @@ static int MenuGameSelection()
{ {
int choice = WindowPrompt( int choice = WindowPrompt(
"Error", "Error",
"Game directory inaccessible on selected load device.", "Games directory is inaccessible on selected load device.",
"Retry", "Retry",
"Change Settings"); "Check Settings");
if(choice) if(choice)
return MENU_GAMESELECTION; return MENU_GAMESELECTION;
@ -1311,7 +1311,7 @@ static int MenuGame()
controllerBtn.SetEffect(EFFECT_FADE, -15); controllerBtn.SetEffect(EFFECT_FADE, -15);
cheatsBtn.SetEffect(EFFECT_FADE, -15); cheatsBtn.SetEffect(EFFECT_FADE, -15);
usleep(150000); usleep(150000); // wait for effects to finish
} }
} }
@ -1587,7 +1587,7 @@ static int MenuGameSaves(int action)
w.SetEffect(EFFECT_FADE, -15); w.SetEffect(EFFECT_FADE, -15);
while(bgBottomImg->GetEffect() > 0) usleep(50); usleep(150000); // wait for effects to finish
} }
} }
@ -1707,7 +1707,7 @@ static int MenuGameCheats()
w.SetEffect(EFFECT_FADE, -15); w.SetEffect(EFFECT_FADE, -15);
while(bgBottomImg->GetEffect() > 0) usleep(50); usleep(150000); // wait for effects to finish
} }
} }
HaltGui(); HaltGui();
@ -2252,8 +2252,9 @@ ButtonMappingWindow()
} }
GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255}); GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255});
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP); msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
msgTxt.SetPosition(0,80); msgTxt.SetPosition(0,-20);
msgTxt.SetMaxWidth(430);
promptWindow.Append(&dialogBoxImg); promptWindow.Append(&dialogBoxImg);
promptWindow.Append(&titleTxt); promptWindow.Append(&titleTxt);
@ -2982,8 +2983,8 @@ static int MenuSettingsMenu()
int i = 0; int i = 0;
OptionList options; OptionList options;
sprintf(options.name[i++], "Wiimote Orientation");
sprintf(options.name[i++], "Exit Action"); sprintf(options.name[i++], "Exit Action");
sprintf(options.name[i++], "Wiimote Orientation");
sprintf(options.name[i++], "Music Volume"); sprintf(options.name[i++], "Music Volume");
sprintf(options.name[i++], "Sound Effects Volume"); sprintf(options.name[i++], "Sound Effects Volume");
options.length = i; options.length = i;
@ -3032,28 +3033,28 @@ static int MenuSettingsMenu()
VIDEO_WaitVSync (); VIDEO_WaitVSync ();
#ifdef HW_RVL #ifdef HW_RVL
if (GCSettings.WiimoteOrientation == 0) if (GCSettings.ExitAction == 1)
sprintf (options.value[0], "Vertical"); sprintf (options.value[0], "Return to Wii Menu");
else if (GCSettings.WiimoteOrientation == 1)
sprintf (options.value[0], "Horizontal");
if (GCSettings.ExitAction == 0)
sprintf (options.value[1], "Return to Loader");
else if (GCSettings.ExitAction == 1)
sprintf (options.value[1], "Return to Wii Menu");
else if (GCSettings.ExitAction == 2) else if (GCSettings.ExitAction == 2)
sprintf (options.value[1], "Power off Wii"); sprintf (options.value[0], "Power off Wii");
#else // GameCube else
options.name[0][0] = 0; // Wiimote sprintf (options.value[0], "Return to Loader");
options.name[2][0] = 0; // Music
options.name[3][0] = 0; // Sound Effects
if (GCSettings.WiimoteOrientation == 0)
sprintf (options.value[1], "Vertical");
else if (GCSettings.WiimoteOrientation == 1)
sprintf (options.value[1], "Horizontal");
#else // GameCube
if(GCSettings.ExitAction > 1) if(GCSettings.ExitAction > 1)
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
if (GCSettings.ExitAction == 0) if (GCSettings.ExitAction == 0)
sprintf (options.value[1], "Return to Loader"); sprintf (options.value[0], "Return to Loader");
else if (GCSettings.ExitAction == 1) else
sprintf (options.value[1], "Reboot"); sprintf (options.value[0], "Reboot");
options.name[1][0] = 0; // Wiimote
options.name[2][0] = 0; // Music
options.name[3][0] = 0; // Sound Effects
#endif #endif
if(GCSettings.MusicVolume > 0) if(GCSettings.MusicVolume > 0)
@ -3071,13 +3072,13 @@ static int MenuSettingsMenu()
switch (ret) switch (ret)
{ {
case 0: case 0:
GCSettings.WiimoteOrientation ^= 1;
break;
case 1:
GCSettings.ExitAction++; GCSettings.ExitAction++;
if(GCSettings.ExitAction > 2) if(GCSettings.ExitAction > 2)
GCSettings.ExitAction = 0; GCSettings.ExitAction = 0;
break; break;
case 1:
GCSettings.WiimoteOrientation ^= 1;
break;
case 2: case 2:
GCSettings.MusicVolume += 10; GCSettings.MusicVolume += 10;
if(GCSettings.MusicVolume > 100) if(GCSettings.MusicVolume > 100)
@ -3281,11 +3282,7 @@ MainMenu (int menu)
// Load preferences // Load preferences
if(!LoadPrefs()) if(!LoadPrefs())
{ SavePrefs(SILENT);
ResumeGui();
ErrorPrompt("Preferences reset - check your settings!");
currentMenu = MENU_SETTINGS_FILE;
}
while(currentMenu != MENU_EXIT || SNESROMSize <= 0) while(currentMenu != MENU_EXIT || SNESROMSize <= 0)
{ {

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 Nintendo Wii/Gamecube Port * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Tantric September 2008 * Tantric 2008-2009
* *
* preferences.cpp * preferences.cpp
* *
@ -15,6 +15,7 @@
#include <mxml.h> #include <mxml.h>
#include "snes9xGX.h" #include "snes9xGX.h"
#include "s9xconfig.h"
#include "images/saveicon.h" #include "images/saveicon.h"
#include "menu.h" #include "menu.h"
#include "memcardop.h" #include "memcardop.h"
@ -369,6 +370,8 @@ SavePrefs (bool silent)
if (!silent) if (!silent)
ShowAction ("Saving preferences..."); ShowAction ("Saving preferences...");
FixInvalidSettings();
AllocSaveBuffer (); AllocSaveBuffer ();
datasize = preparePrefsData (method); datasize = preparePrefsData (method);
@ -437,5 +440,8 @@ bool LoadPrefs()
prefLoaded = true; // attempted to load preferences prefLoaded = true; // attempted to load preferences
if(prefFound)
FixInvalidSettings();
return prefFound; return prefFound;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* Snes9x 1.51 Nintendo Wii/Gamecube Port * Snes9x 1.51 Nintendo Wii/Gamecube Port
* *
* Tantric September 2008 * Tantric 2008-2009
* *
* preferences.h * preferences.h
* *

View File

@ -4,7 +4,7 @@
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
* Michniewski 2008 * Michniewski 2008
* Tantric September 2008 * Tantric 2008-2009
* *
* s9xconfig.cpp * s9xconfig.cpp
* *
@ -21,6 +21,25 @@
struct SGCSettings GCSettings; struct SGCSettings GCSettings;
/****************************************************************************
* Attempts to correct at least some invalid settings - the ones that
* might cause crashes
***************************************************************************/
void FixInvalidSettings()
{
if(!(GCSettings.ZoomLevel > 0.5 && GCSettings.ZoomLevel < 1.5))
GCSettings.ZoomLevel = 1.0;
if(!(GCSettings.xshift > -50 && GCSettings.xshift < 50))
GCSettings.xshift = 0;
if(!(GCSettings.yshift > -50 && GCSettings.yshift < 50))
GCSettings.yshift = 0;
if(!(GCSettings.MusicVolume >= 0 && GCSettings.MusicVolume <= 100))
GCSettings.MusicVolume = 40;
if(!(GCSettings.SFXVolume >= 0 && GCSettings.SFXVolume <= 100))
GCSettings.SFXVolume = 40;
}
void void
DefaultSettings () DefaultSettings ()
{ {

View File

@ -4,7 +4,7 @@
* softdev July 2006 * softdev July 2006
* crunchy2 May 2007 * crunchy2 May 2007
* Michniewski 2008 * Michniewski 2008
* Tantric September 2008 * Tantric 2008-2009
* *
* s9xconfig.h * s9xconfig.h
* *
@ -17,6 +17,7 @@
#define _S9XCONFIG_ #define _S9XCONFIG_
void FixInvalidSettings();
void DefaultSettings (); void DefaultSettings ();
#endif #endif

View File

@ -977,6 +977,7 @@ void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degr
GX_InitTexObj(&texObj, data, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE); GX_InitTexObj(&texObj, data, width,height, GX_TF_RGBA8,GX_CLAMP, GX_CLAMP,GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0); GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_InvalidateTexAll();
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE); GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT); GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);