mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Move Config.cpp to Core renamed it to ConfigManager
Todo: Use it from core.cpp instead of the params git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1905 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -49,7 +49,7 @@
|
||||
#include "ISOFile.h"
|
||||
#include "Volume.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "Config.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Core.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "ConfigMain.h"
|
||||
|
@ -1,192 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
#ifdef __APPLE__
|
||||
#include <CoreFoundation/CFString.h>
|
||||
#include <CoreFoundation/CFUrl.h>
|
||||
#include <CoreFoundation/CFBundle.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#endif
|
||||
|
||||
SConfig SConfig::m_Instance;
|
||||
|
||||
|
||||
SConfig::SConfig()
|
||||
{
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
|
||||
SConfig::~SConfig()
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
void SConfig::SaveSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff
|
||||
|
||||
// General
|
||||
{
|
||||
ini.Set("General", "LastFilename", m_LastFilename);
|
||||
|
||||
// ISO folders
|
||||
ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
|
||||
|
||||
for (size_t i = 0; i < m_ISOFolder.size(); i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", (int)i);
|
||||
ini.Set("General", tmp, m_ISOFolder[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Interface
|
||||
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
|
||||
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
|
||||
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
|
||||
ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
|
||||
ini.Set("Interface", "ShowWiimoteLeds", m_LocalCoreStartupParameter.bWiiLeds);
|
||||
ini.Set("Interface", "ShowWiimoteSpeakers", m_LocalCoreStartupParameter.bWiiSpeakers);
|
||||
|
||||
// Core
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
|
||||
ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore);
|
||||
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
|
||||
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
|
||||
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
||||
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
|
||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
|
||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
|
||||
// Plugins
|
||||
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin);
|
||||
ini.Set("Core", "WiiMotePlugin", m_LocalCoreStartupParameter.m_strWiimotePlugin);
|
||||
}
|
||||
|
||||
ini.Save(CONFIG_FILE);
|
||||
}
|
||||
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(CONFIG_FILE);
|
||||
#ifdef __APPLE__
|
||||
// Plugin path will be Dolphin.app/Contents/PlugIns
|
||||
CFURLRef BundleRef, PluginDirRef;
|
||||
// Get the main bundle for the app
|
||||
BundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
PluginDirRef = CFBundleCopyBuiltInPlugInsURL(CFBundleGetMainBundle());
|
||||
CFStringRef BundlePath = CFURLCopyFileSystemPath(BundleRef, kCFURLPOSIXPathStyle);
|
||||
CFStringRef PluginDirPath = CFURLCopyFileSystemPath(PluginDirRef, kCFURLPOSIXPathStyle);
|
||||
char AppBundlePath[MAXPATHLEN], PluginPath[MAXPATHLEN];
|
||||
CFStringGetFileSystemRepresentation(BundlePath, AppBundlePath, sizeof(AppBundlePath));
|
||||
CFStringGetFileSystemRepresentation(PluginDirPath, PluginPath, sizeof(PluginPath));
|
||||
// printf("bundle path = %s %s\n", AppBundlePath, PluginPath);
|
||||
CFRelease(BundleRef);
|
||||
CFRelease(BundlePath);
|
||||
CFRelease(PluginDirRef);
|
||||
CFRelease(PluginDirPath);
|
||||
std::string PluginsDir = AppBundlePath;
|
||||
PluginsDir += DIR_SEP;
|
||||
PluginsDir += PluginPath;
|
||||
PluginsDir += DIR_SEP;
|
||||
|
||||
m_DefaultGFXPlugin = PluginsDir + DEFAULT_GFX_PLUGIN;
|
||||
m_DefaultDSPPlugin = PluginsDir + DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PluginsDir + DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PluginsDir + DEFAULT_WIIMOTE_PLUGIN;
|
||||
|
||||
#else
|
||||
// Hard coded default plugin
|
||||
{
|
||||
m_DefaultGFXPlugin = PLUGINS_DIR DIR_SEP DEFAULT_GFX_PLUGIN;
|
||||
m_DefaultDSPPlugin = PLUGINS_DIR DIR_SEP DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN;
|
||||
}
|
||||
#endif
|
||||
// General
|
||||
{
|
||||
ini.Get("General", "LastFilename", &m_LastFilename);
|
||||
|
||||
m_ISOFolder.clear();
|
||||
int numGCMPaths;
|
||||
|
||||
if (ini.Get("General", "GCMPathes", &numGCMPaths, 0))
|
||||
{
|
||||
for (int i = 0; i < numGCMPaths; i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", i);
|
||||
std::string tmpPath;
|
||||
ini.Get("General", tmp, &tmpPath, "");
|
||||
m_ISOFolder.push_back(tmpPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// Interface
|
||||
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, false);
|
||||
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
|
||||
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
|
||||
ini.Get("Interface", "Theme", &m_LocalCoreStartupParameter.iTheme, 0);
|
||||
ini.Get("Interface", "ShowWiimoteLeds", &m_LocalCoreStartupParameter.bWiiLeds, false);
|
||||
ini.Get("Interface", "ShowWiimoteSpeakers", &m_LocalCoreStartupParameter.bWiiSpeakers, false);
|
||||
|
||||
// Core
|
||||
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);
|
||||
ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true);
|
||||
ini.Get("Core", "UseDualCore", &m_LocalCoreStartupParameter.bUseDualCore, false);
|
||||
ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
|
||||
ini.Get("Core", "LockThreads", &m_LocalCoreStartupParameter.bLockThreads, true);
|
||||
ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
|
||||
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
|
||||
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
||||
|
||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||
|
||||
// Plugins
|
||||
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
|
||||
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
|
||||
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
|
||||
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Boot/Boot.h"
|
||||
|
||||
struct SConfig
|
||||
{
|
||||
// hard coded default plugins ...
|
||||
std::string m_DefaultGFXPlugin;
|
||||
std::string m_DefaultDSPPlugin;
|
||||
std::string m_DefaultPADPlugin;
|
||||
std::string m_DefaultWiiMotePlugin;
|
||||
|
||||
// name of the last used filename
|
||||
std::string m_LastFilename;
|
||||
|
||||
// gcm folder
|
||||
std::vector<std::string>m_ISOFolder;
|
||||
|
||||
SCoreStartupParameter m_LocalCoreStartupParameter;
|
||||
|
||||
// save settings
|
||||
void SaveSettings();
|
||||
|
||||
// load settings
|
||||
void LoadSettings();
|
||||
|
||||
/* Return the permanent and somewhat globally used instance of this struct
|
||||
there is also a Core::GetStartupParameter() instance of it with almost
|
||||
the same values */
|
||||
static SConfig& GetInstance() {return(m_Instance);}
|
||||
|
||||
private:
|
||||
|
||||
// constructor
|
||||
SConfig();
|
||||
|
||||
// destructor
|
||||
~SConfig();
|
||||
|
||||
static SConfig m_Instance;
|
||||
};
|
||||
|
||||
#endif
|
@ -26,6 +26,7 @@
|
||||
#include "Globals.h" // Local
|
||||
#include "ConfigMain.h"
|
||||
#include "PluginManager.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Frame.h"
|
||||
//////////////////////////////////////
|
||||
|
||||
@ -407,8 +408,11 @@ void CConfigMain::CreateGUIControls()
|
||||
|
||||
FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
|
||||
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
|
||||
for (int i=0;i<MAXPADS;i++)
|
||||
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]);
|
||||
|
||||
for (int i=0;i<MAXWIIMOTES;i++)
|
||||
FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]);
|
||||
|
||||
sPlugins = new wxBoxSizer(wxVERTICAL);
|
||||
sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5);
|
||||
@ -646,8 +650,14 @@ void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
GetFilename(GraphicSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
GetFilename(DSPSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
|
||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin);
|
||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0]);
|
||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[1]);
|
||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[2]);
|
||||
GetFilename(PADSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[3]);
|
||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
|
||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[1]);
|
||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[2]);
|
||||
GetFilename(WiimoteSelection, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[3]);
|
||||
}
|
||||
|
||||
void CConfigMain::OnConfig(wxCommandEvent& event)
|
||||
|
@ -48,7 +48,7 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include "Config.h" // Core
|
||||
#include "ConfigManager.h" // Core
|
||||
#include "Core.h"
|
||||
#include "HW/DVDInterface.h"
|
||||
#include "State.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Windows
|
||||
/* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
||||
|
||||
CFrame is the main parent window. Inside CFrame there is m_Panel which is the parent for
|
||||
the rendering window (when we render to the main window). In Windows the rendering window is
|
||||
@ -48,7 +48,7 @@ be accessed from Core::GetWindowHandle().
|
||||
#include "FileUtil.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#include "Config.h" // Core
|
||||
#include "ConfigManager.h" // Core
|
||||
#include "Core.h"
|
||||
#include "HW/DVDInterface.h"
|
||||
#include "State.h"
|
||||
@ -202,7 +202,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Music mod
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
#ifdef MUSICMOD
|
||||
MM_PopulateGUI();
|
||||
#endif
|
||||
@ -217,7 +217,7 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar)
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// Delete and recreate the toolbar
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// ¯¯¯¯¯¯¯¯¯¯
|
||||
void CFrame::RecreateToolbar()
|
||||
{
|
||||
|
||||
@ -556,14 +556,14 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin.c_str()
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[0].c_str()
|
||||
);
|
||||
}
|
||||
void CFrame::OnPluginWiimote(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
CPluginManager::GetInstance().OpenConfig(
|
||||
GetHandle(),
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin.c_str()
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[0].c_str()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "BootManager.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "Core.h"
|
||||
#include "State.h"
|
||||
#include "ConfigMain.h"
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "FileSearch.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "Config.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "GameListCtrl.h"
|
||||
#include "Blob.h"
|
||||
#include "ISOProperties.h"
|
||||
|
@ -41,7 +41,7 @@
|
||||
|
||||
#include "Main.h" // Local
|
||||
#include "Frame.h"
|
||||
#include "Config.h"
|
||||
#include "ConfigManager.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "LogWindow.h"
|
||||
#include "ExtendedTrace.h"
|
||||
|
@ -7,7 +7,7 @@ wxenv = env.Clone()
|
||||
|
||||
files = [
|
||||
'BootManager.cpp',
|
||||
'Config.cpp',
|
||||
# 'Config.cpp',
|
||||
'cmdline.c',
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user