Kill some horribly ugly hackery :( It's just not right to pass entire IniFile objects across DLLs. Only POD (plain-old-data, like int, float, char, char[] etc) are safe to pass across DLL boundaries.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4257 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-09-13 08:54:46 +00:00
parent 700f2ff694
commit 512053fa5e
20 changed files with 87 additions and 149 deletions

View File

@ -705,7 +705,7 @@ void Callback_VideoCopiedToXFB(bool video_update)
double wait_frametime = (1000.0 / targetfps);
if (Timer.GetTimeDifference() >= wait_frametime * frames)
no_framelimit=Timer.GetTimeDifference();
no_framelimit = (u32)Timer.GetTimeDifference();
while (Timer.GetTimeDifference() < wait_frametime * frames)
{
@ -756,7 +756,7 @@ void Callback_VideoCopiedToXFB(bool video_update)
int TargetVPS = (int)(VideoInterface::TargetRefreshRate + 0.5);
float Speed = ((VPS > 0 ? VPS : VideoInterface::ActualRefreshRate) / TargetVPS) * 100.0f;
float Speed = ((VPS > 0.0f ? VPS : VideoInterface::ActualRefreshRate) / TargetVPS) * 100.0f;
// Settings are shown the same for both extended and summary info
std::string SSettings = StringFromFormat(" | Core: %s %s",

View File

@ -47,8 +47,6 @@ void SCoreStartupParameter::LoadDefaults()
bWii = false;
SelectedLanguage = 0;
iTLBHack = 0;
delete gameIni;
gameIni = NULL;
bJITOff = false; // debugger only settings
bJITLoadStoreOff = false;

View File

@ -37,9 +37,6 @@ struct SCoreStartupParameter
// Windows/GUI related
void* hMainWindow;
// game ini
IniFile *gameIni;
// Settings
bool bEnableDebugging; bool bAutomaticStart; bool bBootToPause;
bool bUseJIT;
@ -116,6 +113,7 @@ struct SCoreStartupParameter
std::string m_strDVDRoot;
std::string m_strUniqueID;
std::string m_strName;
std::string m_strGameIni;
// Constructor just calls LoadDefaults
SCoreStartupParameter();

View File

@ -338,8 +338,8 @@ static u32 s_lineCount = 0;
static u32 s_upperFieldBegin = 0;
static u32 s_lowerFieldBegin = 0;
double TargetRefreshRate = 0.0;
double ActualRefreshRate = 0.0;
float TargetRefreshRate = 0.0;
float ActualRefreshRate = 0.0;
s64 SyncTicksProgress = 0;
void DoState(PointerWrap &p)

View File

@ -44,8 +44,8 @@ namespace VideoInterface
void Update();
// urgh, ugly externs.
extern double ActualRefreshRate;
extern double TargetRefreshRate;
extern float ActualRefreshRate;
extern float TargetRefreshRate;
extern s64 SyncTicksProgress;
// UpdateInterrupts: check if we have to generate a new VI Interrupt

View File

@ -15,15 +15,11 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// File description
/* ------------
This file controls when plugins are loaded and unloaded from memory. Its functions scan for valid
plugins when Dolphin is booted, and open the debugging and config windows. The PluginManager is
created once when Dolphin starts and is closed when Dolphin is closed.
*/
// Include
@ -58,7 +54,6 @@ CPluginManager::CPluginManager()
// Start LogManager
m_PluginGlobals->logManager = LogManager::GetInstance();
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
m_params = &(SConfig::GetInstance().m_LocalCoreStartupParameter);
@ -104,6 +99,13 @@ CPluginManager::~CPluginManager()
// Function: Point the m_pad[] and other variables to a certain plugin
bool CPluginManager::InitPlugins()
{
// Update pluginglobals.
if (SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.size() == 0)
{
PanicAlert("Bad gameini filename");
}
strcpy(m_PluginGlobals->game_ini, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str());
strcpy(m_PluginGlobals->unique_id, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str());
if (!GetDSP()) {
PanicAlert("Can't init DSP Plugin");
return false;

View File

@ -71,7 +71,7 @@ private:
bool m_Initialized;
CPluginInfos m_PluginInfos;
PLUGIN_GLOBALS* m_PluginGlobals;
PLUGIN_GLOBALS *m_PluginGlobals;
Common::PluginPAD *m_pad[4];
Common::PluginVideo *m_video;
Common::PluginWiimote *m_wiimote[4];

View File

@ -71,11 +71,7 @@ namespace BootManager
extern "C" HINSTANCE wxGetInstance();
#endif
// Boot the ISO or file
// ----------------
bool BootCore(const std::string& _rFilename)
{
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -117,40 +113,28 @@ bool BootCore(const std::string& _rFilename)
// ====================================================
// Load game specific settings
// ----------------
// Released when you LoadDefaults
IniFile *ini = new IniFile();
IniFile game_ini;
std::string unique_id = StartUp.GetUniqueID();
if (unique_id.size() == 6 && ini->Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str()))
StartUp.m_strGameIni = FULL_GAMECONFIG_DIR + unique_id + ".ini";
if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str()))
{
StartUp.gameIni = ini;
// ------------------------------------------------
// General settings
// ----------------
ini->Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
ini->Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
ini->Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
ini->Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
ini->Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
// ------------------------------------------------
game_ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
game_ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
// Wii settings
// ----------------
if (StartUp.bWii)
{
//bRefreshList = false;
FILE* pStream; // file handle
u16 IPL_PGS = 0x17CC; // progressive scan
u16 IPL_AR = 0x04D9; // widescreen
ini->Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
ini->Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
game_ini.Get("Wii", "ProgressiveScan", &StartUp.bProgressiveScan, StartUp.bProgressiveScan);
game_ini.Get("Wii", "Widescreen", &StartUp.bWidescreen, StartUp.bWidescreen);
// Save the update Wii SYSCONF settings
pStream = NULL;
pStream = fopen(WII_SYSCONF_FILE, "r+b");
if (pStream != NULL)
FILE* pStream = fopen(WII_SYSCONF_FILE, "r+b");
if (pStream)
{
const int IPL_PGS = 0x17CC; // progressive scan
const int IPL_AR = 0x04D9; // widescreen
fseek(pStream, IPL_PGS, 0);
fputc(StartUp.bProgressiveScan ? 1 : 0, pStream);
fseek(pStream, IPL_AR, 0);
@ -162,15 +146,8 @@ bool BootCore(const std::string& _rFilename)
PanicAlert("Could not write to %s", WII_SYSCONF_FILE);
}
}
// ---------------
} else {
delete ini;
ini = NULL;
}
// =====================
}
// =================================================================
// Run the game
// --------------
#if defined(HAVE_WX) && HAVE_WX

View File

@ -105,40 +105,20 @@ void Config::Load(const char *ini_file)
SetEnableAlert(bTmp);
}
void Config::GameIniLoad(IniFile *iniFile)
void Config::GameIniLoad(const char *ini_file)
{
if (! iniFile)
return;
if (iniFile->Exists("Video", "ForceFiltering"))
iniFile->Get("Video", "ForceFiltering", &bForceFiltering, 0);
if (iniFile->Exists("Video", "MaxAnisotropy"))
iniFile->Get("Video", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x)
if (iniFile->Exists("Video", "EFBCopyDisable"))
iniFile->Get("Video", "EFBCopyDisable", &bEFBCopyDisable, 0);
if (iniFile->Exists("Video", "EFBCopyDisableHotKey"))
iniFile->Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
if (iniFile->Exists("Video", "EFBToRAMEnable"))
iniFile->Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0);
if (iniFile->Exists("Video", "SafeTextureCache"))
iniFile->Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
if (iniFile->Exists("Video", "MSAA"))
iniFile->Get("Video", "MSAA", &iMultisampleMode, 0);
if (iniFile->Exists("Video", "DstAlphaPass"))
iniFile->Get("Video", "DstAlphaPass", &bDstAlphaPass, false);
if (iniFile->Exists("Video", "UseXFB"))
iniFile->Get("Video", "UseXFB", &bUseXFB, 0);
if (iniFile->Exists("Video", "ProjectionHack"))
iniFile->Get("Video", "ProjectionHack", &iPhackvalue, 0);
IniFile iniFile;
iniFile.Load(ini_file);
iniFile.Get("Video", "ForceFiltering", &bForceFiltering, 0);
iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy, 3); // NOTE - this is x in (1 << x)
iniFile.Get("Video", "EFBCopyDisable", &bEFBCopyDisable, 0);
iniFile.Get("Video", "EFBCopyDisableHotKey", &bEFBCopyDisableHotKey, 0);
iniFile.Get("Video", "EFBToRAMEnable", &bCopyEFBToRAM, 0);
iniFile.Get("Video", "SafeTextureCache", &bSafeTextureCache, false);
iniFile.Get("Video", "MSAA", &iMultisampleMode, 0);
iniFile.Get("Video", "DstAlphaPass", &bDstAlphaPass, false);
iniFile.Get("Video", "UseXFB", &bUseXFB, 0);
iniFile.Get("Video", "ProjectionHack", &iPhackvalue, 0);
}
void Config::Save(const char *ini_file)

View File

@ -55,7 +55,7 @@ struct Config
{
Config();
void Load(const char *ini_file);
void GameIniLoad(IniFile *iniFile);
void GameIniLoad(const char *ini_file);
void Save(const char *ini_file);
void UpdateProjectionHack();