Ejemplo n.º 1
0
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");
	}
}
Ejemplo n.º 2
0
void SConfig::SaveFifoPlayerSettings(IniFile& ini)
{
  IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");

  fifoplayer->Set("LoopReplay", bLoopFifoReplay);
}
Ejemplo n.º 3
0
void SConfig::LoadInputSettings(IniFile& ini)
{
  IniFile::Section* input = ini.GetOrCreateSection("Input");

  input->Get("BackgroundInput", &m_BackgroundInput, false);
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 5
0
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();
}
Ejemplo n.º 6
0
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;
	}
	
	const char *gitVer = PPSSPP_GIT_VERSION;
	Version installed(gitVer);
	Version upgrade(upgradeVersion);
	const bool versionsValid = installed.IsValid() && upgrade.IsValid();

	// Do this regardless of iRunCount to prevent a silly bug where one might use an older
	// build of PPSSPP, receive an upgrade notice, then start a newer version, and still receive the upgrade notice,
	// even if said newer version is >= the upgrade found online.
	if ((dismissedVersion == upgradeVersion) || (versionsValid && (installed >= upgrade))) {
		upgradeMessage = "";
	}

	// Check for new version on every 10 runs.
	// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
	// splash screen quickly), but then we'll just show the notification next time instead, we store the
	// upgrade number in the ini.
#if !defined(ARMEABI)  // blackberry and stuff? why do we still keep this check?
	if (iRunCount % 10 == 0 && bCheckForNewVersion) {
		std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
			"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
		dl->SetHidden(true);
	}
#endif

	INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
	bSaveSettings = true;

	LoadStandardControllerIni();
	
	//so this is all the way down here to overwrite the controller settings
	//sadly it won't benefit from all the "version conversion" going on up-above
	//but these configs shouldn't contain older versions anyhow
	if (bGameSpecific)
	{
		loadGameConfig(gameId_);
	}

	CleanRecent();

	// Fix Wrong MAC address by old version by "Change MAC address"
	if (sMACAddress.length() != 17)
		sMACAddress = CreateRandMAC();

	if (g_Config.bAutoFrameSkip && g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) {
		g_Config.iRenderingMode = FB_BUFFERED_MODE;
	}

	// Override ppsspp.ini JIT value to prevent crashing
	if (!DefaultJit() && g_Config.bJit) {
		jitForcedOff = true;
		g_Config.bJit = false;
	}
}
Ejemplo n.º 7
0
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();
}
Ejemplo n.º 8
0
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
	m_upnp_chk = new wxCheckBox(host_tab, wxID_ANY, _("Forward port (UPnP)"));
	top_szr->Add(m_upnp_chk, 0, wxALL | wxALIGN_RIGHT, 5);
#endif

	wxBoxSizer* const host_szr = new wxBoxSizer(wxVERTICAL);
	host_szr->Add(top_szr, 0, wxALL | wxEXPAND, 5);
	host_szr->Add(m_game_lbox, 1, wxLEFT | wxRIGHT | wxEXPAND, 5);
	host_szr->Add(host_btn, 0, wxALL | wxALIGN_RIGHT, 5);

	host_tab->SetSizerAndFit(host_szr);
	}

	// bottom row
	wxButton* const quit_btn = new wxButton(panel, wxID_ANY, _("Quit"));
	quit_btn->Bind(wxEVT_BUTTON, &NetPlaySetupDiag::OnQuit, this);

	// main sizer
	wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
	main_szr->Add(nick_szr, 0, wxALL | wxALIGN_RIGHT, 5);
	main_szr->Add(notebook, 1, wxLEFT | wxRIGHT | wxEXPAND, 5);
	main_szr->Add(quit_btn, 0, wxALL | wxALIGN_RIGHT, 5);

	panel->SetSizerAndFit(main_szr);

	//wxBoxSizer* const diag_szr = new wxBoxSizer(wxVERTICAL);
	//diag_szr->Add(panel, 1, wxEXPAND);
	//SetSizerAndFit(diag_szr);

	main_szr->SetSizeHints(this);

	Center();
	Show();
}
Ejemplo n.º 9
0
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) {
			if (GetWindowThreadProcessId(GetForegroundWindow(), NULL) != GetCurrentProcessId())
			{
				_this->m_flash_state = !_this->m_flash_state;
				FlashWindow(hwnd, _this->m_flash_state);
			} else {
				_this->m_foreground_hack = FALSE;
			}
		}

		// Update the displayed count
		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);
		break;

		// Dialog has just received a command
	case WM_COMMAND:
		switch (LOWORD(wParam)) {
			// User clicked Accept or pressed return
		case IDACCEPT:
		case IDOK:
			EndDialog(hwnd, IDACCEPT);
			return TRUE;

		case IDREJECT:
		case IDCANCEL:
			EndDialog(hwnd, IDREJECT);
			return TRUE;
		};

		break;

		// Window is being destroyed!  (Should never happen)
	case WM_DESTROY:
		DeleteObject(hbmBkGnd);
		EndDialog(hwnd, IDREJECT);
		return TRUE;
	}
	return 0;
}
Ejemplo n.º 10
0
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);
#else
		ini.Get("Core", "CPUCore",      &m_LocalCoreStartupParameter.iCPUCore, 0);
#endif
		ini.Get("Core", "Fastmem",           &m_LocalCoreStartupParameter.bFastmem,      true);
		ini.Get("Core", "DSPThread",         &m_LocalCoreStartupParameter.bDSPThread,    false);
		ini.Get("Core", "DSPHLE",            &m_LocalCoreStartupParameter.bDSPHLE,       true);
		ini.Get("Core", "CPUThread",         &m_LocalCoreStartupParameter.bCPUThread,    true);
		ini.Get("Core", "SkipIdle",          &m_LocalCoreStartupParameter.bSkipIdle,     true);
		ini.Get("Core", "DefaultGCM",        &m_LocalCoreStartupParameter.m_strDefaultGCM);
		ini.Get("Core", "DVDRoot",           &m_LocalCoreStartupParameter.m_strDVDRoot);
		ini.Get("Core", "Apploader",         &m_LocalCoreStartupParameter.m_strApploader);
		ini.Get("Core", "EnableCheats",      &m_LocalCoreStartupParameter.bEnableCheats, false);
		ini.Get("Core", "SelectedLanguage",  &m_LocalCoreStartupParameter.SelectedLanguage, 0);
		ini.Get("Core", "DPL2Decoder",       &m_LocalCoreStartupParameter.bDPL2Decoder, false);
		ini.Get("Core", "Latency",           &m_LocalCoreStartupParameter.iLatency, 2);
		ini.Get("Core", "MemcardAPath",      &m_strMemoryCardA);
		ini.Get("Core", "MemcardBPath",      &m_strMemoryCardB);
		ini.Get("Core", "SlotA",       (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD);
		ini.Get("Core", "SlotB",       (int*)&m_EXIDevice[1], EXIDEVICE_NONE);
		ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE);
		ini.Get("Core", "BBA_MAC",           &m_bba_mac);
		ini.Get("Core", "TimeProfiling",     &m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
		ini.Get("Core", "OutputIR",          &m_LocalCoreStartupParameter.bJITILOutputIR,      false);
		for (int i = 0; i < MAX_SI_CHANNELS; ++i)
		{
			ini.Get("Core", StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);
		}
		ini.Get("Core", "WiiSDCard",                 &m_WiiSDCard,                                   false);
		ini.Get("Core", "WiiKeyboard",               &m_WiiKeyboard,                                 false);
		ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning,                   false);
		ini.Get("Core", "WiimoteEnableSpeaker",      &m_WiimoteEnableSpeaker,                        true);
		ini.Get("Core", "RunCompareServer",          &m_LocalCoreStartupParameter.bRunCompareServer, false);
		ini.Get("Core", "RunCompareClient",          &m_LocalCoreStartupParameter.bRunCompareClient, false);
		ini.Get("Core", "MMU",                       &m_LocalCoreStartupParameter.bMMU,              false);
		ini.Get("Core", "TLBHack",                   &m_LocalCoreStartupParameter.bTLBHack,          false);
		ini.Get("Core", "BBDumpPort",                &m_LocalCoreStartupParameter.iBBDumpPort,       -1);
		ini.Get("Core", "VBeam",                     &m_LocalCoreStartupParameter.bVBeamSpeedHack,   false);
		ini.Get("Core", "SyncGPU",                   &m_LocalCoreStartupParameter.bSyncGPU,          false);
		ini.Get("Core", "FastDiscSpeed",             &m_LocalCoreStartupParameter.bFastDiscSpeed,    false);
		ini.Get("Core", "DCBZ",                      &m_LocalCoreStartupParameter.bDCBZOFF,          false);
		ini.Get("Core", "FrameLimit",                &m_Framelimit,                                  1); // auto frame limit by default
		ini.Get("Core", "FrameSkip",                 &m_FrameSkip,                                   0);

		// GFX Backend
		ini.Get("Core", "GFXBackend",  &m_LocalCoreStartupParameter.m_strVideoBackend, "");

		// Movie
		ini.Get("Movie", "PauseMovie", &m_PauseMovie, false);
		ini.Get("Movie", "Author", &m_strMovieAuthor, "");

		// DSP
		ini.Get("DSP", "EnableJIT", &m_DSPEnableJIT, true);
		ini.Get("DSP", "DumpAudio", &m_DumpAudio, false);
	#if defined __linux__ && HAVE_ALSA
		ini.Get("DSP", "Backend", &sBackend, BACKEND_ALSA);
	#elif defined __APPLE__
		ini.Get("DSP", "Backend", &sBackend, BACKEND_COREAUDIO);
	#elif defined _WIN32
		ini.Get("DSP", "Backend", &sBackend, BACKEND_XAUDIO2);
	#elif defined ANDROID
		ini.Get("DSP", "Backend", &sBackend, BACKEND_OPENSLES);
	#else
		ini.Get("DSP", "Backend", &sBackend, BACKEND_NULLSOUND);
	#endif
		ini.Get("DSP", "Volume", &m_Volume, 100);

		ini.Get("FifoPlayer", "LoopReplay", &m_LocalCoreStartupParameter.bLoopFifoReplay, true);
	}

	m_SYSCONF = new SysConf();
}
Ejemplo n.º 11
0
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;
				}

				cfg.CharToGlyphNo[c] = atoi( sValue );

				continue;
			}

			if( sName.substr(0, 6) == "RANGE " )
			{
				/*
				 * range CODESET=first_frame or
				 * range CODESET #start-end=first_frame
				 * eg
				 * range CP1252=0       (default for 256-frame fonts)
				 * range ASCII=0        (default for 128-frame fonts)
				 *
				 * (Start and end are in hex.)
				 *
				 * Map two high-bit portions of ISO-8859- to one font:
				 * range ISO-8859-2 #80-FF=0
				 * range ISO-8859-3 #80-FF=128
				 *
				 * Map hiragana to 0-84:
				 * range Unicode #3041-3094=0
				 */
				vector<CString> asMatches;
				static Regex parse("^RANGE ([A-Z\\-]+)( ?#([0-9A-F]+)-([0-9A-F]+))?$");
				bool bMatch = parse.Compare( sName, asMatches );
				
				ASSERT( asMatches.size() == 4 ); /* 4 parens */

				if( !bMatch || asMatches[0].empty() )
					RageException::Throw("Font definition '%s' has an invalid range '%s': parse error",
						ini.GetPath().c_str(), sName.c_str() );
				
				/* We must have either 1 match (just the codeset) or 4 (the whole thing). */

				int iCount = -1;
				int iFirst = 0;
				if( !asMatches[2].empty() )
				{
					sscanf( asMatches[2].c_str(), "%x", &iFirst );
					int iLast;
					sscanf( asMatches[3].c_str(), "%x", &iLast );
					if( iLast < iFirst )
						RageException::Throw("Font definition '%s' has an invalid range '%s': %i < %i.",
							ini.GetPath().c_str(), sName.c_str(), iLast < iFirst );

					iCount = iLast - iFirst + 1;
				}

				CString sRet = cfg.MapRange( asMatches[0], iFirst, atoi(sValue), iCount );
				if( !sRet.empty() )
					RageException::Throw( "Font definition '%s' has an invalid range '%s': %s.",
						ini.GetPath().c_str(), sName.c_str(), sRet.c_str() );

				continue;
			}

			if( sName.substr(0, 5) == "LINE " )
			{
				/* line ROW=CHAR1CHAR2CHAR3CHAR4
				 * eg.
				 * line 0=ABCDEFGH
				 *
				 * This lets us assign characters very compactly and readably. */

				CString sRowStr = sName.substr(5);
				ASSERT( IsAnInt(sRowStr) );
				const int iRow = atoi( sRowStr.c_str() );
				const int iFirstFrame = iRow * iNumFramesWide;

				if( iRow > iNumFramesHigh )
					RageException::Throw( "The font definition \"%s\" tries to assign line %i, but the font is only %i characters high",
						ini.GetPath().c_str(), iFirstFrame, iNumFramesHigh );

				/* Decode the string. */
				const wstring wdata( CStringToWstring(sValue) );

				if( int(wdata.size()) > iNumFramesWide )
					RageException::Throw( "The font definition \"%s\" assigns %i characters to row %i (\"%ls\"), but the font only has %i characters wide",
						ini.GetPath().c_str(), wdata.size(), iRow, wdata.c_str(), iNumFramesWide );

				for( unsigned i = 0; i < wdata.size(); ++i )
					cfg.CharToGlyphNo[wdata[i]] = iFirstFrame+i;
			}
		}
	}
Ejemplo n.º 12
0
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);
	ini.Set("Core", "EnableCheats",     m_LocalCoreStartupParameter.bEnableCheats);
	ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
	ini.Set("Core", "DPL2Decoder",      m_LocalCoreStartupParameter.bDPL2Decoder);
	ini.Set("Core", "Latency",          m_LocalCoreStartupParameter.iLatency);
	ini.Set("Core", "MemcardAPath",     m_strMemoryCardA);
	ini.Set("Core", "MemcardBPath",     m_strMemoryCardB);
	ini.Set("Core", "SlotA",            m_EXIDevice[0]);
	ini.Set("Core", "SlotB",            m_EXIDevice[1]);
	ini.Set("Core", "SerialPort1",      m_EXIDevice[2]);
	ini.Set("Core", "BBA_MAC",          m_bba_mac);
	for (int i = 0; i < MAX_SI_CHANNELS; ++i)
	{
		ini.Set("Core", StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
	}
	ini.Set("Core", "WiiSDCard", m_WiiSDCard);
	ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
	ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
	ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
	ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
	ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
	ini.Set("Core", "FrameLimit",       m_Framelimit);
	ini.Set("Core", "FrameSkip",        m_FrameSkip);

	// GFX Backend
	ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend);

	// Movie
	ini.Set("Movie", "PauseMovie", m_PauseMovie);
	ini.Set("Movie", "Author", m_strMovieAuthor);

	// DSP
	ini.Set("DSP", "EnableJIT", m_DSPEnableJIT);
	ini.Set("DSP", "DumpAudio", m_DumpAudio);
	ini.Set("DSP", "Backend", sBackend);
	ini.Set("DSP", "Volume", m_Volume);

	// Fifo Player
	ini.Set("FifoPlayer", "LoopReplay", m_LocalCoreStartupParameter.bLoopFifoReplay);

	ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
	m_SYSCONF->Save();
}
Ejemplo n.º 13
0
bool InputPlugin::LoadConfig(bool isGC)
{
	IniFile inifile;
	IniFile game_ini;
	bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
	std::string num[MAX_BBMOTES] = {"1", "2", "3", "4", "BB"};
	std::string profile[MAX_BBMOTES];
	std::string path;

	if (SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() != "00000000")
	{
		std::string type;
		if (isGC)
		{
			type = "Pad";
			path = "Profiles/GCPad/";
		}
		else
		{
			type = "Wiimote";
			path = "Profiles/Wiimote/";
		}
		game_ini.Load(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini");
		game_ini.Load(File::GetUserPath(D_GAMESETTINGS_IDX) + SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID() + ".ini", true);
		for (int i = 0; i < 4; i++)
		{
			if (game_ini.Exists("Controls", (type + "Profile" + num[i]).c_str()))
			{
				game_ini.Get("Controls", (type + "Profile" + num[i]).c_str(), &profile[i]);
				if (File::Exists(File::GetUserPath(D_CONFIG_IDX) + path + profile[i] + ".ini"))
					useProfile[i] = true;
				else
				{
					// TODO: Having a PanicAlert for this is dumb.
					PanicAlertT("Selected controller profile does not exist");
				}
			}
		}
	}

	if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + ini_name + ".ini"))
	{
		std::vector< ControllerEmu* >::const_iterator
			i = controllers.begin(),
			e = controllers.end();
		for (int n = 0; i!=e; ++i, ++n)
		{
			// load settings from ini
			if (useProfile[n])
			{
				IniFile profile_ini;
				profile_ini.Load(File::GetUserPath(D_CONFIG_IDX) + path + profile[n] + ".ini");
				(*i)->LoadConfig(profile_ini.GetOrCreateSection("Profile"));
			}
			else
			{
				(*i)->LoadConfig(inifile.GetOrCreateSection((*i)->GetName().c_str()));
			}

			// update refs
			(*i)->UpdateReferences(g_controller_interface);
		}
		return true;
	}
	else
	{
		controllers[0]->LoadDefaults(g_controller_interface);
		controllers[0]->UpdateReferences(g_controller_interface);
		return false;
	}
}
Ejemplo n.º 14
0
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", &currentDirectory, "");
	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);
	control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
	control->Get("ForceInputDevice", &iForceInputDevice, -1);

	IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
	pspConfig->Get("NickName", &sNickName, "shadow");
	pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
	pspConfig->Get("TimeFormat", &itimeformat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
	pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD);
	pspConfig->Get("TimeZone", &iTimeZone, 0);
	pspConfig->Get("DayLightSavings", &bDayLightSavings, PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD);
	pspConfig->Get("ButtonPreference", &bButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
	pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
	pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
	pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
	pspConfig->Get("EncryptSave", &bEncryptSave, true);

	CleanRecent();
}
Ejemplo n.º 15
0
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");
		debugConfig->Set("DisasmWindowX", iDisasmWindowX);
		debugConfig->Set("DisasmWindowY", iDisasmWindowY);
		debugConfig->Set("DisasmWindowW", iDisasmWindowW);
		debugConfig->Set("DisasmWindowH", iDisasmWindowH);
		debugConfig->Set("ConsoleWindowX", iConsoleWindowX);
		debugConfig->Set("ConsoleWindowY", iConsoleWindowY);
		debugConfig->Set("FontWidth", iFontWidth);
		debugConfig->Set("FontHeight", iFontHeight);
		debugConfig->Set("DisplayStatusBar", bDisplayStatusBar);

		KeyMap::SaveToIni(iniFile);

		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");
	}
}
Ejemplo n.º 16
0
WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(parent), m_num(num)
{
  const QKeySequence ir_x_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_F);
  const QKeySequence ir_y_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_G);

  m_ir_box = new QGroupBox(QStringLiteral("%1 (%2/%3)")
                               .arg(tr("IR"),
                                    ir_x_shortcut_key_sequence.toString(QKeySequence::NativeText),
                                    ir_y_shortcut_key_sequence.toString(QKeySequence::NativeText)));

  auto* x_layout = new QHBoxLayout;
  m_ir_x_value = CreateSliderValuePair(x_layout, ir_max_x, ir_x_shortcut_key_sequence,
                                       Qt::Horizontal, m_ir_box, true);

  auto* y_layout = new QVBoxLayout;
  m_ir_y_value = CreateSliderValuePair(y_layout, ir_max_y, ir_y_shortcut_key_sequence, Qt::Vertical,
                                       m_ir_box, true);
  m_ir_y_value->setMaximumWidth(60);

  auto* visual = new IRWidget(this);
  connect(m_ir_x_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
          &IRWidget::SetX);
  connect(m_ir_y_value, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), visual,
          &IRWidget::SetY);
  connect(visual, &IRWidget::ChangedX, m_ir_x_value, &QSpinBox::setValue);
  connect(visual, &IRWidget::ChangedY, m_ir_y_value, &QSpinBox::setValue);

  m_ir_x_value->setValue(static_cast<int>(std::round(ir_max_x / 2.)));
  m_ir_y_value->setValue(static_cast<int>(std::round(ir_max_y / 2.)));

  auto* visual_ar = new AspectRatioWidget(visual, ir_max_x, ir_max_y);

  auto* visual_layout = new QHBoxLayout;
  visual_layout->addWidget(visual_ar);
  visual_layout->addLayout(y_layout);

  auto* ir_layout = new QVBoxLayout;
  ir_layout->addLayout(x_layout);
  ir_layout->addLayout(visual_layout);
  m_ir_box->setLayout(ir_layout);

  m_nunchuk_stick_box = CreateStickInputs(tr("Nunchuk Stick"), m_nunchuk_stick_x_value,
                                          m_nunchuk_stick_y_value, 255, 255, Qt::Key_X, Qt::Key_Y);

  m_classic_left_stick_box =
      CreateStickInputs(tr("Left Stick"), m_classic_left_stick_x_value,
                        m_classic_left_stick_y_value, 63, 63, Qt::Key_F, Qt::Key_G);

  m_classic_right_stick_box =
      CreateStickInputs(tr("Right Stick"), m_classic_right_stick_x_value,
                        m_classic_right_stick_y_value, 31, 31, Qt::Key_Q, Qt::Key_W);

  // Need to enforce the same minimum width because otherwise the different lengths in the labels
  // used on the QGroupBox will cause the StickWidgets to have different sizes.
  m_ir_box->setMinimumWidth(20);
  m_nunchuk_stick_box->setMinimumWidth(20);

  m_remote_orientation_box = new QGroupBox(tr("Wii Remote Orientation"));

  auto* top_layout = new QHBoxLayout;
  top_layout->addWidget(m_ir_box);
  top_layout->addWidget(m_nunchuk_stick_box);
  top_layout->addWidget(m_classic_left_stick_box);
  top_layout->addWidget(m_classic_right_stick_box);

  auto* remote_orientation_x_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("X"), m_remote_orientation_x_value, 1023, Qt::Key_Q,
                                  m_remote_orientation_box);
  auto* remote_orientation_y_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("Y"), m_remote_orientation_y_value, 1023, Qt::Key_W,
                                  m_remote_orientation_box);
  auto* remote_orientation_z_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("Z"), m_remote_orientation_z_value, 1023, Qt::Key_E,
                                  m_remote_orientation_box);

  m_remote_orientation_x_value->setValue(512);
  m_remote_orientation_y_value->setValue(512);
  m_remote_orientation_z_value->setValue(616);

  auto* remote_orientation_layout = new QVBoxLayout;
  remote_orientation_layout->addLayout(remote_orientation_x_layout);
  remote_orientation_layout->addLayout(remote_orientation_y_layout);
  remote_orientation_layout->addLayout(remote_orientation_z_layout);
  m_remote_orientation_box->setLayout(remote_orientation_layout);

  m_nunchuk_orientation_box = new QGroupBox(tr("Nunchuk Orientation"));

  auto* nunchuk_orientation_x_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("X"), m_nunchuk_orientation_x_value, 1023, Qt::Key_I,
                                  m_nunchuk_orientation_box);
  auto* nunchuk_orientation_y_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("Y"), m_nunchuk_orientation_y_value, 1023, Qt::Key_O,
                                  m_nunchuk_orientation_box);
  auto* nunchuk_orientation_z_layout =
      // i18n: Refers to a 3D axis (used when mapping motion controls)
      CreateSliderValuePairLayout(tr("Z"), m_nunchuk_orientation_z_value, 1023, Qt::Key_P,
                                  m_nunchuk_orientation_box);

  m_nunchuk_orientation_x_value->setValue(512);
  m_nunchuk_orientation_y_value->setValue(512);
  m_nunchuk_orientation_z_value->setValue(512);

  auto* nunchuk_orientation_layout = new QVBoxLayout;
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_x_layout);
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_y_layout);
  nunchuk_orientation_layout->addLayout(nunchuk_orientation_z_layout);
  m_nunchuk_orientation_box->setLayout(nunchuk_orientation_layout);

  m_triggers_box = new QGroupBox(tr("Triggers"));
  auto* l_trigger_layout =
      CreateSliderValuePairLayout(tr("Left"), m_left_trigger_value, 31, Qt::Key_N, m_triggers_box);
  auto* r_trigger_layout = CreateSliderValuePairLayout(tr("Right"), m_right_trigger_value, 31,
                                                       Qt::Key_M, m_triggers_box);

  auto* triggers_layout = new QVBoxLayout;
  triggers_layout->addLayout(l_trigger_layout);
  triggers_layout->addLayout(r_trigger_layout);
  m_triggers_box->setLayout(triggers_layout);

  m_a_button = new QCheckBox(QStringLiteral("&A"));
  m_b_button = new QCheckBox(QStringLiteral("&B"));
  m_1_button = new QCheckBox(QStringLiteral("&1"));
  m_2_button = new QCheckBox(QStringLiteral("&2"));
  m_plus_button = new QCheckBox(QStringLiteral("&+"));
  m_minus_button = new QCheckBox(QStringLiteral("&-"));
  m_home_button = new QCheckBox(QStringLiteral("&HOME"));
  m_left_button = new QCheckBox(QStringLiteral("&Left"));
  m_up_button = new QCheckBox(QStringLiteral("&Up"));
  m_down_button = new QCheckBox(QStringLiteral("&Down"));
  m_right_button = new QCheckBox(QStringLiteral("&Right"));
  m_c_button = new QCheckBox(QStringLiteral("&C"));
  m_z_button = new QCheckBox(QStringLiteral("&Z"));

  auto* buttons_layout1 = new QHBoxLayout;
  buttons_layout1->addWidget(m_a_button);
  buttons_layout1->addWidget(m_b_button);
  buttons_layout1->addWidget(m_1_button);
  buttons_layout1->addWidget(m_2_button);
  buttons_layout1->addWidget(m_plus_button);
  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);
}
Ejemplo n.º 17
0
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("NewUI", &bNewUI, false);
	general->Get("Enable Logging", &bEnableLogging, true);
	general->Get("AutoLoadLast", &bAutoLoadLast, false);
	general->Get("AutoRun", &bAutoRun, true);
	general->Get("Browse", &bBrowse, false);
	general->Get("DirectLoad", &bDirectLoad, false);
	general->Get("ConfirmOnQuit", &bConfirmOnQuit, false);
	general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
	general->Get("CurrentDirectory", &currentDirectory, "");
	general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
	general->Get("Language", &languageIni, "en_US");
	general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
	general->Get("EnableCheats", &bEnableCheats, false);
	general->Get("MaxRecent", &iMaxRecent, 12);
	general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
	general->Get("StateSlot", &iCurrentStateSlot, 0);

	// 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("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
