Skip to content

Instantly share code, notes, and snippets.

@173210
Last active December 29, 2015 10:28
Show Gist options
  • Save 173210/7656903 to your computer and use it in GitHub Desktop.
Save 173210/7656903 to your computer and use it in GitHub Desktop.
Binary Loader excluding NULL character for PSP
/* by 173210 (adapted from valentine-hbl) */
.set noat
.set noreorder
addiu $a0, $ra, 0x180 /* filename. If you change this value, move it in the savegame */
li $a1, 258
addiu $a2, $a1, -227
jal sceIoOpen /* sceIoOpen */
addiu $a1, $a1, -257
xori $s0, $v0, 0xFFFF /* backup the return value of the function */
xori $a0, $s0, 0xFFFF /* set the return value of the function for arg0 of the next function */
lui $a1, 0x08C0 /* arg1 is 0x08C00000, load address of the binary file */
jal sceIoRead /* sceIoRead */
li $a2, 0xFFFF /* arg2, read 0xFFFF bytes from the file */
jal sceIoClose /* sceIoClose */
xori $a0, $s0, 0xFFFF /* restore the return value of the function for arg0 of the next function */
j sceKernelDcacheWritebackInvalidateAll /* sceKernelDcacheWritebackInvalidateAll */
lui $ra, 0x08C0 /* return address is 0x08C00000, load address of the binary file */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment