Difference between revisions of "SceCompat"

From Vita Development Wiki
Jump to navigation Jump to search
 
(35 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
== Module ==
 
== Module ==
  
=== Known NIDs ===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Version !! Name !! World !! Privilege !! NID
+
! Version !! World !! Privilege
|-
 
| 1.69 || SceCompat || Non-secure || Kernel || 0x7FA33B9B
 
|-
 
| 3.60 || SceCompat || Non-secure || Kernel || 0x8F2D0378
 
 
|-
 
|-
| 3.65 || SceCompat || Non-secure || Kernel || 0x8F2D0378
+
| 1.69-3.65 || Non-secure || Kernel
 
|}
 
|}
  
Line 23: Line 18:
 
! Version !! Name !! World !! Visibility !! NID
 
! Version !! Name !! World !! Visibility !! NID
 
|-
 
|-
| 3.60 || [[SceCompat#SceCompatForDriver|SceCompatForDriver]] || Non-secure || Kernel || 0x7CFA62CD
+
| 3.60-3.65 || [[SceCompat#SceCompatForDriver|SceCompatForDriver]] || Non-secure || Kernel || 0x7CFA62CD
 
|-
 
|-
| 3.65 || [[SceCompat#SceCompatForDriver|SceCompatForDriver]] || Non-secure || Kernel || 0x7CFA62CD
+
| 3.60-3.65 || [[SceCompat#SceCompatForVsh|SceCompatForVsh]] || Non-secure || User || 0xF68A1AD0
 
|-
 
|-
| 3.60 || [[SceCompat#SceCompatForVsh|SceCompatForVsh]] || Non-secure || User || 0xF68A1AD0
+
| 0.990-3.65 || [[SceCompat#SceCompat|SceCompat]] || Non-secure || User || 0x0F35909D
|-
 
| 3.65 || [[SceCompat#SceCompatForVsh|SceCompatForVsh]] || Non-secure || User || 0xF68A1AD0
 
|-
 
| 1.69 || [[SceCompat#SceCompat|SceCompat]] || Non-secure || User || 0x0F35909D
 
 
|}
 
|}
 +
 +
== Types ==
 +
 +
<source lang="C">
 +
typedef struct SceCompatSettings { // size is 8 on FW 1.03
 +
  SceUInt32 disp_filter : 1;
 +
  SceUInt32 camera_direction : 1;
 +
  SceUInt32 ra_up : 4;
 +
  SceUInt32 ra_down : 4;
 +
  SceUInt32 ra_left : 4;
 +
  SceUInt32 ra_right : 4;
 +
  SceUInt32 reserved : 46;
 +
} SceCompatSettings;
 +
 +
typedef struct SceCompatInitParam { // size is 0x40 on FW 1.03
 +
  char unk[0x40];
 +
} SceCompatInitParam;
 +
 +
typedef struct SceCompatAllocCdramWithHoleParam { // size is 8 on FW 3.60
 +
    void *pCachedCdramBase;
 +
    void *pUncachedCdramBase;
 +
} SceCompatAllocCdramWithHoleParam;
 +
 +
typedef enum SceCompatCacheMode {
 +
SCE_COMPAT_CACHE_MODE_NONE            = 0,
 +
SCE_COMPAT_CACHE_MODE_INVALIDATE      = 1,
 +
SCE_COMPAT_CACHE_MODE_CLEAN_INVALIDATE = 2,
 +
SCE_COMPAT_CACHE_MODE_CLEAN            = 3
 +
} SceCompatCacheMode;
 +
 +
typedef struct SceCompatCtrl { // size is 0x10 on FW 3.60
 +
    SceUInt32 timestamp;
 +
    SceUInt32 buttons;
 +
    SceUInt8 Lx;
 +
    SceUInt8 Ly;
 +
    SceUInt8 Rx;
 +
    SceUInt8 Ry;
 +
    SceUInt32 reserved;
 +
} SceCompatCtrl;
 +
 +
typedef enum SceCompatPeripheralStateId {
 +
SCE_COMPAT_PERIPHERAL_STATE_IS_HEADPHONE_EXIST      = 1,
 +
SCE_COMPAT_PERIPHERAL_STATE_GET_BATTERY_LIFE_PERCENT = 2,
 +
SCE_COMPAT_PERIPHERAL_STATE_GET_BATTERY_LIFE_TIME    = 3,
 +
SCE_COMPAT_PERIPHERAL_STATE_IS_SUSPEND_REQUIRED      = 4
 +
} SceCompatPeripheralStateId;
 +
</source>
  
 
== SceCompatForDriver ==
 
== SceCompatForDriver ==
  
=== SceCompatForDriver_6EBD9E01 ===
+
=== sceCompatSetColorSpaceModeForDriver ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990 || not present
 
|-
 
|-
 
| 3.60 || 0x6EBD9E01
 
| 3.60 || 0x6EBD9E01
 
|}
 
|}
 +
 +
Name might also be sceCompatSetDisplayConfigForDriver.
 +
 +
<source lang="C">
 +
// mode can be 0, 1 or 2
 +
int sceCompatSetColorSpaceModeForDriver(SceUInt32 mode);
 +
</source>
  
 
== SceCompatForVsh ==
 
== SceCompatForVsh ==
  
=== SceCompatForVsh_4915DEE7 ===
+
=== sceCompatGetTitleListForVsh ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990 || not present
 
|-
 
|-
 
| 3.60 || 0x4915DEE7
 
| 3.60 || 0x4915DEE7
 
|}
 
|}
  
=== SceCompatForVsh_70997F92 ===
+
Reads ur0:emu_list/title_list.bin.
 +
 
 +
<source lang="C">
 +
// size must be 100
 +
int sceCompatGetTitleListForVsh(void *pBuf, SceSize size);
 +
</source>
 +
 
 +
=== sceCompatIsPocketStationTitleForVsh ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990 || not present
 
|-
 
|-
 
| 3.60 || 0x70997F92
 
| 3.60 || 0x70997F92
 
|}
 
|}
  
=== SceCompatForVsh_9C107CC9 ===
+
The first 4 characters of the Title Id are letters. The remaining numbers are converted to digital values with strtol,
 +
 
 +
XORed then compared to SceCompat hardcoded values.
 +
 
 +
<source lang="C">SceBool sceCompatIsPocketStationTitleForVsh(const char *titleId);</source>
 +
 
 +
=== sceCompatGetPspSystemSoftwareVersionForVsh ===
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990 || not present
 
|-
 
|-
 
| 3.60 || 0x9C107CC9
 
| 3.60 || 0x9C107CC9
 
|}
 
|}
 +
 +
On emulated PSP FW 6.60, it returns 660. On emulated PSP FW 6.61, it returns 661.
 +
 +
<source lang="C">int sceCompatGetPspSystemSoftwareVersionForVsh(void);</source>
  
 
== SceCompat ==
 
== SceCompat ==
 
  
 
=== sceCompatGetUpdateState ===
 
=== sceCompatGetUpdateState ===
Line 77: Line 146:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x0CDE9EC5
 
| 3.60 || 0x0CDE9EC5
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatGetUpdateState(void);</source>
  
 
=== sceCompatGetDevInf ===
 
=== sceCompatGetDevInf ===
Line 86: Line 159:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x138006A8
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0x138006A8
+
| 1.03-3.60 || 0x138006A8
 
|}
 
|}
 +
 +
Calls sceIoDevctlForDriver("ux0", 0x3001, NULL, 0, pInfo, sizeof(SceIoDevInfo));.
 +
 +
<source lang="C">int sceCompatGetDevInf(SceIoDevInfo *pInfo);</source>
  
 
=== sceCompatGetPeripheralState ===
 
=== sceCompatGetPeripheralState ===
Line 96: Line 173:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x176B2906
+
| 0.990-3.60 || 0x176B2906
|-
 
| 3.60 || 0x176B2906
 
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatGetPeripheralState(SceCompatPeripheralStateId stateId);</source>
  
 
=== sceCompatWriteShared32 ===
 
=== sceCompatWriteShared32 ===
Line 106: Line 183:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x1CD51530
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0x1CD51530
+
| 1.03-3.60 || 0x1CD51530
 
|}
 
|}
 +
 +
<source lang="C">
 +
// some_id must be between 0x80 and 0x8A
 +
int sceCompatWriteShared32(SceUInt32 some_id, SceUInt32 value);
 +
</source>
  
 
=== sceCompatWriteSharedCtrl ===
 
=== sceCompatWriteSharedCtrl ===
Line 116: Line 198:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x2306FFED
+
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x2306FFED
 
| 3.60 || 0x2306FFED
 
|}
 
|}
 +
 +