#ifdef _WIN32
	general->Get("TopMost", &bTopMost);
	general->Get("WindowX", &iWindowX, 40);
	general->Get("WindowY", &iWindowY, 100);
#endif

	if ((int)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
	cpu->Get("FastMemory", &bFastMemory, false);
	cpu->Get("CPUSpeed", &iLockedCPUSpeed, false);

	IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
	graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);
#ifdef _WIN32
	graphics->Get("ResolutionScale", &iWindowZoom, 2);
#else
	graphics->Get("ResolutionScale", &iWindowZoom, 1);
#endif
	graphics->Get("RenderingMode", &iRenderingMode, 1); // default is buffered rendering mode
	graphics->Get("HardwareTransform", &bHardwareTransform, true);
	graphics->Get("TextureFiltering", &iTexFiltering, 1);
	graphics->Get("SSAA", &bAntiAliasing, 0);
	graphics->Get("VBO", &bUseVBO, false);
	graphics->Get("FrameSkip", &iFrameSkip, 0);
	graphics->Get("FrameRate", &iFpsLimit, 0);
	graphics->Get("ForceMaxEmulatedFPS", &iForceMaxEmulatedFPS, 0);
#ifdef USING_GLES2
	graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
#else
	graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
#endif
	if (iAnisotropyLevel > 4) {
		iAnisotropyLevel = 4;
	}
	graphics->Get("VertexCache", &bVertexCache, true);
#ifdef _WIN32
	graphics->Get("FullScreen", &bFullScreen, false);
	graphics->Get("FullScreenOnLaunch", &bFullScreenOnLaunch, false);
#endif
#ifdef BLACKBERRY
	graphics->Get("PartialStretch", &bPartialStretch, pixel_xres == pixel_yres);
#endif
	graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
	graphics->Get("TrueColor", &bTrueColor, true);
	graphics->Get("MipMap", &bMipMap, true);
	graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
	graphics->Get("TexScalingType", &iTexScalingType, 0);
	graphics->Get("TexDeposterize", &bTexDeposterize, false);
	graphics->Get("VSyncInterval", &bVSync, false);

	IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
	sound->Get("Enable", &bEnableSound, true);
	sound->Get("EnableAtrac3plus", &bEnableAtrac3plus, true);
	sound->Get("VolumeBGM", &iBGMVolume, 7);
	sound->Get("VolumeSFX", &iSEVolume, 7);
	
	IniFile::Section *control = iniFile.GetOrCreateSection("Control");
	control->Get("ShowStick", &bShowAnalogStick, false);
