示例#1
0
文件: KeyMap.cpp 项目: KrisLee/ppsspp
// Note that it's easy to add other defaults if desired.
void RestoreDefault() {
	g_controllerMap.clear();
#if defined(_WIN32)
	SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
	SetDefaultKeyMap(DEFAULT_MAPPING_X360, false);
	SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#elif defined(ANDROID)
	// Autodetect a few common devices
	std::string name = System_GetName();
	if (name == "NVIDIA:SHIELD") {
		SetDefaultKeyMap(DEFAULT_MAPPING_SHIELD, true);
	} else if (name == "OUYA:OUYA Console") {  // TODO: check!
		SetDefaultKeyMap(DEFAULT_MAPPING_OUYA, true);
	} else if (name == "Sony Ericsson:R800i" || name == "Sony Ericsson:zeus") {
		SetDefaultKeyMap(DEFAULT_MAPPING_XPERIA_PLAY, true);
	} else {
		SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true);
	}
#else
	SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true);
	SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false);
#endif
}
示例#2
0
文件: Config.cpp 项目: PewnyPL/ppsspp
void Config::Load(const char *iniFileName, const char *controllerIniFilename)
{
	iniFilename_ = iniFileName;
	controllerIniFilename_ = controllerIniFilename;
	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");

	general->Get("FirstRun", &bFirstRun, true);
	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("Language", &languageIni, "en_US");
	general->Get("NumWorkerThreads", &iNumWorkerThreads, cpu_info.num_cores);
	general->Get("EnableCheats", &bEnableCheats, false);
	general->Get("MaxRecent", &iMaxRecent, 30);
	general->Get("ScreenshotsAsPNG", &bScreenshotsAsPNG, false);
	general->Get("StateSlot", &iCurrentStateSlot, 0);
	general->Get("GridView1", &bGridView1, true);
	general->Get("GridView2", &bGridView2, true);
	general->Get("GridView3", &bGridView3, true);

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

	// "default" means let emulator decide, "" means disable.
	general->Get("ReportingHost", &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("SeparateCPUThread", &bSeparateCPUThread, false);
#ifdef __SYMBIAN32__
	cpu->Get("SeparateIOThread", &bSeparateIOThread, false);
#else
	cpu->Get("SeparateIOThread", &bSeparateIOThread, true);
#endif
	cpu->Get("FastMemory", &bFastMemory, false);
	cpu->Get("CPUSpeed", &iLockedCPUSpeed, 0);

	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, 
		// Many ARMv6 devices have serious problems with buffered rendering.
#if defined(ARM) && !defined(ARMV7)
		0
#else
		1
#endif
		); // default is buffered rendering mode
	graphics->Get("SoftwareRendering", &bSoftwareRendering, false);
	graphics->Get("HardwareTransform", &bHardwareTransform, true);
	graphics->Get("TextureFiltering", &iTexFiltering, 1);
	graphics->Get("SSAA", &bAntiAliasing, 0);
	graphics->Get("FrameSkip", &iFrameSkip, 0);
	graphics->Get("FrameRate", &iFpsLimit, 0);
	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 _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", &iSFXVolume, 7);
	sound->Get("LowLatency", &bLowLatencyAudio, false);

	IniFile::Section *control = iniFile.GetOrCreateSection("Control");
	control->Get("ShowAnalogStick", &bShowAnalogStick, true);
#ifdef BLACKBERRY
	control->Get("ShowTouchControls", &bShowTouchControls, pixel_xres != pixel_yres);
#elif defined(USING_GLES2)
	std::string name = System_GetName();
	if (name == "NVIDIA:SHIELD" || name == "Sony Ericsson:R800i" || name == "Sony Ericsson:zeus") {
		control->Get("ShowTouchControls", &bShowTouchControls, false);
	} else {
		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);
#ifdef _WIN32
	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("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);

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

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

	CleanRecent();
}
示例#3
0
// Get the property
int SystemOsc_PropertyGet( int property, int channel )
{
  int value = 0;
  //char address[ OSC_SCRATCH_SIZE ];
  switch ( property )
  {
    case 0: // active
      value = System_GetActive( );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;
    case 1: // freememory
      value = System_GetFreeMemory( );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;
    case 4: // serialnumber
      value = System_GetSerialNumber( );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;  
    case 5: // version
    {
      char versionString[50];
      snprintf( versionString, 50, "%s %d.%d.%d", FIRMWARE_NAME, FIRMWARE_MAJOR_VERSION, FIRMWARE_MINOR_VERSION, FIRMWARE_BUILD_NUMBER );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",s", versionString ); 
      break;
    }
    case 6: // name
    {
      char* name;
      name = System_GetName( );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",s", name ); 
      break;
    }
    case 7: // info-internal
    case 8: // info
    {
      int a0, a1, a2, a3;
			{ // put these in their own context so the local variables aren't lying around on the stack for the whole message
				char ipAddr[25];
				char* sysName = System_GetName( );
				int serialnum = System_GetSerialNumber( );
				char sysVersion[25];
				snprintf( sysVersion, 25, "%s %d.%d.%d", FIRMWARE_NAME, FIRMWARE_MAJOR_VERSION, FIRMWARE_MINOR_VERSION, FIRMWARE_BUILD_NUMBER );
				int freemem = System_GetFreeMemory( );
				#ifdef MAKE_CTRL_NETWORK
				if( Network_GetAddress( &a0, &a1, &a2, &a3 ) != CONTROLLER_OK )
					a0 = a1 = a2 = a3 = -1;
				#else
				a0 = a1 = a2 = a3 = -1;
				#endif // MAKE_CTRL_NETWORK
				snprintf( ipAddr, 25, "%d.%d.%d.%d", a0, a1, a2, a3 );
				snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s-a", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
				Osc_CreateMessage( channel, System->scratch1, ",sissi", sysName, serialnum, ipAddr, sysVersion, freemem );
			}
			{
			char gateway[25];
      char mask[25];
			int dhcp;
      int webserver;
			int oscUdpListen;
			int oscUdpSend; 
      #ifdef MAKE_CTRL_NETWORK
      if( Network_GetGateway( &a0, &a1, &a2, &a3 ) != CONTROLLER_OK )
        a0 = a1 = a2 = a3 = -1;
			snprintf( gateway, 25, "%d.%d.%d.%d", a0, a1, a2, a3 );
      if( Network_GetMask( &a0, &a1, &a2, &a3 ) != CONTROLLER_OK )
        a0 = a1 = a2 = a3 = -1;
			snprintf( mask, 25, "%d.%d.%d.%d", a0, a1, a2, a3 );
      dhcp = Network_GetDhcpEnabled( );
      webserver = 0; // webserver no longer in core. TODO - update system-info to not use webserver
      oscUdpListen = NetworkOsc_GetUdpListenPort( );
      oscUdpSend = NetworkOsc_GetUdpSendPort( );
      #else
      a0 = a1 = a2 = a3 = -1;
			snprintf( gateway, 25, "%d.%d.%d.%d", a0, a1, a2, a3 );
			snprintf( mask, 25, "%d.%d.%d.%d", a0, a1, a2, a3 );
      dhcp = 0;
      webserver = 0;
      oscUdpListen = 0;
      oscUdpSend = 0;
      #endif // MAKE_CTRL_NETWORK
      
			snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s-b", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",iissii", dhcp, webserver, gateway, mask, oscUdpListen, oscUdpSend );
			}
      break;
    }
    case 9: // stack-audit
      if( System->StackAuditPtr == NULL )
        value = 0;
      else
        value = 1;
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;
    case 10: // task-report
    {
      int numOfTasks = GetNumberOfTasks( ) - 1;  // don't count the IDLE task
      int i;
      void* task = NULL;
      char* taskName = "";
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      
      for( i = 0; i < numOfTasks; i++ )
      {
      	task = TaskGetNext( task );
      	value = TaskGetRemainingStack( task );
      	taskName = TaskGetName( task );
      	Osc_CreateMessage( channel, System->scratch1, ",si", taskName, value ); 
      }
      break;
    }
    case 11: // autosend-usb
      value = ( System_GetAsyncDestination( ) == OSC_CHANNEL_USB ) ? 1 : 0;
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;
    case 12: // autosend-udp
      value = ( System_GetAsyncDestination( ) == OSC_CHANNEL_UDP ) ? 1 : 0;
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break;
    case 13: // autosend-interval
      value = System_GetAutoSendInterval( );
      snprintf( System->scratch1, OSC_SCRATCH_SIZE, "/%s/%s", SystemOsc_Name, SystemOsc_PropertyNames[ property ] ); 
      Osc_CreateMessage( channel, System->scratch1, ",i", value ); 
      break; 
  }
  
  return CONTROLLER_OK;
}