예제 #1
0
void WinPostLoad(ConfigFile& conf)
{
	int i;
	if(Settings.DisplayPressedKeys) Settings.DisplayPressedKeys = 2;
	for(i=0;i<8;i++) Joypad[i+8].Enabled = Joypad[i].Enabled;
	if(GUI.MaxRecentGames < 1) GUI.MaxRecentGames = 1;
	if(GUI.MaxRecentGames > MAX_RECENT_GAMES_LIST_SIZE) GUI.MaxRecentGames = MAX_RECENT_GAMES_LIST_SIZE;
    if(GUI.rewindGranularity==0) GUI.rewindGranularity = 1;
	bool gap = false;
	for(i=0;i<MAX_RECENT_GAMES_LIST_SIZE;i++) // remove gaps in recent games list
	{
		if(!*GUI.RecentGames[i])
			gap = true;
		else if(gap)
		{
			memmove(GUI.RecentGames[i-1], GUI.RecentGames[i], MAX_PATH * sizeof(TCHAR));
			*GUI.RecentGames[i] = TEXT('\0');
			gap = false;
			i = -1;
		}
	}
	if(conf.Exists("Sound::Mono")) Settings.Stereo = !conf.GetBool("Sound::Mono"); // special case

	ConfigFile::SetNiceAlignment(niceAlignment);
	ConfigFile::SetShowComments(showComments);
	ConfigFile::SetAlphaSort(configSort==2);
	ConfigFile::SetTimeSort(configSort==1);

	WinPostSave(conf);
}
예제 #2
0
// domaemon: FIXME, just collecting the essentials.
// domaemon: *) here we define the keymapping.
void S9xParseInputConfig (ConfigFile &conf, int pass)
{
	keymaps.clear();
	if (!conf.GetBool("Unix::ClearAllControls", false))
	{
		// Using 'Joypad# Axis'
		keymaps.push_back(strpair_t("J00:Axis0",      "Joypad1 Axis Left/Right T=50%"));
		keymaps.push_back(strpair_t("J00:Axis1",      "Joypad1 Axis Up/Down T=50%"));

		keymaps.push_back(strpair_t("J00:B0",         "Joypad1 X"));
		keymaps.push_back(strpair_t("J00:B1",         "Joypad1 A"));
		keymaps.push_back(strpair_t("J00:B2",         "Joypad1 B"));
		keymaps.push_back(strpair_t("J00:B3",         "Joypad1 Y"));

		keymaps.push_back(strpair_t("J00:B6",         "Joypad1 L"));
		keymaps.push_back(strpair_t("J00:B7",         "Joypad1 R"));
		keymaps.push_back(strpair_t("J00:B8",         "Joypad1 Select"));
		keymaps.push_back(strpair_t("J00:B11",        "Joypad1 Start"));
		keymaps.push_back(strpair_t("K00:SDLK_RIGHT",        "Joypad1 Right"));
		keymaps.push_back(strpair_t("K00:SDLK_LEFT",         "Joypad1 Left"));
		keymaps.push_back(strpair_t("K00:SDLK_DOWN",         "Joypad1 Down"));
		keymaps.push_back(strpair_t("K00:SDLK_UP",           "Joypad1 Up"));
		keymaps.push_back(strpair_t("K00:SDLK_RETURN",       "Joypad1 Start"));
		keymaps.push_back(strpair_t("K00:SDLK_SPACE",        "Joypad1 Select"));
		keymaps.push_back(strpair_t("K00:SDLK_d",            "Joypad1 A"));
		keymaps.push_back(strpair_t("K00:SDLK_c",            "Joypad1 B"));
		keymaps.push_back(strpair_t("K00:SDLK_s",            "Joypad1 X"));
		keymaps.push_back(strpair_t("K00:SDLK_x",            "Joypad1 Y"));
		keymaps.push_back(strpair_t("K00:SDLK_a",            "Joypad1 L"));
		keymaps.push_back(strpair_t("K00:SDLK_z",            "Joypad1 R"));

		// domaemon: *) GetSDLKeyFromName().
		name_sdlkeysym["SDLK_s"] = SDLK_s;
		name_sdlkeysym["SDLK_d"] = SDLK_d;
		name_sdlkeysym["SDLK_x"] = SDLK_x;
		name_sdlkeysym["SDLK_c"] = SDLK_c;
		name_sdlkeysym["SDLK_a"] = SDLK_a;
		name_sdlkeysym["SDLK_z"] = SDLK_z;
		name_sdlkeysym["SDLK_UP"] = SDLK_UP;
		name_sdlkeysym["SDLK_DOWN"] = SDLK_DOWN;
		name_sdlkeysym["SDLK_RIGHT"] = SDLK_RIGHT;
		name_sdlkeysym["SDLK_LEFT"] = SDLK_LEFT;
		name_sdlkeysym["SDLK_RETURN"] = SDLK_RETURN;
		name_sdlkeysym["SDLK_SPACE"] = SDLK_SPACE;
	}

	return;
}
예제 #3
0
파일: snes9x.cpp 프로젝트: 7sevenx7/snes9x
void S9xLoadConfigFiles (char **argv, int argc)
{
	static ConfigFile	conf; // static because some of its functions return pointers
	conf.Clear();

	bool	skip = false;
	for (int i = 0; i < argc; i++)
	{
		if (!strcasecmp(argv[i], "-nostdconf"))
		{
			skip = true;
			break;
		}
	}

	if (!skip)
	{
	#ifdef SYS_CONFIG_FILE
		try_load_config_file(SYS_CONFIG_FILE, conf);
		S9xParsePortConfig(conf, 0);
	#endif

		std::string	fname;

		fname = S9xGetDirectory(DEFAULT_DIR);
		fname += SLASH_STR S9X_CONF_FILE_NAME;
		try_load_config_file(fname.c_str(), conf);
	}
	else
		fprintf(stderr, "Skipping standard config files.\n");

	for (int i = 0; i < argc - 1; i++)
		if (!strcasecmp(argv[i], "-conf"))
			try_load_config_file(argv[++i], conf);

	// Parse config file here

	// ROM

	Settings.ForceInterleaved2          =  conf.GetBool("ROM::Interleaved2",                   false);
	Settings.ForceInterleaveGD24        =  conf.GetBool("ROM::InterleaveGD24",                 false);
	Settings.ApplyCheats                =  conf.GetBool("ROM::Cheat",                          false);
	Settings.NoPatch                    = !conf.GetBool("ROM::Patch",                          true);

	Settings.ForceLoROM = conf.GetBool("ROM::LoROM", false);
	Settings.ForceHiROM = conf.GetBool("ROM::HiROM", false);
	if (Settings.ForceLoROM)
		Settings.ForceHiROM = false;

	Settings.ForcePAL   = conf.GetBool("ROM::PAL",  false);
	Settings.ForceNTSC  = conf.GetBool("ROM::NTSC", false);
	if (Settings.ForcePAL)
		Settings.ForceNTSC = false;

	if (conf.Exists("ROM::Header"))
	{
		Settings.ForceHeader = conf.GetBool("ROM::Header", false);
		Settings.ForceNoHeader = !Settings.ForceHeader;
	}

	if (conf.Exists("ROM::Interleaved"))
	{
		Settings.ForceInterleaved = conf.GetBool("ROM::Interleaved", false);
		Settings.ForceNotInterleaved = !Settings.ForceInterleaved;
	}

	rom_filename = conf.GetStringDup("ROM::Filename", NULL);

	// Sound

	Settings.SoundSync                  =  conf.GetBool("Sound::Sync",                         true);
	Settings.SixteenBitSound            =  conf.GetBool("Sound::16BitSound",                   true);
	Settings.Stereo                     =  conf.GetBool("Sound::Stereo",                       true);
	Settings.ReverseStereo              =  conf.GetBool("Sound::ReverseStereo",                false);
	Settings.SoundPlaybackRate          =  conf.GetUInt("Sound::Rate",                         32000);
	Settings.SoundInputRate             =  conf.GetUInt("Sound::InputRate",                    32000);
	Settings.Mute                       =  conf.GetBool("Sound::Mute",                         false);

	// Display

	Settings.SupportHiRes               =  conf.GetBool("Display::HiRes",                      true);
	Settings.Transparency               =  conf.GetBool("Display::Transparency",               true);
	Settings.DisableGraphicWindows      = !conf.GetBool("Display::GraphicWindows",             true);
	Settings.DisplayFrameRate           =  conf.GetBool("Display::DisplayFrameRate",           false);
	Settings.DisplayWatchedAddresses    =  conf.GetBool("Display::DisplayWatchedAddresses",    false);
	Settings.DisplayPressedKeys         =  conf.GetBool("Display::DisplayInput",               false);
	Settings.DisplayMovieFrame          =  conf.GetBool("Display::DisplayFrameCount",          false);
	Settings.AutoDisplayMessages        =  conf.GetBool("Display::MessagesInImage",            true);
	Settings.InitialInfoStringTimeout   =  conf.GetInt ("Display::MessageDisplayTime",         120);

	// Settings

	Settings.BSXBootup                  =  conf.GetBool("Settings::BSXBootup",                 false);
	Settings.TurboMode                  =  conf.GetBool("Settings::TurboMode",                 false);
	Settings.TurboSkipFrames            =  conf.GetUInt("Settings::TurboFrameSkip",            15);
	Settings.MovieTruncate              =  conf.GetBool("Settings::MovieTruncateAtEnd",        false);
	Settings.MovieNotifyIgnored         =  conf.GetBool("Settings::MovieNotifyIgnored",        false);
	Settings.WrongMovieStateProtection  =  conf.GetBool("Settings::WrongMovieStateProtection", true);
	Settings.StretchScreenshots         =  conf.GetInt ("Settings::StretchScreenshots",        1);
	Settings.SnapshotScreenshots        =  conf.GetBool("Settings::SnapshotScreenshots",       true);
	Settings.DontSaveOopsSnapshot       =  conf.GetBool("Settings::DontSaveOopsSnapshot",      false);
	Settings.AutoSaveDelay              =  conf.GetUInt("Settings::AutoSaveDelay",             0);

	if (conf.Exists("Settings::FrameTime"))
		Settings.FrameTimePAL = Settings.FrameTimeNTSC = conf.GetUInt("Settings::FrameTime", 16667);

	if (!strcasecmp(conf.GetString("Settings::FrameSkip", "Auto"), "Auto"))
		Settings.SkipFrames = AUTO_FRAMERATE;
	else
		Settings.SkipFrames = conf.GetUInt("Settings::FrameSkip", 0) + 1;

	// Controls

	Settings.MouseMaster                =  conf.GetBool("Controls::MouseMaster",               true);
	Settings.SuperScopeMaster           =  conf.GetBool("Controls::SuperscopeMaster",          true);
	Settings.JustifierMaster            =  conf.GetBool("Controls::JustifierMaster",           true);
	Settings.MultiPlayer5Master         =  conf.GetBool("Controls::MP5Master",                 true);
	Settings.UpAndDown                  =  conf.GetBool("Controls::AllowLeftRight",            false);

	if (conf.Exists("Controls::Port1"))
		parse_controller_spec(0, conf.GetString("Controls::Port1"));
	if (conf.Exists("Controls::Port2"))
		parse_controller_spec(1, conf.GetString("Controls::Port2"));

	if (conf.Exists("Controls::Mouse1Crosshair"))
		parse_crosshair_spec(X_MOUSE1,     conf.GetString("Controls::Mouse1Crosshair"));
	if (conf.Exists("Controls::Mouse2Crosshair"))
		parse_crosshair_spec(X_MOUSE2,     conf.GetString("Controls::Mouse2Crosshair"));
	if (conf.Exists("Controls::SuperscopeCrosshair"))
		parse_crosshair_spec(X_SUPERSCOPE, conf.GetString("Controls::SuperscopeCrosshair"));
	if (conf.Exists("Controls::Justifier1Crosshair"))
		parse_crosshair_spec(X_JUSTIFIER1, conf.GetString("Controls::Justifier1Crosshair"));
	if (conf.Exists("Controls::Justifier2Crosshair"))
		parse_crosshair_spec(X_JUSTIFIER2, conf.GetString("Controls::Justifier2Crosshair"));

	// Hack

	Settings.DisableGameSpecificHacks       = !conf.GetBool("Hack::EnableGameSpecificHacks",       true);
	Settings.BlockInvalidVRAMAccessMaster   = !conf.GetBool("Hack::AllowInvalidVRAMAccess",        false);
	Settings.HDMATimingHack                 =  conf.GetInt ("Hack::HDMATiming",                    100);

	// Netplay

#ifdef NETPLAY_SUPPORT
	Settings.NetPlay = conf.GetBool("Netplay::Enable");

	Settings.Port = NP_DEFAULT_PORT;
	if (conf.Exists("Netplay::Port"))
		Settings.Port = -(int) conf.GetUInt("Netplay::Port");

	Settings.ServerName[0] = '\0';
	if (conf.Exists("Netplay::Server"))
		conf.GetString("Netplay::Server", Settings.ServerName, 128);
#endif

	// Debug

#ifdef DEBUGGER
	if (conf.GetBool("DEBUG::Debugger", false))
		CPU.Flags |= DEBUG_MODE_FLAG;

	if (conf.GetBool("DEBUG::Trace", false))
	{
		ENSURE_TRACE_OPEN(trace,"trace.log","wb")
		CPU.Flags |= TRACE_FLAG;
	}
#endif

	S9xParsePortConfig(conf, 1);
	S9xVerifyControllers();
}
예제 #4
0
bool CCGShader::LoadShader(const char *path)
{
	ConfigFile conf;
	int shaderCount;
	char keyName[100];

	shaderPasses.clear();
	lookupTextures.clear();

	if(strlen(path)<4 || strcasecmp(&path[strlen(path)-4],".cgp")) {
		shaderPass pass;
		pass.scaleParams.scaleTypeX = CG_SCALE_NONE;
		pass.scaleParams.scaleTypeY = CG_SCALE_NONE;
		pass.linearFilter = false;
		pass.filterSet = false;
		strcpy(pass.cgShaderFile,path);
		shaderPasses.push_back(pass);
		return true;
	} else {
		conf.LoadFile(path);
	}	

	shaderCount = conf.GetInt("::shaders",0);

	if(shaderCount<1)
		return false;

	for(int i=0;i<shaderCount;i++) {
		shaderPass pass;
		sprintf(keyName,"::filter_linear%u",i);
		pass.linearFilter = conf.GetBool(keyName);
		pass.filterSet = conf.Exists(keyName);

		sprintf(keyName,"::scale_type%u",i);
		const char *scaleType = conf.GetString(keyName,"");
		if(!strcasecmp(scaleType,"")) {
			sprintf(keyName,"::scale_type_x%u",i);
			const char *scaleTypeX = conf.GetString(keyName,"");
			if(*scaleTypeX=='\0' && (i!=(shaderCount-1)))
				scaleTypeX = "source";
			pass.scaleParams.scaleTypeX = scaleStringToEnum(scaleTypeX);
			sprintf(keyName,"::scale_type_y%u",i);
			const char *scaleTypeY = conf.GetString(keyName,"");
			if(*scaleTypeY=='\0' && (i!=(shaderCount-1)))
				scaleTypeY = "source";
			pass.scaleParams.scaleTypeY = scaleStringToEnum(scaleTypeY);
		} else {
			cgScaleType sType = scaleStringToEnum(scaleType);
			pass.scaleParams.scaleTypeX = sType;
			pass.scaleParams.scaleTypeY = sType;
		}

		sprintf(keyName,"::scale%u",i);
		const char *scaleFloat = conf.GetString(keyName,"");
		int scaleInt = conf.GetInt(keyName,0);
		if(!strcasecmp(scaleFloat,"")) {
			sprintf(keyName,"::scalex%u",i);
			const char *scaleFloatX = conf.GetString(keyName,"1.0");
			pass.scaleParams.scaleX = atof(scaleFloatX);
			pass.scaleParams.absX = conf.GetInt(keyName,1);
			sprintf(keyName,"::scaley%u",i);
			const char *scaleFloatY = conf.GetString(keyName,"1.0");
			pass.scaleParams.scaleY = atof(scaleFloatY);
			pass.scaleParams.absY = conf.GetInt(keyName,1);

		} else {
			float floatval = atof(scaleFloat);
			pass.scaleParams.scaleX = floatval;
			pass.scaleParams.absX = scaleInt;
			pass.scaleParams.scaleY = floatval;
			pass.scaleParams.absY = scaleInt;
		}

		sprintf(keyName,"::shader%u",i);
		strcpy(pass.cgShaderFile,conf.GetString(keyName,""));
		shaderPasses.push_back(pass);
	}

	char *shaderIds = conf.GetStringDup("::textures","");

	char *id = strtok(shaderIds,";");
	while(id!=NULL) {
		lookupTexture tex;
		sprintf(keyName,"::%s",id);
		strcpy(tex.id,id);
		strcpy(tex.texturePath,conf.GetString(keyName,""));
		sprintf(keyName,"::%s_linear",id);
		tex.linearfilter = conf.GetBool(keyName,true);
		lookupTextures.push_back(tex);
		id = strtok(NULL,";");
	}

	free(shaderIds);

	return true;
}
예제 #5
0
	void Get(ConfigFile& conf) {
		switch(type)
		{
			case CIT_BOOL:
			case CIT_BOOLONOFF:
				if(size	== 1) *(uint8 *)addr = (uint8) conf.GetBool(name, def!=0);
				if(size	== 2) *(uint16*)addr = (uint16)conf.GetBool(name, def!=0);
				if(size	== 4) *(uint32*)addr = (uint32)conf.GetBool(name, def!=0);
				if(size	== 8) *(uint64*)addr = (uint64)conf.GetBool(name, def!=0);
				break;
			case CIT_INT:
				if(size	== 1) *(uint8 *)addr = (uint8) conf.GetInt(name, reinterpret_cast<int32>(def));
				if(size	== 2) *(uint16*)addr = (uint16)conf.GetInt(name, reinterpret_cast<int32>(def));
				if(size	== 4) *(uint32*)addr = (uint32)conf.GetInt(name, reinterpret_cast<int32>(def));
				if(size	== 8) *(uint64*)addr = (uint64)conf.GetInt(name, reinterpret_cast<int32>(def));
				break;
			case CIT_UINT:
				if(size	== 1) *(uint8 *)addr = (uint8) conf.GetUInt(name, reinterpret_cast<uint32>(def));
				if(size	== 2) *(uint16*)addr = (uint16)conf.GetUInt(name, reinterpret_cast<uint32>(def));
				if(size	== 4) *(uint32*)addr = (uint32)conf.GetUInt(name, reinterpret_cast<uint32>(def));
				if(size	== 8) *(uint64*)addr = (uint64)conf.GetUInt(name, reinterpret_cast<uint32>(def));
				break;
			case CIT_STRING:
				lstrcpyn((TCHAR*)addr, _tFromChar(conf.GetString(name, reinterpret_cast<const char*>(def))), size-1);
				((TCHAR*)addr)[size-1] = TEXT('\0');
				break;
			case CIT_INVBOOL:
			case CIT_INVBOOLONOFF:
				if(size	== 1) *(uint8 *)addr = (uint8) !conf.GetBool(name, def!=0);
				if(size	== 2) *(uint16*)addr = (uint16)!conf.GetBool(name, def!=0);
				if(size	== 4) *(uint32*)addr = (uint32)!conf.GetBool(name, def!=0);
				if(size	== 8) *(uint64*)addr = (uint64)!conf.GetBool(name, def!=0);
				break;
			case CIT_VKEY:
				{
					uint16 keyNum = (uint16)conf.GetUInt(name, reinterpret_cast<uint32>(def));
					const char* keyStr = conf.GetString(name);
					if(keyStr)
					{
						for(int i=0;i<512;i++)
						{
							if(i<256) // keys
							{
								if(!strcasecmp(keyStr,keyToString[i]) ||
								(*keyToAlternateString[i] && !strcasecmp(keyStr,keyToAlternateString[i])))
								{
									keyNum = i;
									break;
								}
							}
							else // joystick:
							{
								char temp [128];
								extern void TranslateKey(WORD keyz,char *out);
								TranslateKey(0x8000|(i-256),temp);
								if(strlen(keyStr)>3 && !strcasecmp(keyStr+3,temp+3))
								{
									for(int j = 0 ; j < 16 ; j++)
									{
										if(keyStr[2]-'0' == j || keyStr[2]-'a' == j-10)
										{
											keyNum = 0x8000|(i-256)|(j<<8);
											i = 512;
											break;
										}
									}
								}
							}
						}
					}
					if(size	== 1) *(uint8 *)addr = (uint8) keyNum;
					if(size	== 2) *(uint16*)addr = (uint16)keyNum;
					if(size	== 4) *(uint32*)addr = (uint32)keyNum;
					if(size	== 8) *(uint64*)addr = (uint64)keyNum;
				}
				break;
			case CIT_VKEYMOD:
				{
					uint16 modNum = 0;
					const char* modStr = conf.GetString(name);
					if(modStr) {
						if(strstr(modStr, "ft") || strstr(modStr, "FT")) modNum |= CUSTKEY_SHIFT_MASK;
						if(strstr(modStr, "tr") || strstr(modStr, "TR")) modNum |= CUSTKEY_CTRL_MASK;
						if(strstr(modStr, "lt") || strstr(modStr, "LT")) modNum |= CUSTKEY_ALT_MASK;
					}
					if(!modNum && (!modStr || strcasecmp(modStr, "none")))
						modNum = conf.GetUInt(name, reinterpret_cast<uint32>(def));
					if(size	== 1) *(uint8 *)addr = (uint8) modNum;
					if(size	== 2) *(uint16*)addr = (uint16)modNum;
					if(size	== 4) *(uint32*)addr = (uint32)modNum;
					if(size	== 8) *(uint64*)addr = (uint64)modNum;
				}
				break;
		}

		// if it had a comment, override our own with it
		const char* newComment = conf.GetComment(name);
		if(newComment && *newComment)
			comment = newComment;
	}