#ifdef BLACKBERRY
	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("KeyMapping",iMappingMap);
	control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
	control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
	control->Get("ButtonScale", &fButtonScale, 1.15);

	IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
	pspConfig->Get("NickName", &sNickName, "PPSSPP");
	pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
	pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
	pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD);
	pspConfig->Get("TimeZone", &iTimeZone, 0);
	pspConfig->Get("DayLightSavings", &bDayLightSavings, PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD);
	pspConfig->Get("ButtonPreference", &iButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
	pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
	pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
	pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
	pspConfig->Get("EncryptSave", &bEncryptSave, true);

	IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
	debugConfig->Get("DisasmWindowX", &iDisasmWindowX, -1);
	debugConfig->Get("DisasmWindowY", &iDisasmWindowY, -1);
	debugConfig->Get("DisasmWindowW", &iDisasmWindowW, -1);
	debugConfig->Get("DisasmWindowH", &iDisasmWindowH, -1);
	debugConfig->Get("ConsoleWindowX", &iConsoleWindowX, -1);
	debugConfig->Get("ConsoleWindowY", &iConsoleWindowY, -1);
	debugConfig->Get("FontWidth", &iFontWidth, 8);
	debugConfig->Get("FontHeight", &iFontHeight, 12);
	debugConfig->Get("DisplayStatusBar", &bDisplayStatusBar, true);

	IniFile::Section *gleshacks = iniFile.GetOrCreateSection("GLESHacks");
	gleshacks->Get("PrescaleUV", &bPrescaleUV, false);

	KeyMap::LoadFromIni(iniFile);

	CleanRecent();
}
Ejemplo n.º 18
0
void VideoConfig::GameIniLoad()
{
	bool gfx_override_exists = false;

	// XXX: Again, bad place to put OSD messages at (see delroth's comment above)
	// XXX: This will add an OSD message for each projection hack value... meh
#define CHECK_SETTING(section, key, var) do { \
		decltype(var) temp = var; \
		if (iniFile.GetIfExists(section, key, &var) && var != temp) { \
			std::string msg = StringFromFormat("Note: Option \"%s\" is overridden by game ini.", key); \
			OSD::AddMessage(msg, 7500); \
			gfx_override_exists = true; \
		} \
	} while (0)

	IniFile iniFile = SConfig::GetInstance().LoadGameIni();

	CHECK_SETTING("Video_Hardware", "VSync", bVSync);

	CHECK_SETTING("Video_Settings", "wideScreenHack", bWidescreenHack);
	CHECK_SETTING("Video_Settings", "AspectRatio", iAspectRatio);
	CHECK_SETTING("Video_Settings", "Crop", bCrop);
	CHECK_SETTING("Video_Settings", "UseXFB", bUseXFB);
	CHECK_SETTING("Video_Settings", "UseRealXFB", bUseRealXFB);
	CHECK_SETTING("Video_Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
	CHECK_SETTING("Video_Settings", "HiresTextures", bHiresTextures);
	CHECK_SETTING("Video_Settings", "HiresMaterialMaps", bHiresMaterialMaps);

	CHECK_SETTING("Video_Settings", "ConvertHiresTextures", bConvertHiresTextures);
	CHECK_SETTING("Video_Settings", "CacheHiresTextures", bCacheHiresTextures);
	CHECK_SETTING("Video_Settings", "CacheHiresTexturesonGPU", bCacheHiresTexturesGPU);
	CHECK_SETTING("Video_Settings", "EnablePixelLighting", bEnablePixelLighting);
	CHECK_SETTING("Video_Settings", "ForcePhongShading", bForcePhongShading);

	CHECK_SETTING("Video_Settings", "FastDepthCalc", bFastDepthCalc);
	CHECK_SETTING("Video_Settings", "MSAA", iMultisampleMode);
	CHECK_SETTING("Video_Settings", "SSAA", bSSAA);
	int tmp = -9000;
	CHECK_SETTING("Video_Settings", "EFBScale", tmp); // integral
	if (tmp != -9000)
	{
		if (tmp != SCALE_FORCE_INTEGRAL)
		{
			iEFBScale = tmp;
		}
		else // Round down to multiple of native IR
		{
			switch (iEFBScale)
			{
			case SCALE_AUTO:
				iEFBScale = SCALE_AUTO_INTEGRAL;
				break;
			case SCALE_1_5X:
				iEFBScale = SCALE_1X;
				break;
			case SCALE_2_5X:
				iEFBScale = SCALE_2X;
				break;
			default:
				break;
			}
		}
	}

	CHECK_SETTING("Video_Settings", "DisableFog", bDisableFog);
	CHECK_SETTING("Video_Settings", "EnableOpenCL", bEnableOpenCL);

	CHECK_SETTING("Video_Enhancements", "ForceFiltering", bForceFiltering);
	CHECK_SETTING("Video_Enhancements", "MaxAnisotropy", iMaxAnisotropy);  // NOTE - this is x in (1 << x)
	CHECK_SETTING("Video_Enhancements", "PostProcessingShader", sPostProcessingShader);
	CHECK_SETTING("Video_Enhancements", "StereoMode", iStereoMode);
	CHECK_SETTING("Video_Enhancements", "StereoDepth", iStereoDepth);
	CHECK_SETTING("Video_Enhancements", "StereoConvergence", iStereoConvergence);
	CHECK_SETTING("Video_Enhancements", "StereoSwapEyes", bStereoSwapEyes);
	CHECK_SETTING("Video_Enhancements", "UseScalingFilter", bUseScalingFilter);
	CHECK_SETTING("Video_Enhancements", "TextureScalingType", iTexScalingType);
	CHECK_SETTING("Video_Enhancements", "TextureScalingFactor", iTexScalingFactor);
	CHECK_SETTING("Video_Enhancements", "UseDePosterize", bTexDeposterize);

	//these are not overrides, they are per-game settings, hence no warning
	IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
	for (size_t i = 0; i < oStereoPresets.size(); ++i)
	{
	   enhancements->Get(StringFromFormat("StereoConvergence_%zu", i), &oStereoPresets[i].depth, iStereoConvergence);
	   enhancements->Get(StringFromFormat("StereoDepth_%zu", i), &oStereoPresets[i].convergence, iStereoDepth);
	}
	enhancements->Get("StereoActivePreset", &iStereoActivePreset, 0);
	iStereoConvergence = oStereoPresets[iStereoActivePreset].convergence;
	iStereoDepth = oStereoPresets[iStereoActivePreset].depth;


	CHECK_SETTING("Video_Stereoscopy", "StereoEFBMonoDepth", bStereoEFBMonoDepth);
	CHECK_SETTING("Video_Stereoscopy", "StereoDepthPercentage", iStereoDepthPercentage);
	CHECK_SETTING("Video_Stereoscopy", "StereoConvergenceMinimum", iStereoConvergenceMinimum);

	CHECK_SETTING("Video_Hacks", "EFBAccessEnable", bEFBAccessEnable);
	CHECK_SETTING("Video_Hacks", "EFBFastAccess", bEFBFastAccess);
	CHECK_SETTING("Video_Hacks", "ForceProgressive", bForceProgressive);
	CHECK_SETTING("Video_Hacks", "EFBToTextureEnable", bSkipEFBCopyToRam);
	CHECK_SETTING("Video_Hacks", "EFBScaledCopy", bCopyEFBScaled);
	CHECK_SETTING("Video_Hacks", "EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
	CHECK_SETTING("Video_Hacks", "BoundingBoxMode", iBBoxMode);

	CHECK_SETTING("Video", "ProjectionHack", iPhackvalue[0]);
	CHECK_SETTING("Video", "PH_SZNear", iPhackvalue[1]);
	CHECK_SETTING("Video", "PH_SZFar", iPhackvalue[2]);
	CHECK_SETTING("Video", "PH_ExtraParam", iPhackvalue[3]);
	CHECK_SETTING("Video", "PH_ZNear", sPhackvalue[0]);
	CHECK_SETTING("Video", "PH_ZFar", sPhackvalue[1]);
	CHECK_SETTING("Video", "ZTPSpeedupHack", bZTPSpeedHack);
	CHECK_SETTING("Video", "PerfQueriesEnable", bPerfQueriesEnable);
	CHECK_SETTING("Video", "FullAsyncShaderCompilation", bFullAsyncShaderCompilation);
	CHECK_SETTING("Video", "WaitForShaderCompilation", bWaitForShaderCompilation);
	CHECK_SETTING("Video", "PredictiveFifo", bPredictiveFifo);
	if (gfx_override_exists)
		OSD::AddMessage("Warning: Opening the graphics configuration will reset settings and might cause issues!", 10000);
}
Ejemplo n.º 19
0
void Config::Save() {
	if (jitForcedOff) {
		// if JIT has been forced off, we don't want to screw up the user's ppsspp.ini
		g_Config.bJit = true;
	}
	if (iniFilename_.size() && g_Config.bSaveSettings) {
		
		saveGameConfig(gameId_);

		CleanRecent();
		IniFile iniFile;
		if (!iniFile.Load(iniFilename_.c_str())) {
			ERROR_LOG(LOADER, "Error saving config - can't read ini %s", iniFilename_.c_str());
		}

		// Need to do this somewhere...
		bFirstRun = false;

		IterateSettings(iniFile, [&](IniFile::Section *section, ConfigSetting *setting) {
			if (!bGameSpecific || !setting->perGame_) {
				setting->Set(section);
			}
		});

		IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
		recent->Set("MaxRecent", iMaxRecent);

		for (int i = 0; i < iMaxRecent; i++) {
			char keyName[64];
			snprintf(keyName, sizeof(keyName), "FileName%d", i);
			if (i < (int)recentIsos.size()) {
				recent->Set(keyName, recentIsos[i]);
			} else {
				recent->Delete(keyName); // delete the nonexisting FileName
			}
		}

		IniFile::Section *pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths");
		pinnedPaths->Clear();
		for (size_t i = 0; i < vPinnedPaths.size(); ++i) {
			char keyName[64];
			snprintf(keyName, sizeof(keyName), "Path%d", (int)i);
			pinnedPaths->Set(keyName, vPinnedPaths[i]);
		}

		IniFile::Section *control = iniFile.GetOrCreateSection("Control");
		control->Delete("DPadRadius");

		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());

		if (!bGameSpecific) //otherwise we already did this in saveGameConfig()
		{
			IniFile controllerIniFile;
			if (!controllerIniFile.Load(controllerIniFilename_.c_str())) {
				ERROR_LOG(LOADER, "Error saving config - can't read ini %s", controllerIniFilename_.c_str());
			}
			KeyMap::SaveToIni(controllerIniFile);
			if (!controllerIniFile.Save(controllerIniFilename_.c_str())) {
				ERROR_LOG(LOADER, "Error saving config - can't write ini %s", controllerIniFilename_.c_str());
				return;
			}
			INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());
		}
	} else {
		INFO_LOG(LOADER, "Not saving config");
	}
	if (jitForcedOff) {
		// force JIT off again just in case Config::Save() is called without exiting PPSSPP
		g_Config.bJit = false;
	}
}
Ejemplo n.º 20
0
void VideoConfig::Save(const std::string& ini_file)
{
	IniFile iniFile;
	iniFile.Load(ini_file);

	IniFile::Section* hardware = iniFile.GetOrCreateSection("Hardware");
	hardware->Set("VSync", bVSync);
	hardware->Set("Adapter", iAdapter);

	IniFile::Section* settings = iniFile.GetOrCreateSection("Settings");
	settings->Set("AspectRatio", iAspectRatio);
	settings->Set("Crop", bCrop);
	settings->Set("wideScreenHack", bWidescreenHack);
	settings->Set("UseXFB", bUseXFB);
	settings->Set("UseRealXFB", bUseRealXFB);
	settings->Set("SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples);
	settings->Set("ShowFPS", bShowFPS);
	settings->Set("LogRenderTimeToFile", bLogRenderTimeToFile);
	settings->Set("ShowInputDisplay", bShowInputDisplay);
	settings->Set("OverlayStats", bOverlayStats);
	settings->Set("OverlayProjStats", bOverlayProjStats);
	settings->Set("DumpTextures", bDumpTextures);
	settings->Set("DumpVertexLoader", bDumpVertexLoaders);
	settings->Set("HiresTextures", bHiresTextures);
	settings->Set("HiresMaterialMaps", bHiresMaterialMaps);

	settings->Set("ConvertHiresTextures", bConvertHiresTextures);
	settings->Set("CacheHiresTextures", bCacheHiresTextures);
	settings->Set("CacheHiresTexturesonGPU", bCacheHiresTexturesGPU);
	settings->Set("DumpEFBTarget", bDumpEFBTarget);
	settings->Set("FreeLook", bFreeLook);
	settings->Set("UseFFV1", bUseFFV1);
	settings->Set("EnablePixelLighting", bEnablePixelLighting);
	settings->Set("ForcePhongShading", bForcePhongShading);
	
	settings->Set("FastDepthCalc", bFastDepthCalc);
	settings->Set("ShowEFBCopyRegions", bShowEFBCopyRegions);
	settings->Set("MSAA", iMultisampleMode);
	settings->Set("SSAA", bSSAA);
	settings->Set("EFBScale", iEFBScale);
	settings->Set("TexFmtOverlayEnable", bTexFmtOverlayEnable);
	settings->Set("TexFmtOverlayCenter", bTexFmtOverlayCenter);
	settings->Set("Wireframe", bWireFrame);
	settings->Set("DisableFog", bDisableFog);

	settings->Set("EnableOpenCL", bEnableOpenCL);
	settings->Set("EnableShaderDebugging", bEnableShaderDebugging);
	settings->Set("BorderlessFullscreen", bBorderlessFullscreen);

	IniFile::Section* enhancements = iniFile.GetOrCreateSection("Enhancements");
	enhancements->Set("ForceFiltering", bForceFiltering);
	enhancements->Set("MaxAnisotropy", iMaxAnisotropy);
	enhancements->Set("PostProcessingShader", sPostProcessingShader);
	enhancements->Set("StereoMode", iStereoMode);
	enhancements->Set("StereoDepth", iStereoDepth);
	enhancements->Set("StereoConvergence", iStereoConvergence);
	enhancements->Set("StereoSwapEyes", bStereoSwapEyes);
	enhancements->Set("UseScalingFilter", bUseScalingFilter);
	enhancements->Set("TextureScalingType", iTexScalingType);
	enhancements->Set("TextureScalingFactor", iTexScalingFactor);
	enhancements->Set("UseDePosterize", bTexDeposterize);


	IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks");
	hacks->Set("EFBAccessEnable", bEFBAccessEnable);
	hacks->Set("EFBFastAccess", bEFBFastAccess);
	hacks->Set("ForceProgressive", bForceProgressive);
	hacks->Set("EFBToTextureEnable", bSkipEFBCopyToRam);
	hacks->Set("EFBScaledCopy", bCopyEFBScaled);
	hacks->Set("EFBEmulateFormatChanges", bEFBEmulateFormatChanges);
	hacks->Set("ForceDualSourceBlend", bForceDualSourceBlend);
	hacks->Set("FullAsyncShaderCompilation", bFullAsyncShaderCompilation);
	hacks->Set("WaitForShaderCompilation", bWaitForShaderCompilation);
	hacks->Set("PredictiveFifo", bPredictiveFifo);
	hacks->Set("BoundingBoxMode", iBBoxMode);

	iniFile.Save(ini_file);
}
Ejemplo n.º 21
0
void SConfig::LoadFifoPlayerSettings(IniFile& ini)
{
	IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");

	fifoplayer->Get("LoopReplay", &m_LocalCoreStartupParameter.bLoopFifoReplay, true);
}
Ejemplo n.º 22
0
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("ShowInputDisplay", &bShowInputDisplay, false);
	settings->Get("OverlayStats", &bOverlayStats, false);
	settings->Get("OverlayProjStats", &bOverlayProjStats, false);
	settings->Get("ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
	settings->Get("DumpTextures", &bDumpTextures, 0);
	settings->Get("DumpVertexLoader", &bDumpVertexLoaders, 0);
	settings->Get("HiresTextures", &bHiresTextures, 0);
	settings->Get("HiresMaterialMaps", &bHiresMaterialMaps, 0);
	settings->Get("ConvertHiresTextures", &bConvertHiresTextures, 0);
	settings->Get("CacheHiresTextures", &bCacheHiresTextures, 0);
	settings->Get("CacheHiresTexturesonGPU", &bCacheHiresTexturesGPU, 0);
	settings->Get("DumpEFBTarget", &bDumpEFBTarget, 0);
	settings->Get("FreeLook", &bFreeLook, 0);
	settings->Get("UseFFV1", &bUseFFV1, 0);
	settings->Get("EnablePixelLighting", &bEnablePixelLighting, 0);
	settings->Get("ForcePhongShading", &bForcePhongShading, 0);

	settings->Get("FastDepthCalc", &bFastDepthCalc, true);
	settings->Get("MSAA", &iMultisampleMode, 0);
	settings->Get("EFBScale", &iEFBScale, (int)SCALE_1X); // native	
	settings->Get("TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
	settings->Get("TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
	settings->Get("WireFrame", &bWireFrame, 0);
	settings->Get("DisableFog", &bDisableFog, 0);
	settings->Get("SSAA", &bSSAA, false);
	settings->Get("EnableOpenCL", &bEnableOpenCL, false);
	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);
	enhancements->Get("UseScalingFilter", &bUseScalingFilter, false);
	enhancements->Get("TextureScalingType", &iTexScalingType, 0);
	enhancements->Get("TextureScalingFactor", &iTexScalingFactor, 2);
	enhancements->Get("UseDePosterize", &bTexDeposterize, false);

	//currently these settings are not saved in global config, so we could've initialized them directly
	for (size_t i = 0; i < oStereoPresets.size(); ++i)
	{
	   enhancements->Get(StringFromFormat("StereoConvergence_%zu", i), &oStereoPresets[i].depth, iStereoConvergence);
	   enhancements->Get(StringFromFormat("StereoDepth_%zu", i), &oStereoPresets[i].convergence, iStereoDepth);
	}
	enhancements->Get("StereoActivePreset", &iStereoActivePreset, 0);
	iStereoConvergence = oStereoPresets[iStereoActivePreset].convergence;
	iStereoDepth = oStereoPresets[iStereoActivePreset].depth;

	IniFile::Section* hacks = iniFile.GetOrCreateSection("Hacks");
	hacks->Get("EFBAccessEnable", &bEFBAccessEnable, true);
	hacks->Get("EFBFastAccess", &bEFBFastAccess, false);
	hacks->Get("ForceProgressive", &bForceProgressive, true);
	hacks->Get("EFBToTextureEnable", &bSkipEFBCopyToRam, true);
	hacks->Get("EFBScaledCopy", &bCopyEFBScaled, true);
	hacks->Get("EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);
	hacks->Get("ForceDualSourceBlend", &bForceDualSourceBlend, false);
	hacks->Get("FullAsyncShaderCompilation", &bFullAsyncShaderCompilation, false);
	hacks->Get("WaitForShaderCompilation", &bWaitForShaderCompilation, false);
	hacks->Get("PredictiveFifo", &bPredictiveFifo, false);
	hacks->Get("BoundingBoxMode", &iBBoxMode, (int)BBoxMode::BBoxGPU);

	// hacks which are disabled by default
	iPhackvalue[0] = 0;
	bPerfQueriesEnable = 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();
}
Ejemplo n.º 23
0
void VideoConfig::Load(const char *ini_file)
{
	IniFile iniFile;
	iniFile.Load(ini_file);

	iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
	iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false);
	iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO);
	iniFile.Get("Settings", "Crop", &bCrop, false);
	iniFile.Get("Settings", "UseXFB", &bUseXFB, 0);
	iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0);
	iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,128);
	iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings
	iniFile.Get("Settings", "LogFPSToFile", &bLogFPSToFile, false);
	iniFile.Get("Settings", "ShowInputDisplay", &bShowInputDisplay, false);
	iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false);
	iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false);
	iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false);
	iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0);
	iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0);
	iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0);
	iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
	iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
	iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
	iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0);
	iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false);
	iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200);
	iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0);
	iniFile.Get("Settings", "EnablePixelLighting", &bEnablePixelLighting, 0);
	iniFile.Get("Settings", "FastDepthCalc", &bFastDepthCalc, true);

	iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0);
	iniFile.Get("Settings", "EFBScale", &iEFBScale, (int) SCALE_1X); // native

	iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false);

	iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0);
	iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0);
	iniFile.Get("Settings", "WireFrame", &bWireFrame, 0);
	iniFile.Get("Settings", "DisableFog", &bDisableFog, 0);

	iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false);

	iniFile.Get("Settings", "EnableShaderDebugging", &bEnableShaderDebugging, false);

	iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0);
	iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 0);  // NOTE - this is x in (1 << x)
	iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, "");
	iniFile.Get("Enhancements", "Enable3dVision", &b3DVision, false);

	iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
	iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
	iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true);
	iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, true);
	iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
	iniFile.Get("Hacks", "EFBCopyCacheEnable", &bEFBCopyCacheEnable, false);
	iniFile.Get("Hacks", "EFBEmulateFormatChanges", &bEFBEmulateFormatChanges, false);

	iniFile.Get("Hardware", "Adapter", &iAdapter, 0);

	// Load common settings
	iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
	bool bTmp;
	iniFile.Get("Interface", "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);
}
Ejemplo n.º 24
0
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("RunCount", iRunCount);
		general->Set("Enable Logging", bEnableLogging);
		general->Set("AutoRun", bAutoRun);
		general->Set("Browse", bBrowse);
		general->Set("IgnoreBadMemAccess", bIgnoreBadMemAccess);
		general->Set("CurrentDirectory", currentDirectory);
		general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
		general->Set("ReportingHost", sReportHost);
		general->Set("AutoSaveSymbolMap", bAutoSaveSymbolMap);
