mirror of
https://github.com/dborth/snes9xgx.git
synced 2024-11-01 00:15:14 +01:00
This commit is contained in:
parent
bf1e7f19c5
commit
489463324d
@ -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) {
|
||||
|
||||
GX_LoadTexObj(texObj, GX_TEXMAP0);
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
|
||||
|
@ -76,7 +76,7 @@ dvd_read (void *dst, unsigned int len, u64 offset)
|
||||
dvd[7] = 3;
|
||||
|
||||
// Enable reading with DMA
|
||||
while (dvd[7] & 1) usleep(50);
|
||||
while (dvd[7] & 1);
|
||||
|
||||
// Ensure it has completed
|
||||
if (dvd[0] & 0x4)
|
||||
@ -432,7 +432,7 @@ getentry (int entrycount, unsigned char dvdbuffer[])
|
||||
if(dvddir == dvdrootdir) // at root already, don't show ..
|
||||
fname[0] = 0;
|
||||
else
|
||||
strcpy (fname, "..");
|
||||
strcpy (fname, "Up One Level");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -742,7 +742,7 @@ void uselessinquiry ()
|
||||
dvd[6] = 0x20;
|
||||
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[6] = 0;
|
||||
dvd[7] = 1; // Do immediate
|
||||
while (dvd[7] & 1) usleep(50);
|
||||
while (dvd[7] & 1);
|
||||
|
||||
/*** PSO Stops blackscreen at reload ***/
|
||||
dvd[0] = 0x14;
|
||||
@ -785,7 +785,7 @@ int dvd_driveid()
|
||||
dvd[6] = 0x20;
|
||||
dvd[7] = 3;
|
||||
|
||||
while( dvd[7] & 1 ) usleep(50);
|
||||
while( dvd[7] & 1 );
|
||||
|
||||
DCFlushRange((void *)0x80000000, 32);
|
||||
|
||||
|
@ -285,7 +285,7 @@ ParseDirectory()
|
||||
ResetBrowser();
|
||||
|
||||
// add device to path
|
||||
sprintf(fulldir, "%s%s", rootdir, browser.dir);
|
||||
sprintf(fulldir, "%s/%s", rootdir, browser.dir);
|
||||
|
||||
// open the directory
|
||||
dir = diropen(fulldir);
|
||||
|
@ -87,7 +87,7 @@ GuiKeyboard::GuiKeyboard(char * t)
|
||||
|
||||
kbText = new GuiText(kbtextstr, 22, (GXColor){0, 0, 0, 0xff});
|
||||
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
kbText->SetPosition(0, 10);
|
||||
kbText->SetPosition(0, 13);
|
||||
this->Append(kbText);
|
||||
|
||||
key = new GuiImageData(keyboard_key_png);
|
||||
|
@ -238,7 +238,11 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
int next, prev;
|
||||
|
||||
// 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);
|
||||
|
||||
arrowUpBtn->Update(t);
|
||||
@ -288,7 +292,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
if(!focus)
|
||||
return; // skip navigation
|
||||
|
||||
if(t->Down())
|
||||
if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED)
|
||||
{
|
||||
next = this->FindMenuItem(optionIndex[selectedItem], 1);
|
||||
|
||||
@ -306,8 +310,9 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
selectedItem++;
|
||||
}
|
||||
}
|
||||
arrowDownBtn->ResetState();
|
||||
}
|
||||
else if(t->Up())
|
||||
else if(t->Up() || arrowUpBtn->GetState() == STATE_CLICKED)
|
||||
{
|
||||
prev = this->FindMenuItem(optionIndex[selectedItem], -1);
|
||||
|
||||
@ -325,6 +330,7 @@ void GuiOptionBrowser::Update(GuiTrigger * t)
|
||||
selectedItem--;
|
||||
}
|
||||
}
|
||||
arrowUpBtn->ResetState();
|
||||
}
|
||||
|
||||
if(updateCB)
|
||||
|
@ -115,6 +115,7 @@ GuiSaveBrowser::GuiSaveBrowser(int w, int h, SaveList * s, int a)
|
||||
saveBtn[i]->SetTrigger(trigA);
|
||||
saveBtn[i]->SetState(STATE_DISABLED);
|
||||
saveBtn[i]->SetEffectGrow();
|
||||
saveBtn[i]->SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -221,7 +222,11 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
||||
int i, len;
|
||||
char savetext[50];
|
||||
// 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);
|
||||
|
||||
arrowUpBtn->Update(t);
|
||||
@ -267,7 +272,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
||||
selectedItem -= 1;
|
||||
}
|
||||
}
|
||||
else if(t->Down())
|
||||
else if(t->Down() || arrowDownBtn->GetState() == STATE_CLICKED)
|
||||
{
|
||||
if(selectedItem >= SAVELISTSIZE-2)
|
||||
{
|
||||
@ -287,8 +292,9 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
||||
{
|
||||
selectedItem += 2;
|
||||
}
|
||||
arrowDownBtn->ResetState();
|
||||
}
|
||||
else if(t->Up())
|
||||
else if(t->Up() || arrowUpBtn->GetState() == STATE_CLICKED)
|
||||
{
|
||||
if(selectedItem < 2)
|
||||
{
|
||||
@ -303,6 +309,7 @@ void GuiSaveBrowser::Update(GuiTrigger * t)
|
||||
{
|
||||
selectedItem -= 2;
|
||||
}
|
||||
arrowUpBtn->ResetState();
|
||||
}
|
||||
|
||||
endNavigation:
|
||||
|
@ -792,9 +792,9 @@ static int MenuGameSelection()
|
||||
{
|
||||
int choice = WindowPrompt(
|
||||
"Error",
|
||||
"Game directory inaccessible on selected load device.",
|
||||
"Games directory is inaccessible on selected load device.",
|
||||
"Retry",
|
||||
"Change Settings");
|
||||
"Check Settings");
|
||||
|
||||
if(choice)
|
||||
return MENU_GAMESELECTION;
|
||||
@ -1311,7 +1311,7 @@ static int MenuGame()
|
||||
controllerBtn.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);
|
||||
|
||||
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);
|
||||
|
||||
while(bgBottomImg->GetEffect() > 0) usleep(50);
|
||||
usleep(150000); // wait for effects to finish
|
||||
}
|
||||
}
|
||||
HaltGui();
|
||||
@ -2252,8 +2252,9 @@ ButtonMappingWindow()
|
||||
}
|
||||
|
||||
GuiText msgTxt(msg, 26, (GXColor){0, 0, 0, 255});
|
||||
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||
msgTxt.SetPosition(0,80);
|
||||
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
||||
msgTxt.SetPosition(0,-20);
|
||||
msgTxt.SetMaxWidth(430);
|
||||
|
||||
promptWindow.Append(&dialogBoxImg);
|
||||
promptWindow.Append(&titleTxt);
|
||||
@ -2982,8 +2983,8 @@ static int MenuSettingsMenu()
|
||||
int i = 0;
|
||||
OptionList options;
|
||||
|
||||
sprintf(options.name[i++], "Wiimote Orientation");
|
||||
sprintf(options.name[i++], "Exit Action");
|
||||
sprintf(options.name[i++], "Wiimote Orientation");
|
||||
sprintf(options.name[i++], "Music Volume");
|
||||
sprintf(options.name[i++], "Sound Effects Volume");
|
||||
options.length = i;
|
||||
@ -3032,28 +3033,28 @@ static int MenuSettingsMenu()
|
||||
VIDEO_WaitVSync ();
|
||||
|
||||
#ifdef HW_RVL
|
||||
if (GCSettings.WiimoteOrientation == 0)
|
||||
sprintf (options.value[0], "Vertical");
|
||||
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");
|
||||
if (GCSettings.ExitAction == 1)
|
||||
sprintf (options.value[0], "Return to Wii Menu");
|
||||
else if (GCSettings.ExitAction == 2)
|
||||
sprintf (options.value[1], "Power off Wii");
|
||||
#else // GameCube
|
||||
options.name[0][0] = 0; // Wiimote
|
||||
options.name[2][0] = 0; // Music
|
||||
options.name[3][0] = 0; // Sound Effects
|
||||
sprintf (options.value[0], "Power off Wii");
|
||||
else
|
||||
sprintf (options.value[0], "Return to Loader");
|
||||
|
||||
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)
|
||||
GCSettings.ExitAction = 0;
|
||||
if (GCSettings.ExitAction == 0)
|
||||
sprintf (options.value[1], "Return to Loader");
|
||||
else if (GCSettings.ExitAction == 1)
|
||||
sprintf (options.value[1], "Reboot");
|
||||
sprintf (options.value[0], "Return to Loader");
|
||||
else
|
||||
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
|
||||
|
||||
if(GCSettings.MusicVolume > 0)
|
||||
@ -3071,13 +3072,13 @@ static int MenuSettingsMenu()
|
||||
switch (ret)
|
||||
{
|
||||
case 0:
|
||||
GCSettings.WiimoteOrientation ^= 1;
|
||||
break;
|
||||
case 1:
|
||||
GCSettings.ExitAction++;
|
||||
if(GCSettings.ExitAction > 2)
|
||||
GCSettings.ExitAction = 0;
|
||||
break;
|
||||
case 1:
|
||||
GCSettings.WiimoteOrientation ^= 1;
|
||||
break;
|
||||
case 2:
|
||||
GCSettings.MusicVolume += 10;
|
||||
if(GCSettings.MusicVolume > 100)
|
||||
@ -3281,11 +3282,7 @@ MainMenu (int menu)
|
||||
|
||||
// Load preferences
|
||||
if(!LoadPrefs())
|
||||
{
|
||||
ResumeGui();
|
||||
ErrorPrompt("Preferences reset - check your settings!");
|
||||
currentMenu = MENU_SETTINGS_FILE;
|
||||
}
|
||||
SavePrefs(SILENT);
|
||||
|
||||
while(currentMenu != MENU_EXIT || SNESROMSize <= 0)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric September 2008
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* preferences.cpp
|
||||
*
|
||||
@ -15,6 +15,7 @@
|
||||
#include <mxml.h>
|
||||
|
||||
#include "snes9xGX.h"
|
||||
#include "s9xconfig.h"
|
||||
#include "images/saveicon.h"
|
||||
#include "menu.h"
|
||||
#include "memcardop.h"
|
||||
@ -369,6 +370,8 @@ SavePrefs (bool silent)
|
||||
if (!silent)
|
||||
ShowAction ("Saving preferences...");
|
||||
|
||||
FixInvalidSettings();
|
||||
|
||||
AllocSaveBuffer ();
|
||||
datasize = preparePrefsData (method);
|
||||
|
||||
@ -437,5 +440,8 @@ bool LoadPrefs()
|
||||
|
||||
prefLoaded = true; // attempted to load preferences
|
||||
|
||||
if(prefFound)
|
||||
FixInvalidSettings();
|
||||
|
||||
return prefFound;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* Snes9x 1.51 Nintendo Wii/Gamecube Port
|
||||
*
|
||||
* Tantric September 2008
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* preferences.h
|
||||
*
|
||||
|
@ -4,7 +4,7 @@
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
* Michniewski 2008
|
||||
* Tantric September 2008
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* s9xconfig.cpp
|
||||
*
|
||||
@ -21,6 +21,25 @@
|
||||
|
||||
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
|
||||
DefaultSettings ()
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
* softdev July 2006
|
||||
* crunchy2 May 2007
|
||||
* Michniewski 2008
|
||||
* Tantric September 2008
|
||||
* Tantric 2008-2009
|
||||
*
|
||||
* s9xconfig.h
|
||||
*
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
#define _S9XCONFIG_
|
||||
|
||||
void FixInvalidSettings();
|
||||
void DefaultSettings ();
|
||||
|
||||
#endif
|
||||
|
@ -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_LoadTexObj(&texObj, GX_TEXMAP0);
|
||||
GX_InvalidateTexAll();
|
||||
|
||||
GX_SetTevOp (GX_TEVSTAGE0, GX_MODULATE);
|
||||
GX_SetVtxDesc (GX_VA_TEX0, GX_DIRECT);
|
||||
|
Loading…
Reference in New Issue
Block a user