diff --git a/out/boot.dol b/out/boot.dol index b925268b..8b6059d3 100644 Binary files a/out/boot.dol and b/out/boot.dol differ diff --git a/source/gc/gc.cpp b/source/gc/gc.cpp index b9e470f1..e6aa2d41 100644 --- a/source/gc/gc.cpp +++ b/source/gc/gc.cpp @@ -25,7 +25,6 @@ #include #include #include -#include "menu/menu.hpp" #include "gc/gc.hpp" #include "gui/text.hpp" #include "devicemounter/DeviceHandler.hpp" @@ -38,23 +37,56 @@ #include "memory/memory.h" #include "memory/mem2.hpp" -/* since Nintendont v1.98 argsboot is supported. and since wiiflow lite doesn't support versions less than v3.358 -we will use argsboot every time. */ +// Languages +#define SRAM_ENGLISH 0 +#define SRAM_GERMAN 1 +#define SRAM_FRENCH 2 +#define SRAM_SPANISH 3 +#define SRAM_ITALIAN 4 +#define SRAM_DUTCH 5 + +extern "C" { +syssram* __SYS_LockSram(); +u32 __SYS_UnlockSram(u32 write); +u32 __SYS_SyncSram(void); +} + +u8 get_wii_language() +{ + switch (CONF_GetLanguage()) + { + case CONF_LANG_GERMAN: + return SRAM_GERMAN; + case CONF_LANG_FRENCH: + return SRAM_FRENCH; + case CONF_LANG_SPANISH: + return SRAM_SPANISH; + case CONF_LANG_ITALIAN: + return SRAM_ITALIAN; + case CONF_LANG_DUTCH: + return SRAM_DUTCH; + default: + return SRAM_ENGLISH; + } +} // Nintendont NIN_CFG NinCfg; -u8 NinDevice = 0; -bool NinArgsboot = false; -void Nintendont_SetOptions(const char *game, const char *gameID, char *CheatPath, char *NewCheatPath, const char *partition, - bool cheats, u8 emuMC, u8 videomode, bool widescreen, bool led, bool native_ctl, bool deflicker, bool wiiu_widescreen, - bool NIN_Debugger, bool tri_arcade, bool cc_rumble, bool ipl) +/* since Nintendont v1.98 argsboot is supported. +since v3.324 '$$Version:' string was added for loaders to detect. +since wiiflow lite doesn't support versions less than v3.358 +we will use argsboot and version detection every time. */ + +void Nintendont_SetOptions(const char *gamePath, const char *gameID, const char *CheatPath, u8 lang, + u32 n_cfg, u32 n_vm, s8 vidscale, s8 vidoffset) { - //clear nincfg and set magicbytes now in case of return when NINRev=0 below memset(&NinCfg, 0, sizeof(NIN_CFG)); NinCfg.Magicbytes = 0x01070CF6; - //check version + NinCfg.MaxPads = 4; + + /* check nintendont version so we can set the proper config version */ u32 NIN_cfg_version = NIN_CFG_VERSION; char NINVersion[7]= ""; u32 NINRev = 0; @@ -83,168 +115,84 @@ void Nintendont_SetOptions(const char *game, const char *gameID, char *CheatPath break; } if(NINRev == 0 || NINRev < 358) - return;// nintendont not found or revision is less than 358(was 135) thus too old for wiiflow lite - /*if(NINRev >= 135 && NINRev < 354) - NIN_cfg_version = 3; - else if(NINRev >= 354 && NINRev < 358) - NIN_cfg_version = 4;*/ + NIN_cfg_version = 2;// nintendont not found or revision is less than 358 thus too old for wiiflow lite + else if(NINRev >= 358 && NINRev < 368) NIN_cfg_version = 5; else if(NINRev >= 368 && NINRev < 424) NIN_cfg_version = 6; else if(NINRev >= 424 && NINRev < 431) NIN_cfg_version = 7; - + NinCfg.Version = NIN_cfg_version; + + /* set config options */ + NinCfg.Config = n_cfg; + + /* VideoMode setup */ + NinCfg.VideoMode = n_vm; - /*if(memcmp("0x474851",gameID,3)==0) // old fix for simpsons hit & run - r155 fixed this - NinCfg.MaxPads = 1; - else*/ - NinCfg.MaxPads = 4; + NinCfg.VideoScale = vidscale; + NinCfg.VideoOffset = vidoffset; - NinCfg.VideoMode |= NIN_VID_FORCE;// always force video? + /* language setup */ + if(lang == 0) + lang = get_wii_language(); + else + lang--; - if((videomode > 3) && (videomode != 6)) + switch(lang) { - NinCfg.Config |= NIN_CFG_FORCE_PROG; - NinCfg.VideoMode |= NIN_VID_PROG; + case SRAM_GERMAN: + NinCfg.Language = NIN_LAN_GERMAN; + break; + case SRAM_FRENCH: + NinCfg.Language = NIN_LAN_FRENCH; + break; + case SRAM_SPANISH: + NinCfg.Language = NIN_LAN_SPANISH; + break; + case SRAM_ITALIAN: + NinCfg.Language = NIN_LAN_ITALIAN; + break; + case SRAM_DUTCH: + NinCfg.Language = NIN_LAN_DUTCH; + break; + default: + NinCfg.Language = NIN_LAN_ENGLISH; + break; } - - NinCfg.Config |= NIN_CFG_AUTO_BOOT; - - NinDevice = DeviceHandle.PathToDriveType(game); - if(NinDevice != SD) - NinCfg.Config |= NIN_CFG_USB; - if(NIN_Debugger && IsOnWiiU() == false) //wii only - NinCfg.Config |= NIN_CFG_OSREPORT; - - if(native_ctl && IsOnWiiU() == false) //wii only - NinCfg.Config |= NIN_CFG_NATIVE_SI; - - if(deflicker) - NinCfg.VideoMode |= NIN_VID_FORCE_DF; - - if(wiiu_widescreen && IsOnWiiU() == true) //wii u vwii only - NinCfg.Config |= NIN_CFG_WIIU_WIDE; - - if(widescreen) - NinCfg.Config |= NIN_CFG_FORCE_WIDE; - - if(led) - NinCfg.Config |= NIN_CFG_LED; - - if(tri_arcade) - NinCfg.Config |= NIN_CFG_ARCADE_MODE; - - if(cc_rumble) - NinCfg.Config |= NIN_CFG_BIT_CC_RUMBLE; - - if(ipl) - NinCfg.Config |= NIN_CFG_SKIP_IPL; - - NinCfg.MemCardBlocks = 0x2; //251 blocks - - if(emuMC > 0 || IsOnWiiU() == true) //force memcardemu for wii u vwii - NinCfg.Config |= NIN_CFG_MEMCARDEMU; - - if(emuMC > 1) - { - NinCfg.Config |= NIN_CFG_MC_MULTI; + /* MemCard Blocks Setup */ + if(NinCfg.Config & NIN_CFG_MC_MULTI) NinCfg.MemCardBlocks = 0x4; //1019 blocks (8MB) - } - if(CheatPath != NULL && NewCheatPath != NULL && cheats) - { - const char *ptr = NULL; - if(strncasecmp(CheatPath, partition, strlen(partition)) != 0) - { - fsop_CopyFile(CheatPath, NewCheatPath, NULL, NULL); - ptr = strchr(NewCheatPath, '/'); - } - else - ptr = strchr(CheatPath, '/'); - snprintf(NinCfg.CheatPath, sizeof(NinCfg.CheatPath), ptr); - NinCfg.Config |= NIN_CFG_CHEAT_PATH; - } - if(cheats) - NinCfg.Config |= NIN_CFG_CHEATS; + else + NinCfg.MemCardBlocks = 0x2; //251 blocks (2MB) + + /* CheatPath Setup */ + if(CheatPath != NULL && (NinCfg.Config & NIN_CFG_CHEATS)) + snprintf(NinCfg.CheatPath, sizeof(NinCfg.CheatPath), strchr(CheatPath, '/')); - strncpy(NinCfg.GamePath, strchr(game, '/'), 254); - if(strstr(NinCfg.GamePath, "boot.bin") != NULL) + /* GamePath Setup */ + if(strstr(gamePath, "games") == NULL)// set path for disc + snprintf(NinCfg.GamePath, sizeof(NinCfg.GamePath), "di"); + else { - *strrchr(NinCfg.GamePath, '/') = '\0'; //boot.bin - *(strrchr(NinCfg.GamePath, '/')+1) = '\0'; //sys + strncpy(NinCfg.GamePath, strchr(gamePath, '/'), 254); + if(strstr(NinCfg.GamePath, "boot.bin") != NULL) + { + *strrchr(NinCfg.GamePath, '/') = '\0'; //boot.bin + *(strrchr(NinCfg.GamePath, '/')+1) = '\0'; //sys + } } + + /* GameID Setup */ memcpy(&NinCfg.GameID, gameID, 4); gprintf("Nintendont Game Path: %s, ID: %08x\n", NinCfg.GamePath, NinCfg.GameID); -} - -void Nintendont_BootDisc(u8 emuMC, bool widescreen, bool cc_rumble, bool native_ctl, bool deflicker) -{ - memset(&NinCfg, 0, sizeof(NIN_CFG)); - NinCfg.Magicbytes = 0x01070CF6; - FILE * location = fopen("sd:/nincfg.bin", "r"); - if(location == NULL) - NinCfg.Config |= NIN_CFG_USB; - - fclose(location); - location = NULL; - - NinCfg.Version = NIN_CFG_VERSION; - NinCfg.Config |= NIN_CFG_AUTO_BOOT; - NinCfg.VideoMode |= NIN_VID_AUTO; - - if(cc_rumble) - NinCfg.Config |= NIN_CFG_BIT_CC_RUMBLE; - if(emuMC == 1) - { - NinCfg.Config |= NIN_CFG_MEMCARDEMU; - NinCfg.MemCardBlocks = 0x2;//251 blocks (2MB) - } - else if(emuMC == 2) - { - NinCfg.Config |= NIN_CFG_MEMCARDEMU; - NinCfg.Config |= NIN_CFG_MC_MULTI; - NinCfg.MemCardBlocks = 0x4;//1019 blocks (8MB) - - } - if(native_ctl) - NinCfg.Config |= NIN_CFG_NATIVE_SI; - if(deflicker) - NinCfg.VideoMode |= NIN_VID_FORCE_DF; - if(widescreen) - NinCfg.Config |= NIN_CFG_FORCE_WIDE; - snprintf(NinCfg.GamePath,sizeof(NinCfg.GamePath),"di"); -} - -void Nintendont_WriteOptions() -{ + gprintf("Writing Arguments\n"); AddBootArgument((char*)&NinCfg, sizeof(NIN_CFG)); } - -/*void Nintendont_WriteOptions() -{ - // Newer Nintendont versions - if(NinArgsboot == true) - { - gprintf("Writing Arguments\n"); - AddBootArgument((char*)&NinCfg, sizeof(NIN_CFG)); - return; - } - // general loader - if(DeviceHandle.SD_Inserted()) - { - gprintf("Writing Nintendont CFG: sd:/%s\n", NIN_CFG_PATH); - fsop_WriteFile(fmt("sd:/%s", NIN_CFG_PATH), &NinCfg, sizeof(NIN_CFG)); - } - // for kernel - if(NinDevice != SD) - { - gprintf("Writing Nintendont USB Kernel CFG: %s:/%s\n", DeviceName[NinDevice], NIN_CFG_PATH); - fsop_WriteFile(fmt("%s:/%s", DeviceName[NinDevice], NIN_CFG_PATH), &NinCfg, sizeof(NIN_CFG)); - } -}*/ bool Nintendont_Installed() { @@ -272,19 +220,6 @@ bool Nintendont_GetLoader() gprintf("Nintendont loaded: %s\n", dol_path); AddBootArgument(dol_path); break; - //search for argsboot not needed - u32 size; - const char *dol_ptr = GetHomebrew(&size); - for(u32 i = 0; i < size; i += 0x10) - { - if(strncmp(dol_ptr + i, "argsboot", 8) == 0) - { - gprintf("Nintendont argsboot found at %08x\n", i); - NinArgsboot = true; - break; - } - } - break; } } return ret; @@ -319,11 +254,11 @@ void DEVO_GetLoader(const char *path) gprintf("Devolution: Loader not found!\n"); } -void DEVO_SetOptions(const char *isopath, const char *gameID, bool memcard_emu, - bool widescreen, bool activity_led, bool wifi) +void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 lang, + bool memcard_emu, bool widescreen, bool activity_led, bool wifi) { // re-mount device we need - DeviceHandle.MountDevolution(); + //DeviceHandle.MountDevolution(); //start writing cfg to mem struct stat st; @@ -429,7 +364,57 @@ void DEVO_SetOptions(const char *isopath, const char *gameID, bool memcard_emu, // flush disc ID and Devolution config out to memory DCFlushRange((void*)Disc_ID, 64); - DeviceHandle.UnMountDevolution(); + //DeviceHandle.UnMountDevolution(); + + // GX Render Mode (rmode) and register (rmode_reg) + GXRModeObj *rmode = VIDEO_GetPreferredMode(0); + int rmode_reg = 0;// VI_NTSC + + switch (videomode) + { + case 1:// PAL50 + rmode = &TVPal528IntDf; + rmode_reg = 1;// VI_PAL + break; + case 2:// PAL60 480i + rmode = &TVEurgb60Hz480IntDf; + rmode_reg = 5;// VI_EURGB60 + default: + case 3:// NTSC 480i + rmode = &TVNtsc480IntDf; + break; + + } + + /* Set video mode register */ + *Video_Mode = rmode_reg; + DCFlushRange((void*)Video_Mode, 4); + + /* Set video mode */ + if(rmode != 0) + VIDEO_Configure(rmode); + + /* Setup video */ + VIDEO_SetBlack(TRUE); + VIDEO_Flush(); + VIDEO_WaitVSync(); + if(rmode->viTVMode & VI_NON_INTERLACE) + VIDEO_WaitVSync(); + else while(VIDEO_GetNextField()) + VIDEO_WaitVSync(); + + /* language setup */ + if(lang == 0) + lang = get_wii_language(); + else + lang--; + + // sram settins for devo language only + syssram *sram; + sram = __SYS_LockSram(); + sram->lang = lang; + __SYS_UnlockSram(1); // 1 -> write changes + while(!__SYS_SyncSram()); } void DEVO_Boot() @@ -443,178 +428,3 @@ void DEVO_Boot() /* Boot that binary */ JumpToEntry(DEVO_ENTRY); } - - -// General -#define SRAM_ENGLISH 0 -#define SRAM_GERMAN 1 -#define SRAM_FRENCH 2 -#define SRAM_SPANISH 3 -#define SRAM_ITALIAN 4 -#define SRAM_DUTCH 5 - -extern "C" { -syssram* __SYS_LockSram(); -u32 __SYS_UnlockSram(u32 write); -u32 __SYS_SyncSram(void); -} - -void GC_SetVideoMode(u8 videomode, u8 loader) -{ - syssram *sram; - sram = __SYS_LockSram(); - GXRModeObj *vmode = VIDEO_GetPreferredMode(0); - int vmode_reg = 0;// VI_NTSC - - if((VIDEO_HaveComponentCable() && (CONF_GetProgressiveScan() > 0)) || ((videomode > 3) && (videomode != 6))) - sram->flags |= 0x80; //set progressive flag - else - sram->flags &= 0x7F; //clear progressive flag - - if(videomode == 1 || videomode == 3 || videomode == 5 || videomode == 6 || videomode == 7) - { - vmode_reg = 1;// VI_PAL - sram->flags |= 0x01; // Set bit 0 to set the video mode to PAL - sram->ntd |= 0x40; //set pal60 flag - } - else - { - sram->flags &= 0xFE; // Clear bit 0 to set the video mode to NTSC - sram->ntd &= 0xBF; //clear pal60 flag - } - /* should the sram pal60 flag be cleared for PAL50? */ - if(videomode == 1)// PAL50 - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_PAL50; - vmode = &TVPal528IntDf; - } - else if(videomode == 2)// NTSC - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_NTSC; - vmode = &TVNtsc480IntDf; - } - else if(videomode == 3)// PAL60 - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_PAL60; - vmode = &TVEurgb60Hz480IntDf; - vmode_reg = 5;// VI_EURGB60 - } - else if(videomode == 4)// NTSC 480P - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_NTSC; - vmode = &TVNtsc480Prog; - } - else if(videomode == 5)// PAL 480P - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_PAL60; - vmode = &TVEurgb60Hz480Prog; - vmode_reg = 5; - } - else if(videomode == 6)// MPAL - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_MPAL; - vmode = &TVEurgb60Hz480IntDf; - vmode_reg = 2;// VI_MPAL - } - else if(videomode == 7)// MPAL Prog - { - if(loader == 1) - NinCfg.VideoMode |= NIN_VID_FORCE_MPAL; - vmode = &TVEurgb60Hz480Prog; - vmode_reg = 2; - } - - __SYS_UnlockSram(1); // 1 -> write changes - while(!__SYS_SyncSram()); - - /* Set video mode register */ - *Video_Mode = vmode_reg; - DCFlushRange((void*)Video_Mode, 4); - - /* Set video mode */ - if(vmode != 0) - VIDEO_Configure(vmode); - - /* Setup video - VIDEO_SetBlack(FALSE); - VIDEO_Flush(); - VIDEO_WaitVSync(); - if(vmode->viTVMode & VI_NON_INTERLACE) - VIDEO_WaitVSync(); - else while(VIDEO_GetNextField()) - VIDEO_WaitVSync(); */ - - /* Set black and flush */ - VIDEO_SetBlack(TRUE); - VIDEO_Flush(); - VIDEO_WaitVSync(); - if(vmode->viTVMode & VI_NON_INTERLACE) - VIDEO_WaitVSync(); - else while(VIDEO_GetNextField()) - VIDEO_WaitVSync(); -} - -u8 get_wii_language() -{ - switch (CONF_GetLanguage()) - { - case CONF_LANG_GERMAN: - return SRAM_GERMAN; - case CONF_LANG_FRENCH: - return SRAM_FRENCH; - case CONF_LANG_SPANISH: - return SRAM_SPANISH; - case CONF_LANG_ITALIAN: - return SRAM_ITALIAN; - case CONF_LANG_DUTCH: - return SRAM_DUTCH; - default: - return SRAM_ENGLISH; - } -} - -void GC_SetLanguage(u8 lang, u8 loader) -{ - if (lang == 0) - lang = get_wii_language(); - else - lang--; - - syssram *sram; - sram = __SYS_LockSram(); - sram->lang = lang; - __SYS_UnlockSram(1); // 1 -> write changes - while(!__SYS_SyncSram()); - - /* write language for nintendont */ - if(loader == 1) - { - switch(lang) - { - case SRAM_GERMAN: - NinCfg.Language = NIN_LAN_GERMAN; - break; - case SRAM_FRENCH: - NinCfg.Language = NIN_LAN_FRENCH; - break; - case SRAM_SPANISH: - NinCfg.Language = NIN_LAN_SPANISH; - break; - case SRAM_ITALIAN: - NinCfg.Language = NIN_LAN_ITALIAN; - break; - case SRAM_DUTCH: - NinCfg.Language = NIN_LAN_DUTCH; - break; - default: - NinCfg.Language = NIN_LAN_ENGLISH; - break; - } - } -} diff --git a/source/gc/gc.hpp b/source/gc/gc.hpp index 7aa0c86b..90f58cbc 100644 --- a/source/gc/gc.hpp +++ b/source/gc/gc.hpp @@ -21,17 +21,12 @@ // Nintendont #include "nin_cfg.h" -#define NIN_CFG_PATH "nincfg.bin" #define NIN_LOADER_PATH "%s:/apps/nintendont/boot.dol" -//const char *NINversionDate(NIN_LOADER_PATH); bool Nintendont_Installed(); bool Nintendont_GetLoader(); -void Nintendont_BootDisc(u8 emuMC, bool widescreen, bool cc_rumble, bool native_ctl, bool deflicker); -void Nintendont_SetOptions(const char *game, const char *gameID, char *CheatPath, char *NewCheatPath, const char *partition, - bool cheats, u8 emuMC, u8 videomode, bool widescreen, bool led, bool native_ctl, bool deflicker, bool wiiu_widescreen, - bool NIN_Debugger, bool tri_arcade, bool cc_rumble, bool ipl); -void Nintendont_WriteOptions(); +void Nintendont_SetOptions(const char *gamePath, const char *gameID, const char *CheatPath, u8 lang, u32 n_cfg, + u32 n_vm, s8 vidscale, s8 vidoffset); // Devolution #define DEVO_LOADER_PATH "%s/loader.bin" @@ -58,13 +53,8 @@ typedef struct global_config bool DEVO_Installed(const char *path); void DEVO_GetLoader(const char *path); -void DEVO_SetOptions(const char *isopath, const char *gameID, - bool memcard_emum, bool widescreen, bool activity_led, bool wifi); +void DEVO_SetOptions(const char *isopath, const char *gameID, u8 videomode, u8 lang, + bool memcard_emum, bool widescreen, bool activity_led, bool wifi); void DEVO_Boot(); - -// General -void GC_SetVideoMode(u8 videomode, u8 loader); -void GC_SetLanguage(u8 lang, u8 loader); - #endif //_GC_HPP_ diff --git a/source/gc/nin_cfg.h b/source/gc/nin_cfg.h index 32b2a213..c8722390 100644 --- a/source/gc/nin_cfg.h +++ b/source/gc/nin_cfg.h @@ -13,7 +13,7 @@ typedef struct NIN_CFG { unsigned int Magicbytes; // 0x01070CF6 - unsigned int Version; // v4 since v3.354, v5 since v3.358, v6 since v3.368, v7 since v4.424, v8 since v4.431 + unsigned int Version; // v3 since rev135, v4 since v3.354, v5 since v3.358, v6 since v3.368, v7 since v4.424, v8 since v4.431 unsigned int Config; unsigned int VideoMode; unsigned int Language; @@ -21,7 +21,10 @@ typedef struct NIN_CFG char CheatPath[255]; unsigned int MaxPads; unsigned int GameID; - unsigned int MemCardBlocks; + unsigned char MemCardBlocks; + signed char VideoScale; // 40 to 120 or 0 for auto, is added to 600 for 640 to 720 + signed char VideoOffset;// -20 to 20 or 0 for center + unsigned char Unused; } NIN_CFG; // NIN_CFG_REMLIMIT is disc read speed limt enabled by default. It keeps loading speed at GC speed. diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index b5e09bc1..6a68fd70 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -1721,18 +1721,21 @@ void CMenu::_mainLoopCommon(bool withCF, bool adjusting) if(withCF && m_gameSelected && m_gamesound_changed && !m_soundThrdBusy && !m_gameSound.IsPlaying() && MusicPlayer.GetVolume() == 0) { - CheckGameSoundThread();// stop sound loading thread - m_gameSound.Play(m_bnrSndVol);// play sound + _stopGameSoundThread();// stop game sound loading thread + m_gameSound.Play(m_bnrSndVol);// play game sound m_gamesound_changed = false; } - // stop game/banner sound if game no longer selected or new game selected + // stop game/banner sound from playing if we exited game selected menu or if we move to new game else if(!m_gameSelected) m_gameSound.Stop(); - // decrease volume to zero if plugin video playing or game/banner sound is loaded and ready to play - // also switch to next song if current song is done + /* decrease music volume to zero if any of these are true: + plugin video playing or + game/banner sound is loaded and ready to play or + gamesound hasn't finished - when finishes music volume back to normal + also this switches to next song if current song is done */ MusicPlayer.Tick(m_video_playing || - (m_gameSelected && m_gamesound_changed && m_gameSound.IsLoaded()) || - (m_gameSound.IsPlaying() && !m_gamesound_changed)); + (m_gameSelected && m_gamesound_changed && m_gameSound.IsLoaded()) || + (m_gameSound.IsPlaying() && !m_gamesound_changed));//this checks if gamesound has finished and thus allows music to play // set song title and display it if music info is allowed if(MusicPlayer.SongChanged() && m_music_info) { diff --git a/source/menu/menu.hpp b/source/menu/menu.hpp index 23c65b15..0851f975 100644 --- a/source/menu/menu.hpp +++ b/source/menu/menu.hpp @@ -482,6 +482,9 @@ private: s16 m_gameSettingsLblWidescreen; s16 m_gameSettingsBtnWidescreen; + s16 m_gameSettingsLblWiiuWidescreen; + s16 m_gameSettingsBtnWiiuWidescreen; + s16 m_gameSettingsLblCC_Rumble; s16 m_gameSettingsBtnCC_Rumble; @@ -497,6 +500,19 @@ private: s16 m_gameSettingsLblSkip_IPL; s16 m_gameSettingsBtnSkip_IPL; + s16 m_gameSettingsLblPatch50; + s16 m_gameSettingsBtnPatch50; + + s16 m_gameSettingsLblWidth; + s16 m_gameSettingsLblWidthVal; + s16 m_gameSettingsBtnWidthP; + s16 m_gameSettingsBtnWidthM; + + s16 m_gameSettingsLblPos; + s16 m_gameSettingsLblPosVal; + s16 m_gameSettingsBtnPosP; + s16 m_gameSettingsBtnPosM; + s16 m_gameSettingsLblGCLoader; s16 m_gameSettingsLblGCLoader_Val; s16 m_gameSettingsBtnGCLoader_P; @@ -1043,7 +1059,7 @@ private: void _cfTheme(void); void _system(void); void _gameinfo(void); - void _gameSettings(void); + void _gameSettings(const dir_discHdr *GameHdr, bool disc = false); void _CoverBanner(void); void _Explorer(void); const char *_FolderExplorer(const char *startPath); @@ -1066,7 +1082,7 @@ private: bool _loadFile(u8 * &buffer, u32 &size, const char *path, const char *file); int _loadIOS(u8 ios, int userIOS, string id, bool RealNAND_Channels = false); void _launch(const dir_discHdr *hdr); - void _launchGame(dir_discHdr *hdr, bool dvd); + void _launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg = false); void _launchChannel(dir_discHdr *hdr); void _launchHomebrew(const char *filepath, vector arguments); void _launchGC(dir_discHdr *hdr, bool disc); @@ -1172,7 +1188,7 @@ private: static u32 _downloadUrlAsync(void *obj); void _playGameSound(void); - void CheckGameSoundThread(void); + void _stopGameSoundThread(void); static void _gameSoundThread(CMenu *m); static void _load_installed_cioses(); @@ -1183,9 +1199,9 @@ private: static const SOption _VideoModes[7]; static const SOption _languages[11]; - static const SOption _GlobalGCvideoModes[8]; + static const SOption _GlobalGCvideoModes[6]; static const SOption _GlobalGClanguages[7]; - static const SOption _GCvideoModes[9]; + static const SOption _GCvideoModes[7]; static const SOption _GClanguages[8]; static const SOption _GlobalGCLoaders[2]; static const SOption _GCLoader[3]; diff --git a/source/menu/menu_config_game.cpp b/source/menu/menu_config_game.cpp index ba3620a0..352963eb 100644 --- a/source/menu/menu_config_game.cpp +++ b/source/menu/menu_config_game.cpp @@ -9,6 +9,8 @@ u8 m_gameSettingsMaxPgs = 5; u8 m_gameSettingsPage = 0; u8 GCLoader = 0; +int videoScale, videoOffset; +const dir_discHdr *GameHdr; template static inline T loopNum(T i, T s) { @@ -108,6 +110,8 @@ void CMenu::_hideGameSettingsPg(bool instant) m_btnMgr.hide(m_gameSettingsBtnDevoMemcardEmu, instant); m_btnMgr.hide(m_gameSettingsLblWidescreen, instant); m_btnMgr.hide(m_gameSettingsBtnWidescreen, instant); + m_btnMgr.hide(m_gameSettingsLblWiiuWidescreen, instant); + m_btnMgr.hide(m_gameSettingsBtnWiiuWidescreen, instant); m_btnMgr.hide(m_gameSettingsLblGCLoader, instant); m_btnMgr.hide(m_gameSettingsLblGCLoader_Val, instant); m_btnMgr.hide(m_gameSettingsBtnGCLoader_P, instant); @@ -122,6 +126,16 @@ void CMenu::_hideGameSettingsPg(bool instant) m_btnMgr.hide(m_gameSettingsBtnArcade, instant); m_btnMgr.hide(m_gameSettingsLblSkip_IPL, instant); m_btnMgr.hide(m_gameSettingsBtnSkip_IPL, instant); + m_btnMgr.hide(m_gameSettingsLblPatch50, instant); + m_btnMgr.hide(m_gameSettingsBtnPatch50, instant); + m_btnMgr.hide(m_gameSettingsLblWidthVal, instant); + m_btnMgr.hide(m_gameSettingsLblWidth, instant); + m_btnMgr.hide(m_gameSettingsBtnWidthP, instant); + m_btnMgr.hide(m_gameSettingsBtnWidthM, instant); + m_btnMgr.hide(m_gameSettingsLblPosVal, instant); + m_btnMgr.hide(m_gameSettingsLblPos, instant); + m_btnMgr.hide(m_gameSettingsBtnPosP, instant); + m_btnMgr.hide(m_gameSettingsBtnPosM, instant); // Channels only m_btnMgr.hide(m_gameSettingsLblApploader, instant); m_btnMgr.hide(m_gameSettingsBtnApploader, instant); @@ -131,10 +145,11 @@ void CMenu::_hideGameSettingsPg(bool instant) m_btnMgr.hide(m_gameSettingsBtnLaunchNK, instant); } -void CMenu::_showGameSettings(void) +void CMenu::_showGameSettings() { - const char *id = CoverFlow.getId(); - const dir_discHdr *GameHdr = CoverFlow.getHdr(); + //const char *id = CoverFlow.getId(); + //const dir_discHdr *GameHdr = CoverFlow.getHdr(); + const char *id = GameHdr->id; if(GameHdr->type == TYPE_GC_GAME) { @@ -143,9 +158,7 @@ void CMenu::_showGameSettings(void) } m_gameSettingsMaxPgs = 5; - if(GameHdr->type == TYPE_GC_GAME && GCLoader == NINTENDONT) - m_gameSettingsMaxPgs = 4; - else if(GameHdr->type == TYPE_GC_GAME && GCLoader == DEVOLUTION) + if(GameHdr->type == TYPE_GC_GAME && GCLoader == DEVOLUTION) m_gameSettingsMaxPgs = 2; _setBg(m_gameSettingsBg, m_gameSettingsBg); @@ -268,8 +281,8 @@ void CMenu::_showGameSettings(void) } else { - m_btnMgr.show(m_gameSettingsLblLED); - m_btnMgr.show(m_gameSettingsBtnLED); + m_btnMgr.show(m_gameSettingsLblWiiuWidescreen); + m_btnMgr.show(m_gameSettingsBtnWiiuWidescreen); m_btnMgr.show(m_gameSettingsLblEmuMemCard); m_btnMgr.show(m_gameSettingsLblEmuMemCard_Val); @@ -333,13 +346,34 @@ void CMenu::_showGameSettings(void) } if(m_gameSettingsPage == 5) { - m_btnMgr.show(m_gameSettingsLblLED); - m_btnMgr.show(m_gameSettingsBtnLED); - - if(GameHdr->type == TYPE_WII_GAME) + if(GameHdr->type == TYPE_GC_GAME) { - m_btnMgr.show(m_gameSettingsLblPrivateServer); - m_btnMgr.show(m_gameSettingsBtnPrivateServer); + m_btnMgr.show(m_gameSettingsLblLED); + m_btnMgr.show(m_gameSettingsBtnLED); + + m_btnMgr.show(m_gameSettingsLblWidthVal); + m_btnMgr.show(m_gameSettingsLblWidth); + m_btnMgr.show(m_gameSettingsBtnWidthP); + m_btnMgr.show(m_gameSettingsBtnWidthM); + + m_btnMgr.show(m_gameSettingsLblPosVal); + m_btnMgr.show(m_gameSettingsLblPos); + m_btnMgr.show(m_gameSettingsBtnPosP); + m_btnMgr.show(m_gameSettingsBtnPosM); + + m_btnMgr.show(m_gameSettingsBtnPatch50); + m_btnMgr.show(m_gameSettingsLblPatch50); + } + else + { + m_btnMgr.show(m_gameSettingsLblLED); + m_btnMgr.show(m_gameSettingsBtnLED); + + if(GameHdr->type == TYPE_WII_GAME) + { + m_btnMgr.show(m_gameSettingsLblPrivateServer); + m_btnMgr.show(m_gameSettingsBtnPrivateServer); + } } } @@ -351,15 +385,28 @@ void CMenu::_showGameSettings(void) if(GameHdr->type == TYPE_GC_GAME) { - //widescreen is shared by devo and nintendont, in the future might seperate them - m_btnMgr.setText(m_gameSettingsLblWidescreen, _t("cfgg36", L"Widescreen Patch")); + //widescreen is shared by devo and nintendont m_btnMgr.setText(m_gameSettingsBtnWidescreen, _optBoolToString(m_gcfg2.getOptBool(id, "widescreen", 0))); + m_btnMgr.setText(m_gameSettingsBtnWiiuWidescreen, _optBoolToString(m_gcfg2.getOptBool(id, "wiiu_widescreen", 0))); m_btnMgr.setText(m_gameSettingsBtnDevoMemcardEmu, _optBoolToString(m_gcfg2.getOptBool(id, "devo_memcard_emu", 2))); m_btnMgr.setText(m_gameSettingsBtnCC_Rumble, _optBoolToString(m_gcfg2.getOptBool(id, "cc_rumble", 2))); m_btnMgr.setText(m_gameSettingsBtnNATIVE_CTL, _optBoolToString(m_gcfg2.getOptBool(id, "native_ctl", 2))); m_btnMgr.setText(m_gameSettingsBtnDeflicker, _optBoolToString(m_gcfg2.getOptBool(id, "deflicker", 0))); m_btnMgr.setText(m_gameSettingsBtnArcade, _optBoolToString(m_gcfg2.getOptBool(id, "triforce_arcade", 0))); m_btnMgr.setText(m_gameSettingsBtnSkip_IPL, _optBoolToString(m_gcfg2.getOptBool(id, "skip_ipl", 0))); + m_btnMgr.setText(m_gameSettingsBtnPatch50, _optBoolToString(m_gcfg2.getOptBool(id, "patch_pal50", 0))); + + if(videoScale == 0) + m_btnMgr.setText(m_gameSettingsLblWidthVal, _t("GC_Auto", L"Auto")); + else if(videoScale == 127) + m_btnMgr.setText(m_gameSettingsLblWidthVal, _t("def", L"Default")); + else + m_btnMgr.setText(m_gameSettingsLblWidthVal, wfmt(L"%i", max(40, min(120, videoScale)) + 600)); + + if(videoOffset == 127) + m_btnMgr.setText(m_gameSettingsLblPosVal, _t("def", L"Default")); + else + m_btnMgr.setText(m_gameSettingsLblPosVal, wfmt(L"%i", max(-20, min(20, videoOffset)))); i = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_GCvideoModes[i].id, CMenu::_GCvideoModes[i].text)); @@ -367,18 +414,9 @@ void CMenu::_showGameSettings(void) i = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); m_btnMgr.setText(m_gameSettingsLblLanguage, _t(CMenu::_GClanguages[i].id, CMenu::_GClanguages[i].text)); - if(GCLoader == NINTENDONT) - { - //m_btnMgr.setText(m_gameSettingsLblEmuMemCard, _t("cfgg47", L"Emulated MemCard")); - i = min((u32)m_gcfg2.getInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); - m_btnMgr.setText(m_gameSettingsLblEmuMemCard_Val, _t(CMenu::_NinEmuCard[i].id, CMenu::_NinEmuCard[i].text)); - if(IsOnWiiU()) - { - m_btnMgr.setText(m_gameSettingsLblWidescreen, _t("cfgg46", L"WiiU Widescreen")); - m_btnMgr.setText(m_gameSettingsBtnWidescreen, _optBoolToString(m_gcfg2.getOptBool(id, "wiiu_widescreen", 0))); - } - } - + i = min((u32)m_gcfg2.getInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); + m_btnMgr.setText(m_gameSettingsLblEmuMemCard_Val, _t(CMenu::_NinEmuCard[i].id, CMenu::_NinEmuCard[i].text)); + i = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); m_btnMgr.setText(m_gameSettingsLblGCLoader_Val, _t(CMenu::_GCLoader[i].id, CMenu::_GCLoader[i].text)); } @@ -424,11 +462,15 @@ void CMenu::_showGameSettings(void) } } -void CMenu::_gameSettings(void) +void CMenu::_gameSettings(const dir_discHdr *hdr, bool disc) { m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); - const char *id = CoverFlow.getId(); - const dir_discHdr *GameHdr = CoverFlow.getHdr(); + GameHdr = hdr; + const char *id = GameHdr->id; + //const char *id = CoverFlow.getId(); + //const dir_discHdr *GameHdr = CoverFlow.getHdr(); + videoScale = m_gcfg2.getInt(id, "nin_width", 127); + videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); m_gameSettingsPage = 1; _showGameSettings(); while(!m_exit) @@ -503,10 +545,12 @@ void CMenu::_gameSettings(void) } else if(m_btnMgr.selected(m_gameSettingsBtnWidescreen)) { - if(IsOnWiiU() and GCLoader == NINTENDONT) - m_gcfg2.setBool(id, "wiiu_widescreen", !m_gcfg2.getBool(id, "wiiu_widescreen", 0)); - else - m_gcfg2.setBool(id, "widescreen", !m_gcfg2.getBool(id, "widescreen", 0)); + m_gcfg2.setBool(id, "widescreen", !m_gcfg2.getBool(id, "widescreen", 0)); + _showGameSettings(); + } + else if(m_btnMgr.selected(m_gameSettingsBtnWiiuWidescreen)) + { + m_gcfg2.setBool(id, "wiiu_widescreen", !m_gcfg2.getBool(id, "wiiu_widescreen", 0)); _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnLanguageP) || m_btnMgr.selected(m_gameSettingsBtnLanguageM)) @@ -533,6 +577,48 @@ void CMenu::_gameSettings(void) m_gcfg2.setInt(id, "aspect_ratio", (int)loopNum((u32)m_gcfg2.getInt(id, "aspect_ratio", 0) + direction, ARRAY_SIZE(CMenu::_AspectRatio))); _showGameSettings(); } + else if(m_btnMgr.selected(m_gameSettingsBtnWidthP) || m_btnMgr.selected(m_gameSettingsBtnWidthM)) + { + if(m_btnMgr.selected(m_gameSettingsBtnWidthP)) + { + if(videoScale == 0) + videoScale = 40; + else if(videoScale == 127) + videoScale = 0; + else if(videoScale < 120) + videoScale += 2; + } + else + { + if(videoScale == 40) + videoScale = 0; + else if(videoScale == 0) + videoScale = 127; + else if(videoScale > 40 && videoScale != 127) + videoScale -= 2; + } + m_gcfg2.setInt(id, "nin_width", videoScale); + _showGameSettings(); + } + else if(m_btnMgr.selected(m_gameSettingsBtnPosP) || m_btnMgr.selected(m_gameSettingsBtnPosM)) + { + if(m_btnMgr.selected(m_gameSettingsBtnPosP)) + { + if(videoOffset == 127) + videoOffset = -20; + else if(videoOffset < 20) + videoOffset++; + } + else + { + if(videoOffset == -20) + videoOffset = 127; + else if(videoOffset > -20 && videoOffset != 127) + videoOffset--; + } + m_gcfg2.setInt(id, "nin_pos", videoOffset); + _showGameSettings(); + } else if(m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_P) || m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_M)) { s8 direction = m_btnMgr.selected(m_gameSettingsBtnEmuMemCard_P) ? 1 : -1; @@ -576,11 +662,16 @@ void CMenu::_gameSettings(void) } else if(m_btnMgr.selected(m_gameSettingsBtnManage)) { - CoverFlow.stopCoverLoader(true); - _hideGameSettings(); - _CoverBanner(); + if(disc) + error(_t("cfgg57", L"Not allowed for disc!")); + else + { + CoverFlow.stopCoverLoader(true); + _hideGameSettings(); + _CoverBanner(); + CoverFlow.startCoverLoader(); + } _showGameSettings(); - CoverFlow.startCoverLoader(); } else if(m_btnMgr.selected(m_gameSettingsBtnCheat)) { @@ -641,6 +732,11 @@ void CMenu::_gameSettings(void) m_gcfg2.setBool(id, "skip_ipl", !m_gcfg2.getBool(id, "skip_ipl", 0)); _showGameSettings(); } + else if(m_btnMgr.selected(m_gameSettingsBtnPatch50)) + { + m_gcfg2.setBool(id, "patch_pal50", !m_gcfg2.getBool(id, "patch_pal50", 0)); + _showGameSettings(); + } else if(m_btnMgr.selected(m_gameSettingsBtnPrivateServer)) { m_gcfg2.setBool(id, "private_server", !m_gcfg2.getBool(id, "private_server", 0)); @@ -648,8 +744,18 @@ void CMenu::_gameSettings(void) } else if(m_btnMgr.selected(m_gameSettingsBtnCategoryMain)) { - _hideGameSettings(); - _CategorySettings(true); + if(disc) + error(_t("cfgg57", L"Not allowed for disc!")); + else + { + _hideGameSettings(); + _CategorySettings(true); + // update these in case the user changed games while in cat menu + id = CoverFlow.getId(); + GameHdr = CoverFlow.getHdr(); + videoScale = m_gcfg2.getInt(id, "nin_width", 127); + videoOffset = m_gcfg2.getInt(id, "nin_pos", 127); + } _showGameSettings(); } else if(m_btnMgr.selected(m_gameSettingsBtnExtractSave)) @@ -670,7 +776,8 @@ void CMenu::_gameSettings(void) } } } - m_gcfg2.save(true); + if(!disc) + m_gcfg2.save(true); _hideGameSettings(); } @@ -750,7 +857,10 @@ void CMenu::_initGameSettingsMenu() m_gameSettingsBtnAspectRatioP = _addPicButton("GAME_SETTINGS/ASPECT_RATIO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 310, 48, 48); //GC Nintendont Page 3 - //nintendont = led_activity(pg5), emu_memcard, widescreen/wiiu widescreen, mng_cvr_bnr (pg4) + //nintendont = wiiu widescreen, emu_memcard, widescreen, mng_cvr_bnr (pg4) + m_gameSettingsLblWiiuWidescreen = _addLabel("GAME_SETTINGS/WIIU_WIDESCREEN", theme.lblFont, L"", 20, 125, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_gameSettingsBtnWiiuWidescreen = _addButton("GAME_SETTINGS/WIIU_WIDESCREEN_BTN", theme.btnFont, L"", 420, 130, 200, 48, theme.btnFontColor); + m_gameSettingsLblEmuMemCard = _addLabel("GAME_SETTINGS/DML_NMM", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsLblEmuMemCard_Val = _addLabel("GAME_SETTINGS/DML_NMM_BTN", theme.btnFont, L"", 468, 190, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_gameSettingsBtnEmuMemCard_M = _addPicButton("GAME_SETTINGS/DML_NMM_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 190, 48, 48); @@ -806,7 +916,19 @@ void CMenu::_initGameSettingsMenu() m_gameSettingsLblPrivateServer = _addLabel("GAME_SETTINGS/PRIVATE_SERVER", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_gameSettingsBtnPrivateServer = _addButton("GAME_SETTINGS/PRIVATE_SERVER_BTN", theme.btnFont, L"", 420, 190, 200, 48, theme.btnFontColor); + //GC + m_gameSettingsLblWidth = _addLabel("GAME_SETTINGS/NIN_WIDTH", theme.lblFont, L"", 20, 185, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_gameSettingsLblWidthVal = _addLabel("GAME_SETTINGS/NIN_WIDTH_BTN", theme.btnFont, L"", 468, 190, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); + m_gameSettingsBtnWidthM = _addPicButton("GAME_SETTINGS/NIN_WIDTH_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 190, 48, 48); + m_gameSettingsBtnWidthP = _addPicButton("GAME_SETTINGS/NIN_WIDTH_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 190, 48, 48); + m_gameSettingsLblPos = _addLabel("GAME_SETTINGS/NIN_POS", theme.lblFont, L"", 20, 245, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_gameSettingsLblPosVal = _addLabel("GAME_SETTINGS/NIN_POS_BTN", theme.btnFont, L"", 468, 250, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); + m_gameSettingsBtnPosM = _addPicButton("GAME_SETTINGS/NIN_POS_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 420, 250, 48, 48); + m_gameSettingsBtnPosP = _addPicButton("GAME_SETTINGS/NIN_POS_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 572, 250, 48, 48); + + m_gameSettingsLblPatch50 = _addLabel("GAME_SETTINGS/PATCH_PAL50", theme.lblFont, L"", 20, 305, 385, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); + m_gameSettingsBtnPatch50 = _addButton("GAME_SETTINGS/PATCH_PAL50_BTN", theme.btnFont, L"", 420, 310, 200, 48, theme.btnFontColor); //Footer m_gameSettingsLblPage = _addLabel("GAME_SETTINGS/PAGE_BTN", theme.btnFont, L"", 68, 400, 104, 48, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); @@ -892,12 +1014,28 @@ void CMenu::_initGameSettingsMenu() _setHideAnim(m_gameSettingsLblWidescreen, "GAME_SETTINGS/WIDESCREEN", 50, 0, -2.f, 0.f); _setHideAnim(m_gameSettingsBtnWidescreen, "GAME_SETTINGS/WIDESCREEN_BTN", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsLblWiiuWidescreen, "GAME_SETTINGS/WIIU_WIDESCREEN", 50, 0, -2.f, 0.f); + _setHideAnim(m_gameSettingsBtnWiiuWidescreen, "GAME_SETTINGS/WIIU_WIDESCREEN_BTN", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsLblArcade, "GAME_SETTINGS/ARCADE", 50, 0, -2.f, 0.f); _setHideAnim(m_gameSettingsBtnArcade, "GAME_SETTINGS/ARCADE_BTN", -50, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsLblSkip_IPL, "GAME_SETTINGS/SKIP_IPL", 50, 0, -2.f, 0.f); _setHideAnim(m_gameSettingsBtnSkip_IPL, "GAME_SETTINGS/SKIP_IPL_BTN", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsLblPatch50, "GAME_SETTINGS/PATCH_PAL50", 50, 0, -2.f, 0.f); + _setHideAnim(m_gameSettingsBtnPatch50, "GAME_SETTINGS/PATCH_PAL50_BTN", -50, 0, 1.f, 0.f); + + _setHideAnim(m_gameSettingsLblWidth, "GAME_SETTINGS/NIN_WIDTH", 50, 0, -2.f, 0.f); + _setHideAnim(m_gameSettingsLblWidthVal, "GAME_SETTINGS/NIN_WIDTH_BTN", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsBtnWidthM, "GAME_SETTINGS/NIN_WIDTH_MINUS", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsBtnWidthP, "GAME_SETTINGS/NIN_WIDTH_PLUS", -50, 0, 1.f, 0.f); + + _setHideAnim(m_gameSettingsLblPos, "GAME_SETTINGS/NIN_POS", 50, 0, -2.f, 0.f); + _setHideAnim(m_gameSettingsLblPosVal, "GAME_SETTINGS/NIN_POS_BTN", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsBtnPosM, "GAME_SETTINGS/NIN_POS_MINUS", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsBtnPosP, "GAME_SETTINGS/NIN_POS_PLUS", -50, 0, 1.f, 0.f); + _setHideAnim(m_gameSettingsLblGCLoader, "GAME_SETTINGS/GC_LOADER", 50, 0, -2.f, 0.f); _setHideAnim(m_gameSettingsLblGCLoader_Val, "GAME_SETTINGS/GC_LOADER_BTN", -50, 0, 1.f, 0.f); _setHideAnim(m_gameSettingsBtnGCLoader_P, "GAME_SETTINGS/GC_LOADER_PLUS", -50, 0, 1.f, 0.f); @@ -957,6 +1095,7 @@ void CMenu::_textGameSettings(void) m_btnMgr.setText(m_gameSettingsLblDeflicker, _t("cfgg44", L"Video Deflicker")); m_btnMgr.setText(m_gameSettingsLblDevoMemcardEmu, _t("cfgg47", L"Emulated MemCard")); m_btnMgr.setText(m_gameSettingsLblWidescreen, _t("cfgg36", L"Widescreen Patch")); + m_btnMgr.setText(m_gameSettingsLblWiiuWidescreen, _t("cfgg46", L"WiiU Widescreen")); m_btnMgr.setText(m_gameSettingsLblCountryPatch, _t("cfgg4", L"Patch country strings")); m_btnMgr.setText(m_gameSettingsLblVipatch, _t("cfgg7", L"Vipatch")); @@ -967,6 +1106,7 @@ void CMenu::_textGameSettings(void) m_btnMgr.setText(m_gameSettingsLblCC_Rumble, _t("cfgg52", L"Wiimote CC Rumble")); m_btnMgr.setText(m_gameSettingsLblNATIVE_CTL, _t("cfgg43", L"Native Control")); m_btnMgr.setText(m_gameSettingsLblSkip_IPL, _t("cfgg53", L"Skip IPL BIOS")); + m_btnMgr.setText(m_gameSettingsLblPatch50, _t("cfgg56", L"Patch PAL50")); m_btnMgr.setText(m_gameSettingsLblArcade, _t("cfgg48", L"Triforce Arcade Mode")); m_btnMgr.setText(m_gameSettingsLblEmulation, _t("cfgg24", L"NAND Emulation")); @@ -980,4 +1120,6 @@ void CMenu::_textGameSettings(void) m_btnMgr.setText(m_gameSettingsLblFlashSave, _t("cfgg32", L"Flash Save to NAND")); m_btnMgr.setText(m_gameSettingsBtnFlashSave, _t("cfgg33", L"Flash")); m_btnMgr.setText(m_gameSettingsLblPrivateServer, _t("cfgg45", L"Private Server")); + m_btnMgr.setText(m_gameSettingsLblWidth, _t("cfgg54", L"Video Width")); + m_btnMgr.setText(m_gameSettingsLblPos, _t("cfgg55", L"Video Position")); } diff --git a/source/menu/menu_game.cpp b/source/menu/menu_game.cpp index 6607ede3..8048d34d 100644 --- a/source/menu/menu_game.cpp +++ b/source/menu/menu_game.cpp @@ -78,27 +78,23 @@ const CMenu::SOption CMenu::_VideoModes[7] = { { "vidprog", L"Progressive" }, }; -const CMenu::SOption CMenu::_GlobalGCvideoModes[8] = { - { "DMLdefG", L"Game" }, - { "DMLpal", L"PAL 576i" }, - { "DMLntsc", L"NTSC 480i" }, - { "DMLpal60", L"PAL 480i" }, - { "DMLprog", L"NTSC 480p" }, - { "DMLprogP", L"PAL 480p" }, +const CMenu::SOption CMenu::_GlobalGCvideoModes[6] = { + { "vidgame", L"Game" }, + { "vidp50", L"PAL 50Hz" }, + { "vidp60", L"PAL 60Hz" }, + { "vidntsc", L"NTSC" }, { "DMLmpal", L"MPAL" }, - { "DMLmpalP", L"MPAL-P" } + { "vidprog", L"Progressive" }, }; -const CMenu::SOption CMenu::_GCvideoModes[9] = { - { "DMLdef", L"Default" }, - { "DMLdefG", L"Game" }, - { "DMLpal", L"PAL 576i" }, - { "DMLntsc", L"NTSC 480i" }, - { "DMLpal60", L"PAL 480i" }, - { "DMLprog", L"NTSC 480p" }, - { "DMLprogP", L"PAL 480p" }, +const CMenu::SOption CMenu::_GCvideoModes[7] = { + { "viddef", L"Default" }, + { "vidgame", L"Game" }, + { "vidp50", L"PAL 50Hz" }, + { "vidp60", L"PAL 60Hz" }, + { "vidntsc", L"NTSC" }, { "DMLmpal", L"MPAL" }, - { "DMLmpalP", L"MPAL-P" } + { "vidprog", L"Progressive" }, }; const CMenu::SOption CMenu::_GlobalGClanguages[7] = { @@ -325,7 +321,7 @@ void CMenu::_cleanupBanner(bool gamechange) { //banner m_gameSound.FreeMemory(); - CheckGameSoundThread(); + _stopGameSoundThread();// stop banner and gamesound loading m_banner.DeleteBanner(gamechange); //movie _cleanupVideo(); @@ -384,7 +380,7 @@ bool CMenu::_startVideo() if(fsop_FileExist(THP_Path)) { m_gameSound.FreeMemory(); - CheckGameSoundThread(); + _stopGameSoundThread(); m_banner.SetShowBanner(false); /* Lets play the movie */ movie.Init(THP_Path); @@ -459,6 +455,12 @@ void CMenu::_game(bool launch) if(!launch) _mainLoopCommon(true); + if(startGameSound == -1) + { + _cleanupBanner(true); + m_gameSelected = false; + } + if(startGameSound == 0) { m_gameSelected = true;// mark game selected and load sound/banner for main loop to start playing @@ -616,7 +618,7 @@ void CMenu::_game(bool launch) else { m_banner.ToggleGameSettings(); - _gameSettings(); + _gameSettings(hdr); m_banner.ToggleGameSettings(); } _showGame(); @@ -752,31 +754,31 @@ void CMenu::_game(bool launch) { if((startGameSound == 1 || startGameSound < -8) && (BTN_UP_REPEAT || RIGHT_STICK_UP)) { - _cleanupBanner(true); + //_cleanupBanner(true); CoverFlow.up(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_RIGHT_REPEAT || RIGHT_STICK_RIGHT)) { - _cleanupBanner(true); + //_cleanupBanner(true); CoverFlow.right(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_DOWN_REPEAT || RIGHT_STICK_DOWN)) { - _cleanupBanner(true); + //_cleanupBanner(true); CoverFlow.down(); startGameSound = -10; } if((startGameSound == 1 || startGameSound < -8) && (BTN_LEFT_REPEAT || RIGHT_STICK_LEFT)) { - _cleanupBanner(true); + //_cleanupBanner(true); CoverFlow.left(); startGameSound = -10; } if(startGameSound == -10)// if -10 then we moved to new cover { - m_gameSelected = false; // deselect game if moved to new cover + //m_gameSelected = false; // deselect game if moved to new cover memcpy(hdr, CoverFlow.getHdr(), sizeof(dir_discHdr));// get new game header memset(tmp1, 0, 74); memset(tmp2, 0, 64); @@ -1003,26 +1005,27 @@ void CMenu::_launch(const dir_discHdr *hdr) void CMenu::_launchGC(dir_discHdr *hdr, bool disc) { + /* note for a disc boot hdr->id is set to the disc id before _launchGC is called */ const char *id = hdr->id; - memcpy((u8*)Disc_ID, id, 6); - DCFlushRange((u8*)Disc_ID, 32); - - const char *path = hdr->path; - + + /* Get loader choice*/ u8 loader = min((u32)m_gcfg2.getInt(id, "gc_loader", 0), ARRAY_SIZE(CMenu::_GCLoader) - 1u); loader = (loader == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "default_loader", 1), ARRAY_SIZE(CMenu::_GlobalGCLoaders) - 1u) : loader-1; if(disc) loader = NINTENDONT; + + /* Check if loader installed */ if((loader == NINTENDONT && !m_nintendont_installed) || (loader == DEVOLUTION && !m_devo_installed)) { error(_t("errgame11", L"GameCube Loader not found! Can't launch game.")); gcLaunchFail = true; return; } - /* GC Loader Found we can go ahead with launchShutdown() */ + /* clear coverflow, start wiiflow wait animation, set exit handler */ _launchShutdown(); + m_gcfg1.setInt("PLAYCOUNT", id, m_gcfg1.getInt("PLAYCOUNT", id, 0) + 1); m_gcfg1.setUInt("LASTPLAYED", id, time(NULL)); m_cfg.setString(_domainFromView(), "current_item", id); @@ -1030,32 +1033,28 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) if(has_enabled_providers() && _initNetwork() == 0) add_game_to_card(id); + /* Get game settings */ + const char *path = NULL; + if(disc) + path = fmt("%s:/", DeviceName[currentPartition]); + else + path = hdr->path; + u8 GClanguage = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u); GClanguage = (GClanguage == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "game_language", 0), ARRAY_SIZE(CMenu::_GlobalGClanguages) - 1u) : GClanguage-1; + // language selection only works for PAL games if(id[3] == 'E' || id[3] == 'J') GClanguage = 1; //=english u8 videoMode = min((u32)m_gcfg2.getInt(id, "video_mode", 0), ARRAY_SIZE(CMenu::_GCvideoModes) - 1u); videoMode = (videoMode == 0) ? min((u32)m_cfg.getInt(GC_DOMAIN, "video_mode", 0), ARRAY_SIZE(CMenu::_GlobalGCvideoModes) - 1u) : videoMode-1; - if(disc || videoMode == 0) - { - if(id[3] == 'E' || id[3] == 'J') - videoMode = 2; //NTSC 480i - else - videoMode = 1; //PAL 576i - } bool widescreen = m_gcfg2.getBool(id, "widescreen", false); - - if(loader == DEVOLUTION) - { - bool memcard_emu = m_gcfg2.testOptBool(id, "devo_memcard_emu", m_cfg.getBool(GC_DOMAIN, "devo_memcard_emu", false)); - bool activity_led = m_gcfg2.getBool(id, "led", false); - DEVO_GetLoader(m_dataDir.c_str()); - DEVO_SetOptions(path, id, memcard_emu, widescreen, activity_led, m_use_wifi_gecko); - } - else if(loader == NINTENDONT) + bool activity_led = m_gcfg2.getBool(id, "led", false); + + if(loader == NINTENDONT) { + /* might add here - if not a disc use path to check for disc2.iso - if so then we need to prompt disc 1 or disc 2? */ u8 emuMC = min((u32)m_gcfg2.getInt(id, "emu_memcard", 0), ARRAY_SIZE(CMenu::_NinEmuCard) - 1u); emuMC = (emuMC == 0) ? m_cfg.getInt(GC_DOMAIN, "emu_memcard", 1) : emuMC - 1; @@ -1065,70 +1064,194 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) bool deflicker = m_gcfg2.getBool(id, "deflicker", false); bool tri_arcade = m_gcfg2.getBool(id, "triforce_arcade", false); - bool activity_led = m_gcfg2.getBool(id, "led", false); bool ipl = m_gcfg2.getBool(id, "skip_ipl", false); - if(IsOnWiiU()) - { - native_ctl = false; - activity_led = false; - } - if(disc == true) - { - /*funny, in order for these settings to work they would have to be entered in gameconfig2 manually under the gameID - or the game will have to already be on USB or SD but then why launch via disc?*/ - Nintendont_BootDisc(emuMC, widescreen, cc_rumble, native_ctl, deflicker); - } - else - { - bool NIN_Debugger = (m_gcfg2.getInt(id, "debugger", 0) == 2); - bool wiiu_widescreen = m_gcfg2.getBool(id, "wiiu_widescreen", false); - bool cheats = m_gcfg2.getBool(id, "cheat", false); - /* Generate gct path */ - char GC_Path[256]; - GC_Path[255] = '\0'; - strncpy(GC_Path, path, 255); - if(strcasestr(path, "boot.bin") != NULL)//games/title [id]/sys/boot.bin - { - *strrchr(GC_Path, '/') = '\0'; //erase /boot.bin - *(strrchr(GC_Path, '/')+1) = '\0'; //erase sys folder - } - else //games/title [id]/game.iso - *(strrchr(GC_Path, '/')+1) = '\0'; //erase game.iso - char CheatPath[256];// wiiflow cheats path - sd:/wiiflow/cheats/id.gct - char NewCheatPath[256];// nintendont cheat path - games/title [id]/id.gct - snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id)); - snprintf(NewCheatPath, sizeof(NewCheatPath), "%s%s.gct",GC_Path,id); - - Nintendont_SetOptions(path, id, CheatPath, NewCheatPath, DeviceName[currentPartition], - cheats, emuMC, videoMode, widescreen, activity_led, native_ctl, deflicker, wiiu_widescreen, - NIN_Debugger, tri_arcade, cc_rumble, ipl); - } - } - /* configs no longer needed */ - m_gcfg1.save(true); - m_gcfg2.save(true); - m_cat.save(true); - m_cfg.save(true); - if(loader == NINTENDONT) - { + bool patch_pal50 = m_gcfg2.getBool(id, "patch_pal50", false); + bool NIN_Debugger = (m_gcfg2.getInt(id, "debugger", 0) == 2); + bool wiiu_widescreen = m_gcfg2.getBool(id, "wiiu_widescreen", false); + bool cheats = m_gcfg2.getBool(id, "cheat", false); + + s8 vidscale = m_gcfg2.getInt(id, "nin_width", 127); + if(vidscale == 127) + vidscale = m_cfg.getInt(GC_DOMAIN, "nin_width", 0); + s8 vidoffset = m_gcfg2.getInt(id, "nin_pos", 127); + if(vidoffset == 127) + vidoffset = m_cfg.getInt(GC_DOMAIN, "nin_pos", 0); + + /* configs no longer needed */ + m_gcfg1.save(true); + m_gcfg2.save(true); + m_cat.save(true); + m_cfg.save(true); + bool ret = (Nintendont_GetLoader() && LoadAppBooter(fmt("%s/app_booter.bin", m_binsDir.c_str()))); if(ret == false) { error(_t("errgame14", L"app_booter.bin not found!")); _exitWiiflow(); } - } - /* no more error msgs - remove btns and sounds */ - cleanup(); - - GC_SetVideoMode(videoMode, loader); - GC_SetLanguage(GClanguage, loader); - /* NTSC-J Patch by FIX94 */ - if(id[3] == 'J') - *HW_PPCSPEED = 0x0002A9E0; + + /* no more error msgs - remove btns and sounds */ + cleanup(); + + //GameID for Video mode when booting a Disc + memcpy((u8*)Disc_ID, id, 6); + DCFlushRange((u8*)Disc_ID, 32); + + /* set nintendont conifg options */ + u32 n_config = 0; + n_config |= NIN_CFG_AUTO_BOOT; - if(loader == DEVOLUTION) + if(DeviceHandle.PathToDriveType(path) != SD) + n_config |= NIN_CFG_USB; + + char CheatPath[256]; + CheatPath[0] = '\0';// set NULL in case cheats are off + if(cheats) + { + n_config |= NIN_CFG_CHEAT_PATH; + n_config |= NIN_CFG_CHEATS; + + /* Generate Game Cheat path - usb1:/games/title [id]/ */ + char GC_Path[256]; + GC_Path[255] = '\0'; + strncpy(GC_Path, path, 255); + if(strcasestr(path, "boot.bin") != NULL)//usb1:/games/title [id]/sys/boot.bin + { + *strrchr(GC_Path, '/') = '\0'; //erase /boot.bin + *(strrchr(GC_Path, '/')+1) = '\0'; //erase sys folder + } + else //usb1:/games/title [id]/game.iso + *(strrchr(GC_Path, '/')+1) = '\0'; //erase game.iso + + //use wiiflow cheat path if on same partition as game + if(strncasecmp(m_cheatDir.c_str(), DeviceName[currentPartition], strlen(DeviceName[currentPartition])) == 0) + snprintf(CheatPath, sizeof(CheatPath), "%s/%s", m_cheatDir.c_str(), fmt("%s.gct", id)); + else + { + // else copy cheat file to Game Cheat path above + snprintf(CheatPath, sizeof(CheatPath), "%s%s.gct", GC_Path, id); + fsop_CopyFile(fmt("%s/%s.gct", m_cheatDir.c_str(), id), CheatPath, NULL, NULL); + //might add err msg here if copy error + } + } + + if(NIN_Debugger && IsOnWiiU() == false) //wii only + n_config |= NIN_CFG_OSREPORT; + + if(native_ctl && IsOnWiiU() == false) //wii only + n_config |= NIN_CFG_NATIVE_SI; + + if(wiiu_widescreen && IsOnWiiU() == true) //wii u vwii only + n_config |= NIN_CFG_WIIU_WIDE; + + if(widescreen) + n_config |= NIN_CFG_FORCE_WIDE; + + if(activity_led && IsOnWiiU() == false) //wii only + n_config |= NIN_CFG_LED; + + if(tri_arcade) + n_config |= NIN_CFG_ARCADE_MODE; + + if(cc_rumble) + n_config |= NIN_CFG_BIT_CC_RUMBLE; + + if(ipl) + n_config |= NIN_CFG_SKIP_IPL; + + /* set memcard options */ + if(emuMC > 0 || IsOnWiiU() == true) //force memcardemu for wii u vwii + n_config |= NIN_CFG_MEMCARDEMU; + + if(emuMC > 1) + n_config |= NIN_CFG_MC_MULTI; + + /* set nintendont video options */ + u32 n_videomode = 0; + + /* if video is not already forced and patch pal50 or deflicker are on then force to game video mode */ + if(videoMode == 0 && (patch_pal50 || deflicker)) + { + if(id[3] == 'E' || id[3] == 'J') + videoMode = 2; //NTSC 480i + else if (CONF_GetEuRGB60() > 0) + videoMode = 3; //PAL 480i + else + videoMode = 1; //PAL 576i + } + + /* auto or forced */ + if(videoMode == 0) + n_videomode |= NIN_VID_AUTO; + else + n_videomode |= NIN_VID_FORCE; + + // patch_pal50 only works on pal50 games forced to mpal, NTSC, or progressive. + if(patch_pal50) + n_videomode |= NIN_VID_PATCH_PAL50; + + // videomode must be forced to set deflicker + if(deflicker) + n_videomode |= NIN_VID_FORCE_DF; + + // progressive only works with NTSC - Nintendont auto forces to NTSC if progressive on + if(videoMode == 5) + { + n_config |= NIN_CFG_FORCE_PROG; + n_videomode |= NIN_VID_PROG; + } + + // rmode and rmode_reg are set by Nintendont + switch (videoMode)//if 0 nothing is forced + { + case 1:// PAL50 + n_videomode |= NIN_VID_FORCE_PAL50; + break; + case 2:// PAL60 480i + n_videomode |= NIN_VID_FORCE_PAL60; + break; + case 3:// NTSC 480i + n_videomode |= NIN_VID_FORCE_NTSC; + break; + case 4:// MPAL + n_videomode |= NIN_VID_FORCE_MPAL; + break; + } + + Nintendont_SetOptions(path, id, CheatPath, GClanguage, n_config, n_videomode, vidscale, vidoffset); + ShutdownBeforeExit(); + loadIOS(58, false); //nintendont NEEDS ios58 + BootHomebrew(); //regular dol + } + else // loader == DEVOLUTION { + // devolution does not allow force video and progressive mode + // igonore video setting choice and use game region always + if(id[3] =='E' || id[3] =='J') + { + // if game is NTSC then video is based on console video + if(CONF_GetVideo() == CONF_VIDEO_PAL) + videoMode = 2; //PAL 480i + else + videoMode = 3; //NTSC 480i + } + else + videoMode = 1; //PAL 576i 50hz + + bool memcard_emu = m_gcfg2.testOptBool(id, "devo_memcard_emu", m_cfg.getBool(GC_DOMAIN, "devo_memcard_emu", false)); + + /* configs no longer needed */ + m_gcfg1.save(true); + m_gcfg2.save(true); + m_cat.save(true); + m_cfg.save(true); + + /* remove btns and sounds */ + cleanup(); + + DEVO_GetLoader(m_dataDir.c_str()); + DEVO_SetOptions(path, id, videoMode, GClanguage, memcard_emu, widescreen, activity_led, m_use_wifi_gecko); + if(AHBRPOT_Patched()) loadIOS(58, false); else //use cIOS instead to make sure Devolution works anyways @@ -1136,13 +1259,6 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool disc) ShutdownBeforeExit(); DEVO_Boot(); } - else - { - Nintendont_WriteOptions(); - ShutdownBeforeExit(); - loadIOS(58, false); //nintendont NEEDS ios58 - BootHomebrew(); //regular dol - } Sys_Exit(); } @@ -1164,7 +1280,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) _exitWiiflow(); } /* no more error msgs - remove btns and sounds */ - cleanup(); // wifi and sd gecko doesnt work anymore after cleanup + cleanup(); AddBootArgument(filepath); for(u32 i = 0; i < arguments.size(); ++i) @@ -1173,7 +1289,7 @@ void CMenu::_launchHomebrew(const char *filepath, vector arguments) AddBootArgument(arguments[i].c_str()); } - ShutdownBeforeExit(); + ShutdownBeforeExit();// wifi and sd gecko doesnt work anymore after loadIOS(58, false); BootHomebrew(); Sys_Exit(); @@ -1392,10 +1508,8 @@ void CMenu::_launchChannel(dir_discHdr *hdr) Sys_Exit(); } -void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) +void CMenu::_launchGame(dir_discHdr *hdr, bool dvd, bool disc_cfg) { - /* clear coverflow, start wiiflow wait animation, set exit handler */ - _launchShutdown(); string id(hdr->id); string path(hdr->path); if(neek2o()) @@ -1410,6 +1524,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) if(dvd) { + /* u32 cover = 0; if(!neek2o() && !Sys_DolphinMode()) { @@ -1428,7 +1543,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) return; } while(!(cover & 0x2)); } - } + }*/ TempLoadIOS(); /* Open Disc */ if(Disc_Open(true) < 0) @@ -1449,10 +1564,20 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) /* Read GC disc header */ Disc_ReadGCHeader(&gc_hdr); memcpy(hdr->id, gc_hdr.id, 6); + hdr->type = TYPE_GC_GAME; /* Launching GC Game */ if(m_nintendont_installed) - _launchGC(hdr, true); + { + if(disc_cfg) + _gameSettings(hdr, dvd); + MusicPlayer.Stop(); + m_cfg.setInt("GENERAL", "cat_startpage", m_catStartPage); + if(!disc_cfg) + m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); + currentPartition = m_cfg.getInt(GC_DOMAIN, "partition", 1); + _launchGC(hdr, dvd); + } else error(_t("errgame12", L"Nintendont not found! Can't launch GC Disc.")); return; @@ -1462,11 +1587,22 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd) { /* Read header */ Disc_ReadHeader(&wii_hdr); + memcpy(hdr->id, wii_hdr.id, 6); id = string((const char*)wii_hdr.id, 6); + hdr->type = TYPE_WII_GAME; + if(disc_cfg) + _gameSettings(hdr, dvd); + MusicPlayer.Stop(); + m_cfg.setInt("GENERAL", "cat_startpage", m_catStartPage); + if(!disc_cfg) + m_gcfg2.load(fmt("%s/" GAME_SETTINGS2_FILENAME, m_settingsDir.c_str())); + currentPartition = m_cfg.getInt(WII_DOMAIN, "partition", 1); } gprintf("Game ID: %s\n", id.c_str()); } - + + /* clear coverflow, start wiiflow wait animation, set exit handler */ + _launchShutdown(); bool vipatch = m_gcfg2.getBool(id, "vipatch", false); bool countryPatch = m_gcfg2.getBool(id, "country_patch", false); bool private_server = m_gcfg2.getBool(id, "private_server", false); @@ -1740,6 +1876,7 @@ struct IMD5Header u8 crypto[16]; } ATTRIBUTE_PACKED; +// loads game banner and sound to be played by mainloop void CMenu::_gameSoundThread(CMenu *m) { m->m_soundThrdBusy = true; @@ -1788,19 +1925,20 @@ void CMenu::_gameSoundThread(CMenu *m) } if(custom_bnr_file == NULL && GameHdr->type == TYPE_GC_GAME) { + //get the gc games banner without sound GC_Disc_Reader.init(GameHdr->path); u8 *opening_bnr = GC_Disc_Reader.GetGameCubeBanner(); if(opening_bnr != NULL) m_banner.CreateGCBanner(opening_bnr, m->m_wbf1_font, m->m_wbf2_font, GameHdr->title); GC_Disc_Reader.clear(); - + //get wiiflow gc ogg sound to play with banner m->m_gameSound.Load(gc_ogg, gc_ogg_size, false); if(m->m_gameSound.IsLoaded()) m->m_gamesound_changed = true; m->m_soundThrdBusy = false; return; } - if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner*/ + if(custom_bnr_file == NULL)/* no custom and not GC game try cached banner id6 only*/ { strncpy(cached_banner, fmt("%s/%s.bnr", m->m_bnrCacheDir.c_str(), GameHdr->id), 255); fsop_GetFileSizeBytes(cached_banner, &cached_bnr_size); @@ -1829,9 +1967,11 @@ void CMenu::_gameSoundThread(CMenu *m) m->m_soundThrdBusy = false; return; } + //save new wii or channel banner to cache folder, gc and custom banners are not cached if(cached_bnr_file == NULL && custom_bnr_file == NULL) fsop_WriteFile(cached_banner, CurrentBanner.GetBannerFile(), CurrentBanner.GetBannerFileSize()); + //get sound from wii, channel, or custom banner and load it to play with the banner u32 sndSize = 0; m_banner.LoadBanner(m->m_wbf1_font, m->m_wbf2_font); u8 *soundBin = CurrentBanner.GetFile("sound.bin", &sndSize); @@ -1874,7 +2014,7 @@ void CMenu::_gameSoundThread(CMenu *m) u8 *GameSoundStack = NULL; u32 GameSoundSize = 0x10000; //64kb -void CMenu::_playGameSound(void) +void CMenu::_playGameSound(void)// starts banner and gamesound loading thread { if(NoGameID(CoverFlow.getHdr()->type)) { @@ -1892,12 +2032,12 @@ void CMenu::_playGameSound(void) return; if(m_gameSoundThread != LWP_THREAD_NULL) - CheckGameSoundThread(); + _stopGameSoundThread(); GameSoundStack = (u8*)MEM2_lo_alloc(GameSoundSize); LWP_CreateThread(&m_gameSoundThread, (void *(*)(void *))CMenu::_gameSoundThread, (void*)this, GameSoundStack, GameSoundSize, 60); } -void CMenu::CheckGameSoundThread() +void CMenu::_stopGameSoundThread()//stops banner and gamesound loading thread { if(m_gameSoundThread == LWP_THREAD_NULL) return; diff --git a/source/menu/menu_main.cpp b/source/menu/menu_main.cpp index a1d15739..d9c41534 100644 --- a/source/menu/menu_main.cpp +++ b/source/menu/menu_main.cpp @@ -406,16 +406,13 @@ int CMenu::main(void) { /* Cleanup for Disc Booter */ _hideMain(true); - CoverFlow.clear(); - _showWaitMessage(); - m_gameSound.Stop(); - CheckGameSoundThread(); + //CoverFlow.clear(); /* Create Fake Header */ dir_discHdr hdr; memset(&hdr, 0, sizeof(dir_discHdr)); - memcpy(&hdr.id, "dvddvd", 6);//only the id is used for a disc and dvddvd is changed in _launchGame. + memcpy(&hdr.id, "dvddvd", 6);//this must be set for neek2o /* Boot the Disc */ - _launchGame(&hdr, true); + _launchGame(&hdr, true, BTN_B_HELD); if(BTN_B_HELD) bUsed = true; _showCF(false); diff --git a/wii/wiiflow/Languages/english.ini b/wii/wiiflow/Languages/english.ini index d9ba8fed..a185089f 100644 --- a/wii/wiiflow/Languages/english.ini +++ b/wii/wiiflow/Languages/english.ini @@ -125,6 +125,10 @@ cfgg50=No save to extract! cfgg51=No save to flash to real NAND! cfgg52=Wiimote CC Rumble cfgg53=Skip IPL BIOS +cfgg54=Video Width +cfgg55=Video Position +cfgg56=Patch PAL50 +cfgg57=Not allowed for disc! cfgg4=Patch country strings cfgg5=Ocarina cfgg6=