#if defined(_WIN32) && !defined(USING_QT_UI)
		general->Set("TopMost", bTopMost);
		general->Set("WindowX", iWindowX);
		general->Set("WindowY", iWindowY);
		general->Set("WindowWidth", iWindowWidth);
		general->Set("WindowHeight", iWindowHeight);
		general->Set("PauseOnLostFocus", bPauseOnLostFocus);
#endif
		general->Set("Language", sLanguageIni);
		general->Set("NumWorkerThreads", iNumWorkerThreads);
		general->Set("EnableAutoLoad", bEnableAutoLoad);
		general->Set("EnableCheats", bEnableCheats);
		general->Set("ScreenshotsAsPNG", bScreenshotsAsPNG);
		general->Set("StateSlot", iCurrentStateSlot);
		general->Set("RewindFlipFrequency", iRewindFlipFrequency);
		general->Set("GridView1", bGridView1);
		general->Set("GridView2", bGridView2);
		general->Set("GridView3", bGridView3);
		general->Set("CheckForNewVersion", bCheckForNewVersion);

		IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
		recent->Set("MaxRecent", iMaxRecent);

		for (int i = 0; i < iMaxRecent; i++) {
			char keyName[64];
			sprintf(keyName,"FileName%d",i);
			if (i < (int)recentIsos.size()) {
				recent->Set(keyName, recentIsos[i]);
			} else {
				recent->Delete(keyName); // delete the nonexisting FileName
			}
		}

		IniFile::Section *pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths");
		pinnedPaths->Clear();
		for (size_t i = 0; i < vPinnedPaths.size(); ++i) {
			char keyName[64];
			snprintf(keyName, sizeof(keyName), "Path%d", i);
			pinnedPaths->Set(keyName, vPinnedPaths[i]);
		}

		IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
		cpu->Set("Jit", bJit);
		cpu->Set("SeparateCPUThread", bSeparateCPUThread);
		cpu->Set("AtomicAudioLocks", bAtomicAudioLocks);
		cpu->Set("SeparateIOThread", bSeparateIOThread);
		cpu->Set("FastMemoryAccess", bFastMemory);
		cpu->Set("CPUSpeed", iLockedCPUSpeed);

		IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
		graphics->Set("ShowFPSCounter", iShowFPSCounter);
		graphics->Set("RenderingMode", iRenderingMode);
		graphics->Set("SoftwareRendering", bSoftwareRendering);
		graphics->Set("HardwareTransform", bHardwareTransform);
		graphics->Set("SoftwareSkinning", bSoftwareSkinning);
		graphics->Set("TextureFiltering", iTexFiltering);
		graphics->Set("InternalResolution", iInternalResolution);
		graphics->Set("FrameSkip", iFrameSkip);
		graphics->Set("FrameRate", iFpsLimit);
		graphics->Set("FrameSkipUnthrottle", bFrameSkipUnthrottle);
		graphics->Set("ForceMaxEmulatedFPS", iForceMaxEmulatedFPS);
		graphics->Set("AnisotropyLevel", iAnisotropyLevel);
		graphics->Set("VertexCache", bVertexCache);
#ifdef _WIN32
		graphics->Set("FullScreen", bFullScreen);
#endif
		graphics->Set("PartialStretch", bPartialStretch);
		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);
		graphics->Set("DisableStencilTest", bDisableStencilTest);
		graphics->Set("AlwaysDepthWrite", bAlwaysDepthWrite);
		graphics->Set("TimerHack", bTimerHack);
		graphics->Set("LowQualitySplineBezier", bLowQualitySplineBezier);
		graphics->Set("PostShader", sPostShaderName);

		IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
		sound->Set("Enable", bEnableSound);
		sound->Set("VolumeBGM", iBGMVolume);
		sound->Set("VolumeSFX", iSFXVolume);
		sound->Set("LowLatency", bLowLatencyAudio);

		IniFile::Section *control = iniFile.GetOrCreateSection("Control");
		control->Set("HapticFeedback", bHapticFeedback);
		control->Set("ShowTouchControls", bShowTouchControls);
		control->Set("ShowTouchCross", bShowTouchCross);
		control->Set("ShowTouchCircle", bShowTouchCircle);
		control->Set("ShowTouchSquare", bShowTouchSquare);
		control->Set("ShowTouchTriangle", bShowTouchTriangle);
		control->Set("ShowTouchStart", bShowTouchStart);
		control->Set("ShowTouchSelect", bShowTouchSelect);
		control->Set("ShowTouchLTrigger", bShowTouchLTrigger);
		control->Set("ShowTouchRTrigger", bShowTouchRTrigger);
		control->Set("ShowAnalogStick", bShowTouchAnalogStick);
		control->Set("ShowTouchUnthrottle", bShowTouchUnthrottle);
		control->Set("ShowTouchDpad", bShowTouchDpad);