Write pCtrl to Shared SRAM.
 +
 +
<source lang="C">int sceCompatWriteSharedCtrl(SceCompatCtrl *pCtrl);</source>
  
 
=== sceCompatSetSettings ===
 
=== sceCompatSetSettings ===
Line 126: Line 212:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x312782DC
+
| 0.990 || not present
 +
|-
 +
| 1.03-1.69 || 0x312782DC
 
|-
 
|-
| 3.60 || NOT PRESENT
+
| 3.60 || not present
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatSetSettings(SceCompatSettings settings);</source>
  
 
=== sceCompatSuspendResume ===
 
=== sceCompatSuspendResume ===
Line 136: Line 226:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x324112CA
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0x324112CA
+
| 1.69-3.60 || 0x324112CA
 
|}
 
|}
 +
 +
<source lang="C">
 +
// mode: 0: suspend, 1: resume
 +
// step: 1: first step, 2: second step
 +
int sceCompatSuspendResume(SceUInt32 mode, SceUInt32 step);
 +
</source>
  
 
=== sceCompatSetDisplayConfig ===
 
=== sceCompatSetDisplayConfig ===
Line 146: Line 242:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x32BA3DCF
+
| 0.990-1.03 || not present
 +
|-
 +
| 1.69-3.60 || 0x32BA3DCF
 
|}
 
|}
 +
 +
<source lang="C">
 +
// head must be SCE_DISPLAY_HEAD_MAIN_LCD_OLED
 +
// mode can be 0, 1 or 2
 +
int sceCompatSetDisplayConfig(SceDisplayHead head, SceUInt32 mode);
 +
</source>
  
 
=== sceCompatRegRead ===
 
=== sceCompatRegRead ===
Line 154: Line 258:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x4521505D
+
| 0.990-1.69 || 0x4521505D
 
|-
 
