-added global save emulation/nand emulation mode (very dirty, completely untested and not finished :P)

This commit is contained in:
fix94.1 2012-01-29 19:28:31 +00:00
parent b38b0ae5a7
commit cd9678052d
3 changed files with 88 additions and 31 deletions

View File

@ -174,8 +174,10 @@ private:
u32 m_configLblPartition; u32 m_configLblPartition;
u32 m_configBtnPartitionP; u32 m_configBtnPartitionP;
u32 m_configBtnPartitionM; u32 m_configBtnPartitionM;
u32 m_configBtnEmulation; u32 m_configLblEmulationVal;
u32 m_configLblEmulation; u32 m_configLblEmulation;
u32 m_configBtnEmulationM;
u32 m_configBtnEmulationP;
u32 m_configLblUser[4]; u32 m_configLblUser[4];
u32 m_configAdvLblTheme; u32 m_configAdvLblTheme;
u32 m_configAdvLblCurTheme; u32 m_configAdvLblCurTheme;
@ -786,7 +788,9 @@ private:
static const SOption _languages[11]; static const SOption _languages[11];
static const SOption _videoModes[7]; static const SOption _videoModes[7];
static const SOption _DMLvideoModes[3]; static const SOption _DMLvideoModes[3];
static const SOption _SaveEmu[3]; static const SOption _NandEmu[3];
static const SOption _SaveEmu[4];
static const SOption _GlobalSaveEmu[3];
static const SOption _AspectRatio[3]; static const SOption _AspectRatio[3];
static const SOption _vidModePatch[4]; static const SOption _vidModePatch[4];
static const SOption _hooktype[8]; static const SOption _hooktype[8];

View File

