cellSysUtil: Implement CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA

This commit is contained in:
Eladash 2020-09-11 17:02:25 +03:00 committed by Megamouse
parent 639650c65a
commit 81eceb1728
3 changed files with 31 additions and 14 deletions

View File

@ -122,6 +122,7 @@ void fmt_class_string<CellSysutilParamId>::format(std::string& out, u64 arg)
case CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE: return "ID_TIMEZONE";
case CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME: return "ID_SUMMERTIME";
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL: return "ID_GAME_PARENTAL_LEVEL";
case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA: return "ID_LICENSE_AREA";
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT: return "ID_GAME_PARENTAL_LEVEL0_RESTRICT";
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT: return "ID_CURRENT_USER_HAS_NP_ACCOUNT";
case CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ: return "ID_CAMERA_PLFREQ";
@ -248,6 +249,20 @@ error_code cellSysutilGetSystemParamInt(CellSysutilParamId id, vm::ptr<s32> valu
*value = CELL_SYSUTIL_GAME_PARENTAL_OFF;
break;
case CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA:
{
if (g_ps3_process_info.sdk_ver > 0x23FFFFu)
{
return CELL_SYSUTIL_ERROR_VALUE;
}
extern s32 cellSysutilGetLicenseArea();
// Identical until proved otherwise
*value = cellSysutilGetLicenseArea();
break;
}
case CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT:
*value = CELL_SYSUTIL_GAME_PARENTAL_LEVEL0_RESTRICT_OFF;
break;

View File

@ -69,6 +69,7 @@ enum CellSysutilParamId: s32
CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE = 0x0116,
CELL_SYSUTIL_SYSTEMPARAM_ID_SUMMERTIME = 0x0117,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL = 0x0121,
CELL_SYSUTIL_SYSTEMPARAM_ID_LICENSE_AREA = 0x0122,
CELL_SYSUTIL_SYSTEMPARAM_ID_GAME_PARENTAL_LEVEL0_RESTRICT = 0x0123,
CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USER_HAS_NP_ACCOUNT = 0x0141,
CELL_SYSUTIL_SYSTEMPARAM_ID_CAMERA_PLFREQ = 0x0151,
@ -208,6 +209,18 @@ enum
CELL_SYSUTIL_PAD_RUMBLE_ON = 1,
};
// License areas
enum
{
CELL_SYSUTIL_LICENSE_AREA_J = 0,
CELL_SYSUTIL_LICENSE_AREA_A = 1,
CELL_SYSUTIL_LICENSE_AREA_E = 2,
CELL_SYSUTIL_LICENSE_AREA_H = 3,
CELL_SYSUTIL_LICENSE_AREA_K = 4,
CELL_SYSUTIL_LICENSE_AREA_C = 5,
CELL_SYSUTIL_LICENSE_AREA_OTHER = 100,
};
enum
{
CELL_SYSUTIL_PAD_AUTOOFF_OFF = 0,

View File

@ -1,26 +1,15 @@
#include "stdafx.h"
#include "Emu/System.h"
#include "Emu/Cell/PPUModule.h"
#include "cellSysutil.h"
LOG_CHANNEL(cellSysutilMisc);
// License areas
enum
{
CELL_SYSUTIL_LICENSE_AREA_J = 0,
CELL_SYSUTIL_LICENSE_AREA_A = 1,
CELL_SYSUTIL_LICENSE_AREA_E = 2,
CELL_SYSUTIL_LICENSE_AREA_H = 3,
CELL_SYSUTIL_LICENSE_AREA_K = 4,
CELL_SYSUTIL_LICENSE_AREA_C = 5,
CELL_SYSUTIL_LICENSE_AREA_OTHER = 100,
};
s32 cellSysutilGetLicenseArea()
{
cellSysutilMisc.warning("cellSysutilGetLicenseArea()");
switch (const char region = Emu.GetTitleID().at(2))
switch (const char region = Emu.GetTitleID().size() >= 3u ? Emu.GetTitleID().at(2) : '\0')
{
case 'J': return CELL_SYSUTIL_LICENSE_AREA_J;
case 'U': return CELL_SYSUTIL_LICENSE_AREA_A;
@ -28,7 +17,7 @@ s32 cellSysutilGetLicenseArea()
case 'H': return CELL_SYSUTIL_LICENSE_AREA_H;
case 'K': return CELL_SYSUTIL_LICENSE_AREA_K;
case 'A': return CELL_SYSUTIL_LICENSE_AREA_C;
default: cellSysutilMisc.todo("Unknown license area: %s", Emu.GetTitleID().c_str()); return CELL_SYSUTIL_LICENSE_AREA_OTHER;
default: cellSysutilMisc.todo("Unknown license area: %s", Emu.GetTitleID()); return CELL_SYSUTIL_LICENSE_AREA_OTHER;
}
}