|-
| 3.60 || NOT PRESENT
+
| 3.60 || not present
 
|}
 
|}
 +
 +
<source lang="C">
 +
// unk_id: if unk_id equals 0, offset + size must be less than 0x3a5d,
 +
// else if unk_id equals 1, offset + size must be less than 0x20000
 +
int sceCompatRegRead(SceUInt32 unk_id, SceUInt32 offset, void *pBuf, SceSize size);
 +
</source>
  
 
=== sceCompatAvailableColorSpaceSetting ===
 
=== sceCompatAvailableColorSpaceSetting ===
Line 163: Line 273:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x456226DD
 
| 3.60 || 0x456226DD
 
|}
 
|}
 +
 +
Returns true only if (displayDeviceType & 3) equals 3.
 +
 +
<source lang="C">SceBool sceCompatAvailableColorSpaceSetting(void);</source>
  
 
=== sceCompatCache ===
 
=== sceCompatCache ===
Line 175: Line 291:
 
|}
 
|}
  
=== sceCompatAllocCdram ===
+
<source lang="C">int sceCompatCache(SceCompatCacheMode mode, void *base, SceSize size);</source>
{| class="wikitable"
 
|-
 
! Version !! NID
 
|-
 
| 1.69 || 0x6E8E3BA8
 
|}
 
  
 
=== sceCompatWaitSpecialRequest ===
 
=== sceCompatWaitSpecialRequest ===
Line 188: Line 298:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x714F7ED6
+
| 0.940-3.60 || 0x714F7ED6
|-
 
| 3.60 || 0x714F7ED6
 
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatWaitSpecialRequest(SceUInt32 req_id);</source>
  
 
=== sceCompatReadShared32 ===
 
=== sceCompatReadShared32 ===
Line 198: Line 308:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x73AA4871
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0x73AA4871
+
| 1.03-3.60 || 0x73AA4871
 
|}
 
|}
 +
 +
<source lang="C">
 +
// some_id must be between 0 and 7. 3 seems disabled.
 +
int sceCompatReadShared32(SceUInt32 some_id, SceUInt32 *pValue);
 +
</source>
  
 
=== sceCompatGetSettings ===
 
=== sceCompatGetSettings ===
Line 208: Line 323:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x782C980E
+
| 0.990 || not present
 +
|-
 +
| 1.03-1.69 || 0x782C980E
 
|-
 
|-
| 3.60 || NOT PRESENT
+
| 3.60 || not present
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatGetSettings(SceCompatSettings *pSettings);</source>
  
 
=== sceCompatIsPocketStationTitle ===
 
=== sceCompatIsPocketStationTitle ===
Line 217: Line 336:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x7DCFBCCE
 
| 3.60 || 0x7DCFBCCE
 
|}
 
|}
 +
 +
The first 4 characters of the Title Id are letters. The remaining numbers are converted to digital values with strtol,
 +
 +
XORed then compared to SceCompat hardcoded values.
 +
 +
<source lang="C">SceBool sceCompatIsPocketStationTitle(const char *titleId);</source>
  
 
=== sceCompatWaitAndGetRequest ===
 
=== sceCompatWaitAndGetRequest ===
Line 225: Line 352:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x8176C238
 
| 3.60 || 0x8176C238
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatWaitAndGetRequest(SceUInt32 req_id, SceUInt32 a2);</source>
  
 
=== sceCompatSetUpdateState ===
 
=== sceCompatSetUpdateState ===
Line 233: Line 364:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x8A44206F
 
| 3.60 || 0x8A44206F
 
|}
 
|}
 +
 +
<source lang="C">
 +
// unsure if there is an argument
 +
int sceCompatSetUpdateState(void);
 +
</source>
  
 
=== sceCompatStart ===
 
=== sceCompatStart ===
Line 242: Line 380:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x8CA1632D
+
| 0.940-3.60 || 0x8CA1632D
 +
|}
 +
 
 +
<source lang="C">int sceCompatStart(void);</source>
 +
 
 +
=== sceCompatPrepareLoad ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.940 || not present
 
|-
 
|-
| 3.60 || 0x8CA1632D
+
| 1.03 || 0x78E469D6
 +
|-
 +
| 3.60 || not present
 
|}
 
|}
 +
 +
Loads Pcff (PSP Compat Flash Files) and Pcbc (PSP Compat Boot Code).
 +
 +
<source lang="C">int sceCompatPrepareLoad(void);</source>
  
 
=== sceCompatRegWrite ===
 
=== sceCompatRegWrite ===
Line 252: Line 406:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0x912B1C28
+
| 0.990-1.69 || 0x912B1C28
 
|-
 
|-
| 3.60 || NOT PRESENT
+
| 3.60 || not present
 
|}
 
|}
 +
 +
<source lang="C">
 +
// unk_id: if unk_id equals 0, offset + size must be less than 0x3a5d,
 +
// else if unk_id equals 1, offset + size must be less than 0x20000
 +
int sceCompatRegWrite(SceUInt32 unk_id, SceUInt32 offset, const void *pBuf, SceSize size);
 +
</source>
  
 
=== sceCompatIdStorageLookup ===
 
=== sceCompatIdStorageLookup ===
Line 264: Line 424:
 
| 0.940-3.60 || 0x94AAA245
 
