-added new option to the game settings, Activity LED, with this

enabled you can toggle the drive led for wii and gc games
-updated english.ini
This commit is contained in:
fix94.1 2013-01-19 20:48:07 +00:00
parent b700d056b8
commit c49d88586b
11 changed files with 54 additions and 29 deletions

View File

@ -30,6 +30,7 @@ struct the_CFG {
u8 GameBootType; u8 GameBootType;
WIP_Code *wip_list; WIP_Code *wip_list;
u32 wip_count; u32 wip_count;
bool use_led;
/* needed for channels */ /* needed for channels */
u64 title; u64 title;
bool use_dol; bool use_dol;

View File

@ -135,6 +135,9 @@ int main()
__IOS_ShutdownSubsystems(); __IOS_ShutdownSubsystems();
__exception_closeall(); __exception_closeall();
/* Enable front LED if requested */
if(normalCFG.use_led) *HW_GPIOB_OUT |= 0x20;
/* Originally from tueidj - taken from NeoGamma (thx) */ /* Originally from tueidj - taken from NeoGamma (thx) */
*(vu32*)0xCC003024 = 1; *(vu32*)0xCC003024 = 1;

View File

@ -29,6 +29,7 @@
#define Priiloader_CFG2 ((vu32*)0x817FEFF0) #define Priiloader_CFG2 ((vu32*)0x817FEFF0)
#define HW_GPIO_OUT ((vu32*)0xCD8000E0) #define HW_GPIO_OUT ((vu32*)0xCD8000E0)
#define HW_GPIOB_OUT ((vu32*)0xCD8000C0)
#define HW_AHBPROT ((vu32*)0xCD800064) #define HW_AHBPROT ((vu32*)0xCD800064)
#define MEM_PROT ((vu32)0xCD8B420A) #define MEM_PROT ((vu32)0xCD8B420A)

View File

@ -30,6 +30,7 @@ struct the_CFG {
u8 GameBootType; u8 GameBootType;
WIP_Code *wip_list; WIP_Code *wip_list;
u32 wip_count; u32 wip_count;
bool use_led;
/* needed for channels */ /* needed for channels */
u64 title; u64 title;
bool use_dol; bool use_dol;

View File

@ -53,7 +53,8 @@ extern u32 gameconfsize;
extern u32 *gameconf; extern u32 *gameconf;
the_CFG normalCFG; the_CFG normalCFG;
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, int aspectRatio, u32 returnTo, u8 BootType) void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
int aspectRatio, u32 returnTo, u8 BootType, bool use_led)
{ {
normalCFG.vidMode = vidMode; normalCFG.vidMode = vidMode;
normalCFG.vipatch = vipatch; normalCFG.vipatch = vipatch;
@ -73,6 +74,7 @@ void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 pat
normalCFG.gameconf = gameconf; normalCFG.gameconf = gameconf;
normalCFG.gameconfsize = gameconfsize; normalCFG.gameconfsize = gameconfsize;
normalCFG.BootType = BootType; normalCFG.BootType = BootType;
normalCFG.use_led = use_led;
normalCFG.wip_list = get_wip_list(); normalCFG.wip_list = get_wip_list();
normalCFG.wip_count = get_wip_count(); normalCFG.wip_count = get_wip_count();

View File

@ -29,7 +29,7 @@ extern u32 hooktype;
#endif #endif
void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode, void WiiFlow_ExternalBooter(u8 vidMode, bool vipatch, bool countryString, u8 patchVidMode,
int aspectRatio, u32 returnTo, u8 BootType); int aspectRatio, u32 returnTo, u8 BootType, bool use_led);
void ExternalBooter_ChannelSetup(u64 title, bool dol); void ExternalBooter_ChannelSetup(u64 title, bool dol);
void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID); void ExternalBooter_WiiGameSetup(bool wbfs, bool dvd, const char *ID);
void ShutdownBeforeExit(bool KeepPatches = false); void ShutdownBeforeExit(bool KeepPatches = false);

View File

