mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-26 08:55:58 +00:00
Merge pull request #1382 from unknownbrackets/systemparam
Correct sceUtilityGetSystemParamString() per tests
This commit is contained in:
commit
d74fa0158c
@ -125,7 +125,7 @@ void Config::Load(const char *iniFileName)
|
||||
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("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);
|
||||
@ -202,7 +202,7 @@ void Config::Save()
|
||||
pspConfig->Set("TimeZone", iTimeZone);
|
||||
pspConfig->Set("DayLightSavings", bDayLightSavings);
|
||||
pspConfig->Set("ButtonPreference", bButtonPreference);
|
||||
pspConfig->Set("LockParentalLevel", bLockParentalLevel);
|
||||
pspConfig->Set("LockParentalLevel", iLockParentalLevel);
|
||||
pspConfig->Set("WlanAdhocChannel", iWlanAdhocChannel);
|
||||
pspConfig->Set("WlanPowerSave", bWlanPowerSave);
|
||||
pspConfig->Set("EncryptSave", bEncryptSave);
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
int iTimeZone;
|
||||
bool bDayLightSavings;
|
||||
bool bButtonPreference;
|
||||
bool bLockParentalLevel;
|
||||
int iLockParentalLevel;
|
||||
bool bEncryptSave;
|
||||
int iWlanAdhocChannel;
|
||||
bool bWlanPowerSave;
|
||||
|
@ -367,19 +367,20 @@ int sceUtilityGamedataInstallGetStatus()
|
||||
//TODO: should save to config file
|
||||
u32 sceUtilitySetSystemParamString(u32 id, u32 strPtr)
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceUtilitySetSystemParamString(%i, %08x)", id,strPtr);
|
||||
WARN_LOG(HLE, "sceUtilitySetSystemParamString(%i, %08x)", id, strPtr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//TODO: Should load from config file
|
||||
u32 sceUtilityGetSystemParamString(u32 id, u32 destaddr, u32 unknownparam)
|
||||
u32 sceUtilityGetSystemParamString(u32 id, u32 destaddr, int destSize)
|
||||
{
|
||||
DEBUG_LOG(HLE,"sceUtilityGetSystemParamString(%i, %08x, %i)", id,destaddr,unknownparam);
|
||||
DEBUG_LOG(HLE, "sceUtilityGetSystemParamString(%i, %08x, %i)", id, destaddr, destSize);
|
||||
char *buf = (char *)Memory::GetPointer(destaddr);
|
||||
switch (id) {
|
||||
case PSP_SYSTEMPARAM_ID_STRING_NICKNAME:
|
||||
strncpy(buf, g_Config.sNickName.c_str(), std::min<u32>(16, g_Config.sNickName.length()));
|
||||
buf[15] = 0;
|
||||
// If there's not enough space for the string and null terminator, fail.
|
||||
if (destSize <= (int)g_Config.sNickName.length())
|
||||
return PSP_SYSTEMPARAM_RETVAL_STRING_TOO_LONG;
|
||||
strncpy(buf, g_Config.sNickName.c_str(), destSize);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -419,8 +420,7 @@ u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr)
|
||||
param = g_Config.bButtonPreference?PSP_SYSTEMPARAM_BUTTON_CROSS:PSP_SYSTEMPARAM_BUTTON_CIRCLE;
|
||||
break;
|
||||
case PSP_SYSTEMPARAM_ID_INT_LOCK_PARENTAL_LEVEL:
|
||||
// TODO
|
||||
param = 0;
|
||||
param = g_Config.iLockParentalLevel;
|
||||
break;
|
||||
default:
|
||||
return PSP_SYSTEMPARAM_RETVAL_FAIL;
|
||||
@ -480,7 +480,7 @@ const HLEFunction sceUtility[] =
|
||||
|
||||
{0x41e30674, &WrapU_UU<sceUtilitySetSystemParamString>, "sceUtilitySetSystemParamString"},
|
||||
{0x45c18506, 0, "sceUtilitySetSystemParamInt"},
|
||||
{0x34b78343, &WrapU_UUU<sceUtilityGetSystemParamString>, "sceUtilityGetSystemParamString"},
|
||||
{0x34b78343, &WrapU_UUI<sceUtilityGetSystemParamString>, "sceUtilityGetSystemParamString"},
|
||||
{0xA5DA2406, &WrapU_UU<sceUtilityGetSystemParamInt>, "sceUtilityGetSystemParamInt"},
|
||||
|
||||
|
||||
|
@ -50,6 +50,7 @@ class PointerWrap;
|
||||
|
||||
// Return values for the SystemParam functions
|
||||
#define PSP_SYSTEMPARAM_RETVAL_OK 0
|
||||
#define PSP_SYSTEMPARAM_RETVAL_STRING_TOO_LONG 0x80110102
|
||||
#define PSP_SYSTEMPARAM_RETVAL_FAIL 0x80110103
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL
|
||||
|
@ -203,6 +203,11 @@ int main(int argc, const char* argv[])
|
||||
g_Config.ilanguage = PSP_SYSTEMPARAM_LANGUAGE_ENGLISH;
|
||||
g_Config.itimeformat = PSP_SYSTEMPARAM_TIME_FORMAT_24HR;
|
||||
g_Config.bEncryptSave = true;
|
||||
g_Config.sNickName = "shadow";
|
||||
g_Config.iTimeZone = 60;
|
||||
g_Config.iDateFormat = PSP_SYSTEMPARAM_DATE_FORMAT_DDMMYYYY;
|
||||
g_Config.bButtonPreference = true;
|
||||
g_Config.iLockParentalLevel = 9;
|
||||
|
||||
#if defined(ANDROID)
|
||||
#elif defined(BLACKBERRY) || defined(__SYMBIAN32__)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8149a0b9afda4757e01f511686f49b247cadf793
|
||||
Subproject commit a46907d2fc1a827158e59188888dec3acc6231f8
|
2
test.py
2
test.py
@ -144,6 +144,7 @@ tests_good = [
|
||||
"threads/vpl/refer",
|
||||
"threads/vpl/try",
|
||||
"threads/vpl/vpl",
|
||||
"utility/systemparam/systemparam",
|
||||
"power/power",
|
||||
"umd/callbacks/umd",
|
||||
"umd/wait/wait",
|
||||
@ -186,7 +187,6 @@ tests_next = [
|
||||
"sysmem/sysmem",
|
||||
"umd/io/umd_io",
|
||||
"umd/raw_access/raw_access",
|
||||
"utility/systemparam/systemparam",
|
||||
"video/pmf/pmf",
|
||||
"video/pmf_simple/pmf_simple",
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user