| 0.940-3.60 || 0x94AAA245
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatIdStorageLookup(SceUInt16 key, SceUInt32 offset, void *pBuf, SceSize size);</source>
  
 
=== sceCompatCheckPocketStation ===
 
=== sceCompatCheckPocketStation ===
Line 270: Line 432:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 3.60 || 0x96FC2A87
+
| 0.990 || not present
 +
|-
 +
| 1.03-3.60 || 0x96FC2A87
 
|}
 
|}
 +
 +
Checks PocketStation RIF.
 +
 +
<source lang="C">int sceCompatCheckPocketStation(void);</source>
  
 
=== sceCompatGetTitleList ===
 
=== sceCompatGetTitleList ===
Line 277: Line 445:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0x99F13E04
 
| 3.60 || 0x99F13E04
 
|}
 
|}
 +
 +
Reads ur0:emu_list/title_list.bin.
 +
 +
<source lang="C">
 +
// size must be 100
 +
int sceCompatGetTitleList(void *pBuf, SceSize size);
 +
</source>
  
 
=== sceCompatGetCurrentSecureTick ===
 
=== sceCompatGetCurrentSecureTick ===
Line 285: Line 462:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0xA073EBEE
 
| 3.60 || 0xA073EBEE
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatGetCurrentSecureTick(SceRtcTick *pTick);</source>
 +
 +
=== sceCompatAllocCdram ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || not present
 +
|-
 +
| 1.69-2.06 || 0x6E8E3BA8
 +
|-
 +
| 3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatAllocCdram(void **ppCachedCdramBase, void **ppUncachedCdramBase);</source>
  
 
=== sceCompatAllocCdramWithHole ===
 
=== sceCompatAllocCdramWithHole ===
Line 293: Line 488:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0xA5039FFA
 
| 3.60 || 0xA5039FFA
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatAllocCdramWithHole(SceCompatAllocCdramWithHoleParam *pCdram);</source>
 +
 +
=== sceCompatMapDDR ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || not present
 +
|-
 +
| 1.03 || 0xC6B19D35
 +
|-
 +
| 3.60 || not present
 +
|}
 +
 +
<source lang="C">
 +
// size must be 0x4000000 (64MB)
 +
int sceCompatMapDDR(SceUID memblock_uid, SceSize size);
 +
</source>
  
 
=== sceCompatGetPspSystemSoftwareVersion ===
 
=== sceCompatGetPspSystemSoftwareVersion ===
Line 302: Line 518:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xB113DCC0
+
| 0.990-3.60 || 0xB113DCC0
|-
 
| 3.60 || 0xB113DCC0
 
 
|}
 
|}
 +
 +
On emulated PSP FW 6.60, it returns 660. On emulated PSP FW 6.61, it returns 661.
 +
 +
<source lang="C">int sceCompatGetPspSystemSoftwareVersion(void);</source>
  
 
=== sceCompatFrameBufferInit ===
 
=== sceCompatFrameBufferInit ===
Line 312: Line 530:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xBC0E2B4C
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xBC0E2B4C
+
| 1.03-3.60 || 0xBC0E2B4C
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatFrameBufferInit(void *base);</source>
  
 
=== sceCompatLCDCSync ===
 
=== sceCompatLCDCSync ===
Line 322: Line 542:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xBD177787
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xBD177787
+
| 1.03-3.60 || 0xBD177787
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatLCDCSync(void);</source>
  
 
=== sceCompatWaitIntr ===
 
=== sceCompatWaitIntr ===
Line 331: Line 553:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 3.60 || 0xC1E14CF5
 
| 3.60 || 0xC1E14CF5
Line 339: Line 563:
 
|-
 
|-
 
! Version !! NID
 
! Version !! NID
 +
|-
 +
| 0.990-1.03 || not present
 
|-
 
|-
 
| 1.69 || 0xCB9F607B
 
| 1.69 || 0xCB9F607B
 +
|-
 +
| 3.60 || not present
 
|}
 
|}
  
Line 348: Line 576:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xCBE73EBE
+
| 0.990-3.60 || 0xCBE73EBE
|-
 
| 3.60 || 0xCBE73EBE
 
 
|}
 
|}
 +
 +
Reads act.dat.
 +
 +
<source lang="C">
 +
// index must be 0
 +
// offset + size must be lower or equal to 0x1038
 +
int sceCompatDatRead(SceUInt32 index, SceUInt32 offset, void *pBuf, SceSize size);
 +
</source>
  
 
=== sceCompatReturnValueEx ===
 
=== sceCompatReturnValueEx ===
Line 358: Line 592:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xCC02A9FF
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xCC02A9FF
+
| 1.69-3.60 || 0xCC02A9FF
 
|}
 
|}
  
Line 368: Line 602:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xD2E3370E
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xD2E3370E
+
| 1.03-3.60 || 0xD2E3370E
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatGetStatus(void);</source>
  
 
=== sceCompatInterrupt ===
 
=== sceCompatInterrupt ===
Line 378: Line 614:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xD6AA36DD
+
| 0.940-3.60 || 0xD6AA36DD
|-
 
| 3.60 || 0xD6AA36DD
 
 
|}
 
|}
 +
 +
Set a custom SceCompatMailbox address.
 +
 +
<source lang="C">
 +
// some_id must be between 0 and 15
 +
