2024-05-11 23:24:13 +02:00
|
|
|
package compat
|
|
|
|
|
|
|
|
|
|
import "core:c"
|
|
|
|
|
import sce "../common"
|
|
|
|
|
import sceIo "../Io"
|
|
|
|
|
|
|
|
|
|
foreign import compat "system:SceCompat_stub"
|
|
|
|
|
|
|
|
|
|
SceCompatCacheMode :: enum c.int {
|
|
|
|
|
NONE = 0,
|
|
|
|
|
INVALIDATE = 1,
|
|
|
|
|
WRITEBACK = 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceCompatPeripheralMode :: enum c.int {
|
|
|
|
|
POWER_IS_SUSPEND_REQUIRED = 1,
|
|
|
|
|
POWER_GET_BATTERY_LIFETIME = 2,
|
|
|
|
|
POWER_GET_BATTERY_PERCENT = 3,
|
|
|
|
|
HPREMOTE_IS_HEADPHONE_EXIST = 4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceCompatCdram :: struct {
|
|
|
|
|
cached_cdram: rawptr,
|
|
|
|
|
uncached_cdram: rawptr,
|
|
|
|
|
}
|
|
|
|
|
when size_of(rawptr) == 4 {
|
|
|
|
|
#assert(size_of(SceCompatCdram) == 8)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SceCtrlDataPsp :: struct {
|
|
|
|
|
TimeStamp: c.uint,
|
|
|
|
|
Buttons: c.uint,
|
|
|
|
|
Lx: c.uchar,
|
|
|
|
|
Ly: c.uchar,
|
|
|
|
|
Rx: c.uchar,
|
|
|
|
|
Ry: c.uchar,
|
|
|
|
|
Rsrv: [4]c.uchar,
|
|
|
|
|
}
|
|
|
|
|
#assert(size_of(SceCtrlDataPsp) == 0x10)
|
|
|
|
|
|
|
|
|
|
foreign compat {
|
|
|
|
|
/**
|
|
|
|
|
* Init compat
|
|
|
|
|
*
|
|
|
|
|
* @param[in] unk - Unknown, pass 0
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatInitEx :: proc(unk: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Uninit compat
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatUninit :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Start compat
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatStart :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Stop compat
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatStop :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Allocate cdram with hole
|
|
|
|
|
*
|
|
|
|
|
* @param[out] cdram - A pointer to a ::SceCompatCdram structure.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatAllocCdramWithHole :: proc(cdram: ^SceCompatCdram) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Framebuffer init
|
|
|
|
|
*
|
|
|
|
|
* @param[in] framebuffer - Pointer to framebuffer
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatFrameBufferInit :: proc(framebuffer: rawptr) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set suspend semaphores
|
|
|
|
|
*
|
|
|
|
|
* @param[in] semaid1 - Semaphore id 1
|
|
|
|
|
* @param[in] semaid2 - Semaphore id 2
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatSetSuspendSema :: proc(semaid1: sce.UID, semaid2: sce.UID) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Suspend/resume compat
|
|
|
|
|
*
|
|
|
|
|
* @param[in] unk - Unknown, pass 1
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatSuspendResume :: proc(unk: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Cache operation
|
|
|
|
|
*
|
|
|
|
|
* @param[in] mode - One of ::SceCompatCacheMode
|
|
|
|
|
* @param[in] addr - Address
|
|
|
|
|
* @param[in] size - Size
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatCache :: proc(mode: SceCompatCacheMode, addr: rawptr, size: sce.Size) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Wait for special request
|
|
|
|
|
*
|
|
|
|
|
* @param[in] unk - Unknown, pass 1
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatWaitSpecialRequest :: proc(unk: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interrupt code
|
|
|
|
|
*
|
|
|
|
|
* @param[in] intr_code - Interrupt code
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatInterrupt :: proc(intr_code: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* LCDC sync
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatLCDCSync :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get primary head
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetPrimaryHead :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get peripheral state
|
|
|
|
|
*
|
|
|
|
|
* @param[in] mode - One of ::SceCompatPeripheralMode
|
|
|
|
|
*
|
|
|
|
|
* @return state on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetPeripheralState :: proc(mode: SceCompatPeripheralMode) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get compat status
|
|
|
|
|
*
|
|
|
|
|
* @return status on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetStatus :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get update state
|
|
|
|
|
*
|
|
|
|
|
* @return state on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetUpdateState :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set update state
|
|
|
|
|
*
|
|
|
|
|
* @param[in] state - State
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatSetUpdateState :: proc(state: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set display config
|
|
|
|
|
*
|
|
|
|
|
* @param[in] unk0 - Unknown
|
|
|
|
|
* @param[in] unk1 - Unknown
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatSetDisplayConfig :: proc(unk0: c.int, unk1: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set RIF name
|
|
|
|
|
*
|
|
|
|
|
* @param[in] rif - RIF name (max. 36 chars)
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatSetRif :: proc(rif: cstring) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get PSP system software version
|
|
|
|
|
*
|
|
|
|
|
* @return version on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetPspSystemSoftwareVersion :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get color space setting availability
|
|
|
|
|
*
|
|
|
|
|
* @return 1 if true, 0 if false, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatAvailableColorSpaceSetting :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if pocket station application is available
|
|
|
|
|
*
|
|
|
|
|
* @return 1 if true, 0 if false, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatCheckPocketStation :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if current title is a pocket station game
|
|
|
|
|
*
|
|
|
|
|
* @return 1 if true, 0 if false, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatIsPocketStationTitle :: proc() -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Wait for command and get request
|
|
|
|
|
*
|
|
|
|
|
* @param[in] mode - Mode
|
|
|
|
|
* @param[in] id - ID
|
|
|
|
|
*
|
|
|
|
|
* @return pointer to request in PspEmu RAM on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatWaitAndGetRequest :: proc(mode: c.int, id: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read from shared sram
|
|
|
|
|
*
|
|
|
|
|
* @param[in] location - Location
|
|
|
|
|
* @param[out] value - Pointer to a int buffer to hold the value
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatReadShared32 :: proc(location: c.int, value: ^c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Write to shared sram
|
|
|
|
|
*
|
|
|
|
|
* @param[in] location - Location
|
|
|
|
|
* @param[in] value - Value
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatWriteShared32 :: proc(location: c.int, value: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Write shared control
|
|
|
|
|
*
|
|
|
|
|
* @param[in] info - A pointer to a ::SceCtrlDataPsp structure.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatWriteSharedCtrl :: proc(pad_data: ^SceCtrlDataPsp) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get title list
|
|
|
|
|
*
|
|
|
|
|
* @param[out] buf - A 100 bytes buffer for the title list
|
|
|
|
|
* @param[in] length - Must be 100
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetTitleList :: proc(buf: rawptr, length: sce.Size) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Memory Card device information
|
|
|
|
|
*
|
|
|
|
|
* @param[out] info - A pointer to a ::SceIoDevInfo structure.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetDevInf :: proc(info: ^sceIo.SceIoDevInfo) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get current secure tick
|
|
|
|
|
*
|
|
|
|
|
* @param[out] tick - A pointer to a ::SceRtcTick structure.
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
2024-05-13 16:04:23 +02:00
|
|
|
sceCompatGetCurrentSecureTick :: proc(tick: ^sce.RtcTick) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
}
|