@ -26,14 +26,13 @@
#include <gccore.h> #include <gccore.h>
#include "Gekko.h" #include "Gekko.h"
#include "memory/memory.h"
#define HW_GPIOB_OUT 0xCD0000C0;
#define DISC_SLOT_LED 0x20 #define DISC_SLOT_LED 0x20
lwp_t light_thread = LWP_THREAD_NULL; lwp_t light_thread = LWP_THREAD_NULL;
void *light_loop(); void *light_loop();
vu32 *light_reg = (u32*)HW_GPIOB_OUT;
bool light_on = false; bool light_on = false;
u8 light_level = 0; u8 light_level = 0;
@ -54,7 +53,7 @@ void wiiLightOff()
light_level = 0; light_level = 0;
LWP_JoinThread(light_thread, NULL); LWP_JoinThread(light_thread, NULL);
light_thread = LWP_THREAD_NULL; light_thread = LWP_THREAD_NULL;
*light_reg &= ~DISC_SLOT_LED; *HW_GPIOB_OUT &= ~DISC_SLOT_LED;
} }
void wiiLightSetLevel(int level) void wiiLightSetLevel(int level)
@ -90,11 +89,11 @@ void *light_loop()
timeon = light_timeon; timeon = light_timeon;
timeoff = light_timeoff; timeoff = light_timeoff;
// Turn on the light and sleep for a bit // Turn on the light and sleep for a bit
*light_reg |= DISC_SLOT_LED; *HW_GPIOB_OUT |= DISC_SLOT_LED;
nanosleep(&timeon); nanosleep(&timeon);
// Turn off the light (if required) and sleep for a bit // Turn off the light (if required) and sleep for a bit
if(timeoff.tv_nsec > 0) if(timeoff.tv_nsec > 0)
*light_reg &= ~DISC_SLOT_LED; *HW_GPIOB_OUT &= ~DISC_SLOT_LED;
nanosleep(&timeoff); nanosleep(&timeoff);
} }
return NULL; return NULL;

View File

@ -29,6 +29,7 @@
#define Priiloader_CFG2 ((vu32*)0x817FEFF0) #define Priiloader_CFG2 ((vu32*)0x817FEFF0)
#define HW_GPIO_OUT ((vu32*)0xCD8000E0) #define HW_GPIO_OUT ((vu32*)0xCD8000E0)
#define HW_GPIOB_OUT ((vu32*)0xCD8000C0)
#define HW_AHBPROT ((vu32*)0xCD800064) #define HW_AHBPROT ((vu32*)0xCD800064)
#define MEM_PROT ((vu32)0xCD8B420A) #define MEM_PROT ((vu32)0xCD8B420A)

View File