int sceCompatInterrupt(SceUInt32 some_id);
 +
</source>
  
 
=== sceCompatSetRif ===
 
=== sceCompatSetRif ===
Line 388: Line 629:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xD8B69F23
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xD8B69F23
+
| 1.03-3.60 || 0xD8B69F23
 
|}
 
|}
 +
 +
<source lang="C">
 +
// Example of entitlementId: AA0000-AAAA00000_00-0000000000000000
 +
int sceCompatSetRif(const char *entitlementId);
 +
</source>
  
 
=== sceCompatGetPrimaryHead ===
 
=== sceCompatGetPrimaryHead ===
Line 398: Line 644:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xDC9EE33A
+
| 0.990 || not present
 +
|-
 +
| 1.69-3.60 || 0xDC9EE33A
 
|}
 
|}
 +
 +
<source lang="C">SceDisplayHead sceCompatGetPrimaryHead(void);</source>
  
 
=== sceCompatSetSuspendSema ===
 
=== sceCompatSetSuspendSema ===
Line 406: Line 656:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xDD30239E
+
| 0.990 || not present
 
|-
 
|-
| 3.60 || 0xDD30239E
+
| 1.69-3.60 || 0xDD30239E
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatSetSuspendSema(SceUID sema_id_0, SceUID sema_id_1);</source>
  
 
=== sceCompatInitEx ===
 
=== sceCompatInitEx ===
Line 416: Line 668:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xE97C1B5F
+
| 0.990-1.03 || not present
 
|-
 
|-
| 3.60 || 0xE97C1B5F
+
| 1.69-3.60 || 0xE97C1B5F
 
|}
 
|}
 +
 +
Loads <code>vs0:app/NPXS10028/pcff.skprx</code> and <code>os0:kd/pcbc.skprx</code>, then <code>compat_sm.self</code>, calls <code>SceGrabForDriver_072B8D93(param)</code>, and then issues [[F00D_Commands#0x10006_-_sceCompatSecLoadSCBootCode|compat_sm command 0x10006]].
 +
 +
<source lang="C">int sceCompatInitEx(int param);</source>
  
 
=== sceCompatUninit ===
 
=== sceCompatUninit ===
Line 426: Line 682:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xEF929397
+
| 0.990-3.60 || 0xEF929397
|-
 
| 3.60 || 0xEF929397
 
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatUninit(void);</source>
  
 
=== sceCompatStop ===
 
=== sceCompatStop ===
Line 436: Line 692:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 1.69 || 0xFCE2422F
+
| 0.990-3.60 || 0xFCE2422F
|-
 
| 3.60 || 0xFCE2422F
 
 
|}
 
|}
 +
 +
<source lang="C">int sceCompatStop(void);</source>
  
 
=== sceCompatInit ===
 
=== sceCompatInit ===
Line 446: Line 702:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 0.940 || 0xB9DBD54A
+
| 0.940-1.03 || 0xB9DBD54A
 +
|-
 +
| 3.60 || not present
 
|}
 
|}
  
Loads Pcff and Pcbc.
+
Loads Pcff (PSP Compat Flash Files) and Pcbc (PSP Compat Boot Code).
 +
 
 +
<source lang="C">int sceCompatInit(SceSize size, SceUInt32 a2, SceCompatInitParam *pParam);</source>
  
 
=== sceCompatLCDCInit ===
 
=== sceCompatLCDCInit ===
Line 456: Line 716:
 
! Version !! NID
 
! Version !! NID
 
|-
 
|-
| 0.940 || 0x3021D626
+
| 0.940-0.990 || 0x3021D626
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 
 +
<source lang="C">int sceCompatLCDCInit(void *pFrameBufBase);</source>
 +
 
 +
=== sceCompatLCDCExec ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.940-0.990 || 0x7E3E266D
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 
 +
<source lang="C">int sceCompatLCDCExec(void);</source>
 +
 
 +
=== sceCompatResume ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || 0xCA184D5B
 +
|-
 +
| 1.03-3.60 || not present
 
|}
 
|}
 +
 +
<source lang="C">
 +
// step: must be either 1 (resume Pervasive, restore CPU speed) or 2 (init lcd dmac, write resume payload, reload act.dat)
 +
int sceCompatResume(SceUInt32 step, int maybe_addr);
 +
</source>
 +
 +
=== sceCompatSuspend ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || 0x9EFFE36E
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 +
<source lang="C">
 +
// step: must be either 1 (black screen) or 2 (suspend Pervasive, slow down CPU, wipe act.dat in memory)
 +
int sceCompatSuspend(SceUInt32 step);
 +
</source>
 +
 +
=== sceCompatWriteShared ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || 0xC37A463C
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 +
Writes to SceCompatSharedSram.
 +
 +
<source lang="C">int sceCompatWriteShared(SceUInt32 offset, const void *pBuf, SceSize size);</source>
 +
 +
=== sceCompatWaitRequest ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990-1.03 || 0x434BDAB0
 +
|-
 +
| 3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatWaitRequest(SceUInt32 req_id);</source>
 +
 +
=== sceCompatReturnResult ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || 0x02F5CF19
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatReturnResult(SceUInt32 req_id);</source>
 +
 +
=== sceCompatReturnValue ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990-1.03 || 0x61DB492A
 +
