2024-05-11 23:24:13 +02:00
|
|
|
package vshbridge
|
|
|
|
|
|
|
|
|
|
import "core:c"
|
|
|
|
|
import sce "../common"
|
|
|
|
|
import sceKernel "../Kernel"
|
|
|
|
|
|
|
|
|
|
foreign import vshbridge "system:SceVshBridge_stub"
|
|
|
|
|
|
|
|
|
|
foreign vshbridge {
|
|
|
|
|
/**
|
|
|
|
|
* Gets real system firmware information.
|
|
|
|
|
*
|
|
|
|
|
* @param[out] data - firmware information.
|
|
|
|
|
*/
|
|
|
|
|
_vshSblGetSystemSwVersion :: proc(data: ^sceKernel.SceKernelFwInfo) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get service/manufacturing information (factory/minimum firmware).
|
|
|
|
|
*
|
|
|
|
|
* @param[out] info - The info output pointer
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshSblAimgrGetSMI :: proc(info: ^sce.UInt32) -> c.int ---
|
|
|
|
|
|
|
|
|
|
_vshSblAimgrGetConsoleId :: proc(CID: [32]c.char) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Check if a module is loaded.
|
|
|
|
|
*
|
|
|
|
|
* @param[in] module_name - The module's name
|
|
|
|
|
* @param[in] buffer - Set a buffer with a size of 8 bytes
|
|
|
|
|
*
|
|
|
|
|
* @return the SceUID of the module on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshKernelSearchModuleByName :: proc(module_name: cstring, buffer: rawptr) -> sce.UID ---
|
|
|
|
|
|
|
|
|
|
/**
|
2025-06-22 21:02:09 +02:00
|
|
|
* @brief Mount a partition.
|
2024-05-11 23:24:13 +02:00
|
|
|
*
|
2025-06-22 21:02:09 +02:00
|
|
|
* @param[in] id - Mount ID (one of ::SceVshMountId)
|
|
|
|
|
* @param[in] path - Mount path (optional, can be NULL)
|
|
|
|
|
* @param[in] permission - `1` for read-only, `2` for read-write.
|
|
|
|
|
* @param[in] buf - Work buffer. Allocate `0x100` and (important!) fill with `0`.
|
|
|
|
|
*
|
|
|
|
|
* @return `>= 0` on success, `< 0` on error.
|
2024-05-11 23:24:13 +02:00
|
|
|
*/
|
2025-06-22 21:02:09 +02:00
|
|
|
_vshIoMount :: proc(id: SceVshMountId, path: cstring, permission: c.int, buf: rawptr) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2025-06-22 21:02:09 +02:00
|
|
|
* @brief Unmount a partition.
|
|
|
|
|
*
|
|
|
|
|
* @warning Unmounting system partitions can cause system instability, even if
|
|
|
|
|
* you remount them back. For example, FIOS overlays used by the Shell
|
|
|
|
|
* won't get recreated and would effectively render the Shell unusable
|
|
|
|
|
*
|
|
|
|
|
* @param[in] id - Mount ID (one of ::SceVshMountId)
|
|
|
|
|
* @param[in] force - `1` to force unmount, `0` otherwise.
|
|
|
|
|
* @param[in] unk2 - Unknown, set to `0`.
|
|
|
|
|
* @param[in] unk3 - Unknown, set to `0`.
|
2024-05-11 23:24:13 +02:00
|
|
|
*
|
2025-06-22 21:02:09 +02:00
|
|
|
* @return `>= 0` on success, `< 0` on error.
|
2024-05-11 23:24:13 +02:00
|
|
|
*/
|
2025-06-22 21:02:09 +02:00
|
|
|
vshIoUmount :: proc(id: SceVshMountId, force: c.int, unk2: c.int, unk3: c.int) -> c.int ---
|
2024-05-11 23:24:13 +02:00
|
|
|
|
|
|
|
|
vshIdStorageIsDirty :: proc() -> c.int ---
|
|
|
|
|
vshIdStorageIsFormatted :: proc() -> c.int ---
|
|
|
|
|
vshIdStorageIsReadOnly :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param[in] leafnum - The read target leaf number
|
|
|
|
|
* @param[out] buf - The leaf data buffer pointer, size is 512 byte
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
vshIdStorageReadLeaf :: proc(leafnum: sce.Size, buf: rawptr) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param[in] leafnum - The write target leaf number
|
|
|
|
|
* @param[in] buf - The leaf data buffer pointer, size is 512 byte
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*
|
|
|
|
|
* note - Writing to leaf requires manufacturing mode.
|
|
|
|
|
*/
|
|
|
|
|
vshIdStorageWriteLeaf :: proc(leafnum: sce.Size, buf: rawptr) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Verify a eboot.pbp signature "__sce_ebootpbp"
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] eboot_signature - The pointer of data of __sce_ebootpbp signature. size is 0x200
|
|
|
|
|
* @param[in] eboot_signature_magic - The pointer of a pointer of magic number within __sce_ebootpbp, "NPUMDSIG" or "PSISOSIG"
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmEbootSigVerify :: proc(eboot_pbp_path: cstring, eboot_signature: cstring, eboot_signature_header: ^cstring) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Verify an older 0x100 byte eboot.pbp signature "__sce_ebootpbp" from firmware <2.00
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] eboot_signature - The pointer of data of __sce_ebootpbp signature. size is 0x100
|
|
|
|
|
* @param[in] eboot_signature_magic - The pointer of a pointer of magic number within __sce_ebootpbp, "NPUMDSIG" or "PSISOSIG"
|
|
|
|
|
*
|
|
|
|
|
* @return 0 on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmPspEbootVerify :: proc(eboot_pbp_path: cstring, eboot_signature: cstring, eboot_signature_header: ^cstring) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generate an older 0x100 byte eboot.pbp signature "__sce_ebootpbp" for a PSP game - this is unused in firmware >2.00
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] eboot_sha256 - The pointer of SHA256 hash of first (data.psar offset + 0x1C0000) bytes into the EBOOT.PBP file
|
|
|
|
|
* @param[out] eboot_signature - The pointer of the output eboot signature data. size is 0x100
|
|
|
|
|
*
|
|
|
|
|
* @return eboot_signature size on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmPspEbootSigGen :: proc(eboot_pbp_path: cstring, eboot_sha256: rawptr, eboot_signature: rawptr) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert an older 0x100 byte eboot.pbp signature "__sce_ebootpbp" to a 0x200 byte one used in firmwares >2.00
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] old_eboot_signature - The pointer of old eboot signature data. size is 0x100
|
|
|
|
|
* @param[out] new_eboot_signature - The pointer of new eboot signature data. size is 0x200
|
|
|
|
|
*
|
|
|
|
|
* @return eboot_signature size on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmEbootSigConvert :: proc(eboot_pbp_path: cstring, old_eboot_signature: rawptr, new_eboot_signature: rawptr) -> c.int ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generate eboot.pbp signature "__sce_ebootpbp" for a PSP game
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] eboot_sha256 - The pointer of SHA256 hash of first (data.psar offset + 0x1C0000) bytes into the EBOOT.PBP file
|
|
|
|
|
* @param[out] eboot_signature - The pointer of the output eboot signature data. size is 0x200
|
|
|
|
|
* @param[in] sw_version - The pointer of the minimum firmware version the signature can be used on. cannot be lower than current firmware
|
|
|
|
|
*
|
|
|
|
|
* @return eboot_signature size on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmEbootSigGenPsp :: proc(eboot_pbp_path: cstring, eboot_sha256: rawptr, eboot_signature: rawptr, sw_version: ^c.int) -> c.int ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generate eboot.pbp signature "__sce_ebootpbp" for a single-disc PS1 game
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] eboot_sha256 - The pointer of SHA256 hash of first (data.psar offset + 0x1C0000) bytes into the EBOOT.PBP file
|
|
|
|
|
* @param[out] eboot_signature - The pointer of the output eboot signature data. size is 0x200
|
|
|
|
|
* @param[in] sw_version - The pointer of the minimum firmware version the signature can be used on. cannot be lower than current firmware
|
|
|
|
|
*
|
|
|
|
|
* @return eboot_signature size on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmEbootSigGenPs1 :: proc(eboot_pbp_path: cstring, eboot_sha256: rawptr, eboot_signature: rawptr, sw_version: ^c.int) -> c.int ---
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Generate eboot.pbp signature "__sce_discinfo" for a multi-disc PS1 game
|
|
|
|
|
*
|
|
|
|
|
* @param[in] eboot_pbp_path - The pointer of the file path of the EBOOT.PBP file
|
|
|
|
|
* @param[in] sce_discinfo - The pointer of contents of vs0:/app/NPXS10028/__sce_discinfo
|
|
|
|
|
* @param[out] eboot_signature - The pointer of the output eboot signature data. size is 0x100
|
|
|
|
|
* @param[in] sw_version - The pointer of the minimum firmware version the signature can be used on. cannot be lower than current firmware
|
|
|
|
|
*
|
|
|
|
|
* @return eboot_signature size on success, < 0 on error.
|
|
|
|
|
*/
|
|
|
|
|
_vshNpDrmEbootSigGenMultiDisc :: proc(eboot_pbp_path: cstring, sce_discinfo: rawptr, eboot_signature: rawptr, sw_version: ^c.int) -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshSblAimgrIsCEX :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsDEX :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsVITA :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsGenuineVITA :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsDolce :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsGenuineDolce :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsTest :: proc() -> c.int ---
|
|
|
|
|
vshSblAimgrIsTool :: proc() -> c.int ---
|
|
|
|
|
vshSblSsIsDevelopmentMode :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshSysconHasWWAN :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshSysconIsDownLoaderMode :: proc() -> c.int ---
|
|
|
|
|
vshSysconIsIduMode :: proc() -> c.int ---
|
|
|
|
|
vshSysconIsMCEmuCapable :: proc() -> c.int ---
|
|
|
|
|
vshSysconIsShowMode :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshSysconIduModeSet :: proc() -> c.int ---
|
|
|
|
|
vshSysconIduModeClear :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshSysconShowModeSet :: proc() -> c.int ---
|
|
|
|
|
vshSysconShowModeClear :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshMemoryCardGetCardInsertState :: proc() -> c.int ---
|
|
|
|
|
vshRemovableMemoryGetCardInsertState :: proc() -> c.int ---
|
|
|
|
|
|
|
|
|
|
vshMsifGetMsInfo :: proc(info: ^sce.MsInfo) -> c.int ---
|
|
|
|
|
}
|