-added option to set DML game lanugage, gamecube games will now use the language of the wii

This commit is contained in:
fix94.1 2012-02-02 22:22:46 +00:00
parent e8e95960f2
commit 27d47ee337
5 changed files with 95 additions and 1 deletions

View File

@ -26,6 +26,13 @@
#define VIDEO_MODE_NTSC480P 3
#define VIDEO_MODE_PAL480P 4
#define SRAM_ENGLISH 0
#define SRAM_GERMAN 1
#define SRAM_FRENCH 2
#define SRAM_SPANISH 3
#define SRAM_ITALIAN 4
#define SRAM_DUTCH 5
syssram* __SYS_LockSram();
u32 __SYS_UnlockSram(u32 write);
u32 __SYS_SyncSram(void);
@ -36,7 +43,7 @@ void set_video_mode(int i)
sram = __SYS_LockSram();
void *m_frameBuf;
static GXRModeObj *rmode;
if (i == 0)
if (i == VIDEO_MODE_NTSC)
{
rmode = &TVNtsc480IntDf;
sram->flags = sram->flags & ~(1 << 0); // Clear bit 0 to set the video mode to NTSC
@ -58,4 +65,40 @@ void set_video_mode(int i)
VIDEO_ClearFrameBuffer(rmode, m_frameBuf, COLOR_BLACK);
VIDEO_SetNextFramebuffer(m_frameBuf);
}
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 set_language(u8 lang)
{
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());
}

View File

@ -6,6 +6,7 @@ extern "C"
#ifndef GC_H_
#define GC_H_
void set_video_mode(int i);
void set_language(u8 lang);
#endif //GC_H_
#ifdef __cplusplus

View File

@ -340,6 +340,11 @@ private:
u32 m_gameSettingsLblDMLVideo;
u32 m_gameSettingsBtnDMLVideoP;
u32 m_gameSettingsBtnDMLVideoM;
u32 m_gameSettingsLblGClanguageVal;
u32 m_gameSettingsLblGClanguage;
u32 m_gameSettingsBtnGClanguageP;
u32 m_gameSettingsBtnGClanguageM;
u32 m_gameSettingsLblIOSreloadBlock;
u32 m_gameSettingsBtnIOSreloadBlock;
@ -800,6 +805,7 @@ private:
static const SOption _languages[11];
static const SOption _videoModes[7];
static const SOption _DMLvideoModes[3];
static const SOption _GClanguages[7];
static const SOption _NandEmu[3];
static const SOption _SaveEmu[4];
static const SOption _GlobalSaveEmu[3];

View File