|-
 +
| 3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatReturnValue(SceUInt32 req_id, uint a2, uint a3);</source>
 +
 +
=== sceCompatSetDisplayBuffer ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990-1.03 || 0xC820EC43
 +
|-
 +
| 3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatSetDisplayBuffer(const SceDisplayFrameBuf *pFrameBuf);</source>
 +
 +
=== sceCompatReadShared ===
 +
{| class="wikitable"
 +
|-
 +
! Version !! NID
 +
|-
 +
| 0.990 || 0xC983287E
 +
|-
 +
| 1.03-3.60 || not present
 +
|}
 +
 +
<source lang="C">int sceCompatReadShared(SceUInt32 offset, void *pBuf, SceSize size);</source>
  
  
 
[[Category:Modules]]
 
[[Category:Modules]]
 
[[Category:Kernel]]
 
[[Category:Kernel]]

Latest revision as of 02:26, 30 September 2020

This is the primary kernel interface to the PSP Emulator.

Module

Version World Privilege
1.69-3.65 Non-secure Kernel

Libraries

Known NIDs

Version Name World Visibility NID
3.60-3.65 SceCompatForDriver Non-secure Kernel 0x7CFA62CD
3.60-3.65 SceCompatForVsh Non-secure User 0xF68A1AD0
0.990-3.65 SceCompat Non-secure User 0x0F35909D

Types

typedef struct SceCompatSettings { // size is 8 on FW 1.03
   SceUInt32 disp_filter : 1;
   SceUInt32 camera_direction : 1;
   SceUInt32 ra_up : 4;
   SceUInt32 ra_down : 4;
   SceUInt32 ra_left : 4;
   SceUInt32 ra_right : 4;
   SceUInt32 reserved : 46;
} SceCompatSettings;

typedef struct SceCompatInitParam { // size is 0x40 on FW 1.03
   char unk[0x40];
} SceCompatInitParam;

typedef struct SceCompatAllocCdramWithHoleParam { // size is 8 on FW 3.60
    void *pCachedCdramBase;
    void *pUncachedCdramBase;
} SceCompatAllocCdramWithHoleParam;

typedef enum SceCompatCacheMode {
	SCE_COMPAT_CACHE_MODE_NONE             = 0,
	SCE_COMPAT_CACHE_MODE_INVALIDATE       = 1,
	SCE_COMPAT_CACHE_MODE_CLEAN_INVALIDATE = 2,
	SCE_COMPAT_CACHE_MODE_CLEAN            = 3
} SceCompatCacheMode;

typedef struct SceCompatCtrl { // size is 0x10 on FW 3.60
    SceUInt32 timestamp;
    SceUInt32 buttons;
    SceUInt8 Lx;
    SceUInt8 Ly;
    SceUInt8 Rx;
    SceUInt8 Ry;
    SceUInt32 reserved;
} SceCompatCtrl;

typedef enum SceCompatPeripheralStateId {
	SCE_COMPAT_PERIPHERAL_STATE_IS_HEADPHONE_EXIST       = 1,
	SCE_COMPAT_PERIPHERAL_STATE_GET_BATTERY_LIFE_PERCENT = 2,
	SCE_COMPAT_PERIPHERAL_STATE_GET_BATTERY_LIFE_TIME    = 3,
	SCE_COMPAT_PERIPHERAL_STATE_IS_SUSPEND_REQUIRED      = 4
} SceCompatPeripheralStateId;

SceCompatForDriver

sceCompatSetColorSpaceModeForDriver

Version NID
0.990 not present
3.60 0x6EBD9E01

Name might also be sceCompatSetDisplayConfigForDriver.

// mode can be 0, 1 or 2
int sceCompatSetColorSpaceModeForDriver(SceUInt32 mode);

SceCompatForVsh

sceCompatGetTitleListForVsh

Version NID
0.990 not present
3.60 0x4915DEE7

Reads ur0:emu_list/title_list.bin.

// size must be 100
int sceCompatGetTitleListForVsh(void *pBuf, SceSize size);

sceCompatIsPocketStationTitleForVsh

Version NID
0.990 not present
3.60 0x70997F92

The first 4 characters of the Title Id are letters. The remaining numbers are converted to digital values with strtol,

XORed then compared to SceCompat hardcoded values.

SceBool sceCompatIsPocketStationTitleForVsh(const char *titleId);

sceCompatGetPspSystemSoftwareVersionForVsh

Version NID
0.990 not present
3.60 0x9C107CC9

On emulated PSP FW 6.60, it returns 660. On emulated PSP FW 6.61, it returns 661.

int sceCompatGetPspSystemSoftwareVersionForVsh(void);

SceCompat

sceCompatGetUpdateState

Version NID
0.990-1.03 not present
3.60 0x0CDE9EC5
int sceCompatGetUpdateState(void);

sceCompatGetDevInf

Version NID
0.990 not present
1.03-3.60 0x138006A8

Calls sceIoDevctlForDriver("ux0", 0x3001, NULL, 0, pInfo, sizeof(SceIoDevInfo));.

int sceCompatGetDevInf(SceIoDevInfo *pInfo);

sceCompatGetPeripheralState

Version NID
0.990-3.60 0x176B2906
int sceCompatGetPeripheralState(SceCompatPeripheralStateId stateId);

