Main Configuration: Fixed the game specific Wii settings so that they don't cause the global settings to be forgotten

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2389 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-02-23 09:34:28 +00:00
parent 366e2ad276
commit 4beff606d7
5 changed files with 62 additions and 51 deletions

View File

@ -134,60 +134,52 @@ bool BootCore(const std::string& _rFilename)
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
// ------------------------------------------------
// Wii settings
// ----------------
if (StartUp.bWii)
{
// ------------------------------------------------
// Update SYSCONF with game specific settings
// ----------------
bool bEnableProgressiveScan, bEnableWideScreen;
//bRefreshList = false;
FILE* pStream; // file handle
u8 m_SYSCONF[0x4000]; // SYSCONF file
u16 IPL_PGS = 0x17CC; // pregressive scan
u16 IPL_PGS = 0x17CC; // progressive scan
u16 IPL_AR = 0x04D9; // widescreen
std::string FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
// Load Wii SYSCONF
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
m_SYSCONF[IPL_PGS] = StartUp.bProgressiveScan;
m_SYSCONF[IPL_AR] = StartUp.bWidescreen;
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
// Save the update Wii SYSCONF settings
pStream = NULL;
pStream = fopen(FullSYSCONFPath.c_str(), "rb");
pStream = fopen(FullSYSCONFPath.c_str(), "r+b");
if (pStream != NULL)
{
fread(m_SYSCONF, 1, 0x4000, pStream);
fseek(pStream, IPL_PGS, 0);
fputc(StartUp.bProgressiveScan ? 1 : 0, pStream);
fseek(pStream, IPL_AR, 0);
fputc(StartUp.bWidescreen ? 1 : 0, pStream);
fclose(pStream);
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, m_SYSCONF[IPL_PGS] != 0);
ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, m_SYSCONF[IPL_AR] != 0);
m_SYSCONF[IPL_PGS] = bEnableProgressiveScan;
m_SYSCONF[IPL_AR] = bEnableWideScreen;
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
// Enable custom Wii SYSCONF settings by saving the file to shared2
pStream = NULL;
pStream = fopen(FullSYSCONFPath.c_str(), "wb");
if (pStream != NULL)
{
fwrite(m_SYSCONF, 1, 0x4000, pStream);
fclose(pStream);
}
else
{
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
}
}
}
else
{
PanicAlert("Could not read %s", FullSYSCONFPath.c_str());
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
}
// ---------
}
// ---------------
}
// ==============
// =====================
// =================================================================
// Run the game
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#if defined(HAVE_WX) && HAVE_WX
if(main_frame)
{
@ -198,7 +190,7 @@ bool BootCore(const std::string& _rFilename)
main_frame->ModifyStatusBar();
}
#endif
// init the core
// Init the core
if (!Core::Init())
{
PanicAlert("Couldn't init the core.\nCheck your configuration.");
@ -212,14 +204,16 @@ bool BootCore(const std::string& _rFilename)
#else
Core::SetState(Core::CORE_RUN);
#endif
// =====================
//////////////////////////////////////////////////////////////////////////////////////////
// =================================================================
// Music mod
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#ifdef MUSICMOD
MusicMod::Main(StartUp.m_strFilename);
#endif
///////////////////////////////////
// ===================
return true;