yifanlu / taiHEN

CFW framework for PS Vita
MIT License
307 stars 46 forks source link

Add blx/bl patching #35

Closed TheOfficialFloW closed 7 years ago

TheOfficialFloW commented 7 years ago

Sometimes you only need to manipulate a single call. Example: sceCtrlPeekBufferPositive does output all buttons (inclusive ps btn, power btn and volumes) if called in kernel mode, whereas from syscall state only user buttons can be received. Patching the import function that checks for syscall mode (not sure if it's really like this) might cause maleffect.

yifanlu commented 7 years ago

Why not patch the user import?

TheOfficialFloW commented 7 years ago

This won't work, since it's a function (or instruction) inside the kernel function that is checking whether the full range of buttons should be written to pad.buttons or not. (On the PSP it was checking for the $k1 register)

yifanlu commented 7 years ago

Ah, look at taiHookForOffset

yifanlu commented 7 years ago

You will be patching the the destination function though. Technically it will work within a function but then it's your responsibility to ensure stack alignment and register saving before calling TAI_CONTINUE

yifanlu commented 7 years ago

Closing this as there are various workarounds for this specific use-case.