#ifdef USING_GLES2
		control->Set("TiltBaseX", fTiltBaseX);
		control->Set("TiltBaseY", fTiltBaseY);
		control->Set("InvertTiltX", bInvertTiltX);
		control->Set("InvertTiltY", bInvertTiltY);
		control->Set("TiltSensitivityX", iTiltSensitivityX);
		control->Set("TiltSensitivityY", iTiltSensitivityY);
		control->Set("DeadzoneRadius", fDeadzoneRadius);
		control->Set("TiltInputType", iTiltInputType);
#endif
		control->Set("DisableDpadDiagonals", bDisableDpadDiagonals);
		control->Set("TouchButtonStyle", iTouchButtonStyle);
		control->Set("TouchButtonOpacity", iTouchButtonOpacity);
		control->Set("ActionButtonScale", fActionButtonScale);
		control->Set("ActionButtonSpacing2", fActionButtonSpacing);
		control->Set("ActionButtonCenterX", fActionButtonCenterX);
		control->Set("ActionButtonCenterY", fActionButtonCenterY);
		control->Set("DPadX", fDpadX);
		control->Set("DPadY", fDpadY);
		control->Set("DPadScale", fDpadScale);
		control->Set("DPadSpacing", fDpadSpacing);
		control->Set("StartKeyX", fStartKeyX);
		control->Set("StartKeyY", fStartKeyY);
		control->Set("StartKeyScale", fStartKeyScale);
		control->Set("SelectKeyX", fSelectKeyX);
		control->Set("SelectKeyY", fSelectKeyY);
		control->Set("SelectKeyScale", fSelectKeyScale);
		control->Set("UnthrottleKeyX", fUnthrottleKeyX);
		control->Set("UnthrottleKeyY", fUnthrottleKeyY);
		control->Set("UnthrottleKeyScale", fUnthrottleKeyScale);
		control->Set("LKeyX", fLKeyX);
		control->Set("LKeyY", fLKeyY);
		control->Set("LKeyScale", fLKeyScale);
		control->Set("RKeyX", fRKeyX);
		control->Set("RKeyY", fRKeyY);
		control->Set("RKeyScale", fRKeyScale);
		control->Set("AnalogStickX", fAnalogStickX);
		control->Set("AnalogStickY", fAnalogStickY);
		control->Set("AnalogStickScale", fAnalogStickScale);
		control->Delete("DPadRadius");

		IniFile::Section *network = iniFile.GetOrCreateSection("Network");
		network->Set("EnableWlan", bEnableWlan);

		IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
		pspConfig->Set("PSPModel", iPSPModel);
		pspConfig->Set("PSPFirmwareVersion", iFirmwareVersion);
		pspConfig->Set("NickName", sNickName.c_str());
		pspConfig->Set("proAdhocServer", proAdhocServer.c_str());
		pspConfig->Set("MacAddress", localMacAddress.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);
#if defined(_WIN32) && !defined(USING_QT_UI)
		pspConfig->Set("BypassOSKWithKeyboard", bBypassOSKWithKeyboard);
#endif

		IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
		debugConfig->Set("DisasmWindowX", iDisasmWindowX);
		debugConfig->Set("DisasmWindowY", iDisasmWindowY);
		debugConfig->Set("DisasmWindowW", iDisasmWindowW);
		debugConfig->Set("DisasmWindowH", iDisasmWindowH);
		debugConfig->Set("GEWindowX", iGEWindowX);
		debugConfig->Set("GEWindowY", iGEWindowY);
		debugConfig->Set("GEWindowW", iGEWindowW);
		debugConfig->Set("GEWindowH", iGEWindowH);
		debugConfig->Set("ConsoleWindowX", iConsoleWindowX);
		debugConfig->Set("ConsoleWindowY", iConsoleWindowY);
		debugConfig->Set("FontWidth", iFontWidth);
		debugConfig->Set("FontHeight", iFontHeight);
		debugConfig->Set("DisplayStatusBar", bDisplayStatusBar);
		debugConfig->Set("ShowBottomTabTitles",bShowBottomTabTitles);
		debugConfig->Set("ShowDeveloperMenu", bShowDeveloperMenu);
		debugConfig->Set("SkipDeadbeefFilling", bSkipDeadbeefFilling);
		debugConfig->Set("FuncHashMap", bFuncHashMap);

		IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
		speedhacks->Set("PrescaleUV", bPrescaleUV);
		speedhacks->Set("DisableAlphaTest", bDisableAlphaTest);

		// Save upgrade check state
		IniFile::Section *upgrade = iniFile.GetOrCreateSection("Upgrade");
		upgrade->Set("UpgradeMessage", upgradeMessage);
		upgrade->Set("UpgradeVersion", upgradeVersion);
		upgrade->Set("DismissedVersion", dismissedVersion);

		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());


		IniFile controllerIniFile;
		if (!controllerIniFile.Load(controllerIniFilename_.c_str())) {
			ERROR_LOG(LOADER, "Error saving config - can't read ini %s", controllerIniFilename_.c_str());
		}
		KeyMap::SaveToIni(controllerIniFile);
		if (!controllerIniFile.Save(controllerIniFilename_.c_str())) {
			ERROR_LOG(LOADER, "Error saving config - can't write ini %s", controllerIniFilename_.c_str());
			return;
		}
		INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());

	} else {
		INFO_LOG(LOADER, "Not saving config");
	}
}
Ejemplo n.º 25
0
void SConfig::SaveInputSettings(IniFile& ini)
{
  IniFile::Section* input = ini.GetOrCreateSection("Input");

  input->Set("BackgroundInput", m_BackgroundInput);
}
Ejemplo n.º 26
0
void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
	iniFilename_ = FindConfigFile(iniFileName != NULL ? iniFileName : "ppsspp.ini");
	controllerIniFilename_ = FindConfigFile(controllerIniFilename != NULL ? controllerIniFilename : "controls.ini");

	INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
	bSaveSettings = 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.
	}

	IniFile::Section *general = iniFile.GetOrCreateSection("General");

	general->Get("FirstRun", &bFirstRun, true);
	general->Get("RunCount", &iRunCount, 0);
	iRunCount++;
	general->Get("Enable Logging", &bEnableLogging, true);
	general->Get("AutoRun", &bAutoRun, true);
	general->Get("Browse", &bBrowse, false);
	general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
	general->Get("CurrentDirectory", &currentDirectory, "");
	general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
	general->Get("HomebrewStore", &bHomebrewStore, false);
	general->Get("CheckForNewVersion", &bCheckForNewVersion, true);

	if (!File::Exists(currentDirectory))
		currentDirectory = "";

	std::string defaultLangRegion = "en_US";
	if (bFirstRun) {
		std::string langRegion = System_GetProperty(SYSPROP_LANGREGION);
		if (i18nrepo.IniExists(langRegion))
			defaultLangRegion = langRegion;
		// TODO: Be smart about same language, different country
	}

	general->Get("Language", &sLanguageIni, defaultLangRegion.c_str());
	general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
	general->Get("EnableAutoLoad", &bEnableAutoLoad, false);
	general->Get("EnableCheats", &bEnableCheats, false);
	general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
	general->Get("StateSlot", &iCurrentStateSlot, 0);
	general->Get("RewindFlipFrequency", &iRewindFlipFrequency, 0);
	general->Get("GridView1", &bGridView1, true);
	general->Get("GridView2", &bGridView2, true);
	general->Get("GridView3", &bGridView3, false);

	// "default" means let emulator decide, "" means disable.
	general->Get("ReportingHost", &sReportHost, "default");
	general->Get("Recent", recentIsos);
	general->Get("AutoSaveSymbolMap", &bAutoSaveSymbolMap, false);
#if defined(_WIN32) && !defined(USING_QT_UI)
	general->Get("TopMost", &bTopMost);
	general->Get("WindowX", &iWindowX, -1); // -1 tells us to center the window.
	general->Get("WindowY", &iWindowY, -1);
	general->Get("WindowWidth", &iWindowWidth, 0);   // 0 will be automatically reset later (need to do the AdjustWindowRect dance).
	general->Get("WindowHeight", &iWindowHeight, 0);
	general->Get("PauseOnLostFocus", &bPauseOnLostFocus, false);
#endif

	IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
	recent->Get("MaxRecent", &iMaxRecent, 30);

	// Fix issue from switching from uint (hex in .ini) to int (dec)
	if (iMaxRecent == 0)
		iMaxRecent = 30;

	recentIsos.clear();
	for (int i = 0; i < iMaxRecent; i++)
	{
		char keyName[64];
		std::string fileName;

		sprintf(keyName,"FileName%d",i);
		if (!recent->Get(keyName,&fileName,"") || fileName.length() == 0) {
			// just skip it to get the next key
		}
		else {
			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);
	}

	IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
#ifdef IOS
	cpu->Get("Jit", &bJit, iosCanUseJit);
#else
	cpu->Get("Jit", &bJit, true);
#endif
	cpu->Get("SeparateCPUThread", &bSeparateCPUThread, false);
	cpu->Get("AtomicAudioLocks", &bAtomicAudioLocks, false);

	cpu->Get("SeparateIOThread", &bSeparateIOThread, true);
	cpu->Get("FastMemoryAccess", &bFastMemory, true);
	cpu->Get("CPUSpeed", &iLockedCPUSpeed, 0);

	IniFile::Section *graphics = iniFile.GetOrCreateSection("Graphics");
	graphics->Get("ShowFPSCounter", &iShowFPSCounter, false);

	int renderingModeDefault = 1;  // Buffered
	if (System_GetProperty(SYSPROP_NAME) == "samsung:GT-S5360") {
		renderingModeDefault = 0;  // Non-buffered
	}

	graphics->Get("RenderingMode", &iRenderingMode, renderingModeDefault);
	graphics->Get("SoftwareRendering", &bSoftwareRendering, false);
	graphics->Get("HardwareTransform", &bHardwareTransform, true);
	graphics->Get("SoftwareSkinning", &bSoftwareSkinning, true);
	graphics->Get("TextureFiltering", &iTexFiltering, 1);
	// Auto on Windows, 2x on large screens, 1x elsewhere.
#if defined(_WIN32) && !defined(USING_QT_UI)
	graphics->Get("InternalResolution", &iInternalResolution, 0);
#else
	graphics->Get("InternalResolution", &iInternalResolution, pixel_xres >= 1024 ? 2 : 1);
#endif

	graphics->Get("FrameSkip", &iFrameSkip, 0);
	graphics->Get("FrameRate", &iFpsLimit, 0);
#ifdef _WIN32
	graphics->Get("FrameSkipUnthrottle", &bFrameSkipUnthrottle, false);
#else
	graphics->Get("FrameSkipUnthrottle", &bFrameSkipUnthrottle, true);
#endif
	graphics->Get("ForceMaxEmulatedFPS", &iForceMaxEmulatedFPS, 60);
#ifdef USING_GLES2
	graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
#else
	graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