@ -17,6 +17,9 @@ u8 m_gameSettingsPage = 0;
s16 m_gameSettingsLblApploader; s16 m_gameSettingsLblApploader;
s16 m_gameSettingsBtnApploader; s16 m_gameSettingsBtnApploader;
s16 m_gameSettingsLblLED;
s16 m_gameSettingsBtnLED;
void CMenu::_hideGameSettings(bool instant) void CMenu::_hideGameSettings(bool instant)
{ {
m_btnMgr.hide(m_gameSettingsLblPage, instant); m_btnMgr.hide(m_gameSettingsLblPage, instant);
@ -102,6 +105,8 @@ void CMenu::_hideGameSettings(bool instant)
m_btnMgr.hide(m_gameSettingsBtnFlashSave, instant); m_btnMgr.hide(m_gameSettingsBtnFlashSave, instant);
m_btnMgr.hide(m_gameSettingsLblApploader, instant); m_btnMgr.hide(m_gameSettingsLblApploader, instant);
m_btnMgr.hide(m_gameSettingsBtnApploader, instant); m_btnMgr.hide(m_gameSettingsBtnApploader, instant);
m_btnMgr.hide(m_gameSettingsLblLED, instant);
m_btnMgr.hide(m_gameSettingsBtnLED, instant);
for(u8 i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i) for(u8 i = 0; i < ARRAY_SIZE(m_gameSettingsLblUser); ++i)
if(m_gameSettingsLblUser[i] != -1) if(m_gameSettingsLblUser[i] != -1)
@ -132,20 +137,11 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnPageP); m_btnMgr.show(m_gameSettingsBtnPageP);
m_btnMgr.show(m_gameSettingsBtnBack); m_btnMgr.show(m_gameSettingsBtnBack);
m_btnMgr.show(m_gameSettingsLblTitle); m_btnMgr.show(m_gameSettingsLblTitle);
if(CoverFlow.getHdr()->type == TYPE_GC_GAME)
{
if(m_new_dml)
g_numGCfPages = 3;
else
g_numGCfPages = 2;
}
else
{
if(CoverFlow.getHdr()->type == TYPE_WII_GAME && _checkSave(string((const char *)CoverFlow.getHdr()->id), false)) if(CoverFlow.getHdr()->type == TYPE_WII_GAME && _checkSave(string((const char *)CoverFlow.getHdr()->id), false))
g_numGCfPages = 5; g_numGCfPages = 5;
else else
g_numGCfPages = 4; g_numGCfPages = 4;
}
if (m_gameSettingsPage == 1) if (m_gameSettingsPage == 1)
{ {
@ -235,7 +231,6 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsBtnHooktypeM); m_btnMgr.show(m_gameSettingsBtnHooktypeM);
m_btnMgr.show(m_gameSettingsBtnHooktypeP); m_btnMgr.show(m_gameSettingsBtnHooktypeP);
} }
m_btnMgr.show(m_gameSettingsLblOcarina); m_btnMgr.show(m_gameSettingsLblOcarina);
m_btnMgr.show(m_gameSettingsBtnOcarina); m_btnMgr.show(m_gameSettingsBtnOcarina);
@ -256,7 +251,6 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsBtnHooktypeM); m_btnMgr.hide(m_gameSettingsBtnHooktypeM);
m_btnMgr.hide(m_gameSettingsBtnHooktypeP); m_btnMgr.hide(m_gameSettingsBtnHooktypeP);
} }
m_btnMgr.hide(m_gameSettingsLblOcarina); m_btnMgr.hide(m_gameSettingsLblOcarina);
m_btnMgr.hide(m_gameSettingsBtnOcarina); m_btnMgr.hide(m_gameSettingsBtnOcarina);
@ -384,6 +378,9 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsLblIOS); m_btnMgr.show(m_gameSettingsLblIOS);
m_btnMgr.show(m_gameSettingsBtnIOSP); m_btnMgr.show(m_gameSettingsBtnIOSP);
m_btnMgr.show(m_gameSettingsBtnIOSM); m_btnMgr.show(m_gameSettingsBtnIOSM);
m_btnMgr.show(m_gameSettingsLblLED);
m_btnMgr.show(m_gameSettingsBtnLED);
} }
else else
{ {
@ -404,6 +401,9 @@ void CMenu::_showGameSettings(void)
m_btnMgr.hide(m_gameSettingsLblExtractSave); m_btnMgr.hide(m_gameSettingsLblExtractSave);
m_btnMgr.hide(m_gameSettingsBtnExtractSave); m_btnMgr.hide(m_gameSettingsBtnExtractSave);
m_btnMgr.hide(m_gameSettingsLblLED);
m_btnMgr.hide(m_gameSettingsBtnLED);
} }
if (m_gameSettingsPage == 5) if (m_gameSettingsPage == 5)
{ {
@ -456,6 +456,7 @@ void CMenu::_showGameSettings(void)
m_btnMgr.setText(m_gameSettingsBtnCustom, _optBoolToString(m_gcfg2.getOptBool(id, "custom", 0))); m_btnMgr.setText(m_gameSettingsBtnCustom, _optBoolToString(m_gcfg2.getOptBool(id, "custom", 0)));
m_btnMgr.setText(m_gameSettingsBtnLaunchNK, _optBoolToString(m_gcfg2.getOptBool(id, "useneek", 0))); m_btnMgr.setText(m_gameSettingsBtnLaunchNK, _optBoolToString(m_gcfg2.getOptBool(id, "useneek", 0)));
m_btnMgr.setText(m_gameSettingsBtnApploader, _optBoolToString(m_gcfg2.getOptBool(id, "apploader", 0))); m_btnMgr.setText(m_gameSettingsBtnApploader, _optBoolToString(m_gcfg2.getOptBool(id, "apploader", 0)));
m_btnMgr.setText(m_gameSettingsBtnLED, _optBoolToString(m_gcfg2.getOptBool(id, "led", 0)));
} }
int j = 0; int j = 0;
@ -680,6 +681,11 @@ void CMenu::_gameSettings(void)
m_gcfg2.setBool(id, "apploader", !m_gcfg2.getBool(id, "apploader", 0)); m_gcfg2.setBool(id, "apploader", !m_gcfg2.getBool(id, "apploader", 0));
_showGameSettings(); _showGameSettings();
} }
else if(m_btnMgr.selected(m_gameSettingsBtnLED))
{
m_gcfg2.setBool(id, "led", !m_gcfg2.getBool(id, "led", 0));
_showGameSettings();
}
else if(m_btnMgr.selected(m_gameSettingsBtnCategoryMain) && !m_locked) else if(m_btnMgr.selected(m_gameSettingsBtnCategoryMain) && !m_locked)
{ {
_hideGameSettings(); _hideGameSettings();
@ -830,6 +836,9 @@ void CMenu::_initGameSettingsMenu()
m_gameSettingsLblExtractSave = _addLabel("GAME_SETTINGS/EXTRACT_SAVE", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsLblExtractSave = _addLabel("GAME_SETTINGS/EXTRACT_SAVE", theme.lblFont, L"", 40, 310, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnExtractSave = _addButton("GAME_SETTINGS/EXTRACT_SAVE_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor); m_gameSettingsBtnExtractSave = _addButton("GAME_SETTINGS/EXTRACT_SAVE_BTN", theme.btnFont, L"", 330, 310, 270, 56, theme.btnFontColor);
m_gameSettingsLblLED = _addLabel("GAME_SETTINGS/LED", theme.lblFont, L"", 40, 250, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnLED = _addButton("GAME_SETTINGS/LED_BTN", theme.btnFont, L"", 330, 250, 270, 56, theme.btnFontColor);
//Page 5 //Page 5
m_gameSettingsLblFlashSave = _addLabel("GAME_SETTINGS/FLASH_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsLblFlashSave = _addLabel("GAME_SETTINGS/FLASH_SAVE", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsBtnFlashSave = _addButton("GAME_SETTINGS/FLASH_SAVE_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor); m_gameSettingsBtnFlashSave = _addButton("GAME_SETTINGS/FLASH_SAVE_BTN", theme.btnFont, L"", 330, 130, 270, 56, theme.btnFontColor);
@ -902,6 +911,9 @@ void CMenu::_initGameSettingsMenu()
_setHideAnim(m_gameSettingsLblApploader, "GAME_SETTINGS/APPLDR", -200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblApploader, "GAME_SETTINGS/APPLDR", -200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnApploader, "GAME_SETTINGS/APPLDR_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnApploader, "GAME_SETTINGS/APPLDR_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblLED, "GAME_SETTINGS/LED", -200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnLED, "GAME_SETTINGS/LED_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblNMM, "GAME_SETTINGS/DML_NMM", -200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblNMM, "GAME_SETTINGS/DML_NMM", -200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblNMM_Val, "GAME_SETTINGS/DML_NMM_BTN", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblNMM_Val, "GAME_SETTINGS/DML_NMM_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnNMM_P, "GAME_SETTINGS/DML_NMM_PLUS", 200, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnNMM_P, "GAME_SETTINGS/DML_NMM_PLUS", 200, 0, 1.f, 0.f);
@ -992,4 +1004,5 @@ void CMenu::_textGameSettings(void)
m_btnMgr.setText(m_gameSettingsLblGCLoader, _t("cfgg35", L"GameCube Loader")); m_btnMgr.setText(m_gameSettingsLblGCLoader, _t("cfgg35", L"GameCube Loader"));
m_btnMgr.setText(m_gameSettingsLblDM_Widescreen, _t("cfgg36", L"DM Widescreen Patch")); m_btnMgr.setText(m_gameSettingsLblDM_Widescreen, _t("cfgg36", L"DM Widescreen Patch"));
m_btnMgr.setText(m_gameSettingsLblApploader, _t("cfgg37", L"Boot Apploader")); m_btnMgr.setText(m_gameSettingsLblApploader, _t("cfgg37", L"Boot Apploader"));
m_btnMgr.setText(m_gameSettingsLblLED, _t("cfgg38", L"Activity LED"));
} }

View File

@ -892,7 +892,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc)
bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false)); bool cheats = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(GC_DOMAIN, "cheat", false));
bool DML_debug = m_gcfg2.getBool(id, "debugger", false); bool DML_debug = m_gcfg2.getBool(id, "debugger", false);
bool DM_Widescreen = m_gcfg2.getBool(id, "dm_widescreen", false); bool DM_Widescreen = m_gcfg2.getBool(id, "dm_widescreen", false);
bool activity_led = m_cfg.getBool(GC_DOMAIN, "dml_activity_led", true); bool activity_led = m_gcfg2.getBool(id, "led", false);
/* Generate gct path */ /* Generate gct path */
char GC_Path[1024]; char GC_Path[1024];
GC_Path[1023] = '\0'; GC_Path[1023] = '\0';
@ -1102,6 +1102,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
int userIOS = m_gcfg2.getInt(id, "ios", 0); int userIOS = m_gcfg2.getInt(id, "ios", 0);
u64 gameTitle = TITLE_ID(hdr->settings[0],hdr->settings[1]); u64 gameTitle = TITLE_ID(hdr->settings[0],hdr->settings[1]);
bool useNK2o = (m_gcfg2.getBool(id, "useneek", false) && !neek2o()); bool useNK2o = (m_gcfg2.getBool(id, "useneek", false) && !neek2o());
bool use_led = m_gcfg2.getBool(id, "led", false);
m_gcfg1.save(true); m_gcfg1.save(true);
m_gcfg2.save(true); m_gcfg2.save(true);
@ -1165,7 +1166,7 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
NandHandle.Patch_AHB(); /* Identify may takes it */ NandHandle.Patch_AHB(); /* Identify may takes it */
Identify(gameTitle); Identify(gameTitle);
ExternalBooter_ChannelSetup(gameTitle, use_dol); ExternalBooter_ChannelSetup(gameTitle, use_dol);
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL); WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, 0, TYPE_CHANNEL, use_led);
} }
Sys_Exit(); Sys_Exit();
} }
@ -1316,6 +1317,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
else else
emulate_mode = 0; emulate_mode = 0;
bool use_led = m_gcfg2.getBool(id, "led", false);
bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false)); bool cheat = m_gcfg2.testOptBool(id, "cheat", m_cfg.getBool(WII_DOMAIN, "cheat", false));
debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0; // debuggerselect is defined in fst.h debuggerselect = m_gcfg2.getBool(id, "debugger", false) ? 1 : 0; // debuggerselect is defined in fst.h
if(id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") // Prince of Persia, Rival Swords if(id == "RPWE41" || id == "RPWZ41" || id == "SPXP41") // Prince of Persia, Rival Swords
@ -1401,7 +1403,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
free(gameconfig); free(gameconfig);
} }
ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str()); ExternalBooter_WiiGameSetup(wbfs_partition, dvd, id.c_str());
WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME); WiiFlow_ExternalBooter(videoMode, vipatch, countryPatch, patchVidMode, aspectRatio, returnTo, TYPE_WII_GAME, use_led);
} }
void CMenu::_initGameMenu() void CMenu::_initGameMenu()

View File

@ -88,6 +88,8 @@ cfgg33=Flash
cfgg34=Devolution Memcard Emulator cfgg34=Devolution Memcard Emulator
cfgg35=GameCube Loader cfgg35=GameCube Loader
cfgg36=DM Widescreen Patch cfgg36=DM Widescreen Patch
cfgg37=Boot Apploader
cfgg38=Activity LED
cfgg4=Patch country strings cfgg4=Patch country strings
cfgg5=Ocarina cfgg5=Ocarina
cfgg7=Vipatch cfgg7=Vipatch