added kernel libraries bindings and cleaned up todos

This commit is contained in:
2024-05-12 16:16:15 +02:00
parent e9824cbd95
commit 8a5e2870f6
68 changed files with 3278 additions and 92 deletions
+26 -2
View File
@@ -4,6 +4,7 @@ import "core:c"
import sce "../common"
foreign import appmgr "system:SceAppMgr_stub"
foreign import appmgrkern "system:SceAppMgrForDriver_stub"
foreign appmgr {
/**
@@ -194,8 +195,7 @@ foreign appmgr {
*
* @note SELF file must be located in app0: partition.
*/
// TODO: no idea how argv is supposed to be changed to odin types. C type is `char *argv[]`
sceAppMgrLoadExec :: proc(appPath: cstring, argv: [][^]c.char, optParam: ^SceAppMgrExecOptParam) -> c.int ---
sceAppMgrLoadExec :: proc(appPath: cstring, argv: [^]cstring, optParam: ^SceAppMgrExecOptParam) -> c.int ---
/**
* Start an application by URI
@@ -438,3 +438,27 @@ foreign appmgr {
sceSharedFbEnd :: proc(fb_id: sce.UID) -> c.int ---
sceSharedFbGetInfo :: proc(fb_id: sce.UID, info: ^SceSharedFbInfo) -> c.int ---
}
@(link_prefix = "ksceAppMgr")
foreign appmgrkern {
/**
* @brief Kill a process.
* @param[in] pid The process to kill.
* @return Zero on success, else < 0.
*/
KillProcess :: proc(pid: sce.UID) -> c.int ---
/**
* @brief Launch an application for debugging
*
* @param[in] path Path to the executable to load
* @param[in] args Arguments to pass to the executable and to configure appmgr
* @param[in] arg_size The size of the args passed in
* @param[in] type Set to 0x80000000 for debugging launch
* @param[in] param pointer to launch params
* @param unk unknown, set to nullptr
*
* @return pid on success, else < 0.
*/
LaunchAppByPath :: proc(path: cstring, args: cstring, arg_size: sce.Size, type: c.uint, #by_ptr param: SceAppMgrLaunchParam, unk: rawptr) -> c.int ---
}
+17 -2
View File
@@ -6,8 +6,7 @@ import apputil "../AppUtil"
SCE_APPMGR_MAX_APP_NAME_LENGTH:: (31)
// TODO: should be c.int
SceAppMgrErrorCode :: enum i64 {
SceAppMgrErrorCode :: enum c.uint {
BUSY = 0x80802000, //!< Busy
STATE = 0x80802013, //!< Invalid state
NULL_POINTER = 0x80802016, //!< NULL pointer
@@ -168,4 +167,20 @@ SceSharedFbInfo :: struct {
unk3: [3]c.int,
}
SceAppMgrLaunchParam :: struct {
size: sce.Size,
unk_4: c.uint, //<! set to 0x80000000 to break on launch
unk_8: c.uint,
unk_C: c.uint,
unk_10: c.uint,
unk_14: c.uint,
unk_18: c.uint,
unk_1C: c.uint,
unk_20: c.uint,
unk_24: c.uint,
unk_28: c.uint,
unk_2C: c.uint,
unk_30: c.uint,
}
#assert(size_of(SceAppMgrLaunchParam) == 0x34)