@ -36,6 +36,10 @@ void CMenu::_hideGameSettings(bool instant)
m_btnMgr.hide(m_gameSettingsLblDMLVideo, instant);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP, instant);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoM, instant);
m_btnMgr.hide(m_gameSettingsLblGClanguageVal, instant);
m_btnMgr.hide(m_gameSettingsLblGClanguage, instant);
m_btnMgr.hide(m_gameSettingsBtnGClanguageP, instant);
m_btnMgr.hide(m_gameSettingsBtnGClanguageM, instant);
m_btnMgr.hide(m_gameSettingsLblAspectRatio, instant);
m_btnMgr.hide(m_gameSettingsLblAspectRatioVal, instant);
m_btnMgr.hide(m_gameSettingsBtnAspectRatioP, instant);
@ -143,6 +147,11 @@ void CMenu::_showGameSettings(void)
m_btnMgr.show(m_gameSettingsLblDMLVideo);
m_btnMgr.show(m_gameSettingsBtnDMLVideoP);
m_btnMgr.show(m_gameSettingsBtnDMLVideoM);
m_btnMgr.show(m_gameSettingsLblGClanguageVal);
m_btnMgr.show(m_gameSettingsLblGClanguage);
m_btnMgr.show(m_gameSettingsBtnGClanguageP);
m_btnMgr.show(m_gameSettingsBtnGClanguageM);
}
}
else
@ -167,6 +176,11 @@ void CMenu::_showGameSettings(void)
}
else
{
m_btnMgr.hide(m_gameSettingsLblGClanguageVal);
m_btnMgr.hide(m_gameSettingsLblGClanguage);
m_btnMgr.hide(m_gameSettingsBtnGClanguageP);
m_btnMgr.hide(m_gameSettingsBtnGClanguageM);
m_btnMgr.hide(m_gameSettingsLblDMLGameVideo);
m_btnMgr.hide(m_gameSettingsLblDMLVideo);
m_btnMgr.hide(m_gameSettingsBtnDMLVideoP);
@ -365,6 +379,8 @@ void CMenu::_showGameSettings(void)
m_btnMgr.setText(m_gameSettingsLblVideo, _t(CMenu::_videoModes[i].id, CMenu::_videoModes[i].text));
i = min((u32)m_gcfg2.getInt(id, "dml_video_mode", 0), ARRAY_SIZE(CMenu::_DMLvideoModes) - 1u);
m_btnMgr.setText(m_gameSettingsLblDMLVideo, _t(CMenu::_DMLvideoModes[i].id, CMenu::_DMLvideoModes[i].text));
i = min((u32)m_gcfg2.getInt(id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
m_btnMgr.setText(m_gameSettingsLblGClanguageVal, _t(CMenu::_GClanguages[i].id, CMenu::_GClanguages[i].text));
i = min((u32)m_gcfg2.getInt(id, "language", 0), ARRAY_SIZE(CMenu::_languages) - 1u);
m_btnMgr.setText(m_gameSettingsLblLanguage, _t(CMenu::_languages[i].id, CMenu::_languages[i].text));
i = min((u32)m_gcfg2.getInt(id, "aspect_ratio", 0), ARRAY_SIZE(CMenu::_AspectRatio) - 1u);
@ -513,6 +529,12 @@ void CMenu::_gameSettings(void)
m_gcfg2.setInt(id, "dml_video_mode", (int)loopNum((u32)m_gcfg2.getInt(id, "dml_video_mode", 0) + direction, ARRAY_SIZE(CMenu::_DMLvideoModes)));
_showGameSettings();
}
else if (m_btnMgr.selected(m_gameSettingsBtnGClanguageP) || m_btnMgr.selected(m_gameSettingsBtnGClanguageM))
{
s8 direction = m_btnMgr.selected(m_gameSettingsBtnGClanguageP) ? 1 : -1;
m_gcfg2.setInt(id, "gc_language", (int)loopNum((u32)m_gcfg2.getInt(id, "gc_language", 0) + direction, ARRAY_SIZE(CMenu::_GClanguages)));
_showGameSettings();
}
else if (m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) || m_btnMgr.selected(m_gameSettingsBtnAspectRatioM))
{
s8 direction = m_btnMgr.selected(m_gameSettingsBtnAspectRatioP) ? 1 : -1;
@ -649,6 +671,11 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme)
m_gameSettingsBtnDMLVideoM = _addPicButton(theme, "GAME_SETTINGS/DML_VIDEO_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 130, 56, 56);
m_gameSettingsBtnDMLVideoP = _addPicButton(theme, "GAME_SETTINGS/DML_VIDEO_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 130, 56, 56);
m_gameSettingsLblGClanguage = _addLabel(theme, "GAME_SETTINGS/GC_LANG", theme.lblFont, L"", 40, 190, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblGClanguageVal = _addLabel(theme, "GAME_SETTINGS/GC_LANG_BTN", theme.btnFont, L"", 386, 190, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_gameSettingsBtnGClanguageM = _addPicButton(theme, "GAME_SETTINGS/GC_LANG_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 330, 190, 56, 56);
m_gameSettingsBtnGClanguageP = _addPicButton(theme, "GAME_SETTINGS/DGC_LANG_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 190, 56, 56);
// Page 2
m_gameSettingsLblDebugger = _addLabel(theme, "GAME_SETTINGS/GAME_DEBUGGER", theme.lblFont, L"", 40, 130, 290, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_gameSettingsLblDebuggerV = _addLabel(theme, "GAME_SETTINGS/GAME_DEBUGGER_BTN", theme.btnFont, L"", 386, 130, 158, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
@ -745,6 +772,10 @@ void CMenu::_initGameSettingsMenu(CMenu::SThemeData &theme)
_setHideAnim(m_gameSettingsLblDMLVideo, "GAME_SETTINGS/DML_VIDEO_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnDMLVideoM, "GAME_SETTINGS/DML_VIDEO_MINUS", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnDMLVideoP, "GAME_SETTINGS/DML_VIDEO_PLUS", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblGClanguageVal, "GAME_SETTINGS/GC_LANG", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblGClanguage, "GAME_SETTINGS/GC_LANG_BTN", -200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnGClanguageM, "GAME_SETTINGS/GC_LANG_MINUS", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnGClanguageP, "GAME_SETTINGS/GC_LANG_PLUS", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblGameLanguage, "GAME_SETTINGS/GAME_LANG", -200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsLblLanguage, "GAME_SETTINGS/GAME_LANG_BTN", 200, 0, 1.f, 0.f);
_setHideAnim(m_gameSettingsBtnLanguageM, "GAME_SETTINGS/GAME_LANG_MINUS", 200, 0, 1.f, 0.f);
@ -809,6 +840,7 @@ void CMenu::_textGameSettings(void)
m_btnMgr.setText(m_gameSettingsLblCountryPatch, _t("cfgg4", L"Patch country strings"));
m_btnMgr.setText(m_gameSettingsLblOcarina, _t("cfgg5", L"Ocarina"));
m_btnMgr.setText(m_gameSettingsLblDMLGameVideo, _t("cfgg2", L"Video mode"));
m_btnMgr.setText(m_gameSettingsLblGClanguage, _t("cfgg3", L"Language"));
m_btnMgr.setText(m_gameSettingsLblVipatch, _t("cfgg7", L"Vipatch"));
m_btnMgr.setText(m_gameSettingsBtnBack, _t("cfgg8", L"Back"));
m_btnMgr.setText(m_gameSettingsLblGameIOS, _t("cfgg10", L"IOS"));

View File

@ -107,6 +107,16 @@ const CMenu::SOption CMenu::_DMLvideoModes[3] = {
{ "DMLntsc", L"NTSC 480i" },
};
const CMenu::SOption CMenu::_GClanguages[7] = {
{ "GClngdef", L"Default" },
{ "GClngeng", L"English" },
{ "GClngger", L"German" },
{ "GClngfre", L"French" },
{ "GClngspa", L"Spanish" },
{ "GClngita", L"Italian" },
{ "GClngdut", L"Dutch" }
};
const CMenu::SOption CMenu::_NandEmu[3] = {
{ "NANDoff", L"Off" },
{ "NANDpart", L"Partial" },
@ -628,6 +638,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
}
#endif
u8 GClanguage = min((u32)m_gcfg2.getInt((char *)hdr->hdr.id, "gc_language", 0), ARRAY_SIZE(CMenu::_GClanguages) - 1u);
memcpy((char *)0x80000000, (char *)hdr->hdr.id, 6);
if((((char)hdr->hdr.id[3] == 'P') && (DMLvideoMode == 0)) || (DMLvideoMode == 1))
@ -638,6 +649,7 @@ void CMenu::_launchGC(dir_discHdr *hdr, bool DML)
{
set_video_mode(0);
}
set_language(GClanguage);
VIDEO_SetBlack(TRUE);
VIDEO_Flush();
VIDEO_WaitVSync();