mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-24 05:49:58 +00:00
Merge pull request #1357 from CrazyMax/master
add save/load PSP system parameters to/from config file
This commit is contained in:
commit
7ae0a07806
@ -118,8 +118,16 @@ void Config::Load(const char *iniFileName)
|
||||
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_CIRCLE);
|
||||
pspConfig->Get("LockParentalLevel", &bLockParentalLevel, PSP_SYSTEMPARAM_TIME_FORMAT_24HR);
|
||||
pspConfig->Get("WlanAdhocChannel", &iWlanAdhocChannel, PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC);
|
||||
pspConfig->Get("WlanPowerSave", &bWlanPowerSave, PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF);
|
||||
pspConfig->Get("EncryptSave", &bEncryptSave, true);
|
||||
|
||||
CleanRecent();
|
||||
@ -187,8 +195,16 @@ void Config::Save()
|
||||
|
||||
|
||||
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", bLockParentalLevel);
|
||||
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
|
||||
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
|
||||
pspConfig->Set("EncryptSave", bEncryptSave);
|
||||
|
||||
if (!iniFile.Save(iniFilename_.c_str())) {
|
||||
|
@ -87,9 +87,17 @@ public:
|
||||
int iForceInputDevice;
|
||||
|
||||
// SystemParam
|
||||
std::string sNickName;
|
||||
int ilanguage;
|
||||
int itimeformat;
|
||||
int iDateFormat;
|
||||
int iTimeZone;
|
||||
bool bDayLightSavings;
|
||||
bool bButtonPreference;
|
||||
bool bLockParentalLevel;
|
||||
bool bEncryptSave;
|
||||
int iWlanAdhocChannel;
|
||||
bool bWlanPowerSave;
|
||||
|
||||
std::string currentDirectory;
|
||||
std::string memCardDirectory;
|
||||
|
@ -18,37 +18,22 @@
|
||||
#include "HLE.h"
|
||||
#include "FunctionWrappers.h"
|
||||
#include "../MIPS/MIPS.h"
|
||||
#include "../Config.h"
|
||||
#include "ChunkFile.h"
|
||||
|
||||
|
||||
const int PSP_LANGUAGE_JAPANESE = 0;
|
||||
const int PSP_LANGUAGE_ENGLISH = 1;
|
||||
const int PSP_LANGUAGE_FRENCH = 2;
|
||||
const int PSP_LANGUAGE_SPANISH = 3;
|
||||
const int PSP_LANGUAGE_GERMAN = 4;
|
||||
const int PSP_LANGUAGE_ITALIAN = 5;
|
||||
const int PSP_LANGUAGE_DUTCH = 6;
|
||||
const int PSP_LANGUAGE_PORTUGUESE = 7;
|
||||
const int PSP_LANGUAGE_RUSSIAN = 8;
|
||||
const int PSP_LANGUAGE_KOREAN = 9;
|
||||
const int PSP_LANGUAGE_TRADITIONAL_CHINESE = 10;
|
||||
const int PSP_LANGUAGE_SIMPLIFIED_CHINESE = 11;
|
||||
|
||||
const int PSP_CONFIRM_BUTTON_CIRCLE = 0;
|
||||
const int PSP_CONFIRM_BUTTON_CROSS = 1;
|
||||
#include "sceUtility.h"
|
||||
|
||||
const int PSP_UMD_POPUP_DISABLE = 0;
|
||||
const int PSP_UMD_POPUP_ENABLE = 1;
|
||||
|
||||
static u32 language = PSP_LANGUAGE_ENGLISH;
|
||||
static u32 buttonValue = PSP_CONFIRM_BUTTON_CIRCLE;
|
||||
static u32 language = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
||||
static u32 buttonValue = PSP_SYSTEMPARAM_BUTTON_CIRCLE;
|
||||
static u32 umdPopup = PSP_UMD_POPUP_DISABLE;
|
||||
static u32 backlightOffTime;
|
||||
|
||||
void __ImposeInit()
|
||||
{
|
||||
language = PSP_LANGUAGE_ENGLISH;
|
||||
buttonValue = PSP_CONFIRM_BUTTON_CIRCLE;
|
||||
language = g_Config.ilanguage;
|
||||
buttonValue = g_Config.bButtonPreference?PSP_SYSTEMPARAM_BUTTON_CROSS:PSP_SYSTEMPARAM_BUTTON_CIRCLE;
|
||||
umdPopup = PSP_UMD_POPUP_DISABLE;
|
||||
backlightOffTime = 0;
|
||||
}
|
||||
|
@ -364,58 +364,6 @@ int sceUtilityGamedataInstallGetStatus()
|
||||
return retval;
|
||||
}
|
||||
|
||||
#define PSP_SYSTEMPARAM_ID_STRING_NICKNAME 1
|
||||
#define PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL 2
|
||||
#define PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE 3
|
||||
#define PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT 4
|
||||
#define PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT 5
|
||||
//Timezone offset from UTC in minutes, (EST = -300 = -5 * 60)
|
||||
#define PSP_SYSTEMPARAM_ID_INT_TIMEZONE 6
|
||||
#define PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS 7
|
||||
#define PSP_SYSTEMPARAM_ID_INT_LANGUAGE 8
|
||||
#define PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE 9
|
||||
#define PSP_SYSTEMPARAM_ID_INT_LOCK_PARENTAL_LEVEL 10
|
||||
|
||||
/**
|
||||
* Return values for the SystemParam functions
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_RETVAL_OK 0
|
||||
#define PSP_SYSTEMPARAM_RETVAL_FAIL 0x80110103
|
||||
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC 0
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_1 1
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_6 6
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_11 11
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF 0
|
||||
#define PSP_SYSTEMPARAM_WLAN_POWERSAVE_ON 1
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD 0
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_MMDDYYYY 1
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY 2
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD 0
|
||||
#define PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_SAVING 1
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE
|
||||
*/
|
||||
#define PSP_SYSTEMPARAM_BUTTON_CIRCLE 0
|
||||
#define PSP_SYSTEMPARAM_BUTTON_CROSS 1
|
||||
|
||||
//TODO: should save to config file
|
||||
u32 sceUtilitySetSystemParamString(u32 id, u32 strPtr)
|
||||
{
|
||||
@ -430,7 +378,7 @@ u32 sceUtilityGetSystemParamString(u32 id, u32 destaddr, u32 unknownparam)
|
||||
char *buf = (char *)Memory::GetPointer(destaddr);
|
||||
switch (id) {
|
||||
case PSP_SYSTEMPARAM_ID_STRING_NICKNAME:
|
||||
strcpy(buf, "shadow");
|
||||
strncpy(buf, g_Config.sNickName.c_str(), std::min<u32>(16, g_Config.sNickName.length()));
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -440,37 +388,37 @@ u32 sceUtilityGetSystemParamString(u32 id, u32 destaddr, u32 unknownparam)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO: Should load from config file
|
||||
u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr)
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceUtilityGetSystemParamInt(%i, %08x)", id,destaddr);
|
||||
u32 param = 0;
|
||||
switch (id) {
|
||||
case PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL:
|
||||
param = PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC;
|
||||
param = g_Config.iWlanAdhocChannel;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE:
|
||||
param = PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF;
|
||||
param = g_Config.bWlanPowerSave?PSP_SYSTEMPARAM_WLAN_POWERSAVE_ON:PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT:
|
||||
param = PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY;
|
||||
param = g_Config.iDateFormat;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT:
|
||||
param = g_Config.itimeformat;
|
||||
param = g_Config.itimeformat?PSP_SYSTEMPARAM_TIME_FORMAT_12HR:PSP_SYSTEMPARAM_TIME_FORMAT_24HR;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_TIMEZONE:
|
||||
param = 60;
|
||||
param = g_Config.iTimeZone;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS:
|
||||
param = PSP_SYSTEMPARAM_TIME_FORMAT_24HR;
|
||||
param = g_Config.bDayLightSavings?PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_SAVING:PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_LANGUAGE:
|
||||
param = g_Config.ilanguage;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE:
|
||||
param = PSP_SYSTEMPARAM_BUTTON_CROSS;
|
||||
param = g_Config.bButtonPreference?PSP_SYSTEMPARAM_BUTTON_CROSS:PSP_SYSTEMPARAM_BUTTON_CIRCLE;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_LOCK_PARENTAL_LEVEL:
|
||||
// TODO
|
||||
param = 0;
|
||||
break;
|
||||
default:
|
||||
|
@ -19,9 +19,7 @@
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
/**
|
||||
* Valid values for PSP_SYSTEMPARAM_ID_INT_LANGUAGE
|
||||
*/
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_LANGUAGE
|
||||
#define PSP_SYSTEMPARAM_LANGUAGE_JAPANESE 0
|
||||
#define PSP_SYSTEMPARAM_LANGUAGE_ENGLISH 1
|
||||
#define PSP_SYSTEMPARAM_LANGUAGE_FRENCH 2
|
||||
@ -38,6 +36,45 @@ class PointerWrap;
|
||||
#define PSP_SYSTEMPARAM_TIME_FORMAT_24HR 0
|
||||
#define PSP_SYSTEMPARAM_TIME_FORMAT_12HR 1
|
||||
|
||||
#define PSP_SYSTEMPARAM_ID_STRING_NICKNAME 1
|
||||
#define PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL 2
|
||||
#define PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE 3
|
||||
#define PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT 4
|
||||
#define PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT 5
|
||||
//Timezone offset from UTC in minutes, (EST = -300 = -5 * 60)
|
||||
#define PSP_SYSTEMPARAM_ID_INT_TIMEZONE 6
|
||||
#define PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS 7
|
||||
#define PSP_SYSTEMPARAM_ID_INT_LANGUAGE 8
|
||||
#define PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE 9
|
||||
#define PSP_SYSTEMPARAM_ID_INT_LOCK_PARENTAL_LEVEL 10
|
||||
|
||||
// Return values for the SystemParam functions
|
||||
#define PSP_SYSTEMPARAM_RETVAL_OK 0
|
||||
#define PSP_SYSTEMPARAM_RETVAL_FAIL 0x80110103
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC 0
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_1 1
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_6 6
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_11 11
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE
|
||||
#define PSP_SYSTEMPARAM_WLAN_POWERSAVE_OFF 0
|
||||
#define PSP_SYSTEMPARAM_WLAN_POWERSAVE_ON 1
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_YYYYMMDD 0
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_MMDDYYYY 1
|
||||
#define PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY 2
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS
|
||||
#define PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_STD 0
|
||||
#define PSP_SYSTEMPARAM_DAYLIGHTSAVINGS_SAVING 1
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_BUTTON_PREFERENCE
|
||||
#define PSP_SYSTEMPARAM_BUTTON_CIRCLE 0
|
||||
#define PSP_SYSTEMPARAM_BUTTON_CROSS 1
|
||||
|
||||
void __UtilityInit();
|
||||
void __UtilityDoState(PointerWrap &p);
|
||||
void __UtilityShutdown();
|
||||
|
Loading…
Reference in New Issue
Block a user