@ -34,8 +34,10 @@ void CMenu::_hideConfig(bool instant)
m_btnMgr.hide(m_configLblParental, instant); m_btnMgr.hide(m_configLblParental, instant);
m_btnMgr.hide(m_configBtnUnlock, instant); m_btnMgr.hide(m_configBtnUnlock, instant);
m_btnMgr.hide(m_configBtnSetCode, instant); m_btnMgr.hide(m_configBtnSetCode, instant);
m_btnMgr.hide(m_configBtnEmulation, instant); m_btnMgr.hide(m_configLblEmulationVal, instant);
m_btnMgr.hide(m_configLblEmulation, instant); m_btnMgr.hide(m_configLblEmulation, instant);
m_btnMgr.hide(m_configBtnEmulationP, instant);
m_btnMgr.hide(m_configBtnEmulationM, instant);
for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i) for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if (m_configLblUser[i] != -1u) if (m_configLblUser[i] != -1u)
m_btnMgr.hide(m_configLblUser[i], instant); m_btnMgr.hide(m_configLblUser[i], instant);
@ -64,13 +66,15 @@ void CMenu::_showConfig(void)
m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode); m_btnMgr.show(m_locked ? m_configBtnUnlock : m_configBtnSetCode);
bool disable = m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true); bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
char *partitionname = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", 0)]; char *partitionname = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", 0)];
for(u8 i = 0; strncmp((const char *)&partitionname[i], "\0", 1) != 0; i++) for(u8 i = 0; strncmp((const char *)&partitionname[i], "\0", 1) != 0; i++)
partitionname[i] = toupper(partitionname[i]); partitionname[i] = toupper(partitionname[i]);
for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i) for (u32 i = 0; i < ARRAY_SIZE(m_configLblUser); ++i)
if (m_configLblUser[i] != -1u) if (m_configLblUser[i] != -1u)
m_btnMgr.show(m_configLblUser[i]); m_btnMgr.show(m_configLblUser[i]);
@ -79,14 +83,24 @@ void CMenu::_showConfig(void)
m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage + 1 : CMenu::_nbCfgPages)); m_btnMgr.setText(m_configLblPage, wfmt(L"%i / %i", g_curPage, m_locked ? g_curPage + 1 : CMenu::_nbCfgPages));
bool isON = false; if (m_current_view == COVERFLOW_CHANNEL || m_current_view == COVERFLOW_USB)
if (m_current_view == COVERFLOW_CHANNEL)
{ {
m_btnMgr.show(m_configBtnEmulation);
m_btnMgr.show(m_configLblEmulation); m_btnMgr.show(m_configLblEmulation);
m_btnMgr.setText(m_configLblEmulation, _t("cfg12", L"NAND Emulation")); m_btnMgr.show(m_configLblEmulationVal);
isON = m_cfg.getBool("NAND", "disable", true); m_btnMgr.show(m_configBtnEmulationP);
m_btnMgr.setText(m_configBtnEmulation, isON ? _t("off", L"Off") : _t("on", L"On")); m_btnMgr.show(m_configBtnEmulationM);
if (m_current_view == COVERFLOW_CHANNEL)
{
m_btnMgr.setText(m_configLblEmulation, _t("cfg12", L"NAND Emulation"));
i = min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
m_btnMgr.setText(m_configLblEmulationVal, _t(CMenu::_NandEmu[i].id, CMenu::_NandEmu[i].text));
}
else if (m_current_view == COVERFLOW_USB)
{
m_btnMgr.setText(m_configLblEmulation, _t("cfgg24", L"Savegame Emulation"));
i = min(max(0, m_cfg.getInt("GAMES", "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
m_btnMgr.setText(m_configLblEmulationVal, _t(CMenu::_GlobalSaveEmu[i].id, CMenu::_GlobalSaveEmu[i].text));
}
} }
} }
@ -187,7 +201,11 @@ int CMenu::_config1(void)
} }
else if (!m_locked && (m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM))) else if (!m_locked && (m_btnMgr.selected(m_configBtnPartitionP) || m_btnMgr.selected(m_configBtnPartitionM)))
{ {
bool disable = m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true); bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
gprintf("i: %i\n",i);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
if(!disable) if(!disable)
{ {
Nand::Instance()->Disable_Emu(); Nand::Instance()->Disable_Emu();
@ -213,18 +231,25 @@ int CMenu::_config1(void)
gprintf("Next item: %s\n", DeviceName[currentPartition]); gprintf("Next item: %s\n", DeviceName[currentPartition]);
m_cfg.setInt(_domainFromView(), "partition", currentPartition); m_cfg.setInt(_domainFromView(), "partition", currentPartition);
} }
_showConfig(); _showConfig();
} }
else if (!m_locked && m_btnMgr.selected(m_configBtnEmulation)) else if (!m_locked && (m_btnMgr.selected(m_configBtnEmulationP) || m_btnMgr.selected(m_configBtnEmulationM)))
{ {
m_cfg.setBool("GAMES", "save_emulation", !m_cfg.getBool("GAMES", "save_emulation", false)); s8 direction = m_btnMgr.selected(m_configBtnEmulationP) ? 1 : -1;
if (m_current_view == COVERFLOW_CHANNEL)
m_cfg.setInt("NAND", "emulation", (int)loopNum((u32)m_cfg.getInt("NAND", "emulation", 0) + direction, ARRAY_SIZE(CMenu::_NandEmu)));
else if (m_current_view == COVERFLOW_USB)
m_cfg.setInt("GAMES", "save_emulation", (int)loopNum((u32)m_cfg.getInt("GAMES", "save_emulation", 0) + direction, ARRAY_SIZE(CMenu::_GlobalSaveEmu)));
_showConfig(); _showConfig();
} }
} }
} }
if (currentPartition != bCurrentPartition) if (currentPartition != bCurrentPartition)
{ {
bool disable = m_current_view == COVERFLOW_CHANNEL && m_cfg.getBool("NAND", "disable", true); bool disable = true;
int i = m_current_view == COVERFLOW_CHANNEL && min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
if (i>0 || m_current_view != COVERFLOW_CHANNEL)
disable = false;
if(!disable) if(!disable)
{ {
char *newpartition = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", currentPartition)]; char *newpartition = disable ? (char *)"NAND" : (char *)DeviceName[m_cfg.getInt(_domainFromView(), "partition", currentPartition)];
@ -259,12 +284,14 @@ void CMenu::_initConfigMenu(CMenu::SThemeData &theme)
m_configBtnPartitionM = _addPicButton(theme, "CONFIG/PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 250, 56, 56); m_configBtnPartitionM = _addPicButton(theme, "CONFIG/PARTITION_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 250, 56, 56);
m_configBtnPartitionP = _addPicButton(theme, "CONFIG/PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56); m_configBtnPartitionP = _addPicButton(theme, "CONFIG/PARTITION_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 250, 56, 56);
m_configLblEmulation = _addLabel(theme, "CONFIG/EMU_SAVE", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE); m_configLblEmulation = _addLabel(theme, "CONFIG/EMU_SAVE", theme.lblFont, L"", 40, 310, 340, 56, theme.lblFontColor, FTGX_JUSTIFY_LEFT | FTGX_ALIGN_MIDDLE);
m_configBtnEmulation = _addButton(theme, "CONFIG/EMU_SAVE_BTN", theme.btnFont, L"", 400, 310, 200, 56, theme.btnFontColor); m_configLblEmulationVal = _addLabel(theme, "CONFIG/EMU_SAVE_BTN_GLOBAL", theme.btnFont, L"", 456, 310, 88, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnEmulationM = _addPicButton(theme, "CONFIG/EMU_SAVE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 400, 310, 56, 56);
m_configBtnEmulationP = _addPicButton(theme, "CONFIG/EMU_SAVE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 544, 310, 56, 56);
m_configLblPage = _addLabel(theme, "CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 410, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC); m_configLblPage = _addLabel(theme, "CONFIG/PAGE_BTN", theme.btnFont, L"", 76, 410, 80, 56, theme.btnFontColor, FTGX_JUSTIFY_CENTER | FTGX_ALIGN_MIDDLE, theme.btnTexC);
m_configBtnPageM = _addPicButton(theme, "CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 410, 56, 56); m_configBtnPageM = _addPicButton(theme, "CONFIG/PAGE_MINUS", theme.btnTexMinus, theme.btnTexMinusS, 20, 410, 56, 56);
m_configBtnPageP = _addPicButton(theme, "CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 410, 56, 56); m_configBtnPageP = _addPicButton(theme, "CONFIG/PAGE_PLUS", theme.btnTexPlus, theme.btnTexPlusS, 156, 410, 56, 56);
m_configBtnBack = _addButton(theme, "CONFIG/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor); m_configBtnBack = _addButton(theme, "CONFIG/BACK_BTN", theme.btnFont, L"", 420, 410, 200, 56, theme.btnFontColor);
//
_setHideAnim(m_configLblTitle, "CONFIG/TITLE", 0, 0, -2.f, 0.f); _setHideAnim(m_configLblTitle, "CONFIG/TITLE", 0, 0, -2.f, 0.f);
_setHideAnim(m_configLblDownload, "CONFIG/DOWNLOAD", 100, 0, -2.f, 0.f); _setHideAnim(m_configLblDownload, "CONFIG/DOWNLOAD", 100, 0, -2.f, 0.f);
@ -277,7 +304,9 @@ void CMenu::_initConfigMenu(CMenu::SThemeData &theme)
_setHideAnim(m_configBtnPartitionM, "CONFIG/PARTITION_MINUS", 0, 0, 1.f, -1.f); _setHideAnim(m_configBtnPartitionM, "CONFIG/PARTITION_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configBtnPartitionP, "CONFIG/PARTITION_PLUS", 0, 0, 1.f, -1.f); _setHideAnim(m_configBtnPartitionP, "CONFIG/PARTITION_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configLblEmulation, "CONFIG/EMU_SAVE", 100, 0, -2.f, 0.f); _setHideAnim(m_configLblEmulation, "CONFIG/EMU_SAVE", 100, 0, -2.f, 0.f);
_setHideAnim(m_configBtnEmulation, "CONFIG/EMU_SAVE_BTN", 0, 0, -2.f, 0.f); _setHideAnim(m_configLblEmulationVal, "CONFIG/EMU_SAVE_BTN_GLOBAL", 0, 0, 1.f, -1.f);
_setHideAnim(m_configBtnEmulationM, "CONFIG/EMU_SAVE_MINUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configBtnEmulationP, "CONFIG/EMU_SAVE_PLUS", 0, 0, 1.f, -1.f);
_setHideAnim(m_configBtnBack, "CONFIG/BACK_BTN", 0, 0, -2.f, 0.f); _setHideAnim(m_configBtnBack, "CONFIG/BACK_BTN", 0, 0, -2.f, 0.f);
_setHideAnim(m_configLblPage, "CONFIG/PAGE_BTN", 0, 0, 1.f, -1.f); _setHideAnim(m_configLblPage, "CONFIG/PAGE_BTN", 0, 0, 1.f, -1.f);
_setHideAnim(m_configBtnPageM, "CONFIG/PAGE_MINUS", 0, 0, 1.f, -1.f); _setHideAnim(m_configBtnPageM, "CONFIG/PAGE_MINUS", 0, 0, 1.f, -1.f);

View File

@ -102,21 +102,34 @@ const CMenu::SOption CMenu::_videoModes[7] = {
}; };
const CMenu::SOption CMenu::_DMLvideoModes[3] = { const CMenu::SOption CMenu::_DMLvideoModes[3] = {
{ "0", L"Default" }, { "DMLdef", L"Default" },
{ "1", L"PAL 576i" }, { "DMLpal", L"PAL 576i" },
{ "2", L"NTSC 480i" }, { "DMLntsc", L"NTSC 480i" },
}; };
const CMenu::SOption CMenu::_SaveEmu[3] = { const CMenu::SOption CMenu::_NandEmu[3] = {
{ "0", L"Default" }, { "NANDoff", L"Off" },
{ "1", L"Partial" }, { "NANDpart", L"Partial" },
{ "2", L"Full" }, { "NANDfull", L"Full" },
};
const CMenu::SOption CMenu::_GlobalSaveEmu[3] = {
{ "SaveOffG", L"Off" },
{ "SavePartG", L"Partial" },
{ "SaveFullG", L"Full" },
};
const CMenu::SOption CMenu::_SaveEmu[4] = {
{ "SaveDef", L"Default" },
{ "SaveOff", L"Off" },
{ "SavePart", L"Partial" },
{ "SaveFull", L"Full" },
}; };
const CMenu::SOption CMenu::_AspectRatio[3] = { const CMenu::SOption CMenu::_AspectRatio[3] = {
{ "0", L"Default" }, { "aspectDef", L"Default" },
{ "1", L"Force 4:3" }, { "aspect43", L"Force 4:3" },
{ "2", L"Force 16:9" }, { "aspect169", L"Force 16:9" },
}; };
const CMenu::SOption CMenu::_vidModePatch[4] = { const CMenu::SOption CMenu::_vidModePatch[4] = {
@ -736,7 +749,10 @@ void CMenu::_launchChannel(dir_discHdr *hdr)
add_game_to_card(id.c_str()); add_game_to_card(id.c_str());
bool emu_disabled = m_cfg.getBool("NAND", "disable", true); bool emu_disabled = m_cfg.getBool("NAND", "disable", true);
bool emulate_mode = m_gcfg2.testOptBool(id, "full_emulation", m_cfg.getBool("NAND", "full_emulation", true)); bool emulate_mode = false;
int i = min(max(0, m_cfg.getInt("NAND", "emulation", 0)), (int)ARRAY_SIZE(CMenu::_NandEmu) - 1);
if (i==2)
emulate_mode = true;
m_gcfg1.save(true); m_gcfg1.save(true);
m_gcfg2.save(true); m_gcfg2.save(true);
@ -915,6 +931,14 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
u8 emuSave = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u); u8 emuSave = min((u32)m_gcfg2.getInt(id, "emulate_save", 0), ARRAY_SIZE(CMenu::_SaveEmu) - 1u);
if (emuSave == 0 && emuSave != 1)
{
emuSave = min(max(0, m_cfg.getInt("GAMES", "save_emulation", 0)), (int)ARRAY_SIZE(CMenu::_GlobalSaveEmu) - 1);
if (emuSave != 0)
emuSave++;
}
else
emuSave = 0;
if (!dvd && get_frag_list((u8 *) hdr->hdr.id, (char *) hdr->path, currentPartition == 0 ? 0x200 : sector_size) < 0) if (!dvd && get_frag_list((u8 *) hdr->hdr.id, (char *) hdr->path, currentPartition == 0 ? 0x200 : sector_size) < 0)
return; return;
@ -1036,7 +1060,7 @@ void CMenu::_launchGame(dir_discHdr *hdr, bool dvd)
Nand::Instance()->Init(emuPath.c_str(), emuPartition, false); Nand::Instance()->Init(emuPath.c_str(), emuPartition, false);
DeviceHandler::Instance()->UnMount(emuPartition); DeviceHandler::Instance()->UnMount(emuPartition);
if (emuSave == 2) if (emuSave == 3)
Nand::Instance()->Set_FullMode(true); Nand::Instance()->Set_FullMode(true);
else else
Nand::Instance()->Set_FullMode(false); Nand::Instance()->Set_FullMode(false);