예제 #6
0
void Emulator_Implementation_ButtonMappingSettings(int map_button_option_enum)
{
	switch(map_button_option_enum)
	{
		case MAP_BUTTONS_OPTION_SETTER:
			currentconfig.SetInt("PS3ButtonMappings::DPad_Up",Settings.DPad_Up);
			currentconfig.SetInt("PS3ButtonMappings::DPad_Down",Settings.DPad_Down);
			currentconfig.SetInt("PS3ButtonMappings::DPad_Left",Settings.DPad_Left);
			currentconfig.SetInt("PS3ButtonMappings::DPad_Right",Settings.DPad_Right);
			currentconfig.SetInt("PS3ButtonMappings::ButtonCircle",Settings.ButtonCircle);
			currentconfig.SetInt("PS3ButtonMappings::ButtonCross",Settings.ButtonCross);
			currentconfig.SetInt("PS3ButtonMappings::ButtonTriangle",Settings.ButtonTriangle);
			currentconfig.SetInt("PS3ButtonMappings::ButtonSquare",Settings.ButtonSquare);
			currentconfig.SetInt("PS3ButtonMappings::ButtonSelect",Settings.ButtonSelect);
			currentconfig.SetInt("PS3ButtonMappings::ButtonStart",Settings.ButtonStart);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL1",Settings.ButtonL1);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR1",Settings.ButtonR1);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2",Settings.ButtonL2);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2",Settings.ButtonR2);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonL3",Settings.ButtonL2_ButtonL3);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonR3",Settings.ButtonL2_ButtonR3);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR3",Settings.ButtonR3);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL3",Settings.ButtonL3);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_ButtonR2",Settings.ButtonL2_ButtonR2);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Right",Settings.ButtonL2_AnalogR_Right);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Left",Settings.ButtonL2_AnalogR_Left);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Up",Settings.ButtonL2_AnalogR_Up);
			currentconfig.SetInt("PS3ButtonMappings::ButtonL2_AnalogR_Down",Settings.ButtonL2_AnalogR_Down);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Right",Settings.ButtonR2_AnalogR_Right);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Left",Settings.ButtonR2_AnalogR_Left);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Up",Settings.ButtonR2_AnalogR_Up);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2_AnalogR_Down",Settings.ButtonR2_AnalogR_Down);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR2_ButtonR3",Settings.ButtonR2_ButtonR3);
			currentconfig.SetInt("PS3ButtonMappings::ButtonR3_ButtonL3",Settings.ButtonR3_ButtonL3);
			currentconfig.SetInt("PS3ButtonMappings::AnalogR_Up",Settings.AnalogR_Up);
			currentconfig.SetInt("PS3ButtonMappings::AnalogR_Down",Settings.AnalogR_Down);
			currentconfig.SetInt("PS3ButtonMappings::AnalogR_Left",Settings.AnalogR_Left);
			currentconfig.SetInt("PS3ButtonMappings::AnalogR_Right",Settings.AnalogR_Right);

			currentconfig.SetBool("PS3ButtonMappings::AnalogR_Up_Type",Settings.AnalogR_Up_Type);
			currentconfig.SetBool("PS3ButtonMappings::AnalogR_Down_Type",Settings.AnalogR_Down_Type);
			currentconfig.SetBool("PS3ButtonMappings::AnalogR_Left_Type",Settings.AnalogR_Left_Type);
			currentconfig.SetBool("PS3ButtonMappings::AnalogR_Right_Type",Settings.AnalogR_Right_Type);
			break;
		case MAP_BUTTONS_OPTION_GETTER:
			Settings.DPad_Up		= currentconfig.GetInt("PS3ButtonMappings::DPad_Up",BTN_UP);
			Settings.DPad_Down		= currentconfig.GetInt("PS3ButtonMappings::DPad_Down",BTN_DOWN);
			Settings.DPad_Left		= currentconfig.GetInt("PS3ButtonMappings::DPad_Left",BTN_LEFT);
			Settings.DPad_Right		= currentconfig.GetInt("PS3ButtonMappings::DPad_Right",BTN_RIGHT);
			Settings.ButtonCircle		= currentconfig.GetInt("PS3ButtonMappings::ButtonCircle",BTN_A);
			Settings.ButtonCross		= currentconfig.GetInt("PS3ButtonMappings::ButtonCross",BTN_B);
			Settings.ButtonTriangle		= currentconfig.GetInt("PS3ButtonMappings::ButtonTriangle",BTN_NONE);
			Settings.ButtonSquare		= currentconfig.GetInt("PS3ButtonMappings::ButtonSquare",BTN_NONE);
			Settings.ButtonSelect		= currentconfig.GetInt("PS3ButtonMappings::ButtonSelect",BTN_SELECT);
			Settings.ButtonStart		= currentconfig.GetInt("PS3ButtonMappings::ButtonStart",BTN_START);
			Settings.ButtonL1		= currentconfig.GetInt("PS3ButtonMappings::ButtonL1",BTN_NONE);
			Settings.ButtonR1		= currentconfig.GetInt("PS3ButtonMappings::ButtonR1",BTN_NONE);
			Settings.ButtonL2		= currentconfig.GetInt("PS3ButtonMappings::ButtonL2",BTN_NONE);
			Settings.ButtonR2		= currentconfig.GetInt("PS3ButtonMappings::ButtonR2",BTN_NONE);
			Settings.ButtonL2_ButtonL3	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonL3",BTN_NONE);
			Settings.ButtonL2_ButtonR3	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonR3",BTN_QUICKLOAD);
			Settings.ButtonR3		= currentconfig.GetInt("PS3ButtonMappings::ButtonR3",BTN_NONE);
			Settings.ButtonL3		= currentconfig.GetInt("PS3ButtonMappings::ButtonL3",BTN_NONE);
			Settings.ButtonL2_ButtonR2	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_ButtonR2",BTN_NONE);
			Settings.ButtonL2_AnalogR_Right = currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Right",BTN_INCREMENTCHEAT);
			Settings.ButtonL2_AnalogR_Left	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Left",BTN_DECREMENTCHEAT);
			Settings.ButtonL2_AnalogR_Up	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Up",BTN_NONE);
			Settings.ButtonL2_AnalogR_Down	= currentconfig.GetInt("PS3ButtonMappings::ButtonL2_AnalogR_Down",BTN_NONE);
			Settings.ButtonR2_AnalogR_Right	= currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Right",BTN_NONE);
			Settings.ButtonR2_AnalogR_Left	= currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Left",BTN_NONE);
			Settings.ButtonR2_AnalogR_Up	= currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Up",BTN_NONE);
			Settings.ButtonR2_AnalogR_Down	= currentconfig.GetInt("PS3ButtonMappings::ButtonR2_AnalogR_Down",BTN_NONE);
			Settings.ButtonR2_ButtonR3	= currentconfig.GetInt("PS3ButtonMappings::ButtonR2_ButtonR3",BTN_QUICKSAVE);
			Settings.ButtonR3_ButtonL3	= currentconfig.GetInt("PS3ButtonMappings::ButtonR3_ButtonL3",BTN_EXITTOMENU);
			Settings.AnalogR_Up		= currentconfig.GetInt("PS3ButtonMappings::AnalogR_Up",BTN_CHEATENABLE);
			Settings.AnalogR_Down		= currentconfig.GetInt("PS3ButtonMappings::AnalogR_Down",BTN_NONE);
			Settings.AnalogR_Left		= currentconfig.GetInt("PS3ButtonMappings::AnalogR_Left",BTN_DECREMENTSAVE);
			Settings.AnalogR_Right		= currentconfig.GetInt("PS3ButtonMappings::AnalogR_Right",BTN_INCREMENTSAVE);

			Settings.AnalogR_Up_Type	= currentconfig.GetBool("PS3ButtonMappings::AnalogR_Up_Type",false);
			Settings.AnalogR_Down_Type	= currentconfig.GetBool("PS3ButtonMappings::AnalogR_Down_Type",false);
			Settings.AnalogR_Left_Type	= currentconfig.GetBool("PS3ButtonMappings::AnalogR_Left_Type",false);
			Settings.AnalogR_Right_Type	= currentconfig.GetBool("PS3ButtonMappings::AnalogR_Right_Type",false);
			break;
		case MAP_BUTTONS_OPTION_DEFAULT:
			Settings.DPad_Up			= BTN_UP;
			Settings.DPad_Down			= BTN_DOWN;
			Settings.DPad_Left			= BTN_LEFT;
			Settings.DPad_Right			= BTN_RIGHT;
			Settings.ButtonCircle			= BTN_A;
			Settings.ButtonCross			= BTN_B;
			Settings.ButtonTriangle			= BTN_NONE;
			Settings.ButtonSquare			= BTN_NONE;
			Settings.ButtonSelect			= BTN_SELECT;
			Settings.ButtonStart			= BTN_START;
			Settings.ButtonL1			= BTN_NONE;
			Settings.ButtonR1			= BTN_NONE;
			Settings.ButtonL2			= BTN_NONE;
			Settings.ButtonR2			= BTN_NONE;
			Settings.ButtonL2_ButtonL3		= BTN_NONE;
			Settings.ButtonL2_ButtonR3		= BTN_QUICKLOAD;	
			Settings.ButtonR3			= BTN_NONE;
			Settings.ButtonL3			= BTN_NONE;
			Settings.ButtonL2_ButtonR2		= BTN_NONE;
			Settings.ButtonL2_AnalogR_Right		= BTN_INCREMENTCHEAT;
			Settings.ButtonL2_AnalogR_Left		= BTN_DECREMENTCHEAT;
			Settings.ButtonL2_AnalogR_Up		= BTN_NONE;
			Settings.ButtonL2_AnalogR_Down		= BTN_NONE;
			Settings.ButtonR2_AnalogR_Right		= BTN_NONE;
			Settings.ButtonR2_AnalogR_Left		= BTN_NONE;
			Settings.ButtonR2_AnalogR_Up		= BTN_NONE;
			Settings.ButtonR2_AnalogR_Down		= BTN_NONE;
			Settings.ButtonR2_ButtonR3		= BTN_QUICKSAVE;
			Settings.ButtonR3_ButtonL3		= BTN_EXITTOMENU;
			Settings.AnalogR_Up			= BTN_CHEATENABLE;
			Settings.AnalogR_Down			= BTN_NONE;
			Settings.AnalogR_Left			= BTN_DECREMENTSAVE;
			Settings.AnalogR_Right			= BTN_INCREMENTSAVE;
			Settings.AnalogR_Up_Type		= false;
			Settings.AnalogR_Down_Type		= false;
			Settings.AnalogR_Left_Type		= false;
			Settings.AnalogR_Right_Type		= false;
			break;
		case MAP_BUTTONS_OPTION_NEW:
			Input_MapButton(&Settings.DPad_Up,false,BTN_UP);
			Input_MapButton(&Settings.DPad_Down,false,BTN_DOWN);
			Input_MapButton(&Settings.DPad_Left,false,BTN_LEFT);
			Input_MapButton(&Settings.DPad_Right,false,BTN_RIGHT);
			Input_MapButton(&Settings.ButtonCircle,false,BTN_A);
			Input_MapButton(&Settings.ButtonCross,false,BTN_B);
			Input_MapButton(&Settings.ButtonTriangle,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonSquare,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonSelect,false,BTN_SELECT);
			Input_MapButton(&Settings.ButtonStart,false,BTN_START);
			Input_MapButton(&Settings.ButtonL1,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL2,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonR2,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL3,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonR3,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonR1,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL2_ButtonL3,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL2_ButtonR2,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL2_ButtonR3,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonR2_ButtonR3,false,BTN_NONE);
			Input_MapButton(&Settings.AnalogR_Up,false,BTN_NONE);
			Input_MapButton(&Settings.AnalogR_Down,false,BTN_NONE);
			Input_MapButton(&Settings.AnalogR_Left,false,BTN_NONE);
			Input_MapButton(&Settings.AnalogR_Right,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonL2_AnalogR_Right,false,BTN_INCREMENTCHEAT);
			Input_MapButton(&Settings.ButtonL2_AnalogR_Left,false,BTN_DECREMENTCHEAT);
			Input_MapButton(&Settings.ButtonL2_AnalogR_Up,false,BTN_CHEATENABLE);
			Input_MapButton(&Settings.ButtonL2_AnalogR_Down,false,BTN_NONE);
			Input_MapButton(&Settings.ButtonR2_AnalogR_Right,false,BTN_INCREMENTSAVE);
			Input_MapButton(&Settings.ButtonR2_AnalogR_Left,false,BTN_DECREMENTSAVE);
			Input_MapButton(&Settings.ButtonR2_AnalogR_Up,false,BTN_QUICKLOAD);
			Input_MapButton(&Settings.ButtonR2_AnalogR_Down,false,BTN_QUICKSAVE);
			Input_MapButton(&Settings.ButtonR3_ButtonL3,false,BTN_EXITTOMENU);
			Settings.AnalogR_Up_Type = 0;
			Settings.AnalogR_Down_Type = 0;
			Settings.AnalogR_Left_Type = 0;
			Settings.AnalogR_Right_Type = 0;
			break;
	}
}
예제 #7
0
bool Emulator_Implementation_InitSettings()
{
	LOG_DBG("Emulator_Implementation_InitSettings()");

	memset((&Settings), 0, (sizeof(Settings)));

	currentconfig.Clear();

	#ifdef SYS_CONFIG_FILE
		try_load_config_file(SYS_CONFIG_FILE, currentconfig);
	#endif

	//PS3 - General settings	
	if (currentconfig.Exists("PS3General::KeepAspect"))
	{
		Settings.PS3KeepAspect		=	currentconfig.GetBool("PS3General::KeepAspect");
	}
	else
	{
		Settings.PS3KeepAspect		=	true;
	}

	if (currentconfig.Exists("PS3General::Smooth"))
	{
		Settings.PS3Smooth		=	currentconfig.GetBool("PS3General::Smooth");
	}
	else
	{
		Settings.PS3Smooth		=	false;
	}

	if (currentconfig.Exists("PS3General::OverscanEnabled"))
	{
		Settings.PS3OverscanEnabled	= currentconfig.GetBool("PS3General::OverscanEnabled");
	}
	else
	{
		Settings.PS3OverscanEnabled	= false;
	}
	if (currentconfig.Exists("PS3General::OverscanAmount"))
	{
		Settings.PS3OverscanAmount	= currentconfig.GetInt("PS3General::OverscanAmount");
	}
	else
	{
		Settings.PS3OverscanAmount	= 0;
	}

	if (currentconfig.Exists("FCEU::Controlstyle"))
	{
		Settings.FCEUControlstyle = currentconfig.GetInt("FCEU::Controlstyle");
		control_style = (ControlStyle)(((int)Settings.FCEUControlstyle));
	}
	else
	{
		Settings.FCEUControlstyle = CONTROL_STYLE_ORIGINAL;
		control_style = CONTROL_STYLE_ORIGINAL;
	}

	if (currentconfig.Exists("FCEU::DisableSpriteLimitation"))
	{
		Settings.FCEUDisableSpriteLimitation = currentconfig.GetBool("FCEU::DisableSpriteLimitation");
		FCEUI_DisableSpriteLimitation(Settings.FCEUDisableSpriteLimitation);
	}
	else
	{
		Settings.FCEUDisableSpriteLimitation = false;
	}

	if (currentconfig.Exists("PS3General::PS3CurrentShader"))
	{
		Settings.PS3CurrentShader.assign(currentconfig.GetString("PS3General::PS3CurrentShader"));
	}
	else
	{
		Settings.PS3CurrentShader.assign(DEFAULT_SHADER_FILE);
	}

	if (currentconfig.Exists("PS3General::PS3CurrentResolution"))
	{
		Settings.PS3CurrentResolution = currentconfig.GetInt("PS3General::PS3CurrentResolution");
	}
	else
	{
		Settings.PS3CurrentResolution = NULL;
	}

	if (currentconfig.Exists("FCEU::GameGenie"))
	{
		Settings.FCEUGameGenie = currentconfig.GetBool("FCEU::GameGenie");
		FCEUI_SetGameGenie(Settings.FCEUGameGenie);
	}
	else
	{
		Settings.FCEUGameGenie = false;
	}
	FCEUI_SetGameGenie(Settings.FCEUGameGenie);
	if (currentconfig.Exists("PS3General::PS3PALTemporalMode60Hz"))
	{
		Settings.PS3PALTemporalMode60Hz = currentconfig.GetBool("PS3General::PS3PALTemporalMode60Hz");
	}
	else
	{
		Settings.PS3PALTemporalMode60Hz = false;
	}
	//RSound Settings
	if(currentconfig.Exists("RSound::RSoundEnabled"))
	{
		Settings.RSoundEnabled		= currentconfig.GetBool("RSound::RSoundEnabled");
	}
	else
	{
		Settings.RSoundEnabled		= false;
	}
	if(currentconfig.Exists("RSound::RSoundServerIPAddress"))
	{
		Settings.RSoundServerIPAddress	= currentconfig.GetString("RSound::RSoundServerIPAddress");
	}
	else
	{
		Settings.RSoundServerIPAddress = "0.0.0.0";
	}
	if(currentconfig.Exists("PS3General::Throttled"))
	{
		Settings.Throttled		= currentconfig.GetInt("PS3General::Throttled");
	}
	else
	{
		Settings.Throttled		= 1;
	}
	// PS3 Path Settings
	if (currentconfig.Exists("PS3Paths::PathSaveStates"))
	{
		Settings.PS3PathSaveStates		= currentconfig.GetString("PS3Paths::PathSaveStates");
	}
	else
	{
		Settings.PS3PathSaveStates		= USRDIR;
	}
	
	if (currentconfig.Exists("PS3Paths::PathSRAM"))
	{
		Settings.PS3PathSRAM		= currentconfig.GetString("PS3Paths::PathSRAM");
	}
	else
	{
		Settings.PS3PathSRAM		= USRDIR;
	}

	if (currentconfig.Exists("PS3Paths::PathCheats"))
	{
		Settings.PS3PathCheats		= currentconfig.GetString("PS3Paths::PathCheats");
	}
	else
	{
		Settings.PS3PathCheats		= USRDIR;
	}
	
	if (currentconfig.Exists("PS3Paths::PathScreenshots"))
	{
		Settings.PS3PathScreenshots		= currentconfig.GetString("PS3Paths::PathScreenshots");
	}
	else
	{
		Settings.PS3PathScreenshots		= USRDIR;
	}
	
	if (currentconfig.Exists("PS3Paths::PathROMDirectory"))
	{
		Settings.PS3PathROMDirectory		= currentconfig.GetString("PS3Paths::PathROMDirectory");
	}
	else
	{
		Settings.PS3PathROMDirectory		= "/";
	}
	if (currentconfig.Exists("PS3Paths::BaseDirectory"))
	{
		Settings.PS3PathBaseDirectory		= currentconfig.GetString("PS3Paths::PathBaseDirectory");
	}
	else
	{
		Settings.PS3PathBaseDirectory		= USRDIR;
	}
	if (currentconfig.Exists("PS3General::ControlScheme"))
	{
		Settings.ControlScheme = currentconfig.GetInt("PS3General::ControlScheme");
	}
	else
	{
		Settings.ControlScheme = CONTROL_SCHEME_DEFAULT;
	}
	Emulator_Implementation_SwitchControlScheme();

	LOG_DBG("SUCCESS - Emulator_Implementation_InitSettings()");
	return true;
}