sceCompatWriteShared32

Version NID
0.990 not present
1.03-3.60 0x1CD51530
// some_id must be between 0x80 and 0x8A
int sceCompatWriteShared32(SceUInt32 some_id, SceUInt32 value);

sceCompatWriteSharedCtrl

Version NID
0.990-1.03 not present
3.60 0x2306FFED

Write pCtrl to Shared SRAM.

int sceCompatWriteSharedCtrl(SceCompatCtrl *pCtrl);

sceCompatSetSettings

Version NID
0.990 not present
1.03-1.69 0x312782DC
3.60 not present
int sceCompatSetSettings(SceCompatSettings settings);

sceCompatSuspendResume

Version NID
0.990 not present
1.69-3.60 0x324112CA
// mode: 0: suspend, 1: resume
// step: 1: first step, 2: second step
int sceCompatSuspendResume(SceUInt32 mode, SceUInt32 step);

sceCompatSetDisplayConfig

Version NID
0.990-1.03 not present
1.69-3.60 0x32BA3DCF
// head must be SCE_DISPLAY_HEAD_MAIN_LCD_OLED
// mode can be 0, 1 or 2
int sceCompatSetDisplayConfig(SceDisplayHead head, SceUInt32 mode);

sceCompatRegRead

Version NID
0.990-1.69 0x4521505D
3.60 not present
// unk_id: if unk_id equals 0, offset + size must be less than 0x3a5d,
// else if unk_id equals 1, offset + size must be less than 0x20000
int sceCompatRegRead(SceUInt32 unk_id, SceUInt32 offset, void *pBuf, SceSize size);

sceCompatAvailableColorSpaceSetting

Version NID
0.990-1.03 not present
3.60 0x456226DD

Returns true only if (displayDeviceType & 3) equals 3.

SceBool sceCompatAvailableColorSpaceSetting(void);

sceCompatCache

Version NID
0.940-3.60 0x6777390E
int sceCompatCache(SceCompatCacheMode mode, void *base, SceSize size);

sceCompatWaitSpecialRequest

Version NID
0.940-3.60 0x714F7ED6
int sceCompatWaitSpecialRequest(SceUInt32 req_id);

sceCompatReadShared32

Version NID
0.990 not present
1.03-3.60 0x73AA4871
// some_id must be between 0 and 7. 3 seems disabled.
int sceCompatReadShared32(SceUInt32 some_id, SceUInt32 *pValue);

sceCompatGetSettings

Version NID
0.990 not present
1.03-1.69 0x782C980E
3.60 not present
int sceCompatGetSettings(SceCompatSettings *pSettings);

sceCompatIsPocketStationTitle

Version NID
0.990-1.03 not present
3.60 0x7DCFBCCE

The first 4 characters of the Title Id are letters. The remaining numbers are converted to digital values with strtol,

XORed then compared to SceCompat hardcoded values.

SceBool sceCompatIsPocketStationTitle(const char *titleId);

sceCompatWaitAndGetRequest

Version NID
0.990-1.03 not present
3.60 0x8176C238
int sceCompatWaitAndGetRequest(SceUInt32 req_id, SceUInt32 a2);

sceCompatSetUpdateState

Version NID
0.990-1.03 not present
3.60 0x8A44206F
// unsure if there is an argument
int sceCompatSetUpdateState(void);

sceCompatStart

Version NID
0.940-3.60 0x8CA1632D
int sceCompatStart(void);

sceCompatPrepareLoad

Version NID
0.940 not present
1.03 0x78E469D6
3.60 not present

Loads Pcff (PSP Compat Flash Files) and Pcbc (PSP Compat Boot Code).

int sceCompatPrepareLoad(void);

sceCompatRegWrite

Version NID
0.990-1.69 0x912B1C28
3.60 not present
// unk_id: if unk_id equals 0, offset + size must be less than 0x3a5d,
// else if unk_id equals 1, offset + size must be less than 0x20000
int sceCompatRegWrite(SceUInt32 unk_id, SceUInt32 offset, const void *pBuf, SceSize size);

sceCompatIdStorageLookup

Version NID
0.940-3.60 0x94AAA245
int sceCompatIdStorageLookup(SceUInt16 key, SceUInt32 offset, void *pBuf, SceSize size);

sceCompatCheckPocketStation

Version NID
0.990 not present
1.03-3.60 0x96FC2A87

Checks PocketStation RIF.

int sceCompatCheckPocketStation(void);

sceCompatGetTitleList

Version NID
0.990-1.03 not present
3.60 0x99F13E04

Reads ur0:emu_list/title_list.bin.

// size must be 100
int sceCompatGetTitleList(void *pBuf, SceSize size);

sceCompatGetCurrentSecureTick

Version NID
0.990-1.03 not present
3.60 0xA073EBEE
int sceCompatGetCurrentSecureTick(SceRtcTick *pTick);

sceCompatAllocCdram

Version NID
0.990 not present
1.69-2.06 0x6E8E3BA8
3.60 not present
int sceCompatAllocCdram(void **ppCachedCdramBase, void **ppUncachedCdramBase);

sceCompatAllocCdramWithHole

Version NID
0.990-1.03 not present
3.60 0xA5039FFA
int sceCompatAllocCdramWithHole(SceCompatAllocCdramWithHoleParam *pCdram);

