本文整理汇总了C++中IniFile类的典型用法代码示例。如果您正苦于以下问题:C++ IniFile类的具体用法?C++ IniFile怎么用?C++ IniFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IniFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CleanRecent
void Config::Save()
{
if (iniFilename_.size() && g_Config.bSaveSettings) {
CleanRecent();
IniFile iniFile;
if (!iniFile.Load(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
}
IniFile::Section *general = iniFile.GetOrCreateSection("General");
general->Set("FirstRun", bFirstRun);
general->Set("AutoLoadLast", bAutoLoadLast);
general->Set("AutoRun", bAutoRun);
general->Set("Browse", bBrowse);
general->Set("ConfirmOnQuit", bConfirmOnQuit);
general->Set("IgnoreBadMemAccess", bIgnoreBadMemAccess);
general->Set("CurrentDirectory", currentDirectory);
general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
general->Set("ReportHost", sReportHost);
general->Set("Recent", recentIsos);
general->Set("WindowX", iWindowX);
general->Set("WindowY", iWindowY);
general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
general->Set("Language", languageIni);
general->Set("NumWorkerThreads", iNumWorkerThreads);
general->Set("MaxRecent", iMaxRecent);
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
cpu->Set("FastMemory", bFastMemory);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Set("ShowFPSCounter", bShowFPSCounter);
graphics->Set("DisplayFramebuffer", bDisplayFramebuffer);
graphics->Set("ResolutionScale", iWindowZoom);
graphics->Set("BufferedRendering", bBufferedRendering);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("LinearFiltering", bLinearFiltering);
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);
graphics->Set("FrameRate", iFpsLimit);
graphics->Set("UseMediaEngine", bUseMediaEngine);
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
graphics->Set("VertexCache", bVertexCache);
graphics->Set("FullScreen", bFullScreen);
#ifdef BLACKBERRY10
graphics->Set("PartialStretch", bPartialStretch);
#endif
graphics->Set("StretchToDisplay", bStretchToDisplay);
graphics->Set("TrueColor", bTrueColor);
graphics->Set("MipMap", bMipMap);
graphics->Set("TexScalingLevel", iTexScalingLevel);
graphics->Set("TexScalingType", iTexScalingType);
graphics->Set("TexDeposterize", bTexDeposterize);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
control->Set("ShowStick", bShowAnalogStick);
control->Set("ShowTouchControls", bShowTouchControls);
control->Set("LargeControls", bLargeControls);
control->Set("KeyMapping",iMappingMap);
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
control->Set("ForceInputDevice", iForceInputDevice);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("NickName", sNickName.c_str());
pspConfig->Set("Language", ilanguage);
pspConfig->Set("TimeFormat", itimeformat);
pspConfig->Set("DateFormat", iDateFormat);
pspConfig->Set("TimeZone", iTimeZone);
pspConfig->Set("DayLightSavings", bDayLightSavings);
pspConfig->Set("ButtonPreference", bButtonPreference);
pspConfig->Set("LockParentalLevel", iLockParentalLevel);
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
pspConfig->Set("EncryptSave", bEncryptSave);
if (!iniFile.Save(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't write ini %s", iniFilename_.c_str());
return;
}
INFO_LOG(LOADER, "Config saved: %s", iniFilename_.c_str());
} else {
INFO_LOG(LOADER, "Not saving config");
}
}
示例2: SaveFifoPlayerSettings
void SConfig::SaveFifoPlayerSettings(IniFile& ini)
{
IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");
fifoplayer->Set("LoopReplay", bLoopFifoReplay);
}
示例3: LoadInputSettings
void SConfig::LoadInputSettings(IniFile& ini)
{
IniFile::Section* input = ini.GetOrCreateSection("Input");
input->Get("BackgroundInput", &m_BackgroundInput, false);
}
示例4: Save
void VideoConfig::Save(const char *ini_file)
{
IniFile iniFile;
iniFile.Load(ini_file);
iniFile.Set("Hardware", "VSync", bVSync);
iniFile.Set("Settings", "AspectRatio", iAspectRatio);
iniFile.Set("Settings", "Crop", bCrop);
iniFile.Set("Settings", "wideScreenHack", bWidescreenHack);
iniFile.Set("Settings", "UseXFB", bUseXFB);
iniFile.Set("Settings", "UseRealXFB", bUseRealXFB);
iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
iniFile.Set("Settings", "ShowFPS", bShowFPS);
iniFile.Set("Settings", "LogFPSToFile", bLogFPSToFile);
iniFile.Set("Settings", "ShowInputDisplay", bShowInputDisplay);
iniFile.Set("Settings", "OverlayStats", bOverlayStats);
iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats);
iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel);
iniFile.Set("Settings", "Show", iCompileDLsLevel);
iniFile.Set("Settings", "DumpTextures", bDumpTextures);
iniFile.Set("Settings", "HiresTextures", bHiresTextures);
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
iniFile.Set("Settings", "FreeLook", bFreeLook);
iniFile.Set("Settings", "UseFFV1", bUseFFV1);
iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo);
iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
iniFile.Set("Settings", "EnablePixelLighting", bEnablePixelLighting);
iniFile.Set("Settings", "FastDepthCalc", bFastDepthCalc);
iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions);
iniFile.Set("Settings", "MSAA", iMultisampleMode);
iniFile.Set("Settings", "EFBScale", iEFBScale);
iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable);
iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter);
iniFile.Set("Settings", "Wireframe", bWireFrame);
iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass);
iniFile.Set("Settings", "DisableFog", bDisableFog);
iniFile.Set("Settings", "OMPDecoder", bOMPDecoder);
iniFile.Set("Settings", "EnableShaderDebugging", bEnableShaderDebugging);
iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering);
iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy);
iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader);
iniFile.Set("Enhancements", "Enable3dVision", b3DVision);
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);
iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);
iniFile.Set("Hacks", "EFBCopyCacheEnable", bEFBCopyCacheEnable);
iniFile.Set("Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
iniFile.Set("Hardware", "Adapter", iAdapter);
iniFile.Save(ini_file);
}
示例5: CreateGUIControls
void CLogWindow::CreateGUIControls()
{
IniFile ini;
ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
IniFile::Section* options = ini.GetOrCreateSection("Options");
IniFile::Section* log_window = ini.GetOrCreateSection("LogWindow");
log_window->Get("x", &x, Parent->GetSize().GetX() / 2);
log_window->Get("y", &y, Parent->GetSize().GetY());
log_window->Get("pos", &winpos, wxAUI_DOCK_RIGHT);
// Set up log listeners
int verbosity;
options->Get("Verbosity", &verbosity, 0);
// Ensure the verbosity level is valid
if (verbosity < 1)
verbosity = 1;
if (verbosity > MAX_LOGLEVEL)
verbosity = MAX_LOGLEVEL;
// Get the logger output settings from the config ini file.
options->Get("WriteToFile", &m_writeFile, false);
options->Get("WriteToWindow", &m_writeWindow, true);
IniFile::Section* logs = ini.GetOrCreateSection("Logs");
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
{
bool enable;
logs->Get(m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &enable, false);
if (m_writeWindow && enable)
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, this);
else
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, this);
if (m_writeFile && enable)
m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());
else
m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());
m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity));
}
// Font
m_FontChoice = new wxChoice(this, wxID_ANY);
m_FontChoice->Bind(wxEVT_CHOICE, &CLogWindow::OnFontChange, this);
m_FontChoice->Append(_("Default font"));
m_FontChoice->Append(_("Monospaced font"));
m_FontChoice->Append(_("Selected font"));
DefaultFont = GetFont();
MonoSpaceFont.SetNativeFontInfoUserDesc("lucida console windows-1252");
LogFont.push_back(DefaultFont);
LogFont.push_back(MonoSpaceFont);
LogFont.push_back(DebuggerFont);
int font;
options->Get("Font", &font, 0);
m_FontChoice->SetSelection(font);
// Word wrap
bool wrap_lines;
options->Get("WrapLines", &wrap_lines, false);
m_WrapLine = new wxCheckBox(this, wxID_ANY, _("Word Wrap"));
m_WrapLine->Bind(wxEVT_CHECKBOX, &CLogWindow::OnWrapLineCheck, this);
m_WrapLine->SetValue(wrap_lines);
// Log viewer
m_Log = CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
(wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));
// submit row
m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);
// Clear log button
m_clear_log_btn = new wxButton(this, wxID_ANY, _("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
m_clear_log_btn->Bind(wxEVT_BUTTON, &CLogWindow::OnClear, this);
// Sizers
wxBoxSizer* sTop = new wxBoxSizer(wxHORIZONTAL);
sTop->Add(m_clear_log_btn);
sTop->Add(m_FontChoice, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 3);
sTop->Add(m_WrapLine, 0, wxALIGN_CENTER_VERTICAL);
sBottom = new wxBoxSizer(wxVERTICAL);
PopulateBottom();
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(sTop, 0, wxEXPAND);
sMain->Add(sBottom, 1, wxEXPAND);
SetSizer(sMain);
m_cmdline->SetFocus();
}
示例6: strlen
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
const bool useIniFilename = iniFileName != nullptr && strlen(iniFileName) > 0;
iniFilename_ = FindConfigFile(useIniFilename ? iniFileName : "ppsspp.ini");
const bool useControllerIniFilename = controllerIniFilename != nullptr && strlen(controllerIniFilename) > 0;
controllerIniFilename_ = FindConfigFile(useControllerIniFilename ? controllerIniFilename : "controls.ini");
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
bSaveSettings = true;
bShowFrameProfiler = true;
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
IterateSettings(iniFile, [](IniFile::Section *section, ConfigSetting *setting) {
setting->Get(section);
});
iRunCount++;
if (!File::Exists(currentDirectory))
currentDirectory = "";
IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
recent->Get("MaxRecent", &iMaxRecent, 30);
// Fix issue from switching from uint (hex in .ini) to int (dec)
// -1 is okay, though. We'll just ignore recent stuff if it is.
if (iMaxRecent == 0)
iMaxRecent = 30;
if (iMaxRecent > 0) {
recentIsos.clear();
for (int i = 0; i < iMaxRecent; i++) {
char keyName[64];
std::string fileName;
snprintf(keyName, sizeof(keyName), "FileName%d", i);
if (recent->Get(keyName, &fileName, "") && !fileName.empty()) {
recentIsos.push_back(fileName);
}
}
}
auto pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths")->ToMap();
vPinnedPaths.clear();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
vPinnedPaths.push_back(it->second);
}
// This caps the exponent 4 (so 16x.)
if (iAnisotropyLevel > 4) {
iAnisotropyLevel = 4;
}
// Check for an old dpad setting
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
float f;
control->Get("DPadRadius", &f, 0.0f);
if (f > 0.0f) {
ResetControlLayout();
}
// MIGRATION: For users who had the old static touch layout, aren't I nice?
// We can probably kill this in 0.9.8 or something.
if (fDpadX > 1.0 || fDpadY > 1.0) { // Likely the rest are too!
float screen_width = dp_xres;
float screen_height = dp_yres;
fActionButtonCenterX /= screen_width;
fActionButtonCenterY /= screen_height;
fDpadX /= screen_width;
fDpadY /= screen_height;
fStartKeyX /= screen_width;
fStartKeyY /= screen_height;
fSelectKeyX /= screen_width;
fSelectKeyY /= screen_height;
fUnthrottleKeyX /= screen_width;
fUnthrottleKeyY /= screen_height;
fLKeyX /= screen_width;
fLKeyY /= screen_height;
fRKeyX /= screen_width;
fRKeyY /= screen_height;
fAnalogStickX /= screen_width;
fAnalogStickY /= screen_height;
fcombo0X /= screen_width;
fcombo0Y /= screen_height;
fcombo1X /= screen_width;
fcombo1Y /= screen_height;
fcombo2X /= screen_width;
fcombo2Y /= screen_height;
fcombo3X /= screen_width;
fcombo3Y /= screen_height;
fcombo4X /= screen_width;
fcombo4Y /= screen_height;
}
//.........这里部分代码省略.........
示例7: in
void VideoConfig::Load(const std::string& ini_file)
{
IniFile iniFile;
iniFile.Load(ini_file);
IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware");
hardware->Get("VSync", &bVSync, 0);
hardware->Get("Adapter", &iAdapter, 0);
IniFile::Section* settings = iniFile.GetOrCreateSection("Settings");
settings->Get("wideScreenHack", &bWidescreenHack, false);
settings->Get("AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
settings->Get("Crop", &bCrop, false);
settings->Get("UseXFB", &bUseXFB, 0);
settings->Get("UseRealXFB", &bUseRealXFB, 0);
settings->Get("SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples, 128);
settings->Get("ShowFPS", &bShowFPS, false);
settings->Get("LogRenderTimeToFile", &bLogRenderTimeToFile, false);
settings->Get("OverlayStats", &bOverlayStats, false);
settings->Get("OverlayProjStats", &bOverlayProjStats, false);
settings->Get("ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
settings->Get("DumpTextures", &bDumpTextures, 0);
settings->Get("HiresTextures", &bHiresTextures, 0);
settings->Get("ConvertHiresTextures", &bConvertHiresTextures, 0);
settings->Get("DumpEFBTarget", &bDumpEFBTarget, 0);
settings->Get("FreeLook", &bFreeLook, 0);
settings->Get("UseFFV1", &bUseFFV1, 0);
settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
settings->Get("FastDepthCalc", &bFastDepthCalc, true);
settings->Get("MSAA", &iMultisampleMode, 0);
settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native
settings->Get("DstAlphaPass", &bDstAlphaPass, false);
settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
settings->Get("WireFrame", &bWireFrame, 0);
settings->Get("DisableFog", &bDisableFog, 0);
settings->Get("EnableShaderDebugging", &bEnableShaderDebugging, false);
settings->Get("BorderlessFullscreen", &bBorderlessFullscreen, false);
IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
enhancements->Get("ForceFiltering", &bForceFiltering, 0);
enhancements->Get("MaxAnisotropy", &iMaxAnisotropy, 0); // NOTE - this is x in (1 << x)
enhancements->Get("PostProcessingShader", &sPostProcessingShader, "");
enhancements->Get("StereoMode", &iStereoMode, 0);
enhancements->Get("StereoDepth", &iStereoDepth, 20);
enhancements->Get("StereoConvergence", &iStereoConvergence, 20);
enhancements->Get("StereoSwapEyes", &bStereoSwapEyes, false);
IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks");
hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true);
hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true);
hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true);
hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
// Load common settings
iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile::Section* interface = iniFile.GetOrCreateSection("Interface");
bool bTmp;
interface->Get("UsePanicHandlers", &bTmp, true);
SetEnableAlert(bTmp);
// Shader Debugging causes a huge slowdown and it's easy to forget about it
// since it's not exposed in the settings dialog. It's only used by
// developers, so displaying an obnoxious message avoids some confusion and
// is not too annoying/confusing for users.
//
// XXX(delroth): This is kind of a bad place to put this, but the current
// VideoCommon is a mess and we don't have a central initialization
// function to do these kind of checks. Instead, the init code is
// triplicated for each video backend.
if (bEnableShaderDebugging)
OSD::AddMessage("Warning: Shader Debugging is enabled, performance will suffer heavily", 15000);
VerifyValidity();
}
示例8: wxFrame
NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl* const game_list)
: wxFrame(parent, wxID_ANY, NETPLAY_TITLEBAR)
, m_game_list(game_list)
{
IniFile inifile;
inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini");
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
wxPanel* const panel = new wxPanel(this);
// top row
wxStaticText* const nick_lbl = new wxStaticText(panel, wxID_ANY, _("Nickname :"));
std::string nickname;
netplay_section.Get("Nickname", &nickname, "Player");
m_nickname_text = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(nickname));
wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL);
nick_szr->Add(nick_lbl, 0, wxCENTER);
nick_szr->Add(m_nickname_text, 0, wxALL, 5);
// tabs
wxNotebook* const notebook = new wxNotebook(panel, wxID_ANY);
wxPanel* const connect_tab = new wxPanel(notebook, wxID_ANY);
notebook->AddPage(connect_tab, _("Connect"));
wxPanel* const host_tab = new wxPanel(notebook, wxID_ANY);
notebook->AddPage(host_tab, _("Host"));
// connect tab
{
wxStaticText* const ip_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Address :"));
std::string address;
netplay_section.Get("Address", &address, "localhost");
m_connect_ip_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(address));
wxStaticText* const port_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Port :"));
// string? w/e
std::string port;
netplay_section.Get("ConnectPort", &port, "2626");
m_connect_port_text = new wxTextCtrl(connect_tab, wxID_ANY, StrToWxStr(port));
wxButton* const connect_btn = new wxButton(connect_tab, wxID_ANY, _("Connect"));
connect_btn->Bind(wxEVT_BUTTON, &NetPlaySetupDiag::OnJoin, this);
wxStaticText* const alert_lbl = new wxStaticText(connect_tab, wxID_ANY,
_("ALERT:\n\n"
"Netplay will only work with the following settings:\n"
" - Enable Dual Core [OFF]\n"
" - DSP Emulator Engine Must be the same on all computers!\n"
" - DSP on Dedicated Thread [OFF]\n"
" - Framelimit NOT set to [Audio]\n"
" - Manually set the extensions for each wiimote\n"
"\n"
"All players should use the same Dolphin version and settings.\n"
"All memory cards must be identical between players or disabled.\n"
"Wiimote support is probably terrible. Don't use it.\n"
"\n"
"The host must have the chosen TCP port open/forwarded!\n"));
wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL);
top_szr->Add(ip_lbl, 0, wxCENTER | wxRIGHT, 5);
top_szr->Add(m_connect_ip_text, 3);
top_szr->Add(port_lbl, 0, wxCENTER | wxRIGHT | wxLEFT, 5);
top_szr->Add(m_connect_port_text, 1);
wxBoxSizer* const con_szr = new wxBoxSizer(wxVERTICAL);
con_szr->Add(top_szr, 0, wxALL | wxEXPAND, 5);
con_szr->AddStretchSpacer(1);
con_szr->Add(alert_lbl, 0, wxLEFT | wxRIGHT | wxEXPAND, 5);
con_szr->AddStretchSpacer(1);
con_szr->Add(connect_btn, 0, wxALL | wxALIGN_RIGHT, 5);
connect_tab->SetSizerAndFit(con_szr);
}
// host tab
{
wxStaticText* const port_lbl = new wxStaticText(host_tab, wxID_ANY, _("Port :"));
// string? w/e
std::string port;
netplay_section.Get("HostPort", &port, "2626");
m_host_port_text = new wxTextCtrl(host_tab, wxID_ANY, StrToWxStr(port));
wxButton* const host_btn = new wxButton(host_tab, wxID_ANY, _("Host"));
host_btn->Bind(wxEVT_BUTTON, &NetPlaySetupDiag::OnHost, this);
m_game_lbox = new wxListBox(host_tab, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT);
m_game_lbox->Bind(wxEVT_LISTBOX_DCLICK, &NetPlaySetupDiag::OnHost, this);
FillWithGameNames(m_game_lbox, *game_list);
wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL);
top_szr->Add(port_lbl, 0, wxCENTER | wxRIGHT, 5);
top_szr->Add(m_host_port_text, 0);
#ifdef USE_UPNP
//.........这里部分代码省略.........
示例9: switch
BOOL CALLBACK vncAcceptDialog::vncAcceptDlgProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam) {
// This is a static method, so we don't know which instantiation we're
// dealing with. But we can get a pseudo-this from the parameter to
// WM_INITDIALOG, which we therafter store with the window and retrieve
// as follows:
static HBITMAP hbmBkGnd = NULL;
vncAcceptDialog *_this = helper::SafeGetWindowUserData<vncAcceptDialog>(hwnd);
switch (uMsg) {
// Dialog has just been created
case WM_INITDIALOG:
{
// Save the lParam into our user data so that subsequent calls have
// access to the parent C++ object
helper::SafeSetWindowUserData(hwnd, lParam);
vncAcceptDialog *_this = (vncAcceptDialog *) lParam;
// Set the IP-address string
char accept_reject_mesg[512];
IniFile myIniFile;
myIniFile.ReadString("admin", "accept_reject_mesg", accept_reject_mesg,512);
if (strlen(accept_reject_mesg)==0) strcpy(accept_reject_mesg,"WinVNC has received an incoming connection from");
SetDlgItemText(hwnd, IDC_STATIC_TEXT1, accept_reject_mesg);
SetDlgItemText(hwnd, IDC_ACCEPT_IP, _this->m_ipAddress);
{
char WORKDIR[MAX_PATH];
char mycommand[MAX_PATH];
if (GetModuleFileName(NULL, WORKDIR, MAX_PATH))
{
char* p = strrchr(WORKDIR, '\\');
if (p == NULL) return 0;
*p = '\0';
}
strcpy(mycommand,WORKDIR);
strcat(mycommand,"\\mylogo.bmp");
hbmBkGnd = (HBITMAP)LoadImage(NULL, mycommand, IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE);
}
SendMessage(GetDlgItem(hwnd, IDC_ACCEPTLOGO),STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)(HBITMAP)hbmBkGnd);
if (SetTimer(hwnd, 1, 1000, NULL) == 0)
{
if (_this->m_acceptOnTimeout)
EndDialog(hwnd, IDACCEPT);
else
EndDialog(hwnd, IDREJECT);
}
_this->m_timeoutCount = _this->m_timeoutSecs;
char temp[256];
if (_this->m_acceptOnTimeout)
sprintf(temp, "AutoAccept:%u", (_this->m_timeoutCount));
else
sprintf(temp, "AutoReject:%u", (_this->m_timeoutCount));
SetDlgItemText(hwnd, IDC_ACCEPT_TIMEOUT, temp);
// Attempt to mimic Win98/2000 dialog behaviour
if ((vncService::IsWinNT() && (vncService::VersionMajor() <= 4)) ||
(vncService::IsWin95() && (vncService::VersionMinor() == 0)))
{
// Perform special hack to display the dialog safely
if (GetWindowThreadProcessId(GetForegroundWindow(), NULL) != GetCurrentProcessId())
{
// We can't set our dialog as foreground if the foreground window
// doesn't belong to us - it's unsafe!
SetActiveWindow(hwnd);
_this->m_foreground_hack = TRUE;
_this->m_flash_state = FALSE;
}
}
if (!_this->m_foreground_hack) {
SetForegroundWindow(hwnd);
}
// Beep
MessageBeep(MB_ICONEXCLAMATION);
// Return success!
return TRUE;
}
// Timer event
case WM_TIMER:
if ((_this->m_timeoutCount) == 0)
{
if ( _this->m_acceptOnTimeout )
{
EndDialog(hwnd, IDACCEPT);
}
else
{
EndDialog(hwnd, IDREJECT);
}
}
_this->m_timeoutCount--;
// Flash if necessary
if (_this->m_foreground_hack) {
//.........这里部分代码省略.........
示例10: INFO_LOG
void SConfig::LoadSettings()
{
INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
// General
{
ini.Get("General", "LastFilename", &m_LastFilename);
ini.Get("General", "ShowLag", &m_ShowLag, false);
#ifdef USE_GDBSTUB
ini.Get("General", "GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1);
#endif
m_ISOFolder.clear();
int numGCMPaths;
if (ini.Get("General", "GCMPathes", &numGCMPaths, 0))
{
for (int i = 0; i < numGCMPaths; i++)
{
std::string tmpPath;
ini.Get("General", StringFromFormat("GCMPath%i", i), &tmpPath, "");
m_ISOFolder.push_back(std::move(tmpPath));
}
}
ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false);
ini.Get("General", "NANDRootPath", &m_NANDPath);
m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
ini.Get("General", "WirelessMac", &m_WirelessMac);
}
{
// Interface
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, true);
ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true);
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
ini.Get("Interface", "MainWindowPosX", &m_LocalCoreStartupParameter.iPosX, 100);
ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100);
ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800);
ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600);
ini.Get("Interface", "Language", &m_InterfaceLanguage, 0);
ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);
ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false);
ini.Get("Interface", "ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
ini.Get("Interface", "ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
// Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++)
{
ini.Get("Hotkeys", g_HKData[i].IniText,
&m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey);
ini.Get("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier",
&m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier);
}
// Display
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "Auto");
ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, -1);
ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, -1);
ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);
ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
ini.Get("Display", "KeepWindowOnTop", &m_LocalCoreStartupParameter.bKeepWindowOnTop, false);
ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false);
ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true);
ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);
// Game List Control
ini.Get("GameList", "ListDrives", &m_ListDrives, false);
ini.Get("GameList", "ListWad", &m_ListWad, true);
ini.Get("GameList", "ListWii", &m_ListWii, true);
ini.Get("GameList", "ListGC", &m_ListGC, true);
ini.Get("GameList", "ListJap", &m_ListJap, true);
ini.Get("GameList", "ListPal", &m_ListPal, true);
ini.Get("GameList", "ListUsa", &m_ListUsa, true);
ini.Get("GameList", "ListFrance", &m_ListFrance, true);
ini.Get("GameList", "ListItaly", &m_ListItaly, true);
ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_X86
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
#elif _M_ARM_32
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3);
//.........这里部分代码省略.........
示例11: LoadFontPageSettings
void Font::LoadFontPageSettings( FontPageSettings &cfg, IniFile &ini, const CString &sTexturePath, const CString &sPageName, CString sChars )
{
cfg.m_sTexturePath = sTexturePath;
/* If we have any characters to map, add them. */
for( unsigned n=0; n<sChars.size(); n++ )
{
char c = sChars[n];
cfg.CharToGlyphNo[c] = n;
}
int iNumFramesWide, iNumFramesHigh;
RageTexture::GetFrameDimensionsFromFileName( sTexturePath, &iNumFramesWide, &iNumFramesHigh );
int iNumFrames = iNumFramesWide * iNumFramesHigh;
ini.RenameKey("Char Widths", "main");
// LOG->Trace("Loading font page '%s' settings from page name '%s'",
// TexturePath.c_str(), sPageName.c_str());
ini.GetValue( sPageName, "DrawExtraPixelsLeft", cfg.m_iDrawExtraPixelsLeft );
ini.GetValue( sPageName, "DrawExtraPixelsRight", cfg.m_iDrawExtraPixelsRight );
ini.GetValue( sPageName, "AddToAllWidths", cfg.m_iAddToAllWidths );
ini.GetValue( sPageName, "ScaleAllWidthsBy", cfg.m_fScaleAllWidthsBy );
ini.GetValue( sPageName, "LineSpacing", cfg.m_iLineSpacing );
ini.GetValue( sPageName, "Top", cfg.m_iTop );
ini.GetValue( sPageName, "Baseline", cfg.m_iBaseline );
ini.GetValue( sPageName, "DefaultWidth", cfg.m_iDefaultWidth );
ini.GetValue( sPageName, "AdvanceExtraPixels", cfg.m_iAdvanceExtraPixels );
ini.GetValue( sPageName, "TextureHints", cfg.m_sTextureHints );
/* Iterate over all keys. */
const XNode* pNode = ini.GetChild( sPageName );
if( pNode )
{
FOREACH_CONST_Attr( pNode, pAttr )
{
CString sName = pAttr->m_sName;
const CString &sValue = pAttr->m_sValue;
sName.MakeUpper();
/* If val is an integer, it's a width, eg. "10=27". */
if( IsAnInt(sName) )
{
cfg.m_mapGlyphWidths[atoi(sName)] = atoi( sValue );
continue;
}
/* "map codepoint=frame" maps a char to a frame. */
if( sName.substr(0, 4) == "MAP " )
{
/*
* map CODEPOINT=frame. CODEPOINT can be
* 1. U+hexval
* 2. an alias ("oq")
* 3. a game type followed by a game alias, eg "pump menuleft"
* 4. a character in quotes ("X")
*
* map 1=2 is the same as
* range unicode #1-1=2
*/
CString sCodepoint = sName.substr(4); /* "CODEPOINT" */
const Game* pGame = NULL;
if( sCodepoint.find_first_of(' ') != sCodepoint.npos )
{
/* There's a space; the first word should be a game type. Split it. */
unsigned pos = sCodepoint.find_first_of( ' ' );
CString gamename = sCodepoint.substr( 0, pos );
sCodepoint = sCodepoint.substr( pos+1 );
pGame = GameManager::StringToGameType(gamename);
if( pGame == NULL )
{
LOG->Warn( "Font definition '%s' uses unknown game type '%s'",
ini.GetPath().c_str(), gamename.c_str() );
continue;
}
}
wchar_t c;
if( sCodepoint.substr(0, 2) == "U+" && IsHexVal(sCodepoint.substr(2)) )
sscanf( sCodepoint.substr(2).c_str(), "%x", &c );
else if( sCodepoint.size() > 0 &&
utf8_get_char_len(sCodepoint[0]) == int(sCodepoint.size()) )
{
c = utf8_get_char( sCodepoint.c_str() );
if(c == wchar_t(-1))
LOG->Warn("Font definition '%s' has an invalid value '%s'.",
ini.GetPath().c_str(), sName.c_str() );
}
else if( !FontCharAliases::GetChar(sCodepoint, c) )
{
LOG->Warn("Font definition '%s' has an invalid value '%s'.",
ini.GetPath().c_str(), sName.c_str() );
continue;
}
//.........这里部分代码省略.........
示例12: NOTICE_LOG
void SConfig::SaveSettings()
{
NOTICE_LOG(BOOT, "Saving settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX).c_str());
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
// General
ini.Set("General", "LastFilename", m_LastFilename);
ini.Set("General", "ShowLag", m_ShowLag);
// ISO folders
// clear removed folders
int oldPaths,
numPaths = (int)m_ISOFolder.size();
ini.Get("General", "GCMPathes", &oldPaths, 0);
for (int i = numPaths; i < oldPaths; i++)
{
ini.DeleteKey("General", StringFromFormat("GCMPath%i", i));
}
ini.Set("General", "GCMPathes", numPaths);
for (int i = 0; i < numPaths; i++)
{
ini.Set("General", StringFromFormat("GCMPath%i", i), m_ISOFolder[i]);
}
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
ini.Set("General", "NANDRootPath", m_NANDPath);
ini.Set("General", "WirelessMac", m_WirelessMac);
#ifdef USE_GDBSTUB
ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort);
#endif
// Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX
ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX
ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
ini.Set("Interface", "Language", m_InterfaceLanguage);
ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow);
ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name);
// Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++)
{
ini.Set("Hotkeys", g_HKData[i].IniText, m_LocalCoreStartupParameter.iHotkey[i]);
ini.Set("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier",
m_LocalCoreStartupParameter.iHotkeyModifier[i]);
}
// Display
ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos);
ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth);
ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop);
ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);
// Game List Control
ini.Set("GameList", "ListDrives", m_ListDrives);
ini.Set("GameList", "ListWad", m_ListWad);
ini.Set("GameList", "ListWii", m_ListWii);
ini.Set("GameList", "ListGC", m_ListGC);
ini.Set("GameList", "ListJap", m_ListJap);
ini.Set("GameList", "ListPal", m_ListPal);
ini.Set("GameList", "ListUsa", m_ListUsa);
ini.Set("GameList", "ListFrance", m_ListFrance);
ini.Set("GameList", "ListItaly", m_ListItaly);
ini.Set("GameList", "ListKorea", m_ListKorea);
ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown);
ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem);
ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE);
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
//.........这里部分代码省略.........
示例13: INFO_LOG
void Config::Load(const char *iniFileName)
{
iniFilename_ = iniFileName;
INFO_LOG(LOADER, "Loading config: %s", iniFileName);
bSaveSettings = true;
IniFile iniFile;
if (!iniFile.Load(iniFileName)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting config to default.", iniFileName);
// Continue anyway to initialize the config.
}
IniFile::Section *general = iniFile.GetOrCreateSection("General");
bSpeedLimit = false;
general->Get("FirstRun", &bFirstRun, true);
general->Get("AutoLoadLast", &bAutoLoadLast, false);
general->Get("AutoRun", &bAutoRun, true);
general->Get("Browse", &bBrowse, false);
general->Get("ConfirmOnQuit", &bConfirmOnQuit, false);
general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
general->Get("CurrentDirectory", ¤tDirectory, "");
general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
general->Get("Language", &languageIni, "en_US");
general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
general->Get("MaxRecent", &iMaxRecent, 12);
// Fix issue from switching from uint (hex in .ini) to int (dec)
if (iMaxRecent == 0)
iMaxRecent = 12;
// "default" means let emulator decide, "" means disable.
general->Get("ReportHost", &sReportHost, "default");
general->Get("Recent", recentIsos);
general->Get("WindowX", &iWindowX, 40);
general->Get("WindowY", &iWindowY, 100);
general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
if (recentIsos.size() > iMaxRecent)
recentIsos.resize(iMaxRecent);
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
#ifdef IOS
cpu->Get("Jit", &bJit, !isJailed);
#else
cpu->Get("Jit", &bJit, true);
#endif
//FastMemory Default set back to True when solve UNIMPL _sceAtracGetContextAddress making game crash
cpu->Get("FastMemory", &bFastMemory, false);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Get("ShowFPSCounter", &bShowFPSCounter, false);
graphics->Get("DisplayFramebuffer", &bDisplayFramebuffer, false);
#ifdef _WIN32
graphics->Get("ResolutionScale", &iWindowZoom, 2);
#else
graphics->Get("ResolutionScale", &iWindowZoom, 1);
#endif
graphics->Get("BufferedRendering", &bBufferedRendering, true);
graphics->Get("HardwareTransform", &bHardwareTransform, true);
graphics->Get("LinearFiltering", &bLinearFiltering, false);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);
graphics->Get("FrameRate", &iFpsLimit, 60);
graphics->Get("UseMediaEngine", &bUseMediaEngine, true);
#ifdef USING_GLES2
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
#else
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
#endif
graphics->Get("VertexCache", &bVertexCache, true);
graphics->Get("FullScreen", &bFullScreen, false);
#ifdef BLACKBERRY10
graphics->Get("PartialStretch", &bPartialStretch, pixel_xres == pixel_yres);
#endif
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
graphics->Get("TrueColor", &bTrueColor, true);
#ifdef USING_GLES2
graphics->Get("MipMap", &bMipMap, true);
#else
graphics->Get("MipMap", &bMipMap, false);
#endif
graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
graphics->Get("TexScalingType", &iTexScalingType, 0);
graphics->Get("TexDeposterize", &bTexDeposterize, false);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Get("Enable", &bEnableSound, true);
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
control->Get("ShowStick", &bShowAnalogStick, false);
#ifdef BLACKBERRY10
control->Get("ShowTouchControls", &bShowTouchControls, pixel_xres != pixel_yres);
#elif defined(USING_GLES2)
control->Get("ShowTouchControls", &bShowTouchControls, true);
#else
control->Get("ShowTouchControls", &bShowTouchControls,false);
#endif
control->Get("LargeControls", &bLargeControls, false);
control->Get("KeyMapping",iMappingMap);
//.........这里部分代码省略.........
示例14: CleanRecent
void Config::Save()
{
if (iniFilename_.size() && g_Config.bSaveSettings) {
CleanRecent();
IniFile iniFile;
if (!iniFile.Load(iniFilename_.c_str())) {
ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
}
IniFile::Section *general = iniFile.GetOrCreateSection("General");
// Need to do this somewhere...
bFirstRun = false;
general->Set("FirstRun", bFirstRun);
general->Set("NewUI", bNewUI);
general->Set("Enable Logging", bEnableLogging);
general->Set("AutoLoadLast", bAutoLoadLast);
general->Set("AutoRun", bAutoRun);
general->Set("Browse", bBrowse);
general->Set("DirectLoad", bDirectLoad);
general->Set("ConfirmOnQuit", bConfirmOnQuit);
general->Set("IgnoreBadMemAccess", bIgnoreBadMemAccess);
general->Set("CurrentDirectory", currentDirectory);
general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
general->Set("ReportHost", sReportHost);
general->Set("Recent", recentIsos);
general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
#ifdef _WIN32
general->Set("TopMost", bTopMost);
general->Set("WindowX", iWindowX);
general->Set("WindowY", iWindowY);
#endif
general->Set("Language", languageIni);
general->Set("NumWorkerThreads", iNumWorkerThreads);
general->Set("MaxRecent", iMaxRecent);
general->Set("EnableCheats", bEnableCheats);
general->Set("ScreenshotsAsPNG", bScreenshotsAsPNG);
general->Set("StateSlot", iCurrentStateSlot);
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
cpu->Set("FastMemory", bFastMemory);
cpu->Set("CPUSpeed", iLockedCPUSpeed);
IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
graphics->Set("ShowFPSCounter", iShowFPSCounter);
graphics->Set("ResolutionScale", iWindowZoom);
graphics->Set("RenderingMode", iRenderingMode);
graphics->Set("HardwareTransform", bHardwareTransform);
graphics->Set("TextureFiltering", iTexFiltering);
graphics->Set("SSAA", bAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);
graphics->Set("FrameRate", iFpsLimit);
graphics->Set("ForceMaxEmulatedFPS", iForceMaxEmulatedFPS);
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
graphics->Set("VertexCache", bVertexCache);
#ifdef _WIN32
graphics->Set("FullScreen", bFullScreen);
graphics->Set("FullScreenOnLaunch", bFullScreenOnLaunch);
#endif
#ifdef BLACKBERRY
graphics->Set("PartialStretch", bPartialStretch);
#endif
graphics->Set("StretchToDisplay", bStretchToDisplay);
graphics->Set("TrueColor", bTrueColor);
graphics->Set("MipMap", bMipMap);
graphics->Set("TexScalingLevel", iTexScalingLevel);
graphics->Set("TexScalingType", iTexScalingType);
graphics->Set("TexDeposterize", bTexDeposterize);
graphics->Set("VSyncInterval", bVSync);
IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
sound->Set("Enable", bEnableSound);
sound->Set("EnableAtrac3plus", bEnableAtrac3plus);
sound->Set("VolumeBGM", iBGMVolume);
sound->Set("VolumeSFX", iSEVolume);
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
control->Set("ShowStick", bShowAnalogStick);
control->Set("ShowTouchControls", bShowTouchControls);
// control->Set("KeyMapping",iMappingMap);
control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
control->Set("TouchButtonOpacity", iTouchButtonOpacity);
control->Set("ButtonScale", fButtonScale);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("NickName", sNickName.c_str());
pspConfig->Set("Language", ilanguage);
pspConfig->Set("TimeFormat", iTimeFormat);
pspConfig->Set("DateFormat", iDateFormat);
pspConfig->Set("TimeZone", iTimeZone);
pspConfig->Set("DayLightSavings", bDayLightSavings);
pspConfig->Set("ButtonPreference", iButtonPreference);
pspConfig->Set("LockParentalLevel", iLockParentalLevel);
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
pspConfig->Set("EncryptSave", bEncryptSave);
IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
//.........这里部分代码省略.........
示例15: TASInputWindow
//.........这里部分代码省略.........
buttons_layout1->addWidget(m_minus_button);
auto* buttons_layout2 = new QHBoxLayout;
buttons_layout2->addWidget(m_home_button);
buttons_layout2->addWidget(m_left_button);
buttons_layout2->addWidget(m_up_button);
buttons_layout2->addWidget(m_down_button);
buttons_layout2->addWidget(m_right_button);
auto* remote_buttons_layout = new QVBoxLayout;
remote_buttons_layout->setSizeConstraint(QLayout::SetFixedSize);
remote_buttons_layout->addLayout(buttons_layout1);
remote_buttons_layout->addLayout(buttons_layout2);
m_remote_buttons_box = new QGroupBox(tr("Wii Remote Buttons"));
m_remote_buttons_box->setLayout(remote_buttons_layout);
auto* nunchuk_buttons_layout = new QHBoxLayout;
nunchuk_buttons_layout->addWidget(m_c_button);
nunchuk_buttons_layout->addWidget(m_z_button);
m_nunchuk_buttons_box = new QGroupBox(tr("Nunchuk Buttons"));
m_nunchuk_buttons_box->setLayout(nunchuk_buttons_layout);
m_classic_a_button = new QCheckBox(QStringLiteral("&A"));
m_classic_b_button = new QCheckBox(QStringLiteral("&B"));
m_classic_x_button = new QCheckBox(QStringLiteral("&X"));
m_classic_y_button = new QCheckBox(QStringLiteral("&Y"));
m_classic_l_button = new QCheckBox(QStringLiteral("&L"));
m_classic_r_button = new QCheckBox(QStringLiteral("&R"));
m_classic_zl_button = new QCheckBox(QStringLiteral("&ZL"));
m_classic_zr_button = new QCheckBox(QStringLiteral("ZR"));
m_classic_plus_button = new QCheckBox(QStringLiteral("&+"));
m_classic_minus_button = new QCheckBox(QStringLiteral("&-"));
m_classic_home_button = new QCheckBox(QStringLiteral("&HOME"));
m_classic_left_button = new QCheckBox(QStringLiteral("L&eft"));
m_classic_up_button = new QCheckBox(QStringLiteral("&Up"));
m_classic_down_button = new QCheckBox(QStringLiteral("&Down"));
m_classic_right_button = new QCheckBox(QStringLiteral("R&ight"));
auto* classic_buttons_layout1 = new QHBoxLayout;
classic_buttons_layout1->addWidget(m_classic_a_button);
classic_buttons_layout1->addWidget(m_classic_b_button);
classic_buttons_layout1->addWidget(m_classic_x_button);
classic_buttons_layout1->addWidget(m_classic_y_button);
classic_buttons_layout1->addWidget(m_classic_l_button);
classic_buttons_layout1->addWidget(m_classic_r_button);
classic_buttons_layout1->addWidget(m_classic_zl_button);
classic_buttons_layout1->addWidget(m_classic_zr_button);
auto* classic_buttons_layout2 = new QHBoxLayout;
classic_buttons_layout2->addWidget(m_classic_plus_button);
classic_buttons_layout2->addWidget(m_classic_minus_button);
classic_buttons_layout2->addWidget(m_classic_home_button);
classic_buttons_layout2->addWidget(m_classic_left_button);
classic_buttons_layout2->addWidget(m_classic_up_button);
classic_buttons_layout2->addWidget(m_classic_down_button);
classic_buttons_layout2->addWidget(m_classic_right_button);
auto* classic_buttons_layout = new QVBoxLayout;
classic_buttons_layout->setSizeConstraint(QLayout::SetFixedSize);
classic_buttons_layout->addLayout(classic_buttons_layout1);
classic_buttons_layout->addLayout(classic_buttons_layout2);
m_classic_buttons_box = new QGroupBox(tr("Classic Buttons"));
m_classic_buttons_box->setLayout(classic_buttons_layout);
auto* layout = new QVBoxLayout;
layout->addLayout(top_layout);
layout->addWidget(m_remote_orientation_box);
layout->addWidget(m_nunchuk_orientation_box);
layout->addWidget(m_triggers_box);
layout->addWidget(m_remote_buttons_box);
layout->addWidget(m_nunchuk_buttons_box);
layout->addWidget(m_classic_buttons_box);
layout->addWidget(m_use_controller);
layout->setAlignment(m_nunchuk_buttons_box, Qt::AlignLeft);
setLayout(layout);
u8 ext = 0;
if (Core::IsRunning())
{
ext = static_cast<WiimoteEmu::Wiimote*>(Wiimote::GetConfig()->GetController(num))
->GetActiveExtensionNumber();
}
else
{
IniFile ini;
ini.Load(File::GetUserPath(D_CONFIG_IDX) + "WiimoteNew.ini");
std::string extension;
ini.GetIfExists("Wiimote" + std::to_string(num + 1), "Extension", &extension);
if (extension == "Nunchuk")
ext = 1;
if (extension == "Classic")
ext = 2;
}
UpdateExt(ext);
}