mirror of
https://github.com/dborth/vbagx.git
synced 2025-04-06 23:56:42 +02:00
only update battery images when required, GB mono changes
This commit is contained in:
parent
8500962719
commit
99e23f239c
@ -1165,8 +1165,12 @@ static int MenuGame()
|
||||
closeBtn.SetEffectGrow();
|
||||
|
||||
#ifdef HW_RVL
|
||||
int i, level;
|
||||
int i;
|
||||
char txt[3];
|
||||
bool status[4] = { false, false, false, false };
|
||||
int level[4] = { 0, 0, 0, 0 };
|
||||
bool newStatus;
|
||||
int newLevel;
|
||||
GuiText * batteryTxt[4];
|
||||
GuiImage * batteryImg[4];
|
||||
GuiImage * batteryBarImg[4];
|
||||
@ -1274,24 +1278,38 @@ static int MenuGame()
|
||||
#ifdef HW_RVL
|
||||
for(i=0; i < 4; i++)
|
||||
{
|
||||
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE) // controller connected
|
||||
if(WPAD_Probe(i, NULL) == WPAD_ERR_NONE)
|
||||
{
|
||||
level = (userInput[i].wpad.battery_level / 100.0) * 4;
|
||||
if(level > 4) level = 4;
|
||||
batteryBarImg[i]->SetTile(level);
|
||||
|
||||
if(level == 0)
|
||||
batteryImg[i]->SetImage(&batteryRed);
|
||||
else
|
||||
batteryImg[i]->SetImage(&battery);
|
||||
|
||||
batteryBtn[i]->SetAlpha(255);
|
||||
newStatus = true;
|
||||
newLevel = (userInput[i].wpad.battery_level / 100.0) * 4;
|
||||
if(newLevel > 4) newLevel = 4;
|
||||
}
|
||||
else // controller not connected
|
||||
else
|
||||
{
|
||||
batteryBarImg[i]->SetTile(0);
|
||||
batteryImg[i]->SetImage(&battery);
|
||||
batteryBtn[i]->SetAlpha(150);
|
||||
newStatus = false;
|
||||
newLevel = 0;
|
||||
}
|
||||
|
||||
if(status[i] != newStatus || level[i] != newLevel)
|
||||
{
|
||||
if(newStatus == true) // controller connected
|
||||
{
|
||||
batteryBtn[i]->SetAlpha(255);
|
||||
batteryBarImg[i]->SetTile(newLevel);
|
||||
|
||||
if(newLevel == 0)
|
||||
batteryImg[i]->SetImage(&batteryRed);
|
||||
else
|
||||
batteryImg[i]->SetImage(&battery);
|
||||
}
|
||||
else // controller not connected
|
||||
{
|
||||
batteryBtn[i]->SetAlpha(150);
|
||||
batteryBarImg[i]->SetTile(0);
|
||||
batteryImg[i]->SetImage(&battery);
|
||||
}
|
||||
status[i] = newStatus;
|
||||
level[i] = newLevel;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -2658,6 +2676,9 @@ static int MenuSettingsVideo()
|
||||
sprintf(options.name[i++], "GB Palette");
|
||||
options.length = i;
|
||||
|
||||
if(!IsGameboyGame())
|
||||
options.name[6][0] = 0; // disable palette option for GBA/GBC
|
||||
|
||||
GuiText titleTxt("Game Settings - Video", 28, (GXColor){255, 255, 255, 255});
|
||||
titleTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
|
||||
titleTxt.SetPosition(50,50);
|
||||
@ -2743,7 +2764,7 @@ static int MenuSettingsVideo()
|
||||
else
|
||||
sprintf (options.value[5], "Off");
|
||||
|
||||
if(strcmp(CurrentPalette.gameName,"default"))
|
||||
if(strcmp(CurrentPalette.gameName, "default"))
|
||||
sprintf(options.value[6], "Custom");
|
||||
else
|
||||
sprintf(options.value[6], "Default");
|
||||
|
@ -291,7 +291,7 @@ int main(int argc, char *argv[])
|
||||
ResetVideo_Emu();
|
||||
|
||||
// GB colorizing - set palette
|
||||
if(cartridgeType == 1)
|
||||
if(IsGameboyGame())
|
||||
{
|
||||
if(GCSettings.colorize && strcmp(RomTitle, "MEGAMAN") != 0)
|
||||
gbSetPalette(CurrentPalette.palette);
|
||||
|
@ -719,7 +719,7 @@ void systemDrawScreen()
|
||||
GX_Render( srcWidth, srcHeight, pix, srcPitch );
|
||||
}
|
||||
|
||||
bool ValidGameId(u32 id)
|
||||
static bool ValidGameId(u32 id)
|
||||
{
|
||||
if (id == 0)
|
||||
return false;
|
||||
@ -733,6 +733,14 @@ bool ValidGameId(u32 id)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsGameboyGame()
|
||||
{
|
||||
if(cartridgeType == 1 && !gbCgbMode && !gbSgbMode)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gbApplyPerImagePreferences()
|
||||
{
|
||||
// Only works for some GB Colour roms
|
||||
|
@ -22,6 +22,7 @@ extern char RomTitle[];
|
||||
|
||||
bool LoadVBAROM(int method);
|
||||
void InitialisePalette();
|
||||
bool IsGameboyGame();
|
||||
bool LoadBatteryOrState(char * filepath, int method, int action, bool silent);
|
||||
bool LoadBatteryOrStateAuto(int method, int action, bool silent);
|
||||
bool SaveBatteryOrState(char * filepath, int method, int action, bool silent);
|
||||
|
@ -453,6 +453,7 @@ bool StartColorizing() {
|
||||
}
|
||||
|
||||
void StopColorizing() {
|
||||
if(!ColorizeGameboy || gbSgbMode || gbCgbMode) return;
|
||||
for(int i = 0; i < 12; i++)
|
||||
gbPalette[i] = systemGbPalette[gbPaletteOption*12+i];
|
||||
ColorizeGameboy = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user