sceCompatMapDDR

Version NID
0.990 not present
1.03 0xC6B19D35
3.60 not present
// size must be 0x4000000 (64MB)
int sceCompatMapDDR(SceUID memblock_uid, SceSize size);

sceCompatGetPspSystemSoftwareVersion

Version NID
0.990-3.60 0xB113DCC0

On emulated PSP FW 6.60, it returns 660. On emulated PSP FW 6.61, it returns 661.

int sceCompatGetPspSystemSoftwareVersion(void);

sceCompatFrameBufferInit

Version NID
0.990 not present
1.03-3.60 0xBC0E2B4C
int sceCompatFrameBufferInit(void *base);

sceCompatLCDCSync

Version NID
0.990 not present
1.03-3.60 0xBD177787
int sceCompatLCDCSync(void);

sceCompatWaitIntr

Version NID
0.990-1.03 not present
3.60 0xC1E14CF5

sceCompatGetRequest

Version NID
0.990-1.03 not present
1.69 0xCB9F607B
3.60 not present

sceCompatDatRead

Version NID
0.990-3.60 0xCBE73EBE

Reads act.dat.

// index must be 0
// offset + size must be lower or equal to 0x1038
int sceCompatDatRead(SceUInt32 index, SceUInt32 offset, void *pBuf, SceSize size);

sceCompatReturnValueEx

Version NID
0.990 not present
1.69-3.60 0xCC02A9FF

sceCompatGetStatus

Version NID
0.990 not present
1.03-3.60 0xD2E3370E
int sceCompatGetStatus(void);

sceCompatInterrupt

Version NID
0.940-3.60 0xD6AA36DD

Set a custom SceCompatMailbox address.

// some_id must be between 0 and 15
int sceCompatInterrupt(SceUInt32 some_id);

sceCompatSetRif

Version NID
0.990 not present
1.03-3.60 0xD8B69F23
// Example of entitlementId: AA0000-AAAA00000_00-0000000000000000
int sceCompatSetRif(const char *entitlementId);

sceCompatGetPrimaryHead

Version NID
0.990 not present
1.69-3.60 0xDC9EE33A
SceDisplayHead sceCompatGetPrimaryHead(void);

sceCompatSetSuspendSema

Version NID
0.990 not present
1.69-3.60 0xDD30239E
int sceCompatSetSuspendSema(SceUID sema_id_0, SceUID sema_id_1);

sceCompatInitEx

Version NID
0.990-1.03 not present
1.69-3.60 0xE97C1B5F

Loads vs0:app/NPXS10028/pcff.skprx and os0:kd/pcbc.skprx, then compat_sm.self, calls SceGrabForDriver_072B8D93(param), and then issues compat_sm command 0x10006.

int sceCompatInitEx(int param);

sceCompatUninit

Version NID
0.990-3.60 0xEF929397
int sceCompatUninit(void);

sceCompatStop

Version NID
0.990-3.60 0xFCE2422F
int sceCompatStop(void);

sceCompatInit

Version NID
0.940-1.03 0xB9DBD54A
3.60 not present

Loads Pcff (PSP Compat Flash Files) and Pcbc (PSP Compat Boot Code).

int sceCompatInit(SceSize size, SceUInt32 a2, SceCompatInitParam *pParam);

sceCompatLCDCInit

Version NID
0.940-0.990 0x3021D626
1.03-3.60 not present
int sceCompatLCDCInit(void *pFrameBufBase);

sceCompatLCDCExec

Version NID
0.940-0.990 0x7E3E266D
1.03-3.60 not present
int sceCompatLCDCExec(void);

sceCompatResume

Version NID
0.990 0xCA184D5B
1.03-3.60 not present
// step: must be either 1 (resume Pervasive, restore CPU speed) or 2 (init lcd dmac, write resume payload, reload act.dat)
int sceCompatResume(SceUInt32 step, int maybe_addr);

sceCompatSuspend

Version NID
0.990 0x9EFFE36E
1.03-3.60 not present
// step: must be either 1 (black screen) or 2 (suspend Pervasive, slow down CPU, wipe act.dat in memory)
int sceCompatSuspend(SceUInt32 step);

sceCompatWriteShared

Version NID
0.990 0xC37A463C
1.03-3.60 not present

Writes to SceCompatSharedSram.

int sceCompatWriteShared(SceUInt32 offset, const void *pBuf, SceSize size);

sceCompatWaitRequest

Version NID
0.990-1.03 0x434BDAB0
3.60 not present
int sceCompatWaitRequest(SceUInt32 req_id);

sceCompatReturnResult

Version NID
0.990 0x02F5CF19
1.03-3.60 not present
int sceCompatReturnResult(SceUInt32 req_id);

sceCompatReturnValue

Version NID
0.990-1.03 0x61DB492A
3.60 not present
int sceCompatReturnValue(SceUInt32 req_id, uint a2, uint a3);

sceCompatSetDisplayBuffer

Version NID
0.990-1.03 0xC820EC43
3.60 not present
int sceCompatSetDisplayBuffer(const SceDisplayFrameBuf *pFrameBuf);

sceCompatReadShared

Version NID
0.990 0xC983287E
1.03-3.60 not present
int sceCompatReadShared(SceUInt32 offset, void *pBuf, SceSize size);