#endif
	if (iAnisotropyLevel > 4) {
		iAnisotropyLevel = 4;
	}
	graphics->Get("VertexCache", &bVertexCache, true);
#ifdef IOS
	graphics->Get("VertexDecJit", &bVertexDecoderJit, iosCanUseJit);
#else
	graphics->Get("VertexDecJit", &bVertexDecoderJit, true);
#endif

#ifdef _WIN32
	graphics->Get("FullScreen", &bFullScreen, false);
#endif
	bool partialStretchDefault = false;
#ifdef BLACKBERRY
	partialStretchDefault = pixel_xres < 1.3 * pixel_yres;
#endif
	graphics->Get("PartialStretch", &bPartialStretch, partialStretchDefault);
	graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
	graphics->Get("TrueColor", &bTrueColor, true);

	graphics->Get("MipMap", &bMipMap, false);

	graphics->Get("TexScalingLevel", &iTexScalingLevel, 1);
	graphics->Get("TexScalingType", &iTexScalingType, 0);
	graphics->Get("TexDeposterize", &bTexDeposterize, false);
	graphics->Get("VSyncInterval", &bVSync, false);
	graphics->Get("DisableStencilTest", &bDisableStencilTest, false);
	graphics->Get("AlwaysDepthWrite", &bAlwaysDepthWrite, false);
// Has been in use on Symbian since v0.7. Preferred option.
#ifdef __SYMBIAN32__
	graphics->Get("TimerHack", &bTimerHack, true);
#else
	graphics->Get("TimerHack", &bTimerHack, false);
#endif
	graphics->Get("LowQualitySplineBezier", &bLowQualitySplineBezier, false);
	graphics->Get("PostShader", &sPostShaderName, "Off");

	IniFile::Section *sound = iniFile.GetOrCreateSection("Sound");
	sound->Get("Enable", &bEnableSound, true);
	sound->Get("VolumeBGM", &iBGMVolume, 7);
	sound->Get("VolumeSFX", &iSFXVolume, 7);
	sound->Get("LowLatency", &bLowLatencyAudio, false);

	IniFile::Section *control = iniFile.GetOrCreateSection("Control");
	control->Get("HapticFeedback", &bHapticFeedback, true);
	control->Get("ShowAnalogStick", &bShowTouchAnalogStick, true);
	control->Get("ShowTouchCross", &bShowTouchCross, true);
	control->Get("ShowTouchCircle", &bShowTouchCircle, true);
	control->Get("ShowTouchSquare", &bShowTouchSquare, true);
	control->Get("ShowTouchTriangle", &bShowTouchTriangle, true);
	control->Get("ShowTouchStart", &bShowTouchStart, true);
	control->Get("ShowTouchSelect", &bShowTouchSelect, true);
	control->Get("ShowTouchLTrigger", &bShowTouchLTrigger, true);
	control->Get("ShowTouchRTrigger", &bShowTouchRTrigger, true);
	control->Get("ShowAnalogStick", &bShowTouchAnalogStick, true);
	control->Get("ShowTouchDpad", &bShowTouchDpad, true);
	control->Get("ShowTouchUnthrottle", &bShowTouchUnthrottle, true);

#if defined(USING_GLES2)
	std::string name = System_GetProperty(SYSPROP_NAME);
	if (KeyMap::HasBuiltinController(name)) {
		control->Get("ShowTouchControls", &bShowTouchControls, false);
	} else {
		control->Get("ShowTouchControls", &bShowTouchControls, true);
	}
#else
	control->Get("ShowTouchControls", &bShowTouchControls, false);
#endif
	// control->Get("KeyMapping",iMappingMap);
#ifdef USING_GLES2
	control->Get("TiltBaseX", &fTiltBaseX, 0);
	control->Get("TiltBaseY", &fTiltBaseY, 0);
	control->Get("InvertTiltX", &bInvertTiltX, false);
	control->Get("InvertTiltY", &bInvertTiltY, true);
	control->Get("TiltSensitivityX", &iTiltSensitivityX, 100);
	control->Get("TiltSensitivityY", &iTiltSensitivityY, 100);
	control->Get("DeadzoneRadius", &fDeadzoneRadius, 0.2);
	control->Get("TiltInputType", &iTiltInputType, 0);

#endif
	control->Get("DisableDpadDiagonals", &bDisableDpadDiagonals, false);
	control->Get("TouchButtonStyle", &iTouchButtonStyle, 1);
	control->Get("TouchButtonOpacity", &iTouchButtonOpacity, 65);
	//set these to -1 if not initialized. initializing these
	//requires pixel coordinates which is not known right now.
	//will be initialized in GamepadEmu::CreatePadLayout
	float defaultScale = 1.15f;
	control->Get("ActionButtonSpacing2", &fActionButtonSpacing, 1.0f);
	control->Get("ActionButtonCenterX", &fActionButtonCenterX, -1.0);
	control->Get("ActionButtonCenterY", &fActionButtonCenterY, -1.0);
	control->Get("ActionButtonScale", &fActionButtonScale, defaultScale);
	control->Get("DPadX", &fDpadX, -1.0);
	control->Get("DPadY", &fDpadY, -1.0);

	// Check for an old dpad setting
	float f;
	control->Get("DPadRadius", &f, 0.0f);
	if (f > 0.0f) {
		ResetControlLayout();
	} else {
		control->Get("DPadScale", &fDpadScale, defaultScale);
		control->Get("DPadSpacing", &fDpadSpacing, 1.0f);
		control->Get("StartKeyX", &fStartKeyX, -1.0);
		control->Get("StartKeyY", &fStartKeyY, -1.0);
		control->Get("StartKeyScale", &fStartKeyScale, defaultScale);
		control->Get("SelectKeyX", &fSelectKeyX, -1.0);
		control->Get("SelectKeyY", &fSelectKeyY, -1.0);
		control->Get("SelectKeyScale", &fSelectKeyScale, defaultScale);
		control->Get("UnthrottleKeyX", &fUnthrottleKeyX, -1.0);
		control->Get("UnthrottleKeyY", &fUnthrottleKeyY, -1.0);
		control->Get("UnthrottleKeyScale", &fUnthrottleKeyScale, defaultScale);
		control->Get("LKeyX", &fLKeyX, -1.0);
		control->Get("LKeyY", &fLKeyY, -1.0);
		control->Get("LKeyScale", &fLKeyScale, defaultScale);
		control->Get("RKeyX", &fRKeyX, -1.0);
		control->Get("RKeyY", &fRKeyY, -1.0);
		control->Get("RKeyScale", &fRKeyScale, defaultScale);
		control->Get("AnalogStickX", &fAnalogStickX, -1.0);
		control->Get("AnalogStickY", &fAnalogStickY, -1.0);
		control->Get("AnalogStickScale", &fAnalogStickScale, defaultScale);
	}

	// MIGRATION: For users who had the old static touch layout, aren't I nice?
	if (fDpadX > 1.0 || fDpadY > 1.0) // Likely the rest are too!
	{
		fActionButtonCenterX /= dp_xres;
		fActionButtonCenterY /= dp_yres;
		fDpadX /= dp_xres;
		fDpadY /= dp_yres;
		fStartKeyX /= dp_xres;
		fStartKeyY /= dp_yres;
		fSelectKeyX /= dp_xres;
		fSelectKeyY /= dp_yres;
		fUnthrottleKeyX /= dp_xres;
		fUnthrottleKeyY /= dp_yres;
		fLKeyX /= dp_xres;
		fLKeyY /= dp_yres;
		fRKeyX /= dp_xres;
		fRKeyY /= dp_yres;
		fAnalogStickX /= dp_xres;
		fAnalogStickY /= dp_yres;
	}

	IniFile::Section *network = iniFile.GetOrCreateSection("Network");
	network->Get("EnableWlan", &bEnableWlan, false);

	IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
	pspConfig->Get("PSPModel", &iPSPModel, PSP_MODEL_SLIM);
	pspConfig->Get("PSPFirmwareVersion", &iFirmwareVersion, PSP_DEFAULT_FIRMWARE);
#if !defined(_M_X64) && !defined(_WIN32) && !defined(__SYMBIAN32__)
	// 32-bit mmap cannot map more than 32MB contiguous
	iPSPModel = PSP_MODEL_FAT;
#endif
	pspConfig->Get("NickName", &sNickName, "PPSSPP");
	pspConfig->Get("proAdhocServer", &proAdhocServer, "localhost");
	pspConfig->Get("MacAddress", &localMacAddress, "01:02:03:04:05:06");
	pspConfig->Get("Language", &iLanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
	pspConfig->Get("TimeFormat", &iTimeFormat, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
	pspConfig->Get("DateFormat", &iDateFormat, PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD);
	pspConfig->Get("TimeZone", &iTimeZone, 0);
	pspConfig->Get("DayLightSavings", &bDayLightSavings, PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD);
	pspConfig->Get("ButtonPreference", &iButtonPreference, PSP_SYSTEMPARAM_BUTTON_CROSS);
	pspConfig->Get("LockParentalLevel", &iLockParentalLevel, 0);
	pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
#if defined(_WIN32) && !defined(USING_QT_UI)
	pspConfig->Get("BypassOSKWithKeyboard", &bBypassOSKWithKeyboard, false);
#endif
	pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
	pspConfig->Get("EncryptSave", &bEncryptSave, true);

	IniFile::Section *debugConfig = iniFile.GetOrCreateSection("Debugger");
	debugConfig->Get("DisasmWindowX", &iDisasmWindowX, -1);
	debugConfig->Get("DisasmWindowY", &iDisasmWindowY, -1);
	debugConfig->Get("DisasmWindowW", &iDisasmWindowW, -1);
	debugConfig->Get("DisasmWindowH", &iDisasmWindowH, -1);
	debugConfig->Get("GEWindowX", &iGEWindowX, -1);
	debugConfig->Get("GEWindowY", &iGEWindowY, -1);
	debugConfig->Get("GEWindowW", &iGEWindowW, -1);
	debugConfig->Get("GEWindowH", &iGEWindowH, -1);
	debugConfig->Get("ConsoleWindowX", &iConsoleWindowX, -1);
	debugConfig->Get("ConsoleWindowY", &iConsoleWindowY, -1);
	debugConfig->Get("FontWidth", &iFontWidth, 8);
	debugConfig->Get("FontHeight", &iFontHeight, 12);
	debugConfig->Get("DisplayStatusBar", &bDisplayStatusBar, true);
	debugConfig->Get("ShowBottomTabTitles",&bShowBottomTabTitles,true);
	debugConfig->Get("ShowDeveloperMenu", &bShowDeveloperMenu, false);
	debugConfig->Get("SkipDeadbeefFilling", &bSkipDeadbeefFilling, false);
	debugConfig->Get("FuncHashMap", &bFuncHashMap, false);

	IniFile::Section *speedhacks = iniFile.GetOrCreateSection("SpeedHacks");
	speedhacks->Get("PrescaleUV", &bPrescaleUV, false);
	speedhacks->Get("DisableAlphaTest", &bDisableAlphaTest, false);

	IniFile::Section *jitConfig = iniFile.GetOrCreateSection("JIT");
	jitConfig->Get("DiscardRegsOnJRRA", &bDiscardRegsOnJRRA, false);

	IniFile::Section *upgrade = iniFile.GetOrCreateSection("Upgrade");
	upgrade->Get("UpgradeMessage", &upgradeMessage, "");
	upgrade->Get("UpgradeVersion", &upgradeVersion, "");
	upgrade->Get("DismissedVersion", &dismissedVersion, "");
	
	if (dismissedVersion == upgradeVersion) {
		upgradeMessage = "";
	}

	// Check for new version on every 5 runs.
	// Sometimes the download may not be finished when the main screen shows (if the user dismisses the
	// splash screen quickly), but then we'll just show the notification next time instead, we store the
	// upgrade number in the ini.
	if (iRunCount % 10 == 0 && bCheckForNewVersion) {
		std::shared_ptr<http::Download> dl = g_DownloadManager.StartDownloadWithCallback(
			"http://www.ppsspp.org/version.json", "", &DownloadCompletedCallback);
		dl->SetHidden(true);
	}

	INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
	bSaveSettings = true;

	IniFile controllerIniFile;
	if (!controllerIniFile.Load(controllerIniFilename_)) {
		ERROR_LOG(LOADER, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str());
		KeyMap::RestoreDefault();
	} else {
		// Continue anyway to initialize the config. It will just restore the defaults.
		KeyMap::LoadFromIni(controllerIniFile);
	}

	CleanRecent();
}
Ejemplo n.º 27
0
void SConfig::LoadCoreSettings(IniFile& ini)
{
  IniFile::Section* core = ini.GetOrCreateSection("Core");

  core->Get("SkipIPL", &bHLE_BS2, true);
#ifdef _M_X86
  core->Get("CPUCore", &iCPUCore, PowerPC::CORE_JIT64);
#elif _M_ARM_64
  core->Get("CPUCore", &iCPUCore, PowerPC::CORE_JITARM64);
#else
  core->Get("CPUCore", &iCPUCore, PowerPC::CORE_INTERPRETER);
#endif
  core->Get("Fastmem", &bFastmem, true);
  core->Get("DSPHLE", &bDSPHLE, true);
  core->Get("TimingVariance", &iTimingVariance, 40);
  core->Get("CPUThread", &bCPUThread, true);
  core->Get("SyncOnSkipIdle", &bSyncGPUOnSkipIdleHack, true);
  core->Get("DefaultISO", &m_strDefaultISO);
  core->Get("EnableCheats", &bEnableCheats, false);
  core->Get("SelectedLanguage", &SelectedLanguage, 0);
  core->Get("OverrideGCLang", &bOverrideGCLanguage, false);
  core->Get("DPL2Decoder", &bDPL2Decoder, false);
  core->Get("AudioLatency", &iLatency, 20);
  core->Get("AudioStretch", &m_audio_stretch, false);
  core->Get("AudioStretchMaxLatency", &m_audio_stretch_max_latency, 80);
  core->Get("MemcardAPath", &m_strMemoryCardA);
  core->Get("MemcardBPath", &m_strMemoryCardB);
  core->Get("AgpCartAPath", &m_strGbaCartA);
  core->Get("AgpCartBPath", &m_strGbaCartB);
  core->Get("SlotA", (int*)&m_EXIDevice[0], ExpansionInterface::EXIDEVICE_MEMORYCARDFOLDER);
  core->Get("SlotB", (int*)&m_EXIDevice[1], ExpansionInterface::EXIDEVICE_NONE);
  core->Get("SerialPort1", (int*)&m_EXIDevice[2], ExpansionInterface::EXIDEVICE_NONE);
  core->Get("BBA_MAC", &m_bba_mac);
  for (int i = 0; i < SerialInterface::MAX_SI_CHANNELS; ++i)
  {
    core->Get(StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i],
              (i == 0) ? SerialInterface::SIDEVICE_GC_CONTROLLER : SerialInterface::SIDEVICE_NONE);
    core->Get(StringFromFormat("AdapterRumble%i", i), &m_AdapterRumble[i], true);
    core->Get(StringFromFormat("SimulateKonga%i", i), &m_AdapterKonga[i], false);
  }
  core->Get("WiiSDCard", &m_WiiSDCard, false);
  core->Get("WiiKeyboard", &m_WiiKeyboard, false);
  core->Get("WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
  core->Get("WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, false);
  core->Get("RunCompareServer", &bRunCompareServer, false);
  core->Get("RunCompareClient", &bRunCompareClient, false);
  core->Get("MMU", &bMMU, bMMU);
  core->Get("BBDumpPort", &iBBDumpPort, -1);
  core->Get("SyncGPU", &bSyncGPU, false);
  core->Get("SyncGpuMaxDistance", &iSyncGpuMaxDistance, 200000);
  core->Get("SyncGpuMinDistance", &iSyncGpuMinDistance, -200000);
  core->Get("SyncGpuOverclock", &fSyncGpuOverclock, 1.0f);
  core->Get("FastDiscSpeed", &bFastDiscSpeed, false);
  core->Get("DCBZ", &bDCBZOFF, false);
  core->Get("LowDCBZHack", &bLowDCBZHack, false);
  core->Get("FPRF", &bFPRF, false);
  core->Get("AccurateNaNs", &bAccurateNaNs, false);
  core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
  core->Get("Overclock", &m_OCFactor, 1.0f);
  core->Get("OverclockEnable", &m_OCEnable, false);
  core->Get("FrameSkip", &m_FrameSkip, 0);
  core->Get("GFXBackend", &m_strVideoBackend, "");
  core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
  core->Get("PerfMapDir", &m_perfDir, "");
  core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
  // Default to seconds between 1.1.1970 and 1.1.2000
  core->Get("CustomRTCValue", &m_customRTCValue, 946684800);
  core->Get("EnableSignatureChecks", &m_enable_signature_checks, true);
}
Ejemplo n.º 28
0
bool InputConfig::LoadConfig(bool isGC)
{
  IniFile inifile;
  bool useProfile[MAX_BBMOTES] = {false, false, false, false, false};
  std::string num[MAX_BBMOTES] = {"1", "2", "3", "4", "BB"};
  std::string profile[MAX_BBMOTES];
  std::string path;

#if defined(ANDROID)
  bool use_ir_config = false;
  std::string ir_values[3];
#endif

  if (SConfig::GetInstance().GetGameID() != "00000000")
  {
    std::string type;
    if (isGC)
    {
      type = "Pad";
      path = "Profiles/GCPad/";
    }
    else
    {
      type = "Wiimote";
      path = "Profiles/Wiimote/";
    }

    IniFile game_ini = SConfig::GetInstance().LoadGameIni();
    IniFile::Section* control_section = game_ini.GetOrCreateSection("Controls");

    for (int i = 0; i < 4; i++)
    {
      if (control_section->Exists(type + "Profile" + num[i]))
      {
        std::string profile_setting;
        if (control_section->Get(type + "Profile" + num[i], &profile_setting))
        {
          auto profiles = InputProfile::GetProfilesFromSetting(
              profile_setting, File::GetUserPath(D_CONFIG_IDX) + path);

          if (profiles.empty())
          {
            // TODO: PanicAlert shouldn't be used for this.
            PanicAlertT("No profiles found for game setting '%s'", profile_setting.c_str());
            continue;
          }

          // Use the first profile by default
          profile[i] = profiles[0];
          useProfile[i] = true;
        }
      }
    }
#if defined(ANDROID)
    // For use on android touchscreen IR pointer
    // Check for IR values
    if (control_section->Exists("IRWidth") && control_section->Exists("IRHeight") &&
        control_section->Exists("IRCenter"))
    {
      use_ir_config = true;
      control_section->Get("IRWidth", &ir_values[0]);
      control_section->Get("IRHeight", &ir_values[1]);
      control_section->Get("IRCenter", &ir_values[2]);
    }
#endif
  }

  if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + m_ini_name + ".ini"))
  {
    int n = 0;
    for (auto& controller : m_controllers)
    {
      IniFile::Section config;
      // Load settings from ini
      if (useProfile[n])
      {
        std::string base;
        SplitPath(profile[n], nullptr, &base, nullptr);
        Core::DisplayMessage("Loading game specific input profile '" + base + "' for device '" +
                                 controller->GetName() + "'",
                             6000);

        IniFile profile_ini;
        profile_ini.Load(profile[n]);
        config = *profile_ini.GetOrCreateSection("Profile");
      }
      else
      {
        config = *inifile.GetOrCreateSection(controller->GetName());
      }
#if defined(ANDROID)
      // Only set for wii pads
      if (!isGC && use_ir_config)
      {
        config.Set("IR/Width", ir_values[0]);
        config.Set("IR/Height", ir_values[1]);
        config.Set("IR/Center", ir_values[2]);
      }
#endif
      controller->LoadConfig(&config);
      // Update refs
      controller->UpdateReferences(g_controller_interface);

      // Next profile
      n++;
    }
    return true;
  }
  else
  {
    m_controllers[0]->LoadDefaults(g_controller_interface);
    m_controllers[0]->UpdateReferences(g_controller_interface);
    return false;
  }
}
Ejemplo n.º 29
0
void SConfig::LoadFifoPlayerSettings(IniFile& ini)
{
  IniFile::Section* fifoplayer = ini.GetOrCreateSection("FifoPlayer");

  fifoplayer->Get("LoopReplay", &bLoopFifoReplay, true);
}
Ejemplo n.º 30
0
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());
		}

		// Need to do this somewhere...
		bFirstRun = false;

		for (size_t i = 0; i < ARRAY_SIZE(sections); ++i) {
			IniFile::Section *section = iniFile.GetOrCreateSection(sections[i].section);
			for (auto setting = sections[i].settings; setting->HasMore(); ++setting) {
				setting->Set(section);
			}
		}

		IniFile::Section *recent = iniFile.GetOrCreateSection("Recent");
		recent->Set("MaxRecent", iMaxRecent);

		for (int i = 0; i < iMaxRecent; i++) {
			char keyName[64];
			sprintf(keyName,"FileName%d",i);
			if (i < (int)recentIsos.size()) {
				recent->Set(keyName, recentIsos[i]);
			} else {
				recent->Delete(keyName); // delete the nonexisting FileName
			}
		}

		IniFile::Section *pinnedPaths = iniFile.GetOrCreateSection("PinnedPaths");
		pinnedPaths->Clear();
		for (size_t i = 0; i < vPinnedPaths.size(); ++i) {
			char keyName[64];
			snprintf(keyName, sizeof(keyName), "Path%d", (int)i);
			pinnedPaths->Set(keyName, vPinnedPaths[i]);
		}

		IniFile::Section *control = iniFile.GetOrCreateSection("Control");
		control->Delete("DPadRadius");

		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());


		IniFile controllerIniFile;
		if (!controllerIniFile.Load(controllerIniFilename_.c_str())) {
			ERROR_LOG(LOADER, "Error saving config - can't read ini %s", controllerIniFilename_.c_str());
		}
		KeyMap::SaveToIni(controllerIniFile);
		if (!controllerIniFile.Save(controllerIniFilename_.c_str())) {
			ERROR_LOG(LOADER, "Error saving config - can't write ini %s", controllerIniFilename_.c_str());
			return;
		}
		INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());

	} else {
		INFO_LOG(LOADER, "Not saving config");
	}
}