PSP Emulation: Difference between revisions

From PS4 Developer wiki
Jump to navigation Jump to search
mNo edit summary
 
(431 intermediate revisions by 4 users not shown)
Line 1: Line 1:
More Information:
=='''PSPHD'''==
The new PS Plus PSP emulator includes plenty of undiscovered functionalities, it even allows patches directly to the emulated Allegrex cpu.
Not many CLI commands were added this time around. Very few commands have a description to their usage inside of the eboot.bin, everything else is just guesswork from the scene. Plenty of LUA commands need to be understood before the compatibility of games can improve. The PSP emulator has not gained the same popularity as the ps2 emulator due to the existence of an unofficial PPSSPP core in the unofficial Retroarch port for the PS4. As far as the compatibility and performance go, the Retroarch core is yet to be bested. This emulator may hold potential, but the potential can only go so far as it seems not to have support for gamedata installation, which in turn will render many games unplayable.
 
== Commands ==
'''Known functions:''' Require cleanup.
<br>The rest of the cli and lua commands can all be found inside of an emu's decrypted '''eboot.bin'''.
=== CLI commands ===
These commands can be added to any of these files:
* '''config-title.txt'''
* '''package-ps4.conf'''
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Command !! Values !! Notes !! Usage
|-style="background-color:#FEA15C"
|  || General || ||
|-
| --boot || || Set directory of psp game's boot.bin || [disc0:/PSP_GAME/SYSDIR/BOOT.BIN]
|-
| --notrophies || || Enable/disable trophies||
|-
| --ps4-trophies  || || ||
|-
| --locale || || ||
|-
| --image || umd0 ,disc0 || Set path for disc image ||
|-
| --vms || ? || ? ||
|-
| --addon || || ||
|-
| --host || Sets host directory || --host="/hostapp/" ||
|-
| --loglevel || none, all, warn, info, error, debug, trace || debug logging  ||
|-
| --xobuttonmode || oenter, ocancel || Switcher between x and circle button, made specifically for japanese gamers  ||
|-
| --lang || Including but not limited to "en" "jp" "fr" "it"  || Language selector || --lang="en"
|-
| --savedata-mode || ? || ? ||
|-
| --securesaves || true, false || Enable/disable encrypted savegames || --securesaves=true
|-
| --multisaves || true, false || Enable Multiple Savegames || --multisaves=true
|-
| --samplesave || ? || ? ||
|-style="background-color:#ff99c2"
| || Graphical fixes || ||
|-
| --antialias || off, MSAA4x, SSAA4x|| Anti-aliasing options || --antialias=off
|-
| --texcachemode || patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo, full || for issues with texture cache (modes lower than full possibly read some textures directly without cache). || --texcachemode=patchworkheroes
|-
| --texclutmode || filter, full || || --texclutmode=full
|-
| --texloadmode || launch, ondemand_lz4 || Seems to be a selector of when to load textures, either before the game requires it, or once the game requires it  ||
|-
| --depthscalehack || true?, false? || ||--depthscalehack=true
|-
| --depthscalehack || true?, false? || ||--depthscalehack=true
|-
| --locorocomeshsmooth || true, false || Custom mesh smoothing for loco roco games(?)|| --locorocomeshsmooth=true
|-
| --locorocomeshsmoothnonindexed || true, false || Turns "locorocomeshsmooth" mesh smoothing into non-indexed(?) ||--locorocomeshsmoothnonindexed=true
|-
| --forcenobilinear || true, false || Turn bilinear filtering on/off, setting it to True will fix many graphical glitches in games that use 2D Images ||--forcenobilinear=true
|-style="background-color:#D7EF54"
|  || Game fixes || ||
|-
| --godofwarhack || true, false || Likely a performance patch for games that go way above the fps cap. Managed to help '''God Of War - Ghost Of Sparta''' skip intro freeze. it could possibly be used as a speedhack.  [https://github.com/hrydgard/ppsspp/pull/15640 Might be this?]|| --godofwarhack=true
|-style="background-color:#03fcc2"
|  || No effect / unknown values || ||
|-
| --texloadcores || 0, 100 || textures to load || texloadcores=2
|-
| --smoothlevel || 0, 100 ||  Mesh smoothing level? || --smoothlevel=0
|-
| --anisolevel || 0, 100 || Anisotropic filtering level?? ||
|-
| --parappajapanesefonthack || true?, false? || Enables Support For Japanese Fonts ??|| --parappajapanesefonthack=true
|-
| --clamp-line-thickness-min || ? || ? ||
|-
| --clamp-line-thickness-max || ? || ? ||
|-
| --parappareplacecolor || The command expects 8 Hex values || (rgb?) ||
|-
| --msxxadhoc || true?, false? || ad hoc support ? ||
|-
| --parappaalphahack || true?, false? || Doesn't seem to have any effect.|| --parappaalphahack=true
|-
| --umddelay || ? || Seems to be I/O timing method. Doesn't seem to have any effect  ||
|-
| --vramcopyback || 0, 10000000 || for games that download data from GPU to Allegrex || --vramcopyback=45
|-
|-style="background-color:#7698FF"
|  || Speedhacks / Possible duplicates|| ||
|-
| --antialias || off || Turning Anti-Alias Off Improves Performance||--antialias=off
|-
| --texclutmode ||  full || Turns on filtering of CLUT hashes to avoid repeat indexed textures ||--texclutmode=full
|-
| --texloadcores || 0 || Textures to load ||--texloadcores=12
|-
| --smoothlevel || 0 || Set mesh smooth level||--smoothlevel=0
|-
| --gputhread || true, false || possibly move GPU emulation to another thread. Speedhack, but can decrease compatibility. || --gputhread=true
|-
| --texcachemode || patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo || Set texture caching method ||--texcachemode=patchworkheroes
|-
| --anisolevel || 0, 100 || Anisotropic filtering level?? ||
|-
| --present || vblankstart, setframebuf, drawsync|| set when frame is presented. Sync issues, flickering screen, tearing, input lag, etc. Doesn't seem to have any effect. ||--present=setframebuf
|-
| --texrecent || true || Optimize texture hashes ||--texrecent=true
|}
====Syphon Filter Dark Mirror====
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Command !! Values !! Notes !! Usage 
|-
| --force-native-aspect-ratio || || ||
|-
| --use-higher-precision-depth || || ||
|-
| --optimize-fb-self-resolves || || ||
|-
| --force-dsf-present || || ||
|-
| --bend-30hz-lock|| || ||
|-
| --setframebuf-auto-vblank-wait-threshold|| || ||
|-
| --gpu-renderthread|| || ||
|-
| --force-triangle-clip-off|| || ||
|-
| --hack-use-sku-vms|| || ||
|-
| --active-sku || || ||
|-
| --psp-right-stick-action || 0,1 || ||--psp-right-stick-action=1
|-
| --psp-right-stick-deadzone-x || || ||--psp-right-stick-deadzone-x=15
|-
| --psp-right-stick-deadzone-y || || ||--psp-right-stick-deadzone-y=15
|-
| --psp-right-stick-deadzone-semicircle-arc || || ||--psp-right-stick-deadzone-semicircle-arc=40
|-
|}
 
====Texture replacement====
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Command !! Values !! Notes !! Usage 
|-
| --texswitch||true, false|| Enables Texture replacement || --texswitch=true
|-
| --texsave || || ||
|-
| --texmissingsave || || ||
|-
| --autoresampler || true, false|| Turns on the auto-resampler. Assumes textures in texreplace are at 8x resolution and resamples them at load, May only work on new LocoRoco Midnight Carnival emu || --autoresampler=true
|-
| --texreplace || Directory || Set directory of texture replacement folder || --texreplace="host0:texreplace"
|-
| --replacementfilter || true, false || This forces alpha blending to on for replaced textures. || --replacementfilter=true
|-
| --replacementalpha || true, false || || --replacementalpha=true
|-
|}
 
===XXXXYYYYY_patches.lua===
The lua can be placed as: '''scripts\XXXXYYYYY_patches.lua'''
 
====Emulator commands====
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Command !! Usage !! Notes - Example
|-
|getEmuObject || '''local emuObj = getEmuObject()''' || Required for all functions using emuObj
|-
|LoadSlideshow ||emuObj.LoadSlideshow()||
|-
|StartSlideshow ||emuObj.StartSlideshow()||
|-
|Log ||emuObj.Log()||
|-
| GetLanguage ||emuObj.GetLanguage()|| Get the language the ps4 is using
|-
| GetNativeLanguage ||emuObj.GetNativeLanguage()||
|-
|DisplayManual || emuObj.DisplayManual()||
|-
| DisplayProduct||emuObj.DisplayProduct()||
|-
|LoadConfig ||emuObj.LoadConfig()||
|-
| SaveConfig||emuObj.SaveConfig()||
|-
| LoadMIDI ||emuObj.LoadMIDI()||
|-
| GetMIDINotesAtTick ||emuObj.GetMIDINotesAtTick()||
|-
|LoadState ||emuObj.LoadState()||
|-
| SaveState ||emuObj.SaveState()||
|-
| SetFDExtraDelay ||emuObj.SetFDExtraDelay()|| 0? 1?
|-
| MeshSmooth ||emuObj.MeshSmooth()||
|-
| SetHue ||emuObj.SetHue()||
|-
| SetSaturation ||emuObj.SetSaturation()||
|-
| SetBrightness ||emuObj.SetBrightness()||
|-
| SetContrast ||emuObj.SetContrast()||
|-
| VideoScale ||emuObj.VideoScale()||
|-
| SetOverlay ||emuObj.SetOverlay()||
|-
| DisplayUIOverlay ||emuObj.DisplayUIOverlay()||
|-
| CRC32 ||emuObj.CRC32()||
|-
| SASGetCRC ||emuObj.SASGetCRC()||
|-
| SASGetSampleRate ||emuObj.SASGetSampleRate()
|-
| GetAppName ||emuObj.GetAppName()||
|-
| ReadFile ||emuObj.ReadFile()||
|-
| RemapFB ||emuObj.RemapFB()||
|-
| InvalFB ||emuObj.InvalFB()||
|-
| PlayVideo||emuObj.PlayVideo()||
|-
| RescaleUForUpscale ||emuObj.RescaleUForUpscale()||
|-
| RescaleVForUpscale||emuObj.RescaleVForUpscale()||
|-
| ShrinkUVRect ||emuObj.ShrinkUVRect()||
|-
| ScalePosition ||emuObj.ScalePosition()||
|-
| AdjustUVJitter ||emuObj.AdjustUVJitter()||
|-
| OverrideFBSize||emuObj.OverrideFBSize()|| Override framebuffer size ?
|-
|RemapSavedata || emuObj.RemapSavedata() ||emuObj.RemapSavedata("UCUS98711", "CUSA06171", "504e802b04a1838c32b616abbe0b475fbea1c823825ef0df06cc2bad129ce2f7")
|-
| NeoMode || emuObj.NeoMode() || Checks whether or not the ps4 is pro
|-
| ThrottleMax || emuObj.ThrottleMax() ||  Disable framelimiter during loading screens. This setting can sometimes be harmful when used globally in config files. Loading times are faster, but the game also runs faster than it should when the PS4 has enough free cpu power.
|-
| ThrottleFast|| emuObj.ThrottleFast() || Faster than default, but exact value is unknown.
|-
| ThrottleNorm ||emuObj.ThrottleNorm() || Enable default framelimiter (50/60 fps depend on region)
|-
|SetTextureHashMode||emuObj.SetTextureHashMode()||
|-
|SetTextureScaleOffset||emuObj.SetTextureScaleOffset()||
|-
|SetTextureSaveSubdir||emuObj.SetTextureSaveSubdir()||
|-
| SetDrawEDRam || emuObj.SetDrawEDRam() ||
|-
|SetSampleTitle||emuObj.SetSampleTitle()||
|-
|ToggleTextures||emuObj.ToggleTextures()||
|-
| CopyFB || emuObj.CopyFB() ||
|-style="background-color:#c6ecd9"
| Hooks  || ||
|-
| AddVsyncHook ||emuObj.AddVsyncHook()|| Set function to be done on every vsync
|-
| RemoveVsyncHook ||emuObj.RemoveVsyncHook()|| Remove vsynchook
|-
| AddBootHook ||emuObj.AddBootHook()|| Set function to be done when the game boots up
|-
|RemoveBootHook||emuObj.RemoveBootHook()|| remove function to be done when the game boots up
|-
| AddGPUHook ||emuObj.AddGPUHook()||
|-
|-style="background-color:#D7EF54"
|  Pad || ||
|-
| Pad require ||'''local pad = require("pad")''' || Required for all commands that rely on pad
|-
|PadRead || emuObj.PadRead() ||
<br>L3        = 0x00000002
<br>R3        = 0x00000004
<br>OPTIONS  = 0x00000008
<br>UP        = 0x00000010
<br>RIGHT    = 0x00000020
<br>DOWN      = 0x00000040
<br>LEFT      = 0x00000080
<br>L2        = 0x00000100
<br>R2        = 0x00000200
<br>L1        = 0x00000400
<br>R1        = 0x00000800
<br>TRIANGLE  = 0x00001000
<br>CIRCLE    = 0x00002000
<br>CROSS    = 0x00004000
<br>SQUARE    = 0x00008000
<br>SELECT    = 0x00010000
<br>START    = 0x00020000
|-
|PadReadPitch || emuObj.PadReadPitch() ||
|-
|PadReadRoll || emuObj.PadReadRoll()||
|-
|PadRegisterSamples || emuObj.PadRegisterSamples()||
|-
| PadSetButtonsMode || emuObj.PadSetButtonsMode() ||
<br>0 = Touch bar is split in two for Start/Select. Option is unmapped (default behaviour)
<br>1 = Touch bar is Start. Option is Select
<br>2 = Touch bar is Select. Option is Start
|-
| PadVibrate|| emuObj.PadVibrate() || emuObj.PadVibrate(5,180,180)
|-
|}
 
====Allegrex commands====
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Command !! Usage !! Notes - Example
|-
| getAXObject ||'''local axObj = getAXObject()''' || Required for all functions using AXObject
|-
| AddHook || axObj.AddHook() ||
|-
| RemoveHook || axObj.RemoveHook() ||
|-
| BurnCycles|| axobj.BurnCycles() || Could be an option to overclock cpu at a hooked offset
|-
|AddAOTBlock ||axObj.AddAOTBlock()|| Ahead of time compilation block ?
|-
|Overlay ||axObj.Overlay()||
|-style="background-color:#ff8080"
| GPR || ||
|-
| gpr require || '''local gpr = require("ax-gpr-alias")''' || Required for any command that includes gpr registers
|-
|SetPC|| axObj.SetPC() ||
|-
|GetPC|| axObj.GetPC() ||
|-
| GetGpr || axObj.GetGpr() ||
|-
| SetGpr ||axObj.SetGpr() ||
|-
|SetFpr|| axObj.SetFpr() ||axObj.SetFpr(0)
|-
|GetFpr || axObj.GetFpr() ||
|-
|SetHi|| axObj.SetHi()||
|-
|GetHi|| axObj.GetHi()||
|-
| SetLo || axObj.SetLo()||
|-
| GetLo ||axObj.GetLo()||
|-
| SetReg||axObj.SetReg()||
|-
|GetReg||axObj.GetReg()||
|-style="background-color:#D7EF54"
| Memory editing || || Do note that the offsets on PPSSPP are mapped differently than the ones on the PS4
|-
| ReadMem32 || axObj.ReadMem32() || Read 4 bytes from offset
|-
| WriteMem32 || axObj.WriteMem32() || Write 4 bytes to offset
|-
| ReadMem16 || axObj.ReadMem16() || Read 2 bytes from offset
|-
| WriteMem16 || axObj.WriteMem16() || Write 2 bytes to offset
|-
| ReadMem8 || axObj.ReadMem8() || Read 1 byte from offset
|-
| WriteMem8 || axObj.WriteMem8() || Write 1 byte to offset
|-
| ReadMemString || axObj.ReadMemString() ||
|-
| WriteMemString || axObj.WriteMemString() ||
|-
| WriteMemStr16 || axObj.WriteMemStr16() ||
|-
|WriteMemStr16Z  ||axObj.WriteMemStr16Z() ||
|-
| WriteMemStringZ ||axobj.WriteMemStringZ ||
|-
|ReadMemFloat || axObj.ReadMemFloat() ||
|-
|WriteMemFloat || axObj.WriteMemFloat() ||
|-
! !! Other/Unknown/Standalone Commands !!
|-
|FuncReplace || axFuncReplace() || axFuncReplace(0x8804670, "__ptmf_scall") Replace allegrex function.
|-
| InsnReplace || axInsnReplace() || Replace allegrex memory
|-
|}
 
====Examples====
<br>'''''LUA example:'''''
<br>
<br>Coconut Dodge "NPEZ00164"
<pre>
local axObj = getAXObject()
local emuObj = getEmuObject()
 
local patcher = function()
--Infinite lives
axObj.WriteMem32(0x8ACA1A4, 0x3) --0x08ACE1A4 on PPSSPP, PPSSPP addresses need to be reduced by 0x4000 in order to work on PS4
end
 
emuObj.AddVsyncHook(patcher)
</pre>
 
[https://www.psdevwiki.com/ps4/Talk:PSP_Emulator_Compatibility_List#Official_PSPemu_Configuration_Files More patches can be found here]
=====Patches.lua=====
======Syphon Filter: Dark Mirror======
 
<pre>
-- Lua 5.3
-- Title: Syphon Filter: Dark Mirror
 
-- Patches for fixing issues with post fx in games using the Syphon Filter/Resistance engine
 
apiRequest(1.0) -- request version 1.0 API. Calling apiRequest() is mandatory.
 
local emuObj = getEmuObject()
local cpu = getAXObject()
 
-- The bloom filter uses 1.5 pixel jitter to make a ghetto blur. When up-ressed, this doesn't look good.
-- To compensate, reduce the jitter amount before rendering.
function BloomJitterPlusAdjust()
-- 1.5 pixel "+" pattern
emuObj.AdjustUVJitter(0, 4, 0.0, 1.5)
emuObj.AdjustUVJitter(4, 4, 0.0, -1.5)
emuObj.AdjustUVJitter(8, 4, 1.5, 0.0)
emuObj.AdjustUVJitter(12, 4, -1.5, 0.0)
end
 
function BloomJitterCrossAdjust()
-- 1.5 pixel "x" pattern
emuObj.AdjustUVJitter(0, 4, 1.5, 1.5)
emuObj.AdjustUVJitter(4, 4, -1.5, 1.5)
emuObj.AdjustUVJitter(8, 4, 1.5, -1.5)
emuObj.AdjustUVJitter(12, 4, -1.5, -1.5)
end
 
local jitterFixPlus = emuObj.AddGPUHook(0x40dc000, 0, 16, 0x40d4000, BloomJitterPlusAdjust)
local jitterFixCross = emuObj.AddGPUHook(0x40d4000, 0, 16, 0x40dc000, BloomJitterCrossAdjust)
 
function depthquery()
local querystruct = 0x8eda968 -- this is always in a fixed location
-- the depth query struct is fixed to 24 entries
-- 0..15 seem to be always used for lights, 16..23 are for npcs
for i=0,23 do
local querytype = cpu.ReadMem32(querystruct+0)
local valid = cpu.ReadMem32(querystruct+1*4)
if valid ~= 0xffffffff then
--local queryx = cpu.ReadMem32(querystruct+2*4)
--local queryy = cpu.ReadMem32(querystruct+3*4)
--local querydepth = cpu.ReadMem32(querystruct+4*4)
--local querywidth = cpu.ReadMem32(querystruct+5*4)
--local queryheight = cpu.ReadMem32(querystruct+6*4)
--local param1c = cpu.ReadMem32(querystruct+7*4)
--local param20 = cpu.ReadMem32(querystruct+8*4)
local param24 = cpu.ReadMem32(querystruct+9*4)
--local result = cpu.ReadMemFloat(querystruct+10*4)
if param24 <= 0 then
cpu.WriteMem32(querystruct+1*4, 0xffffffff) -- to be removed from the list -> mark as invalid
else
if querytype == 3 then -- n x n coverage based occlusion used by lights. Object opacity is set to (visible_samples / total_samples)
cpu.WriteMemFloat(querystruct+10*4, 0.0) -- always hide lights
else -- Enemies use a 5-point (corners + center) occlusion check. Object is visible if any of the points is visible.
cpu.WriteMemFloat(querystruct+10*4, 1.0) -- set always visible
end
end
end
querystruct = querystruct + 0x2c
end
end
 
cpu.AddHook(0x8c163d4, 0x27bdff80, depthquery) -- = addiu sp, sp, -0x80
-- the hook code replaces the occlusion function, so just adjust the stack and return
cpu.InsnReplace(0x8c163d8, 0x34040000, 0x27bd0080) -- addiu sp, sp, 0x80
cpu.InsnReplace(0x8c163dc, 0xafa40048, 0x03e00008) -- jr ra
cpu.InsnReplace(0x8c163e0, 0x3c0408ee, 0x00000000) -- nop
</pre>
======Patapon 2'''======
<pre>
-- Lua 5.3
-- Title:  Patapon 2 PSP - UCUS-98732 (USA)
 
apiRequest(1.0) -- request version 1.0 API. Calling apiRequest() is mandatory.
 
local gpr = require( "ax-gpr-alias" ) -- you can access Allegrex GPR by alias (gpr.a0 / gpr["a0"])
local emuObj = getEmuObject() -- emulator
local axObj = getAXObject() -- allegrex
local pad = require("pad")
 
-- Hook memcpy to catch framebuffer effects
axFuncReplace(0x881D194, "patapon_memcpy")
 
-- Accelerate some functions
axFuncReplace(0x8804670, "__ptmf_scall")
axFuncReplace(0x8892230, "Renderer__makeWorldMatrix__4psysFv")
axFuncReplace(0x88209A8, "patapon_strcmp")
axFuncReplace(0x8815130, "sceGupSetStatus")
axFuncReplace(0x8851D84, "FMtx44__setRow__3PydFv")
axFuncReplace(0x88437F0, "Script__Talk__Controller__setDeltaTime__3PydFv")
axFuncReplace(0x8843B6C, "Script__Talk__Controller__setCmdId__3PydFv")
axFuncReplace(0x88441DC, "Script__Talk__Controller__getArgValuePtr__3PydFv_0")
axFuncReplace(0x89B25B0, "sceGmoCol4Multiply")
axFuncReplace(0x8910A60, "Gfx__CacheModel__getNodeMtx__6SystemFv")
axFuncReplace(0x8911440, "Gfx__StaticGmoModel__getNodeIdx__6SystemFv")
axFuncReplace(0x89114C8, "Gfx__StaticGmoModel__getNodeMtx__6SystemFv")
axFuncReplace(0x891157C, "Gfx__StaticGmoModel__getNodeMtx__6SystemFv_0")
axFuncReplace(0x881462C, "sceGuEnable", 0x8B3C050) -- param = gupbase pointer
axFuncReplace(0x8814684, "sceGuDisable", 0x8B3C050) -- param = gupbase pointer
axFuncReplace(0x89B2D84, "sceGmoFCurveEval_fastpath", 0x89B2D88) -- param = function entry if not fast path
--axFuncReplace(0x88D0788, "Game__Map__Weather__WindLocus__update__4LaboFv_loop", 0x88D0864) -- param = continue address
axFuncReplace(0x890FCBC, "convertLowerString__6SystemFv")
axFuncReplace(0x8877104, "convertLowerString__6SystemFv") -- convertLowerString__21@unnamed@BNDFile_cpp@Fv, same functionality
axFuncReplace(0x897927C, "__extendsfdf2")
axFuncReplace(0x8979AF8, "__muldf3")
axFuncReplace(0x8979A8C, "__adddf3")
axFuncReplace(0x897A750, "__truncdfsf2")
axFuncReplace(0x88CBD64, "RemapPacket", 0x8ACC394) -- param comes from RemapPacketAddr24 & RemapPacketAddr16
axFuncReplace(0x890FEA0, "patapon_strcmp") -- strcmpFast__6SystemFv ('fast' strcmp)
 
-- Switch Select command to "Options" button.
emuObj.PadSetButtonsMode(pad.BUTTONS_MODE_OPTION_IS_SELECT)
 
-- Remove "Transfer Patapon Saved Data" option from New Game option
--axInsnReplace(0x8A46660, 0x24070002, 0x24070001) -- li  a3,0x2  (change 2 menu options to 1)
emuObj.RemapSavedata("UCUS98711", "CUSA06171", "504e802b04a1838c32b616abbe0b475fbea1c823825ef0df06cc2bad129ce2f7")
 
-- Fix "Tree of Life" unaligned lines and shadows
axObj.AddHook(0x884600C, 0x8c850010, function() -- PSP::Gfx::PrimitiveContext::setVertex2f
local context = axObj.GetGpr(gpr.a0)
local cmdCount = axObj.ReadMem32(context + 0x14)
if (cmdCount & 1) == 1 then -- we have at least 2 commands
local cmdBuffer = axObj.ReadMem32(context + 0x10)
local cx = axObj.GetFpr(12)
local cy = axObj.GetFpr(13)
local ox = axObj.ReadMemFloat(cmdBuffer-12)
local oy = axObj.ReadMemFloat(cmdBuffer-8)
if cx == ox then
axObj.SetFpr(12, cx + 0.5)
axObj.WriteMemFloat(cmdBuffer-12, ox + 0.5)
elseif cy == oy then
axObj.SetFpr(13, cy + 0.5)
axObj.WriteMemFloat(cmdBuffer-8, oy + 0.5)
end
end
end)
 
-- LANGUAGES --
local langCode = "us" -- default
--local languageList = {"Japanese","English","UK","Italian","German","Spanish","French","Korean","Chinese","ns","nf","Dutch","Portuguese","gr","Belgium"}
--local gameLanguageCode = {"jp","us","uk","it","de","sp","fr","kr","cn","ns","nf","nl","pt","gr","be"}
local languageList = {"","English","","","","","","","","Spanish","French","","","",""}
local gameLanguageCode = {"","us","","","","","","","","ns","nf","","","",""}
 
-- US: english = 1, spanish = 9, french = 0xA (from Localize__Manager__setDefaultLangage)
-- EU: uk = 2, italian = 3, german = 4, spanish = 5, french = 6
-- JP: jp = 0
-- HP: ko = 7, ch = 8,
-- GLOBAL FUNCTIONS --
 
local GLOBAL = 0x8B7D088 -- reawakeDeathUnit - offset 0x88A95E8 in $v1
 
function getGlobalAddr() -- gets Global to user data.
-- address comes from: Labo::Bases::Camp::Controller::reawakeDeathUnit - offset 0x88A95E8 in $v1
-- add 0x20 to address to align it with the word "none"
local main = axObj.ReadMem32(GLOBAL) -- fixed Global address from: 0x88A95E8 -> 0x8c9fbc0
if main == 0xFFFFFFFF or main == 0 then
return 0xFFFFFFFF
end
local ptr = axObj.ReadMem32(main + 0x10c0) --> sets to: 0x8d07840
if ptr == 0xFFFFFFFF or ptr == 0 then
return 0xFFFFFFFF
end
 
return ptr
end
 
-- MAIN FUNCTIONS --
 
local H1 = function() -- Labo::Bases::Camp::Scene::updateTips
local v0 = axObj.GetGpr(gpr.v0)
if v0 > 0 then
emuObj.ThrottleMax()
else
emuObj.ThrottleNormal()
end
end
 
local H2 = function() -- GameSystem__SaveDataController__setStateMessage
local ptr = axObj.GetGpr(gpr.a2)
local str = axObj.ReadMemStr16(ptr)
local newStr = "Now loading. Do not turn off the power."
-- english: Now loading./Do not remove the Memory Stick Duo™ /or turn off the system power.
-- spanish: Cargando./No extraigas el Memory Stick Duo™ /ni apagues el sistema.
-- french: Chargement./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
-- italian: Caricamento in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
-- german: Lädt./Bitte den Memory Stick Duo™ nicht entfernen /und das System nicht ausschalten.
-- japanese: システムデータをロード中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
-- chinese: 系統資料載入中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
-- korean: 시스템 데이터를 불러오는 중입니다./Memory Stick Duo™를 빼거나/전원을 끄지 마십시오.
if string.find(str, "Now loading") then
newStr = "Now loading." -- English: Now loading./Do not remove the Memory Stick Duo™ /or turn off the system power.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Checking Memory Stick") then
newStr = "Please wait." -- English: Checking Memory Stick Duo™.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Now saving")then
newStr = "Now saving." -- English: Now saving./Do not remove the Memory Stick Duo™ /or turn off the system power.
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "Cargando.") then
newStr = "Cargando..." -- Spanish: Cargando./No extraigas el Memory Stick Duo™ /ni apagues el sistema.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Guardando...")then
newStr = "Espera..." -- Spanish: Guardando.../No extraigas el Memory Stick Duo™ /ni apagues el sistema.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Comprobando el Memory Stick") then
newStr = "Guardando..." -- Spanish: Comprobando el Memory Stick Duo™.
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "Chargement.") then
newStr = "Chargement." -- French: Chargement./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Vérification du Memory Stick")then
newStr = "Veuillez patienter." -- French: Vérification du Memory Stick Duo™.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Sauvegarde.") then
newStr = "Sauvegarde en cours." -- French: Sauvegarde./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "Caricamento in corso") then
newStr = "Caricamento in corso." -- Italian: Caricamento in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Controllo del Memory Stick")then
newStr = "Attendi." -- Italian: Controllo del Memory Stick Duo™.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Salvataggio in corso") then
newStr = "Salvataggio in corso." -- Italian: Salvataggio in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "Lädt") then
newStr = "Lädt." -- German: Lädt./Bitte den Memory Stick Duo™ nicht entfernen /und das System nicht ausschalten.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Memory Stick Duo™ wird überprüft")then
newStr = "Bitte warten." -- German: Memory Stick Duo™ wird überprüft.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Speichert.") then
newStr = "Speichert." -- German: Speichert./Bitte den Memory Stick Duo™ nicht entfernen und /das System nicht ausschalten.
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "システムデータをロード中です。") then
newStr = "ロード中。" -- Japanese: システムデータをロード中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Memory Stick Duo™のチェック中です。")then
newStr = "お待ちください。" -- Japanese: Memory Stick Duo™のチェック中です。
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "システムデータをセーブ中です。") then
newStr = "セーブ中。" -- Japanese: システムデータをセーブ中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "系統資料載入中。") then
newStr = "載入中。" -- Chinese: 系統資料載入中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Memory Stick Duo™確認中。")then
newStr = "請稍候。" -- Chinese: Memory Stick Duo™確認中。
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "保存中。") then
newStr = "存檔中。" -- Chinese: 保存中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
axObj.WriteMemStr16Z(ptr, newStr)
--
elseif string.find(str, "시스템 데이터를 불러오는 중입니다") then
newStr = "불러오는 중입니다." -- Korean: 시스템 데이터를 불러오는 중입니다./Memory Stick Duo™를 빼거나/전원을 끄지 마십시오.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "Memory Stick Duo™ 체크 중입니다")then
newStr = "잠시 기다려 주십시오." -- Korean: Memory Stick Duo™ 체크 중입니다.
axObj.WriteMemStr16Z(ptr, newStr)
elseif string.find(str, "시스템 데이터를 저장 중입니다") then
newStr = "저장 중입니다." -- Korean: 시스템 데이터를 저장 중입니다./Memory Stick Duo™를 빼거나,/전원을 끄지 마십시오.
axObj.WriteMemStr16Z(ptr, newStr)
end
end
 
local H3 = function() -- Localize__Manager__getLanguageName
local v0 = axObj.GetGpr(gpr.v0)
local langPtr = axObj.ReadMem32(v0)
langCode = axObj.ReadMemStr(langPtr)
end
 
local bundleFileName = ""
local H4 = function() -- System::Util__BNDFile__doNameCallback
local ptr = axObj.GetGpr(gpr.a0)
bundleFileName = axObj.ReadMemStr(ptr)
end
 
local H5 = function() -- Labo::GameSystem__callbackFunc_MemoryObject
local ptr = axObj.GetGpr(gpr.s5)
local dataPtr = axObj.ReadMem32(ptr)
if bundleFileName == "colony_data.pac" then
axObj.WriteMem16(dataPtr + 0x79ba, 4)
end
end
 
-- Black Smith - Remove "KeyGuide" bug when hit anvil head while quenching --
local blackSmithRunning = false
local H6 = function() -- Sound__SubGame__Blacksmith__Command__start__4LaboFv
blackSmithRunning = true
end
local H7 = function() -- Sound__BeatCommander__endSubGame__4LaboFv
if blackSmithRunning == true then
local a0 = axObj.GetGpr(gpr.a0)
axObj.WriteMem8(a0 + 0x19c, 1) -- set memory to 1 (instead of 0) otherwise brings up bad "KeyGuide"
end
blackSmithRunning = false
end
 
-- TIPS System hacks --
axInsnReplace(0x8A73A44, 0x3C0342A8, 0x3C0342A4) -- change required number of Tips from 84 to 82.
local H8 = function() -- GameSystem__Tips__Viewer__setup__4LaboFv
local global = getGlobalAddr()
if global == 0xFFFFFFFF then
return
end
 
local unitTable = axObj.ReadMem32(global + 0x1068) --> sets to: 0x8d13580 (unit table)
local tipsPtr = unitTable + 0x1F5E4
local badTips = axObj.ReadMem32(tipsPtr + 8)
badTips = badTips & 0xFFBBFFFF -- remove tips 0x53 and 0x57 as they referred to Multiplayer
axObj.WriteMem32(tipsPtr + 8, badTips)
end
 
-- Remove AutoSave menu from initial startup --
local H9 = function() -- GameSystem__SaveDataController__update__4LaboFv
local s3 = axObj.GetGpr(gpr.s3)
local flg = axObj.ReadMem32(s3 + 0x7eed)
local val = axObj.ReadMem32(s3 + 0x7efc)
if flg == 0 and val == 0x14 then
axObj.WriteMem32(s3 + 0x7efc, 0x13)
end
end
 
-- Change game save name to "Patapon 2 Remastered" --
local H10 = function() -- Utility__SaveDataUtility__setDataParamsfoString
local ptr = axObj.GetGpr(gpr.s1)
local strPtr = axObj.ReadMem32(ptr)
local newStr = "PATAPON™ 2 Remastered"
axObj.WriteMemStrZ(strPtr, newStr)
end
 
-- Change description for the "Friendship" weapon to remove game sharing text --
local itemsTable = {}
itemsTable[1] = "Proof of friendship establish" -- English
itemsTable[2] = "Prueba de la amistad establecida" -- Spanish
itemsTable[3] = "Preuve de l'amitié établie" -- French
itemsTable[4] = "Preuve d'une amitié" -- French alt
function changeStrings(strPtr) -- modify strings
local str = axObj.ReadMemStr16(strPtr) -- ptr to the string
local strFind = string.gsub(str, "/", " ") -- change any slash to space to strings can match.
strFind = string.gsub(strFind, "  ", " ") -- change any double spaces due to above change to only 1 space.
for i = 1, #itemsTable do
local startPos, endPos = string.find(strFind, itemsTable[i])
if startPos ~= nil then
str = string.sub(str, 1, (startPos-1) )
-- SPECIAL fixes --
str = string.gsub(str, "Un oiseau avec de bons HP et /une grosse attaque.","Un oiseau qui augmente vos/HP.") -- French incorrect grammar (bird)
str = string.gsub(str, "aumente","augmente") -- French incorrect grammar.
 
axObj.WriteMemStr16Z(strPtr, str)
end
end
end
local H11 = function() -- from Bases__Item__ExplanationWindow__setItemId
local ptr = axObj.GetGpr(gpr.a0)
local a2 = axObj.GetGpr(gpr.a2)
local valPtr = axObj.ReadMem32(ptr)
local v1 = valPtr + 8
local v0 = a2 * 4
v0 = v0 + v1
local strPtr = axObj.ReadMem32(v0)
strPtr = strPtr + valPtr
 
changeStrings(strPtr)
end
 
-- Skip Memory message when selecting "Delete Save Data" on "Save the adventure" dialogue.
local menuSkip = false
local H12 = function() -- Bases__Talk__CommandCamp__showDialog
menuSkip = true
end
local H13 = function() -- Bases__Talk__CommandCamp__showDialog
if menuSkip == true then
axObj.SetGpr(gpr.v1, 0)
menuSkip = false
end
end
local H14 = function() -- Bases__Talk__CommandCamp__showDialog
if menuSkip == true then
axObj.SetPC(0x88D908C)
end
end
 
 
-- HOOKS --
local hook1  = axObj.AddHook(0x88E9564, 0x0002102B, H1) -- Labo::Bases__Camp__Scene__updateTips
local hook2  = axObj.AddHook(0x899E718, 0x00403021, H2) -- GameSystem__SaveDataController__setStateMessage
local hook3  = axObj.AddHook(0x897771C, 0x00431021, H3) -- Localize__Manager__getLanguageName
local hook4  = axObj.AddHook(0x88774D0, 0x00402821, H4) -- System::Util__BNDFile__doNameCallback
local hook5  = axObj.AddHook(0x886889C, 0x02002021, H5) -- Labo::GameSystem__callbackFunc_MemoryObject
local hook6  = axObj.AddHook(0x898BCDC, 0x27BDFFE0, H6) -- Sound__SubGame__Blacksmith__Command__start__4LaboFv
local hook7  = axObj.AddHook(0x89220F8, 0xAC80019C, H7) -- Sound__BeatCommander__endSubGame__4LaboFv
local hook8  = axObj.AddHook(0x8A734DC, 0x27BDFFC0, H8) -- GameSystem__Tips__Viewer__setup__4LaboFv
local hook9  = axObj.AddHook(0x899CF4C, 0x92637EED, H9) -- GameSystem__SaveDataController__update__4LaboFv
local hook10 = axObj.AddHook(0x88E7E48, 0x2490009C, H10) -- Utility__SaveDataUtility__setDataParamsfoString
local hook11 = axObj.AddHook(0x897CF90, 0x26041718, H11) -- Bases__Item__ExplanationWindow__setItemId
local hook12 = axObj.AddHook(0x88D9114, 0xAEA00014, H12) -- Bases__Talk__CommandCamp__showDialog
local hook13 = axObj.AddHook(0x88D90B4, 0x9063C550, H13) -- Bases__Talk__CommandCamp__showDialog
local hook14 = axObj.AddHook(0x88D907C, 0x8FA2003C, H14) -- Bases__Talk__CommandCamp__showDialog
local hook15 = axObj.AddHook(0x8A394B4, 0x26241718, H11) -- Bases__Organization__Managed__ItemSelectWindow__onSlotChange (note uses H11)
 
 
-- US game bug fix.  "Paraget" -> "Patagate" --
axObj.AddHook(0x88DC5F4, 0x00409021, function() -- from Bases__Camp__Person__Behavior__Idle__update__4LaboFv
local strPtr = axObj.GetGpr(gpr.v0) + 0xE -- 0xE skip over X/Y positions.
local str = axObj.ReadMemStr16(strPtr)
if string.find(str, "The Paraget will") then
-- org string: The Paraget will teleport you to/another world…
local newStr = "The Patagate can teleport you to/another world…"
axObj.WriteMemStr16Z(strPtr, newStr)
elseif string.find(str, "Paraget Shrine") then
-- org string: This is the Paraget Shrine./Only <N0> and <N1> can/enter.
local newStr = "This is the Patagate Shrine/Only <N0> and <N1> can/enter."
axObj.WriteMemStr16Z(strPtr, newStr)
end
end)
 
--[[
axObj.AddHook(0x08982F48, 0x24070001, function()
if emuObj.NeoMode() then
axObj.SetGpr(gpr.a3, 0) -- turn on 60fps mode
end
end)
]]--
 
--- MOVIE FIX ---
local movieLastTime = 0.0
local movieFix = function() -- Labo::GameSystem__MovieModule__render
local t = axObj.GetFpr(0)
if t == 0 and movieLastTime > 0 then
local s0 = axObj.GetGpr(gpr.s0)
axObj.WriteMemFloat(s0 + 0x44, movieLastTime)
elseif t > 0 then
movieLastTime = t
end
end
 
axObj.AddHook(0x8A6A1DC, 0xe6000044, movieFix)
 
 
--- PAT2-16 FIX ---
axObj.AddHook(0x890E9E0, 0x02002021, function() -- Labo::Game__Gimmick__WindowAttacher__update
local ptr = axObj.GetGpr(gpr.sp) + 0x28
local posy = axObj.ReadMemFloat(ptr + 4)
if posy < -30 then
local obj = axObj.GetGpr(gpr.a0)
axObj.WriteMem8(obj + 0x2a8, 0)
end
end)
</pre>
 
== Emulators ==
<pre>Every emulator is programmed in a differently. Sometimes choosing the right emulator is the only possible way to fix a game. Emulators are not provided pre-installed on the ps4, they have to be unpacked from a backup that's downloaded from the ps store from that specific game. This list includes The typical usage of some of The emulators.</pre>
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Emulator !! Usage !! API Version !! Similar emulators (compatibility)
|-
| Echochrome || The default psp emulator for PSPFPKG tool at the time of writing and the best in terms of compatibility. || ? || ?
|-
| LocoRoco Midnight Carnival  || ? || ? || ?
|-
| LocoRoco 1  || ? || ? || ?
|-
| LocoRoco 2  || ? || ? || ?
|-
| Castlevania Requiem  || ? || ? || ?
|-
| Patapon 2 || ? ||  ? || ?
|-
| PaRappa the Rapper || An unofficial emulator developed by sony with very bad compatibility ||  ? || ?
|-
| Syphon Filter: Dark Mirror || ? || ? || ?
|-
|}
 
==Memory mapping==
<br>'''Note''': The memory on PPSSPP is 0x4000 offsets ahead of the memory on the PS4
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Size !! Offset From -> Offset To !! Name
|-
| || 1008000000 -> 10887FFFFF ||  Allegrex memory(?)
|-
|640.00MB  || 228200000 -> 250200000 ||
|-
|64.00MB  ||  250200000 -> 254200000 ||
|-
|32.00MB  ||  254200000 -> 256200000 ||
|-
|2048.00MB ||  256200000 -> 2d6200000 ||
|-
|16.00MB  ||  2d6200000 -> 2d7200000 ||
|-
|16.00MB  ||  2d7200000 -> 2d8200000 ||
|-
|16.00MB  ||  2d8200000 -> 2d9200000 ||
|-
|16.00MB  ||  2d9200000 -> 2da200000 ||
|-
|}
 
===Registers map===
<br>Registers that are marked with '''(?)''' are untested but should be accurate.
<br>*'''Note''': The offsets' positions change as the CLI file's content increases, but the offsets should still be somewhere nearby the offsets listed below and the layout should be the same regardless. The PC pointer script can be used to locate another PC register properly in Echochrome's emulator
{| class=wikitable style="border: none; background: none;"
! scope=col | GPR
! scope=col | Offset
! scope=col | Notes
| rowspan=900 style="border: none; background: none;"|
! scope=col | FPU
! scope=col | Offset
|-
| zero || 0x200414CA8? || || f0 || 0x200414D4C?
|--style="background-color:#EEEFF2"
| at  || 0x200414CAC? || || f1 || 0x200414D50
|-
| v0 || 0x200414CB0  || || f2 || 0x200414D54?
|--style="background-color:#EEEFF2"
| v1 || 0x200414CB4  || || f3 || 0x200414D58?
|-
| a0 || 0x200414CB8  || || f4 || 0x200414D5C?
|--style="background-color:#EEEFF2"
| a1 || 0x200414CBC? || || f5 || 0x200414D60?
|-
| a2 || 0x200414CC0? || || f6 || 0x200414D64?
|--style="background-color:#EEEFF2"
| a3 ||  0x200414CC4? || || f7 || 0x200414D68?
|-
| t0 || 0x200414CC8? || ||f8|| 0x200414D6C?
|--style="background-color:#EEEFF2"
| t1 || 0x200414CCC? || ||f9 || 0x200414D70?
|-
| t2 ||  0x200414CD0? || || f10 || 0x200414D74?
|--style="background-color:#EEEFF2"
| t3 ||  0x200414CD4? || ||f11|| 0x200414D78?
|-
| t4 ||  0x200414CD8? || || f12 || 0x200414D7C?
|--style="background-color:#EEEFF2"
| t5 ||  0x200414CDC? || || f13 || 0x200414D80?
|-
| t6 || 0x200414CE0? || || f14 || 0x200414D84?
|--style="background-color:#EEEFF2"
| t7 || 0x200414CE4? || || f15 || 0x200414D88?
|-
| s0 ||  0x200414CE8? || || f16 || 0x200414D8C?
|--style="background-color:#EEEFF2"
| s1 || 0x200414CEC? || || f17 || 0x200414D90?
|-
| s2 ||  0x200414CF0? || || f18 || 0x200414D94?
|--style="background-color:#EEEFF2"
| s3 || 0x200414CF4? || || f19 || 0x200414D98?
|-
| s4 ||  0x200414CF8? || || f20|| 0x200414D9C?
|--style="background-color:#EEEFF2"
| s5 ||  0x200414CFC? || || f21 || 0x200414DA0?
|-
| s6 ||  0x200414D00? || || f22 || 0x200414DA4?
|--style="background-color:#EEEFF2"
| s7 ||  0x200414D04? || || f23|| 0x200414DA8?
|-
| t8 ||  0x200414D08? || || f24 || 0x200414DAC?
|--style="background-color:#EEEFF2"
| t9 ||  0x200414D0C? || || f25 || 0x200414DB0?
|-
| k0 ||  0x200414D10 || ||f26 || 0x200414DB4?
|--style="background-color:#EEEFF2"
| k1 ||  0x200414D14 || || f27 || 0x200414DB8?
|-
| gp ||  0x200414D18 || || f28|| 0x200414DBC?
|--style="background-color:#EEEFF2"
| sp || 0x200414D1C || || f29 || 0x200414DC0?
|-
| fp || 0x200414D20 ||  || f30 || 0x200414DC4?
|--style="background-color:#EEEFF2"
| {{cellcolors|#D7EF54|#000000}}ra || 0x200414D24 || || f31 || 0x200414DC8
|-
| ? || 0x20AD14D28 || ||  ||
|--style="background-color:#EEEFF2"
| last syscall? || 0x20AD14D2C || ||  ||
|-
| {{cellcolors|#7698FF|#000000}}pc || 0x200414D34 || Will show "0x0", "0x1", "0x5", if the Allegrex cpu is idle(?). || ||
|--style="background-color:#EEEFF2"
| hi || 0x200414D38 || ||  ||
|-
| lo || 0x200414D3C || ||  ||
|--style="background-color:#EEEFF2"
| Memory base? || 0x200414D48 || Shows "0x08800000", could be used as pointer or something?|| ||
|-
|}
====PC pointer====
<br>PS4CHEATER
<br>'''PSP.cht'''
<pre>
1.5|eboot.bin|ID:|VER:01.00|FM:505
simple pointer|pointer|4 bytes|@C6B8C8_2_6B8C8+210+108|data|4 bytes|143011412|0||
</pre>
'''VFPU'''
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Register !! Offset !! Register !! Offset !! Register !! Offset !! Register !! Offset
|-
| S000|| 0x200414DE0 || S001|| 0x200414DE4 || S002|| 0x200414DE8 || S003|| 0x200414DEC
|-
| S010|| 0x200414DF0 || S011|| 0x200414DF4 || S012|| 0x200414DF8  || S013|| 0x200414DFC
|-
| S020|| 0x200414E00 || S021|| 0x200414E04 || S022||  0x200414E08 || S023|| 0x200414E0C
|-
|S030|| 0x200414E10 || S031|| 0x200414E14 || S032|| 0x200414E18  || S033|| 0x200414E1C
|-
|S100|| 0x200414E20  || S101|| 0x200414E24  || S102||  0x200414E28  || S103|| 0x200414E2C
|-
| S110 || 0x200414E30  || S111|| 0x200414E34 || S112||  0x200414E38 || S113||0x200414E3C
|-
| S120|| 0x200414E40  || S121|| 0x200414E44 || S122|| 0x200414E48 || S123|| 0x200414E4C
|-
|S130|| 0x200414E50 || S131||0x200414E54  || S132|| 0x200414E58  || S133|| 0x200414E5C
|-
|S200|| 0x200414E60  || S201|| 0x200414E64 || S202||  0x200414E68 || S203||0x200414E6C
|-
|S210|| 0x200414E70  || S211|| 0x200414E74 || S212||  0x200414E78 || S213|| 0x200414E7C
|-
|S220|| 0x200414E80  || S221|| 0x200414E84 || S222|| 0x200414E88 || S223|| 0x200414E8C
|-
|S230|| 0x200414E90 || S231|| 0x200414E94 || S232||  0x200414E98 || S233|| 0x200414E9C
|-
|S300|| 0x200414EA0  || S301|| 0x200414EA4 || S302||  0x200414EA8 || S303|| 0x200414EAC
|-
|S310|| 0x200414EB0  || S311|| 0x200414EB4 || S312|| 0x200414EB8  || S313|| 0x200414EBC
|-
|S320|| 0x200414EC0  || S321|| 0x200414EC4 || S322|| 0x200414EC8 || S323||0x200414ECC
|-
|S330|| 0x200414ED0 || S331|| 0x200414ED4 || S332|| 0x200414ED8 || S333||0x200414EDC
|-
|S400|| 0x200414EE0  || S401||  0x200414EE4 || S402|| 0x200414EE8 || S403|| 0x200414EEC
|-
|S410|| 0x200414EF0  || S411||  0x200414EF4 || S412||  0x200414EF8 || S413|| 0x200414EFC
|-
|S420|| 0x200414F00 || S421|| 0x200414F04 || S422||  0x200414F08 || S423|| 0x200414F0C
|-
|S430|| 0x200414F10 || S431|| 0x200414F14 || S432||  0x200414F18 || S433|| 0x200414F1C
|-
|S500|| 0x200414F20 || S501|| 0x200414F24|| S502|| 0x200414F28 || S503|| 0x200414F2C
|-
|S510|| 0x200414F30  || S511|| 0x200414F34 || S512|| 0x200414F38 || S513|| 0x200414F3C
|-
|S520|| 0x200414F40 || S521|| 0x200414F44 || S522|| 0x200414F48 || S523||0x200414F4C
|-
|S530 || 0x200414F50|| S531|| 0x200414F54 || S532||  0x200414F58|| S533|| 0x200414F5C
|-
|S600|| 0x200414F60 || S601|| 0x200414F64 || S602|| 0x200414F68 || S603|| 0x200414F6C
|-
|S610|| 0x200414F70  || S611|| 0x200414F74 || S612||  0x200414F78 || S613||0x200414F7C
|-
|S620|| 0x200414F80  || S621|| 0x200414F84 || S622|| 0x200414F88 || S623|| 0x200414F8C
|-
|S630 || 0x200414F90 || S631|| 0x200414F94 || S632||  0x200414F98 || S633|| 0x200414F9C
|-
|S700|| 0x200414FA0 || S701 || 0x200414FA4 || S702|| 0x200414FA8  || S703|| 0x200414FAC
|-
|S710|| 0x200414FB0  || S711|| 0x200414FB4 || S712||  0x200414FB8 || S713|| 0x200414FBC
|-
|S720|| 0x200414FC0  || S721|| 0x200414FC4 || S722|| 0x200414FC8 || S723|| 0x200414FCC
|-
|S730 || 0x200414FD0|| S731|| 0x200414FD4 || S732||  0x200414FD8 || S733|| 0x200414FDC
|-
|}
 
= Known issues =
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Issue !! Games affected !! Solution !! Description
|-
| No gamdata installation functionality (?)|| || ||
|-
| Highly unoptimized graphics renderer || || || Low fps
|-
| No support for some syscalls || || ||
|-
|}
 
=LUA include files=
<br>Files that need to be placed in the '''/lua_include/''' folder
 
'''uv-clamping.lua'''
<pre>
print ("Loading uv-clamping.lua from global scripts")
 
UV_CLAMPING_ENABLE = true
UV_CLAMPING_DISABLE = false
 
UV_CLAMPING_USE_ZERO_EDGE_ALPHA = true
UV_CLAMPING_DONT_USE_ZERO_EDGE_ALPHA = false
 
emuObj = getEmuObject()
 
-- Turns off UV clamping for the given list of textures.
-- textureTable: A list of texture base addresses.
DisableUvClampingForTextures = function(textureTable)
if emuObj.OverrideUvClampingState then
for _, texAddr in ipairs(textureTable) do
emuObj.OverrideUvClampingState(texAddr, UV_CLAMPING_DISABLE, UV_CLAMPING_DONT_USE_ZERO_EDGE_ALPHA);
end
else
print ("This emulator does not support OverrideUvClampingState()")
end
end
 
</pre>
'''sce-locale.lua'''
<pre>
print ("Loading sce-locale.lua from global scripts")
 
-- Language codes
--
-- ja    Japanese
-- en    English (US)
-- fr    French (France)
-- es    Spanish (Spain)
-- de    German
-- it    Italian
-- nl    Dutch
-- pt    Portuguese (Portugal)
-- ru    Russian
-- ko    Korean
-- zh-TW  Chinese (traditional)
-- zh-CN  Chinese (simplified)
-- fi    Finnish
-- sv    Swedish
-- da    Danish
-- no    Norwegian
-- pl    Polish
-- pt-BR  Portuguese (Brazil)
-- en-GB  English (UK)
-- tr    Turkish
-- es-MX  Spanish (Latin America)
-- ar    Arabic
-- fr-CA  French (Canada)
-- cs    Czech
-- hu    Hungarian
-- el    Greek ("Ελληνικά" in the system language menu)
-- ro    Romanian
-- th    Thai
-- vi    Vietnamese
-- id    Indonesian
-- uk    Ukrainian
 
-- returns locale (en-US) and language only (us), useful for lookups with fallback.
GetLocaleLangPair = function()
local locale, lang
locale = AppHost_GetLocaleTag()
lang = locale:sub(1,2)    -- grab first two digits, eg. en-US -> en
 
print ("[BOOT] App Host Langauge =", lang)
 
if locale ~= nil then
print ("[BOOT] App Host Locale =", locale)
else
print ("[BOOT] Deprecated Native Language =", lang)
end
 
return locale, lang
end
 
FindLocaleTableKey = function(table, primary, fallback, default)
-- try for a specific Locale, and if that fails fallback on just a language (without region),
-- and if that fails fallback on default.
 
local keyres = primary
if keyres == nil or table[keyres] == nil then
keyres = fallback
end
 
if keyres == nil or table[keyres] == nil then
print ("WARNING: No table entry for locale", primary, "or language", fallback, ", using default", default);
keyres = default
else
print ("Found locale table entry", keyres);
end
 
return keyres
end
 
</pre>
'''disc-selection.lua'''
<pre>
print ("Loading disc-selection.lua from global scripts")
require "sce-locale"
 
-- Determines and sets the active SKU.
--
-- sku_map: Cannot be nil.  A table of the form
-- {
-- en = <sku dir name>,
-- fr = <sku dir name>,
-- de = <sku dir name>,
-- it = <sku dir name>,
-- es = <sku dir name>,
--  ...
-- }
--
RegisterSkus = function(sku_map, default_locale)
if default_locale == nil then
default_locale = "en"
end
local locale, lang = GetLocaleLangPair()
local key = FindLocaleTableKey(sku_map, locale, lang, default_locale)
local sku_name = sku_map[key]
 
if EM_SetActiveSku == nil then
print "EM_SetActiveSku is undefined, use the stable branch of the packager or use a new version of the emulator."
end
EM_SetActiveSku(sku_name)
 
end
 
</pre>
 
'''ax-gpr-alias.lua'''
<pre>
 
-- Recommended method to import this module:
--  local gpr = require("ax-gpr-alias")
 
 
gpr = {}
 
gpr.zero = 0
gpr.at  = 1
gpr.v0  = 2
gpr.v1  = 3
gpr.a0  = 4
gpr.a1  = 5
gpr.a2  = 6
gpr.a3  = 7
gpr.t0  = 8
gpr.t1  = 9
gpr.t2  = 10
gpr.t3  = 11
gpr.t4  = 12
gpr.t5  = 13
gpr.t6  = 14
gpr.t7  = 15
gpr.s0  = 16
gpr.s1  = 17
gpr.s2  = 18
gpr.s3  = 19
gpr.s4  = 20
gpr.s5  = 21
gpr.s6  = 22
gpr.s7  = 23
gpr.t8  = 24
gpr.t9  = 25
gpr.k0  = 26
gpr.k1  = 27
gpr.gp  = 28
gpr.sp  = 29
gpr.fp  = 30
gpr.ra  = 31
 
return gpr
 
</pre>
'''multiapp.lua'''
<pre>
-- Recommended method to import this module:
--  local mapp = require("mapp")
--
-- Multi-application support module
-- Wraps common hook calls to support multiple executables
--
 
local emuObj = getEmuObject() -- emulator
local axObj = getAXObject() -- allegrex
 
mapp = {}
mapp.curAppName = emuObj.GetAppName()
 
mapp.AddBootHook = function(app, func)
if mapp[app] == nil then
mapp[app] = {}
end
 
mapp[app].boot = func
end
 
mapp.AddHook = function(app, pc, verify, func)
if mapp[app] == nil then
mapp[app] = {}
end
if mapp[app].hooks == nil then
mapp[app].hooks = {}
mapp[app].hookids = 1
end
local localid = mapp[app].hookids
mapp[app].hookids = mapp[app].hookids + 1
local handler = { addr = pc, v = verify, f = func, id = 0 }
if mapp.curAppName == app then
handler.id = axObj.AddHook(pc, verify, func)
end
-- print(string.format("Added Hook for app: %s, pc=%08x, handler=%d", app, pc, localid))
mapp[app].hooks[localid] = handler
return localid
end
 
mapp.RemoveHook = function(app, hookid)
-- print(string.format("RemoveHook for app: %s, id=%d", app, hookid))
if mapp[app] ~= nil then
if mapp[app].hooks ~= nil then
if mapp[app].hooks[hookid] ~= nil then
local id = mapp[app].hooks[hookid].id
mapp[app].hooks[hookid] = nil -- WBD 7/6/2018
if mapp.curAppName == app and id > 0 then
axObj.RemoveHook(id)
end
end
end
end
end
 
mapp.GetHookPC = function(app, hookid)
if mapp[app] ~= nil then
if mapp[app].hooks ~= nil then
if mapp[app].hooks[hookid] ~= nil then
return mapp[app].hooks[hookid].addr
end
end
end
return 0
end
 
mapp.AddVSyncHook = function(app, func)
if mapp[app] == nil then
mapp[app] = {}
end
mapp[app].vsync = func
if mapp.curAppName == app then
emuObj.AddVsyncHook(func)
end
end
 
mapp.RemoveVSyncHook = function(app)
if mapp[app] == nil then
mapp[app] = {}
end
if mapp[app].vsync ~= nil then
table.remove(mapp[app].vsync)
end
if mapp.curAppName == app then
emuObj.RemoveVsyncHook(func)
end
end
 
-- Actual switch functionality
emuObj.AddBootHook(function()
local app = emuObj.GetAppName()
 
if app ~= mapp.curAppName then
-- switch out the old handlers
-- print(string.format("Switching out handlers for app: %s", mapp.curAppName))
if mapp[mapp.curAppName] ~= nil then
if mapp[mapp.curAppName].vsync ~= nil then
emuObj.RemoveVsyncHook()
end
if mapp[mapp.curAppName].hooks ~= nil then
local hooks = mapp[mapp.curAppName].hooks
-- print(string.format("hooks: %d", #hooks))
for k,v in pairs(hooks) do
if v.id > 0 then
axObj.RemoveHook(v.id)
v.id = 0
end
end
end
end
-- switch current app name
mapp.curAppName = app
-- install the new handlers
-- print(string.format("Switching in handlers for app: %s", mapp.curAppName))
if mapp[mapp.curAppName] ~= nil then
if mapp[mapp.curAppName].vsync ~= nil then
emuObj.AddVsyncHook(mapp[mapp.curAppName].vsync)
end
if mapp[mapp.curAppName].hooks ~= nil then
local hooks = mapp[mapp.curAppName].hooks
-- print(string.format("hooks: %d", #hooks))
for k,v in pairs(hooks) do
v.id = axObj.AddHook(v.addr, v.v, v.f)
end
end
end
end
if mapp[mapp.curAppName] ~= nil then
if mapp[mapp.curAppName].boot ~= nil then
mapp[mapp.curAppName].boot()
end
end
end)
 
return mapp
 
</pre>
 
'''pad.lua'''
<pre>
-- Recommended method to import this module:
--  local pad = require("pad")
--
-- Buttons marked PS4 are not used by the emulator, but can be read from Lua
--
-- Read the Pad state with getEmuObject().PadRead()
-- ie:
-- local padstate = getEmuObject().PadRead()
--
 
pad = {}
 
pad.L3        = 0x00000002 -- L3 (PS4)
pad.R3        = 0x00000004 -- R3 (PS4)
pad.OPTIONS  = 0x00000008 -- Options (PS4)
pad.UP        = 0x00000010 -- Up
pad.RIGHT    = 0x00000020 -- Right
pad.DOWN      = 0x00000040 -- Down
pad.LEFT      = 0x00000080 -- Left
pad.L2        = 0x00000100 -- L2 (PS4)
pad.R2        = 0x00000200 -- R2 (PS4)
pad.L1        = 0x00000400 -- L1
pad.R1        = 0x00000800 -- R1
pad.TRIANGLE  = 0x00001000 -- Triangle
pad.CIRCLE    = 0x00002000 -- Circle
pad.CROSS    = 0x00004000 -- Cross
pad.SQUARE    = 0x00008000 -- Square
pad.SELECT    = 0x00010000 -- Select
pad.START    = 0x00020000 -- Start
 
-- Automap SELECT or START to the Options Button, leaving the full touchar for the opposite, with getEmuObject().PadSetButtonsMode(mode)
-- ie:
-- getEmuObject().PadSetButtonsMode(pad.BUTTONS_MODE_OPTION_IS_SELECT)
 
pad.BUTTONS_MODE_NORMAL = 0 -- Touch bar is split in two for Start/Select. Option is unmapped (default behaviour)
pad.BUTTONS_MODE_OPTION_IS_SELECT = 1 -- Touch bar is Start. Option is Select
pad.BUTTONS_MODE_OPTION_IS_START = 2 -- Touch bar is Select. Option is Start
 
return pad
 
</pre>
 
=Information=
Note: Missing entries
==Folder/File layout==
<pre>
├── assets
│  ├── common
│  └── PSPHD
├── app
│  └── USER_L0.IMG
├── lua_include
│  ├── ax-gpr-alias.lua
│  ├── multiapp.lua
│  ├── sce-locale.lua
│  ├── uv-clamping.lua
│  ├── disc-selection.lua
│  └── pad.lua
├── scripts
│  ├──XXXXYYYYY_patches.lua
│  ├──XXXXYYYYY_features.lua
│  ├──XXXXYYYYY_tooling.lua
│  └──XXXXYYYYY_trophies.lua
├── sce_module
├── sce_sys
├── vms
├── trophy_data
├── usermodule
│  └──libfont.lib
├── sce_discmap.plt
├── eboot.bin
├── revision.conf
├── package-ps4.conf
└── config-title.txt
</pre>
 
==Other==
<pre>
XXXXYYYYY_config.txt
videos/
.mp4
videos/%08x.mp4
audio/%08x.ogg
 
Paths:
 
/app0/
/download0/
/savedata
/host/
/hostapp/
/data/
</pre>
 
==Sample==
 
<pre>; PS4 configuration file for PSPHD
; Game Image
--image="data/USER_L0.IMG"
; Redirect host0: to a specific directory (uncomment to enable).
; By default it's mapped to either "/hostapp/" if available, or "/app0/" if "/hostapp/" is not available.
;--host="/hostapp/"
; To dump the original video in PMF format, uncomment the --dumpvideos line
; For example, with the current setting, it will save them in a "videos" directory inside the File Serving Directory
;--dumpvideos="host0:videos"
; To dump the original audio in Atrac3 format, uncomment the --dumpaudio line
; For example, with the current setting, it will save them in a "audio" directory inside the File Serving Directory
;--dumpaudio="host0:audio"
; To replace atrac3 audio samples, use this.
--samplereplace="host0:samplereplace"
; To save the in-game textures as the game runs, uncomment the --texsave line
; For example, with the current setting, it will save them in a "texdump" directory inside the File Serving Directory
;--texsave="host0:texdump"
;--texmissingsave="host0:texdump"
; To replace specific textures as the game runs, uncomment the --texreplace line
; For example, with the current setting, it will load them from the "texreplace" directory inside the File Serving Directory
--texreplace="host0:texreplace"
; This forces alpha blending to on for replaced textures. (uncomment to enable)
; With this we can freely make use of a normal alpha channel on replacement textures
--replacementalpha=true
; Antialiasing mode. SSAA4x looks best, MSAA4x only smooths edges.
; Choices: off, SSAA4x, MSAA4x
--antialias=SSAA4x
; Enable switching between original and replacement textures at runtime using the L3 button on a DS4 or the 'T' key on Windows
;--texswitch=true
; Turns on the auto-resampler. Assumes textures in texreplace are at 8x resolution and resamples them at load
--autoresampler=true
; Parappa Alpha Hack
--parappaalphahack=true
</pre>
==NIDs in HLE==
<pre>
|HLEInterruptManager|
 
sceKernelRegisterSubIntrHandler
sceKernelReleaseSubIntrHandler
sceKernelEnableSubIntr
 
|HLEStdioForUser|
 
sceIoOpen
sceIoClose
sceIoRead
sceIoWrite
sceIoLseek
sceIoLseek32
sceIoDopen
sceIoDread
sceIoDclose
sceIoChdir
sceIoGetstat
sceIoDevctl
sceIoRename
sceIoMkDir
sceIoChstat
sceIoRemove
sceIoRmdir
sceIoOpenAsync
sceIoReadAsync
sceIoIoctlAsync
sceIoWaitAsync
sceIoWaitAsyncCB
sceIoCloseAsync
sceIoSetAsyncCallback
sceIoPollAsync
sceIoLseekAsync
sceIoGetAsyncStat
asyncWaitTimerCallback
asyncCallbackTimerCallback
sceKernelStdin
sceKernelStdout
sceKernelStderr
 
|HLELoadExecForUser|
 
sceKernelCpuSuspendIntr
sceKernelCpuResumeIntr
sceKernelIsCpuIntrEnable
sceKernelExitGame
sceKernelRegisterExitCallback
sceKernelLoadModule
sceKernelUnloadModule
sceKernelStartModule
sceKernelStopModule
sceKernelStopUnloadSelfModule
sceKernelGetModuleIdByAddress
sceKernelStopUnloadSelfModuleWithStatus
sceKernelGetModuleId
 
|HLEsceAtrac3plus|
 
sceAtracReinit
sceAtracDecodeData
sceAtracGetNextDecodePosition
sceAtracSetHalfwayBufferAndGetID
sceAtracGetSoundSample
sceAtracGetStreamDataInfo
sceAtracGetRemainFrame
sceAtracSetLoopNum
sceAtracResetPlayPosition
sceAtracReleaseAtracID
sceAtracGetAtracID
sceAtracGetNextSample
sceAtracSetData
sceAtracAddStreamData
 
|HLEsceAudio|
 
sceAudioChReserve
sceAudioChRelease
sceAudioOutputBlocking
sceAudioChangeChannelConfig
sceAudioGetChannelRestLength
sceAudioChangeChannelVolume
sceAudioSetChannelDataLen
sceAudioOutputPanned
sceAudioOutputPannedBlocking
sceAudioGetChannelRestLen
sceAudioOutput2Reserve
sceAudioOutput2OutputBlocking
sceAudioOutput2Release
outputCallback
 
|HLEsceCtrl|
 
sceCtrlSetSamplingCycle
sceCtrlSetSamplingMode
sceCtrlReadBufferPositive
sceCtrlReadBufferNegative
sceCtrlPeekBufferPositive
sceCtrlPeekBufferNegative
sceCtrlGetIdleCancelThreshold
sceCtrlSetIdleCancelThreshold
sceCtrlReadLatch
sceCtrlPeekLatch
sampleControllerCallback
vibrationControllerCallback
 
|HLEsceDisplay|
 
sceDisplaySetMode
sceDisplaySetFramebuf
sceDisplayGetFramebuf
sceDisplayGetVcount
sceDisplayWaitVblankStart
sceDisplayWaitVblankStartCB
sceDisplayGetCurrentHcount
sceDisplayGetAccumulatedHcount
sceDisplayGetFramePerSec
sceDisplayWaitVblank
sceDisplayWaitVblankCB
sceDisplayIsVblank
sceDisplaySetHoldMode
vblankStart
vblankEnd
 
|HLEsceGe_user|
 
sceGeEdramGetAddr
sceGeEdramGetSize
sceGeGetCmd
sceGeGetMtx
sceGeListEnQueue
sceGeListEnQueueHead
sceGeListDeQueue
sceGeListSync
sceGeListUpdateStallAddr
sceGeDrawSync
sceGeSetCallback
sceGeUnsetCallback
sceGeBreak
sceGeContinue
interruptCallback
 
|HLEsceImpose|
 
sceImposeGetLanguageMode
sceImposeSetLanguageMode
sceImposeSetUMDPopup
 
|HLEsceMpeg|
 
sceMpegInit
sceMpegFinish
sceMpegCreate
sceMpegDelete
sceMpegQueryMemSize
sceMpegMallocAvcEsBuf
sceMpegFreeAvcEsBuf
sceMpegInitAu
sceMpegGetAvcAu
sceMpegGetAtracAu
sceMpegQueryAtracEsSize
sceMpegAtracDecode
sceMpegRingbufferQueryMemSize
sceMpegRingbufferConstruct
sceMpegRingbufferDestruct
sceMpegRingbufferPut
sceMpegRingbufferAvailableSize
sceMpegAvcCsc
sceMpegAvcDecodeMode
sceMpegAvcDecodeDetail
sceMpegAvcDecodeFlush
sceMpegAvcQueryYCbCrSize
sceMpegAvcInitYCbCr
sceMpegAvcDecodeYCbCr
sceMpegAvcDecodeStopYCbCr
sceMpegRegistStream
sceMpegUnRegistStream
sceMpegQueryStreamSize
sceMpegQueryStreamOffset
sceMpegFlushAllStream
 
|HLEsceNet|
 
sceNetInit
sceNetInetGetsockopt
sceNetInetSetsockopt
sceNetInetGetErrno
 
|HLEscePower|
 
scePowerRegisterCallback
scePowerUnregisterCallback
scePowerSetClockFrequency
scePowerSetCpuClockFrequency
scePowerSetBusClockFrequency
 
|HLEscePsmf|
 
scePsmfVerifyPsmf
scePsmfSetPsmf
scePsmfSpecifyStreamWithStreamTypeNumber
scePsmfCheckEPmap
scePsmfGetVideoInfo
scePsmfGetNumberOfStreams
scePsmfGetNumberOfEPentries
scePsmfGetEPWithId
scePsmfGetPsmfVersion
scePsmfGetNumberOfSpecificStreams
scePsmfSpecifyStream
scePsmfGetCurrentStreamType
 
|HLEscePsmfPlayer|
 
scePsmfPlayerCreate
scePsmfPlayerDelete
scePsmfPlayerSetPsmf
scePsmfPlayerReleasePsmf
scePsmfPlayerStart
scePsmfPlayerGetAudioOutSize
scePsmfPlayerStop
scePsmfPlayerUpdate
scePsmfPlayerGetVideoData
scePsmfPlayerGetAudioData
scePsmfPlayerGetCurrentStatus
scePsmfPlayerGetPsmfInfo
scePsmfPlayerConfigPlayer
scePsmfPlayerBreak
scePsmfPlayerChangePlayMode
 
|HLEsceRtc|
 
sceRtcGetCurrentTick
sceRtcGetAccumulativeTime
sceRtcGetCurrentClockLocalTime
 
|HLEsceSasCore|
 
sceSasInit
sceSasCore
sceSasCoreWithMix
sceSasGetEndFlag
sceSasGetPauseFlag
sceSasGetEnvelopeHeight
sceSasGetAllEnvelopeHeights
sceSasGetOutputMode
sceSasSetOutputMode
sceSasGetGrain
sceSasSetGrain
sceSasSetVoice
sceSasSetNoise
sceSasSetPitch
sceSasSetVolume
sceSasSetSimpleADSR
sceSasSetKeyOn
sceSasSetKeyOff
sceSasSetPause
sceSasSetSL
sceSasSetADSR
sceSasSetADSRMode
sceSasRevEVOL
sceSasRevType
sceSasRevParam
sceSasRevVON
 
|HLEsceSuspendForUser|
 
sceKernelPowerTick
sceKernelPowerLock
sceKernelPowerUnlock
sceKernelVolatileMemTryLock
sceKernelVolatileMemUnlock
sceKernelVolatileMemLock
 
|HLEsceUmdUser|
 
sceUmdActivate
sceUmdGetDriveStat
sceUmdCheckMedium
sceUmdRegisterUMDCallback
sceUmdUnRegisterUMDCallBack
sceUmdWaitDriveStat
sceUmdWaitDriveStatWithTimer
sceUmdWaitDriveStatCB
sceUmdCancelWaitDriveStat
_UmdWaitDriveTimeout
 
|HLEsceUtility|
 
sceUtilityLoadModule
sceUtilityUnloadModule
sceUtilityLoadNetModule
sceUtilityUnloadNetModule
sceUtilityLoadAvModule
sceUtilityUnloadAvModule
sceUtilityGetSystemParamInt
sceUtilityGetSystemParamString
sceUtilitySavedataGetStatus
sceUtilitySavedataShutdownStart
sceUtilitySavedataInitStart
sceUtilitySavedataUpdate
sceUtilityMsgDialogGetStatus
sceUtilityMsgDialogShutdownStart
sceUtilityMsgDialogInitStart
sceUtilityMsgDialogUpdate
sceUtilityMsgDialogAbort
sceUtilityOskGetStatus
sceUtilityOskShutdownStart
sceUtilityOskInitStart
sceUtilityOskUpdate
saveDataUpdateCallback
oskUpdateCallback
 
|HLEsceWlanDrv|
 
sceWlanGetSwitchState
sceWlanGetEtherAddr
 
|HLESysMemUserForUser|
 
sceKernelMaxFreeMemSize
sceKernelTotalFreeMemSize
sceKernelQueryMemoryInfo
sceKernelDevkitVersion
sceKernelPrintf
sceKernelGetPTRIG
sceKernelSetPTRIG
sceKernelAllocPartitionMemory
sceKernelFreePartitionMemory
sceKernelGetBlockHeadAddr
sceKernelGetMemoryBlockAddr
sceKernelAllocMemoryBlock
sceKernelFreeMemoryBlock
sceKernelSetCompilerVersion
sceKernelGetCompiledSdkVersion
sceKernelSetCompiledSdkVersion
sceKernelSetCompiledSdkVersion370
sceKernelSetCompiledSdkVersion380_390
sceKernelSetCompiledSdkVersion395
sceKernelSetCompiledSdkVersion401_402
sceKernelSetCompiledSdkVersion500_505
sceKernelSetCompiledSdkVersion507
sceKernelSetCompiledSdkVersion600_602
sceKernelSetCompiledSdkVersion603_605
sceKernelSetCompiledSdkVersion606
sceKernelSetUsersystemLibWork
sceKernelSysMemUserForUser_ACBD88CA
sceKernelSysMemUserForUser_D8DE5C1E
sceKernelSysMemUserForUser_945E45DA
 
|HLEThreadManForUser|
 
sceKernelDelayThread
sceKernelDelayThreadCB
sceKernelCreateCallback
sceKernelDeleteCallback
sceKernelSleepThread
sceKernelSleepThreadCB
sceKernelWakeupThread
sceKernelCreateMsgPipe
sceKernelDeleteMsgPipe
sceKernelSendMsgPipe
sceKernelTrySendMsgPipe
sceKernelReceiveMsgPipe
sceKernelTryReceiveMsgPipe
sceKernelReferMsgPipeStatus
sceKernelCreateThread
sceKernelStartThread
sceKernelExitThread
sceKernelDeleteThread
sceKernelExitDeleteThread
sceKernelGetThreadExitStatus
sceKernelTerminateThread
sceKernelTerminateDeleteThread
sceKernelWaitThreadEnd
sceKernelWaitThreadEndCB
sceKernelRotateThreadReadyQueue
sceKernelReferThreadStatus
sceKernelSuspendDispatchThread
sceKernelResumeDispatchThread
sceKernelSuspendThread
sceKernelResumeThread
sceKernelCancelWakeupThread
sceKernelGetThreadStackFreeSize
sceKernelGetSystemTimeLow
sceKernelGetSystemTime
sceKernelGetSystemTimeWide
sceKernelGetThreadCurrentPriority
sceKernelChangeCurrentThreadAttr
sceKernelGetThreadId
sceKernelChangeThreadPriority
sceKernelReferThreadProfiler
sceKernelCheckCallback
sceKernelCancelSema
sceKernelCreateSema
sceKernelDeleteSema
sceKernelPollSema
sceKernelSignalSema
sceKernelReferSemaStatus
sceKernelWaitSema
sceKernelWaitSemaCB
sceKernelCreateFpl
sceKernelDeleteFpl
sceKernelAllocateFpl
sceKernelAllocateFplCB
sceKernelTryAllocateFpl
sceKernelFreeFpl
sceKernelCancelFpl
sceKernelReferFplStatus
sceKernelCreateVpl
sceKernelDeleteVpl
sceKernelAllocateVpl
sceKernelAllocateVplCB
sceKernelTryAllocateVpl
sceKernelFreeVpl
sceKernelCancelVpl
sceKernelReferVplStatus
sceKernelCreateEventFlag
sceKernelSetEventFlag
sceKernelDeleteEventFlag
sceKernelClearEventFlag
sceKernelWaitEventFlag
sceKernelWaitEventFlagCB
sceKernelPollEventFlag
sceKernelCancelEventFlag
sceKernelReferEventFlagStatus
sceKernelCreateMbx
sceKernelDeleteMbx
sceKernelSendMbx
sceKernelReceiveMbx
sceKernelReceiveMbxCB
sceKernelPollMbx
sceKernelCancelReceiveMbx
sceKernelReferMbxStatus
sceKernelCreateMutex
sceKernelDeleteMutex
sceKernelLockMutex
sceKernelLockMutexCB
sceKernelTryLockMutex
sceKernelUnlockMutex
sceKernelCancelMutex
sceKernelReferMutexStatus
_sceKernelDelayThreadCallback
_sceKernelWaitThreadEndTimeout
_sceKernelAllocateFplTimeout
_sceKernelAllocateVplTimeout
_sceKernelWaitEventFlagTimeout
_sceKernelMsgPipeTimeout
_sceKernelLockMutexTimeout
 
|HLEUtilsForKernel|
 
sceKernelIcacheInvalidateRange
 
|HLEUtilsForUser|
 
sceKernelIcacheInvalidateRange
sceKernelDcacheInvalidateRange
sceKernelDcacheWritebackInvalidateRange
sceKernelDcacheWritebackAll
sceKernelDcacheWritebackRange
sceKernelDcacheWritebackInvalidateAll
sceKernelSetGPO
sceKernelGetGPI
sceKernelLibcClock
sceKernelLibcTime
sceKernelLibcGettimeofday 0x71EC4271
</pre>
 
==Unimplemented functions==
<pre>
sceIoChdir() unimplemented, ignoring
sceIoChstat unimplemented, ignoring
sceKernelExitGame() unimplemented
sceKernelStopUnloadSelfModule() unimplemented
sceKernelStopUnloadSelfModuleWithStatus() unimplemented
sceGeGetMtx() unimplemented
sceGeListDeQueue() unimplemented
sceGeBreak unimplemented
sceGeContinue unimplemented
sceNetInetGetsockopt() unimplemented
sceNetInetSetsockopt() unimplemented
sceNetInetGetErrno() unimplemented
sceWlanGetEtherAddr unimplemented
sceKernelQueryMemoryInfo() unimplemented
sceKernelGetPTRIG() unimplemented
sceKernelSetPTRIG() unimplemented
sceKernelSetCompiledSdkVersion401_402() unimplemented
sceKernelSetCompiledSdkVersion507() unimplemented
sceKernelSetCompiledSdkVersion600_602() unimplemented
sceKernelSetCompiledSdkVersion603_605() unimplemented
sceKernelSetUsersystemLibWork() unimplemented
sceKernelSysMemUserForUser_ACBD88CA() unimplemented
sceKernelSysMemUserForUser_D8DE5C1E() unimplemented -- sceKernelSafetyCheck0
sceKernelSysMemUserForUser_945E45DA() unimplemented
sceKernelTerminateDeleteThread() unimplemented
sceKernelCancelSema unimplemented
sceKernelCancelFpl unimplemented
sceKernelReferFplStatus unimplemented
sceKernelCancelVpl unimplemented
sceKernelCreateMbx unimplemented
sceKernelDeleteMbx unimplemented
sceKernelSendMbx unimplemented
sceKernelReceiveMbx unimplemented
sceKernelReceiveMbxCB unimplemented
sceKernelPollMbx unimplemented
sceKernelCancelReceiveMbx unimplemented
sceKernelReferMbxStatus unimplemented
</pre>
 
===Partially Supported===
<pre>
|sceIoIoctl|
 
supported:
0x1010005 (UMD file seek set)
0x1020006 (Get UMD file start sector)
 
|sceIoDevctl|
 
supported:
0x1F100A4 (Prepare UMD data into cache)
0x2415821 (MScmRegisterMSInsertEjectCallback)
0x2415822 (MScmUnregisterMSInsertEjectCallback)
0x2025806 (Check if the device is inserted (mscmhc0))
0x2425823 (Check if FAT enabled)
0x2415823 (Set FAT as enabled), supported
</pre>
 
==Restricted==
<pre>
scePowerRegisterCallback - ignoring
scePowerUnregisterCallback - ignoring
scePowerSetClockFrequency - ignoring
scePowerSetCpuClockFrequency(%d) - ignoring
scePowerSetBusClockFrequency(%d) - ignoring
sceUtilityMsgDialogInitStart ignored
</pre>
 
===Links===
* https://forums.ppsspp.org/showthread.php?tid=1473
* https://forums.ppsspp.org/showthread.php?tid=11961
* https://github.com/LunaMoo/PPSSPP_workarounds/blob/master/cheat.db
* https://www.psdevwiki.com/ps4/Talk:PSP_Emulator_Compatibility_List#Official_PSPemu_Configuration_Files
* https://www.psdevwiki.com/ps4/PSP_Emulator_Compatibility_List
 
===More Information:===
** https://pastebin.com/CXRpVLdd (by [[User:DarkElement]])
* https://gbatemp.net/threads/wip-psp-injection.503103/
* https://gbatemp.net/threads/wip-psp-injection.503103/
* https://twitter.com/zordon605/status/993758941627772929
* https://twitter.com/zordon605/status/993758941627772929
** https://pastebin.com/CXRpVLdd (by [[User:DarkElement]])
* https://forums.ppsspp.org/showthread.php?tid=22787
* https://twitter.com/notzecoxao/status/993950722600460296
* https://twitter.com/notzecoxao/status/993950722600460296
* https://twitter.com/ZiL0G80/status/994112249810866176
* https://twitter.com/ZiL0G80/status/994112249810866176

Latest revision as of 13:43, 24 December 2023

PSPHD[edit | edit source]

The new PS Plus PSP emulator includes plenty of undiscovered functionalities, it even allows patches directly to the emulated Allegrex cpu. Not many CLI commands were added this time around. Very few commands have a description to their usage inside of the eboot.bin, everything else is just guesswork from the scene. Plenty of LUA commands need to be understood before the compatibility of games can improve. The PSP emulator has not gained the same popularity as the ps2 emulator due to the existence of an unofficial PPSSPP core in the unofficial Retroarch port for the PS4. As far as the compatibility and performance go, the Retroarch core is yet to be bested. This emulator may hold potential, but the potential can only go so far as it seems not to have support for gamedata installation, which in turn will render many games unplayable.

Commands[edit | edit source]

Known functions: Require cleanup.
The rest of the cli and lua commands can all be found inside of an emu's decrypted eboot.bin.

CLI commands[edit | edit source]

These commands can be added to any of these files:

  • config-title.txt
  • package-ps4.conf
Command Values Notes Usage
General
--boot Set directory of psp game's boot.bin [disc0:/PSP_GAME/SYSDIR/BOOT.BIN]
--notrophies Enable/disable trophies
--ps4-trophies
--locale
--image umd0 ,disc0 Set path for disc image
--vms ? ?
--addon
--host Sets host directory --host="/hostapp/"
--loglevel none, all, warn, info, error, debug, trace debug logging
--xobuttonmode oenter, ocancel Switcher between x and circle button, made specifically for japanese gamers
--lang Including but not limited to "en" "jp" "fr" "it" Language selector --lang="en"
--savedata-mode ? ?
--securesaves true, false Enable/disable encrypted savegames --securesaves=true
--multisaves true, false Enable Multiple Savegames --multisaves=true
--samplesave ? ?
Graphical fixes
--antialias off, MSAA4x, SSAA4x Anti-aliasing options --antialias=off
--texcachemode patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo, full for issues with texture cache (modes lower than full possibly read some textures directly without cache). --texcachemode=patchworkheroes
--texclutmode filter, full --texclutmode=full
--texloadmode launch, ondemand_lz4 Seems to be a selector of when to load textures, either before the game requires it, or once the game requires it
--depthscalehack true?, false? --depthscalehack=true
--depthscalehack true?, false? --depthscalehack=true
--locorocomeshsmooth true, false Custom mesh smoothing for loco roco games(?) --locorocomeshsmooth=true
--locorocomeshsmoothnonindexed true, false Turns "locorocomeshsmooth" mesh smoothing into non-indexed(?) --locorocomeshsmoothnonindexed=true
--forcenobilinear true, false Turn bilinear filtering on/off, setting it to True will fix many graphical glitches in games that use 2D Images --forcenobilinear=true
Game fixes
--godofwarhack true, false Likely a performance patch for games that go way above the fps cap. Managed to help God Of War - Ghost Of Sparta skip intro freeze. it could possibly be used as a speedhack. Might be this? --godofwarhack=true
No effect / unknown values
--texloadcores 0, 100 textures to load texloadcores=2
--smoothlevel 0, 100 Mesh smoothing level? --smoothlevel=0
--anisolevel 0, 100 Anisotropic filtering level??
--parappajapanesefonthack true?, false? Enables Support For Japanese Fonts ?? --parappajapanesefonthack=true
--clamp-line-thickness-min ? ?
--clamp-line-thickness-max ? ?
--parappareplacecolor The command expects 8 Hex values (rgb?)
--msxxadhoc true?, false? ad hoc support ?
--parappaalphahack true?, false? Doesn't seem to have any effect. --parappaalphahack=true
--umddelay ? Seems to be I/O timing method. Doesn't seem to have any effect
--vramcopyback 0, 10000000 for games that download data from GPU to Allegrex --vramcopyback=45
Speedhacks / Possible duplicates
--antialias off Turning Anti-Alias Off Improves Performance --antialias=off
--texclutmode full Turns on filtering of CLUT hashes to avoid repeat indexed textures --texclutmode=full
--texloadcores 0 Textures to load --texloadcores=12
--smoothlevel 0 Set mesh smooth level --smoothlevel=0
--gputhread true, false possibly move GPU emulation to another thread. Speedhack, but can decrease compatibility. --gputhread=true
--texcachemode patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo Set texture caching method --texcachemode=patchworkheroes
--anisolevel 0, 100 Anisotropic filtering level??
--present vblankstart, setframebuf, drawsync set when frame is presented. Sync issues, flickering screen, tearing, input lag, etc. Doesn't seem to have any effect. --present=setframebuf
--texrecent true Optimize texture hashes --texrecent=true

Syphon Filter Dark Mirror[edit | edit source]

Command Values Notes Usage
--force-native-aspect-ratio
--use-higher-precision-depth
--optimize-fb-self-resolves
--force-dsf-present
--bend-30hz-lock
--setframebuf-auto-vblank-wait-threshold
--gpu-renderthread
--force-triangle-clip-off
--hack-use-sku-vms
--active-sku
--psp-right-stick-action 0,1 --psp-right-stick-action=1
--psp-right-stick-deadzone-x --psp-right-stick-deadzone-x=15
--psp-right-stick-deadzone-y --psp-right-stick-deadzone-y=15
--psp-right-stick-deadzone-semicircle-arc --psp-right-stick-deadzone-semicircle-arc=40

Texture replacement[edit | edit source]

Command Values Notes Usage
--texswitch true, false Enables Texture replacement --texswitch=true
--texsave
--texmissingsave
--autoresampler true, false Turns on the auto-resampler. Assumes textures in texreplace are at 8x resolution and resamples them at load, May only work on new LocoRoco Midnight Carnival emu --autoresampler=true
--texreplace Directory Set directory of texture replacement folder --texreplace="host0:texreplace"
--replacementfilter true, false This forces alpha blending to on for replaced textures. --replacementfilter=true
--replacementalpha true, false --replacementalpha=true

XXXXYYYYY_patches.lua[edit | edit source]

The lua can be placed as: scripts\XXXXYYYYY_patches.lua

Emulator commands[edit | edit source]

Command Usage Notes - Example
getEmuObject local emuObj = getEmuObject() Required for all functions using emuObj
LoadSlideshow emuObj.LoadSlideshow()
StartSlideshow emuObj.StartSlideshow()
Log emuObj.Log()
GetLanguage emuObj.GetLanguage() Get the language the ps4 is using
GetNativeLanguage emuObj.GetNativeLanguage()
DisplayManual emuObj.DisplayManual()
DisplayProduct emuObj.DisplayProduct()
LoadConfig emuObj.LoadConfig()
SaveConfig emuObj.SaveConfig()
LoadMIDI emuObj.LoadMIDI()
GetMIDINotesAtTick emuObj.GetMIDINotesAtTick()
LoadState emuObj.LoadState()
SaveState emuObj.SaveState()
SetFDExtraDelay emuObj.SetFDExtraDelay() 0? 1?
MeshSmooth emuObj.MeshSmooth()
SetHue emuObj.SetHue()
SetSaturation emuObj.SetSaturation()
SetBrightness emuObj.SetBrightness()
SetContrast emuObj.SetContrast()
VideoScale emuObj.VideoScale()
SetOverlay emuObj.SetOverlay()
DisplayUIOverlay emuObj.DisplayUIOverlay()
CRC32 emuObj.CRC32()
SASGetCRC emuObj.SASGetCRC()
SASGetSampleRate emuObj.SASGetSampleRate()
GetAppName emuObj.GetAppName()
ReadFile emuObj.ReadFile()
RemapFB emuObj.RemapFB()
InvalFB emuObj.InvalFB()
PlayVideo emuObj.PlayVideo()
RescaleUForUpscale emuObj.RescaleUForUpscale()
RescaleVForUpscale emuObj.RescaleVForUpscale()
ShrinkUVRect emuObj.ShrinkUVRect()
ScalePosition emuObj.ScalePosition()
AdjustUVJitter emuObj.AdjustUVJitter()
OverrideFBSize emuObj.OverrideFBSize() Override framebuffer size ?
RemapSavedata emuObj.RemapSavedata() emuObj.RemapSavedata("UCUS98711", "CUSA06171", "504e802b04a1838c32b616abbe0b475fbea1c823825ef0df06cc2bad129ce2f7")
NeoMode emuObj.NeoMode() Checks whether or not the ps4 is pro
ThrottleMax emuObj.ThrottleMax() Disable framelimiter during loading screens. This setting can sometimes be harmful when used globally in config files. Loading times are faster, but the game also runs faster than it should when the PS4 has enough free cpu power.
ThrottleFast emuObj.ThrottleFast() Faster than default, but exact value is unknown.
ThrottleNorm emuObj.ThrottleNorm() Enable default framelimiter (50/60 fps depend on region)
SetTextureHashMode emuObj.SetTextureHashMode()
SetTextureScaleOffset emuObj.SetTextureScaleOffset()
SetTextureSaveSubdir emuObj.SetTextureSaveSubdir()
SetDrawEDRam emuObj.SetDrawEDRam()
SetSampleTitle emuObj.SetSampleTitle()
ToggleTextures emuObj.ToggleTextures()
CopyFB emuObj.CopyFB()
Hooks
AddVsyncHook emuObj.AddVsyncHook() Set function to be done on every vsync
RemoveVsyncHook emuObj.RemoveVsyncHook() Remove vsynchook
AddBootHook emuObj.AddBootHook() Set function to be done when the game boots up
RemoveBootHook emuObj.RemoveBootHook() remove function to be done when the game boots up
AddGPUHook emuObj.AddGPUHook()
Pad
Pad require local pad = require("pad") Required for all commands that rely on pad
PadRead emuObj.PadRead()


L3 = 0x00000002
R3 = 0x00000004
OPTIONS = 0x00000008
UP = 0x00000010
RIGHT = 0x00000020
DOWN = 0x00000040
LEFT = 0x00000080
L2 = 0x00000100
R2 = 0x00000200
L1 = 0x00000400
R1 = 0x00000800
TRIANGLE = 0x00001000
CIRCLE = 0x00002000
CROSS = 0x00004000
SQUARE = 0x00008000
SELECT = 0x00010000
START = 0x00020000

PadReadPitch emuObj.PadReadPitch()
PadReadRoll emuObj.PadReadRoll()
PadRegisterSamples emuObj.PadRegisterSamples()
PadSetButtonsMode emuObj.PadSetButtonsMode()


0 = Touch bar is split in two for Start/Select. Option is unmapped (default behaviour)
1 = Touch bar is Start. Option is Select
2 = Touch bar is Select. Option is Start

PadVibrate emuObj.PadVibrate() emuObj.PadVibrate(5,180,180)

Allegrex commands[edit | edit source]

Command Usage Notes - Example
getAXObject local axObj = getAXObject() Required for all functions using AXObject
AddHook axObj.AddHook()
RemoveHook axObj.RemoveHook()
BurnCycles axobj.BurnCycles() Could be an option to overclock cpu at a hooked offset
AddAOTBlock axObj.AddAOTBlock() Ahead of time compilation block ?
Overlay axObj.Overlay()
GPR
gpr require local gpr = require("ax-gpr-alias") Required for any command that includes gpr registers
SetPC axObj.SetPC()
GetPC axObj.GetPC()
GetGpr axObj.GetGpr()
SetGpr axObj.SetGpr()
SetFpr axObj.SetFpr() axObj.SetFpr(0)
GetFpr axObj.GetFpr()
SetHi axObj.SetHi()
GetHi axObj.GetHi()
SetLo axObj.SetLo()
GetLo axObj.GetLo()
SetReg axObj.SetReg()
GetReg axObj.GetReg()
Memory editing Do note that the offsets on PPSSPP are mapped differently than the ones on the PS4
ReadMem32 axObj.ReadMem32() Read 4 bytes from offset
WriteMem32 axObj.WriteMem32() Write 4 bytes to offset
ReadMem16 axObj.ReadMem16() Read 2 bytes from offset
WriteMem16 axObj.WriteMem16() Write 2 bytes to offset
ReadMem8 axObj.ReadMem8() Read 1 byte from offset
WriteMem8 axObj.WriteMem8() Write 1 byte to offset
ReadMemString axObj.ReadMemString()
WriteMemString axObj.WriteMemString()
WriteMemStr16 axObj.WriteMemStr16()
WriteMemStr16Z axObj.WriteMemStr16Z()
WriteMemStringZ axobj.WriteMemStringZ
ReadMemFloat axObj.ReadMemFloat()
WriteMemFloat axObj.WriteMemFloat()
Other/Unknown/Standalone Commands
FuncReplace axFuncReplace() axFuncReplace(0x8804670, "__ptmf_scall") Replace allegrex function.
InsnReplace axInsnReplace() Replace allegrex memory

Examples[edit | edit source]


LUA example:

Coconut Dodge "NPEZ00164"

local axObj = getAXObject()
local emuObj = getEmuObject()

local patcher = function()
--Infinite lives
axObj.WriteMem32(0x8ACA1A4, 0x3) --0x08ACE1A4 on PPSSPP, PPSSPP addresses need to be reduced by 0x4000 in order to work on PS4
end

emuObj.AddVsyncHook(patcher)

More patches can be found here

Patches.lua[edit | edit source]
Syphon Filter: Dark Mirror[edit | edit source]
-- Lua 5.3
-- Title: Syphon Filter: Dark Mirror

-- Patches for fixing issues with post fx in games using the Syphon Filter/Resistance engine

apiRequest(1.0)	-- request version 1.0 API. Calling apiRequest() is mandatory.

local emuObj = getEmuObject()
local cpu = getAXObject() 

-- The bloom filter uses 1.5 pixel jitter to make a ghetto blur. When up-ressed, this doesn't look good.
-- To compensate, reduce the jitter amount before rendering.
function BloomJitterPlusAdjust()
	-- 1.5 pixel "+" pattern
	emuObj.AdjustUVJitter(0, 4, 0.0, 1.5)
	emuObj.AdjustUVJitter(4, 4, 0.0, -1.5)
	emuObj.AdjustUVJitter(8, 4, 1.5, 0.0)
	emuObj.AdjustUVJitter(12, 4, -1.5, 0.0)
end

function BloomJitterCrossAdjust()
	-- 1.5 pixel "x" pattern
	emuObj.AdjustUVJitter(0, 4, 1.5, 1.5)
	emuObj.AdjustUVJitter(4, 4, -1.5, 1.5)
	emuObj.AdjustUVJitter(8, 4, 1.5, -1.5)
	emuObj.AdjustUVJitter(12, 4, -1.5, -1.5)
end

local jitterFixPlus = emuObj.AddGPUHook(0x40dc000, 0, 16, 0x40d4000, BloomJitterPlusAdjust)
local jitterFixCross = emuObj.AddGPUHook(0x40d4000, 0, 16, 0x40dc000, BloomJitterCrossAdjust)

function depthquery()
	local querystruct = 0x8eda968		-- this is always in a fixed location
	-- the depth query struct is fixed to 24 entries
	-- 0..15 seem to be always used for lights, 16..23 are for npcs
	for i=0,23 do
		local querytype = cpu.ReadMem32(querystruct+0)
		local valid = cpu.ReadMem32(querystruct+1*4)
		if valid ~= 0xffffffff then
			--local queryx = cpu.ReadMem32(querystruct+2*4)
			--local queryy = cpu.ReadMem32(querystruct+3*4)
			--local querydepth = cpu.ReadMem32(querystruct+4*4)
			--local querywidth = cpu.ReadMem32(querystruct+5*4)
			--local queryheight = cpu.ReadMem32(querystruct+6*4)
			--local param1c = cpu.ReadMem32(querystruct+7*4)
			--local param20 = cpu.ReadMem32(querystruct+8*4)
			local param24 = cpu.ReadMem32(querystruct+9*4)
			--local result = cpu.ReadMemFloat(querystruct+10*4)
			if param24 <= 0 then
				cpu.WriteMem32(querystruct+1*4, 0xffffffff)		-- to be removed from the list -> mark as invalid
			else
				if querytype == 3 then		-- n x n coverage based occlusion used by lights. Object opacity is set to (visible_samples / total_samples)
					cpu.WriteMemFloat(querystruct+10*4, 0.0)	-- always hide lights
				else						-- Enemies use a 5-point (corners + center) occlusion check. Object is visible if any of the points is visible.
					cpu.WriteMemFloat(querystruct+10*4, 1.0)	-- set always visible
				end
			end
		end
		querystruct = querystruct + 0x2c
	end
end

cpu.AddHook(0x8c163d4, 0x27bdff80, depthquery)			-- = addiu sp, sp, -0x80
-- the hook code replaces the occlusion function, so just adjust the stack and return
cpu.InsnReplace(0x8c163d8, 0x34040000, 0x27bd0080)		-- addiu sp, sp, 0x80
cpu.InsnReplace(0x8c163dc, 0xafa40048, 0x03e00008)		-- jr ra
cpu.InsnReplace(0x8c163e0, 0x3c0408ee, 0x00000000)		-- nop
Patapon 2[edit | edit source]
-- Lua 5.3
-- Title:   Patapon 2 PSP - UCUS-98732 (USA)

apiRequest(1.0)	-- request version 1.0 API. Calling apiRequest() is mandatory.

local gpr		= require( "ax-gpr-alias" ) -- you can access Allegrex GPR by alias (gpr.a0 / gpr["a0"])
local emuObj	= getEmuObject() -- emulator
local axObj		= getAXObject() -- allegrex
local pad		= require("pad")

-- Hook memcpy to catch framebuffer effects
axFuncReplace(0x881D194, "patapon_memcpy")

-- Accelerate some functions
axFuncReplace(0x8804670, "__ptmf_scall")
axFuncReplace(0x8892230, "Renderer__makeWorldMatrix__4psysFv")
axFuncReplace(0x88209A8, "patapon_strcmp")
axFuncReplace(0x8815130, "sceGupSetStatus")
axFuncReplace(0x8851D84, "FMtx44__setRow__3PydFv")
axFuncReplace(0x88437F0, "Script__Talk__Controller__setDeltaTime__3PydFv")
axFuncReplace(0x8843B6C, "Script__Talk__Controller__setCmdId__3PydFv")
axFuncReplace(0x88441DC, "Script__Talk__Controller__getArgValuePtr__3PydFv_0")
axFuncReplace(0x89B25B0, "sceGmoCol4Multiply")
axFuncReplace(0x8910A60, "Gfx__CacheModel__getNodeMtx__6SystemFv")
axFuncReplace(0x8911440, "Gfx__StaticGmoModel__getNodeIdx__6SystemFv")
axFuncReplace(0x89114C8, "Gfx__StaticGmoModel__getNodeMtx__6SystemFv")
axFuncReplace(0x891157C, "Gfx__StaticGmoModel__getNodeMtx__6SystemFv_0")
axFuncReplace(0x881462C, "sceGuEnable", 0x8B3C050) -- param = gupbase pointer
axFuncReplace(0x8814684, "sceGuDisable", 0x8B3C050) -- param = gupbase pointer
axFuncReplace(0x89B2D84, "sceGmoFCurveEval_fastpath", 0x89B2D88) -- param = function entry if not fast path
--axFuncReplace(0x88D0788, "Game__Map__Weather__WindLocus__update__4LaboFv_loop", 0x88D0864) -- param = continue address
axFuncReplace(0x890FCBC, "convertLowerString__6SystemFv")
axFuncReplace(0x8877104, "convertLowerString__6SystemFv") -- convertLowerString__21@unnamed@BNDFile_cpp@Fv, same functionality
axFuncReplace(0x897927C, "__extendsfdf2")
axFuncReplace(0x8979AF8, "__muldf3")
axFuncReplace(0x8979A8C, "__adddf3")
axFuncReplace(0x897A750, "__truncdfsf2")
axFuncReplace(0x88CBD64, "RemapPacket", 0x8ACC394) -- param comes from RemapPacketAddr24 & RemapPacketAddr16
axFuncReplace(0x890FEA0, "patapon_strcmp") -- strcmpFast__6SystemFv ('fast' strcmp)

-- Switch Select command to "Options" button.
emuObj.PadSetButtonsMode(pad.BUTTONS_MODE_OPTION_IS_SELECT)

-- Remove "Transfer Patapon Saved Data" option from New Game option
--axInsnReplace(0x8A46660, 0x24070002, 0x24070001) -- li  a3,0x2  (change 2 menu options to 1)
emuObj.RemapSavedata("UCUS98711", "CUSA06171", "504e802b04a1838c32b616abbe0b475fbea1c823825ef0df06cc2bad129ce2f7")

-- Fix "Tree of Life" unaligned lines and shadows
axObj.AddHook(0x884600C, 0x8c850010, function() -- PSP::Gfx::PrimitiveContext::setVertex2f
	local context = axObj.GetGpr(gpr.a0)
	local cmdCount = axObj.ReadMem32(context + 0x14)
	if (cmdCount & 1) == 1 then -- we have at least 2 commands
		local cmdBuffer = axObj.ReadMem32(context + 0x10)
		local cx = axObj.GetFpr(12)
		local cy = axObj.GetFpr(13)
		local ox = axObj.ReadMemFloat(cmdBuffer-12)
		local oy = axObj.ReadMemFloat(cmdBuffer-8)
		
		if cx == ox then
			axObj.SetFpr(12, cx + 0.5)
			axObj.WriteMemFloat(cmdBuffer-12, ox + 0.5)
		elseif cy == oy then
			axObj.SetFpr(13, cy + 0.5)
			axObj.WriteMemFloat(cmdBuffer-8, oy + 0.5)
		end
	end
end)

-- LANGUAGES --
local langCode = "us" -- default
--local languageList = {"Japanese","English","UK","Italian","German","Spanish","French","Korean","Chinese","ns","nf","Dutch","Portuguese","gr","Belgium"}
--local gameLanguageCode = {"jp","us","uk","it","de","sp","fr","kr","cn","ns","nf","nl","pt","gr","be"}
local languageList = {"","English","","","","","","","","Spanish","French","","","",""}
local gameLanguageCode = {"","us","","","","","","","","ns","nf","","","",""}

-- US: english = 1, spanish = 9, french = 0xA (from Localize__Manager__setDefaultLangage)
-- EU: uk = 2, italian = 3, german = 4, spanish = 5, french = 6
-- JP: jp = 0
-- HP: ko = 7, ch = 8, 
	
-- GLOBAL FUNCTIONS --

local GLOBAL = 0x8B7D088 -- reawakeDeathUnit - offset 0x88A95E8 in $v1

function getGlobalAddr() -- gets Global to user data.
	-- address comes from: Labo::Bases::Camp::Controller::reawakeDeathUnit - offset 0x88A95E8 in $v1
	-- add 0x20 to address to align it with the word "none"
	
	local main = axObj.ReadMem32(GLOBAL)				-- fixed Global address from: 0x88A95E8 -> 0x8c9fbc0
	if main == 0xFFFFFFFF or main == 0 then
		return 0xFFFFFFFF
	end
	local ptr = axObj.ReadMem32(main + 0x10c0)			--> sets to: 0x8d07840
	if ptr == 0xFFFFFFFF or ptr == 0 then
		return 0xFFFFFFFF
	end

	return ptr
end

-- MAIN FUNCTIONS --

local H1 = function() -- Labo::Bases::Camp::Scene::updateTips
	local v0 = axObj.GetGpr(gpr.v0)
	if v0 > 0 then
		emuObj.ThrottleMax()
	else
		emuObj.ThrottleNormal()
	end
end

local H2 = function() -- GameSystem__SaveDataController__setStateMessage
	local ptr = axObj.GetGpr(gpr.a2)
	local str = axObj.ReadMemStr16(ptr)
	local newStr = "Now loading. Do not turn off the power."
	-- english: Now loading./Do not remove the Memory Stick Duo™ /or turn off the system power.
	-- spanish: Cargando./No extraigas el Memory Stick Duo™ /ni apagues el sistema.
	-- french: Chargement./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
	-- italian: Caricamento in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
	-- german: Lädt./Bitte den Memory Stick Duo™ nicht entfernen /und das System nicht ausschalten.
	-- japanese: システムデータをロード中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
	-- chinese: 系統資料載入中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
	-- korean: 시스템 데이터를 불러오는 중입니다./Memory Stick Duo™를 빼거나/전원을 끄지 마십시오.
	
	if string.find(str, "Now loading") then
		newStr = "Now loading."										-- English: Now loading./Do not remove the Memory Stick Duo™ /or turn off the system power.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Checking Memory Stick") then
		newStr = "Please wait."										-- English: Checking Memory Stick Duo™.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Now saving")then
		newStr = "Now saving."										-- English: Now saving./Do not remove the Memory Stick Duo™ /or turn off the system power.
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "Cargando.") then
		newStr = "Cargando..."										-- Spanish: Cargando./No extraigas el Memory Stick Duo™ /ni apagues el sistema.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Guardando...")then
		newStr = "Espera..."										-- Spanish: Guardando.../No extraigas el Memory Stick Duo™ /ni apagues el sistema.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Comprobando el Memory Stick") then
		newStr = "Guardando..."										-- Spanish: Comprobando el Memory Stick Duo™.
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "Chargement.") then
		newStr = "Chargement."										-- French: Chargement./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Vérification du Memory Stick")then
		newStr = "Veuillez patienter."								-- French: Vérification du Memory Stick Duo™.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Sauvegarde.") then
		newStr = "Sauvegarde en cours."								-- French: Sauvegarde./Ne pas retirer le Memory Stick Duo™ /ou éteindre le système.
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "Caricamento in corso") then
		newStr = "Caricamento in corso."							-- Italian: Caricamento in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Controllo del Memory Stick")then
		newStr = "Attendi."											-- Italian: Controllo del Memory Stick Duo™.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Salvataggio in corso") then
		newStr = "Salvataggio in corso."							-- Italian: Salvataggio in corso.../Non rimuovere il Memory Stick Duo™ /e non spegnere il sistema.
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "Lädt") then
		newStr = "Lädt."											-- German: Lädt./Bitte den Memory Stick Duo™ nicht entfernen /und das System nicht ausschalten.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Memory Stick Duo™ wird überprüft")then
		newStr = "Bitte warten."									-- German: Memory Stick Duo™ wird überprüft.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Speichert.") then
		newStr = "Speichert."										-- German: Speichert./Bitte den Memory Stick Duo™ nicht entfernen und /das System nicht ausschalten.
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "システムデータをロード中です。") then
		newStr = "ロード中。"											-- Japanese: システムデータをロード中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Memory Stick Duo™のチェック中です。")then
		newStr = "お待ちください。"										-- Japanese: Memory Stick Duo™のチェック中です。
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "システムデータをセーブ中です。") then
		newStr = "セーブ中。"											-- Japanese: システムデータをセーブ中です。/Memory Stick Duo™を抜き挿ししたり、/電源を切ったりしないでください。
		axObj.WriteMemStr16Z(ptr, newStr)
--	
	elseif string.find(str, "系統資料載入中。") then
		newStr = "載入中。"											-- Chinese: 系統資料載入中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Memory Stick Duo™確認中。")then
		newStr = "請稍候。"											-- Chinese: Memory Stick Duo™確認中。
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "保存中。") then
		newStr = "存檔中。"											-- Chinese: 保存中。/請勿插拔Memory Stick Duo™/或是關閉主機的電源。
		axObj.WriteMemStr16Z(ptr, newStr)
--
	elseif string.find(str, "시스템 데이터를 불러오는 중입니다") then
		newStr = "불러오는 중입니다."										-- Korean: 시스템 데이터를 불러오는 중입니다./Memory Stick Duo™를 빼거나/전원을 끄지 마십시오.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "Memory Stick Duo™ 체크 중입니다")then
		newStr = "잠시 기다려 주십시오."									-- Korean: Memory Stick Duo™ 체크 중입니다.
		axObj.WriteMemStr16Z(ptr, newStr)
	elseif string.find(str, "시스템 데이터를 저장 중입니다") then
		newStr = "저장 중입니다."										-- Korean: 시스템 데이터를 저장 중입니다./Memory Stick Duo™를 빼거나,/전원을 끄지 마십시오.
		axObj.WriteMemStr16Z(ptr, newStr)
	end
end

local H3 = function()	-- Localize__Manager__getLanguageName
	local v0 = axObj.GetGpr(gpr.v0)
	local langPtr = axObj.ReadMem32(v0)
	langCode = axObj.ReadMemStr(langPtr)
end

local bundleFileName = ""
local H4 = function() -- System::Util__BNDFile__doNameCallback
	local ptr = axObj.GetGpr(gpr.a0)
	bundleFileName = axObj.ReadMemStr(ptr)
end

local H5 = function() -- Labo::GameSystem__callbackFunc_MemoryObject
	local ptr = axObj.GetGpr(gpr.s5)
	local dataPtr = axObj.ReadMem32(ptr)
	
	if bundleFileName == "colony_data.pac" then
		axObj.WriteMem16(dataPtr + 0x79ba, 4)
	end
end

-- Black Smith - Remove "KeyGuide" bug when hit anvil head while quenching --
local blackSmithRunning = false
local H6 = function() -- Sound__SubGame__Blacksmith__Command__start__4LaboFv
	blackSmithRunning = true
end
local H7 = function() -- Sound__BeatCommander__endSubGame__4LaboFv
	if blackSmithRunning == true then
		local a0 = axObj.GetGpr(gpr.a0)
		axObj.WriteMem8(a0 + 0x19c, 1)	-- set memory to 1 (instead of 0) otherwise brings up bad "KeyGuide"
	end
	
	blackSmithRunning = false
end

-- TIPS System hacks --
axInsnReplace(0x8A73A44, 0x3C0342A8, 0x3C0342A4) -- change required number of Tips from 84 to 82.
local H8 = function() -- GameSystem__Tips__Viewer__setup__4LaboFv
	local global = getGlobalAddr()
	if global == 0xFFFFFFFF then
		return
	end

	local unitTable = axObj.ReadMem32(global + 0x1068)	--> sets to: 0x8d13580 (unit table)
	local tipsPtr = unitTable + 0x1F5E4
	
	local badTips = axObj.ReadMem32(tipsPtr + 8)
	badTips = badTips & 0xFFBBFFFF		-- remove tips 0x53 and 0x57 as they referred to Multiplayer
	axObj.WriteMem32(tipsPtr + 8, badTips)
end

-- Remove AutoSave menu from initial startup --
local H9 = function() -- GameSystem__SaveDataController__update__4LaboFv
	local s3 = axObj.GetGpr(gpr.s3)
	local flg = axObj.ReadMem32(s3 + 0x7eed)
	local val = axObj.ReadMem32(s3 + 0x7efc)
	
	if flg == 0 and val == 0x14 then
		axObj.WriteMem32(s3 + 0x7efc, 0x13)
	end
end

-- Change game save name to "Patapon 2 Remastered" --
local H10 = function() -- Utility__SaveDataUtility__setDataParamsfoString
	local ptr = axObj.GetGpr(gpr.s1)
	local strPtr = axObj.ReadMem32(ptr)
	local newStr = "PATAPON™ 2 Remastered"
	
	axObj.WriteMemStrZ(strPtr, newStr)
end

-- Change description for the "Friendship" weapon to remove game sharing text --
local	itemsTable = {}
		itemsTable[1] = "Proof of friendship establish"			-- English
		itemsTable[2] = "Prueba de la amistad establecida"		-- Spanish
		itemsTable[3] = "Preuve de l'amitié établie"			-- French
		itemsTable[4] = "Preuve d'une amitié"					-- French alt
		
function changeStrings(strPtr) -- modify strings
	local str = axObj.ReadMemStr16(strPtr) -- ptr to the string
	local strFind = string.gsub(str, "/", " ")	-- change any slash to space to strings can match.
	strFind = string.gsub(strFind, "  ", " ")	-- change any double spaces due to above change to only 1 space.
	
	for i = 1, #itemsTable do
		local startPos, endPos = string.find(strFind, itemsTable[i])
	
		if startPos ~= nil then
			str = string.sub(str, 1, (startPos-1) )
			-- SPECIAL fixes --
			str = string.gsub(str, "Un oiseau avec de bons HP et /une grosse attaque.","Un oiseau qui augmente vos/HP.") -- French incorrect grammar (bird)
			str = string.gsub(str, "aumente","augmente") -- French incorrect grammar.

			axObj.WriteMemStr16Z(strPtr, str)
		end
	end
end
		
local H11 = function() -- from Bases__Item__ExplanationWindow__setItemId
	local ptr = axObj.GetGpr(gpr.a0)
	local a2 = axObj.GetGpr(gpr.a2)
	local valPtr = axObj.ReadMem32(ptr)
	local v1 = valPtr + 8
	local v0 = a2 * 4
	v0 = v0 + v1
	local strPtr = axObj.ReadMem32(v0)
	strPtr = strPtr + valPtr

	changeStrings(strPtr)
end

-- Skip Memory message when selecting "Delete Save Data" on "Save the adventure" dialogue.
local menuSkip = false
local H12 = function()		-- Bases__Talk__CommandCamp__showDialog
	menuSkip = true
end
local H13 = function()		-- Bases__Talk__CommandCamp__showDialog
	if menuSkip == true then
		axObj.SetGpr(gpr.v1, 0)
		menuSkip = false
	end
end
local H14 = function()		-- Bases__Talk__CommandCamp__showDialog
	if menuSkip == true then
		axObj.SetPC(0x88D908C)
	end
end


-- HOOKS --
local hook1  = axObj.AddHook(0x88E9564, 0x0002102B, H1)		-- Labo::Bases__Camp__Scene__updateTips
local hook2  = axObj.AddHook(0x899E718, 0x00403021, H2)		-- GameSystem__SaveDataController__setStateMessage
local hook3  = axObj.AddHook(0x897771C, 0x00431021, H3)		-- Localize__Manager__getLanguageName
local hook4  = axObj.AddHook(0x88774D0, 0x00402821, H4)		-- System::Util__BNDFile__doNameCallback
local hook5  = axObj.AddHook(0x886889C, 0x02002021, H5)		-- Labo::GameSystem__callbackFunc_MemoryObject
local hook6  = axObj.AddHook(0x898BCDC, 0x27BDFFE0, H6)		-- Sound__SubGame__Blacksmith__Command__start__4LaboFv
local hook7  = axObj.AddHook(0x89220F8, 0xAC80019C, H7)		-- Sound__BeatCommander__endSubGame__4LaboFv
local hook8  = axObj.AddHook(0x8A734DC, 0x27BDFFC0, H8)		-- GameSystem__Tips__Viewer__setup__4LaboFv
local hook9  = axObj.AddHook(0x899CF4C, 0x92637EED, H9)		-- GameSystem__SaveDataController__update__4LaboFv
local hook10 = axObj.AddHook(0x88E7E48, 0x2490009C, H10)	-- Utility__SaveDataUtility__setDataParamsfoString
local hook11 = axObj.AddHook(0x897CF90, 0x26041718, H11)	-- Bases__Item__ExplanationWindow__setItemId
local hook12 = axObj.AddHook(0x88D9114, 0xAEA00014, H12)	-- Bases__Talk__CommandCamp__showDialog
local hook13 = axObj.AddHook(0x88D90B4, 0x9063C550, H13)	-- Bases__Talk__CommandCamp__showDialog
local hook14 = axObj.AddHook(0x88D907C, 0x8FA2003C, H14)	-- Bases__Talk__CommandCamp__showDialog
local hook15 = axObj.AddHook(0x8A394B4, 0x26241718, H11)	-- Bases__Organization__Managed__ItemSelectWindow__onSlotChange (note uses H11)


-- US game bug fix.  "Paraget" -> "Patagate" --
axObj.AddHook(0x88DC5F4, 0x00409021, function() -- from Bases__Camp__Person__Behavior__Idle__update__4LaboFv
	local strPtr = axObj.GetGpr(gpr.v0) + 0xE	-- 0xE skip over X/Y positions.
	local str = axObj.ReadMemStr16(strPtr)
	
	if string.find(str, "The Paraget will") then
		-- org string: The Paraget will teleport you to/another world…
		local newStr = "The Patagate can teleport you to/another world…"
		axObj.WriteMemStr16Z(strPtr, newStr)
	elseif string.find(str, "Paraget Shrine") then
		-- org string: This is the Paraget Shrine./Only <N0> and <N1> can/enter.
		local newStr = "This is the Patagate Shrine/Only <N0> and <N1> can/enter."
		axObj.WriteMemStr16Z(strPtr, newStr)
	end
end)

--[[
axObj.AddHook(0x08982F48, 0x24070001, function()
	if emuObj.NeoMode() then
		axObj.SetGpr(gpr.a3, 0) -- turn on 60fps mode
	end
end)
]]--

--- MOVIE FIX ---
local movieLastTime = 0.0
local movieFix = function() -- Labo::GameSystem__MovieModule__render
	local t = axObj.GetFpr(0)
	if t == 0 and movieLastTime > 0 then
		local s0 = axObj.GetGpr(gpr.s0)
		axObj.WriteMemFloat(s0 + 0x44, movieLastTime)
	elseif t > 0 then
		movieLastTime = t
	end
end

axObj.AddHook(0x8A6A1DC, 0xe6000044, movieFix)


--- PAT2-16 FIX ---
axObj.AddHook(0x890E9E0, 0x02002021, function() -- Labo::Game__Gimmick__WindowAttacher__update
	local ptr = axObj.GetGpr(gpr.sp) + 0x28
	local posy = axObj.ReadMemFloat(ptr + 4)
	
	if posy < -30 then
		local obj = axObj.GetGpr(gpr.a0)
		axObj.WriteMem8(obj + 0x2a8, 0)
	end
end)

Emulators[edit | edit source]

Every emulator is programmed in a differently. Sometimes choosing the right emulator is the only possible way to fix a game. Emulators are not provided pre-installed on the ps4, they have to be unpacked from a backup that's downloaded from the ps store from that specific game. This list includes The typical usage of some of The emulators.
Emulator Usage API Version Similar emulators (compatibility)
Echochrome The default psp emulator for PSPFPKG tool at the time of writing and the best in terms of compatibility. ? ?
LocoRoco Midnight Carnival ? ? ?
LocoRoco 1 ? ? ?
LocoRoco 2 ? ? ?
Castlevania Requiem ? ? ?
Patapon 2 ? ? ?
PaRappa the Rapper An unofficial emulator developed by sony with very bad compatibility ? ?
Syphon Filter: Dark Mirror ? ? ?

Memory mapping[edit | edit source]


Note: The memory on PPSSPP is 0x4000 offsets ahead of the memory on the PS4

Size Offset From -> Offset To Name
1008000000 -> 10887FFFFF Allegrex memory(?)
640.00MB 228200000 -> 250200000
64.00MB 250200000 -> 254200000
32.00MB 254200000 -> 256200000
2048.00MB 256200000 -> 2d6200000
16.00MB 2d6200000 -> 2d7200000
16.00MB 2d7200000 -> 2d8200000
16.00MB 2d8200000 -> 2d9200000
16.00MB 2d9200000 -> 2da200000

Registers map[edit | edit source]


Registers that are marked with (?) are untested but should be accurate.
*Note: The offsets' positions change as the CLI file's content increases, but the offsets should still be somewhere nearby the offsets listed below and the layout should be the same regardless. The PC pointer script can be used to locate another PC register properly in Echochrome's emulator

GPR Offset Notes FPU Offset
zero 0x200414CA8? f0 0x200414D4C?
at 0x200414CAC? f1 0x200414D50
v0 0x200414CB0 f2 0x200414D54?
v1 0x200414CB4 f3 0x200414D58?
a0 0x200414CB8 f4 0x200414D5C?
a1 0x200414CBC? f5 0x200414D60?
a2 0x200414CC0? f6 0x200414D64?
a3 0x200414CC4? f7 0x200414D68?
t0 0x200414CC8? f8 0x200414D6C?
t1 0x200414CCC? f9 0x200414D70?
t2 0x200414CD0? f10 0x200414D74?
t3 0x200414CD4? f11 0x200414D78?
t4 0x200414CD8? f12 0x200414D7C?
t5 0x200414CDC? f13 0x200414D80?
t6 0x200414CE0? f14 0x200414D84?
t7 0x200414CE4? f15 0x200414D88?
s0 0x200414CE8? f16 0x200414D8C?
s1 0x200414CEC? f17 0x200414D90?
s2 0x200414CF0? f18 0x200414D94?
s3 0x200414CF4? f19 0x200414D98?
s4 0x200414CF8? f20 0x200414D9C?
s5 0x200414CFC? f21 0x200414DA0?
s6 0x200414D00? f22 0x200414DA4?
s7 0x200414D04? f23 0x200414DA8?
t8 0x200414D08? f24 0x200414DAC?
t9 0x200414D0C? f25 0x200414DB0?
k0 0x200414D10 f26 0x200414DB4?
k1 0x200414D14 f27 0x200414DB8?
gp 0x200414D18 f28 0x200414DBC?
sp 0x200414D1C f29 0x200414DC0?
fp 0x200414D20 f30 0x200414DC4?
ra 0x200414D24 f31 0x200414DC8
? 0x20AD14D28
last syscall? 0x20AD14D2C
pc 0x200414D34 Will show "0x0", "0x1", "0x5", if the Allegrex cpu is idle(?).
hi 0x200414D38
lo 0x200414D3C
Memory base? 0x200414D48 Shows "0x08800000", could be used as pointer or something?

PC pointer[edit | edit source]


PS4CHEATER
PSP.cht

1.5|eboot.bin|ID:|VER:01.00|FM:505
simple pointer|pointer|4 bytes|@C6B8C8_2_6B8C8+210+108|data|4 bytes|143011412|0||

VFPU

Register Offset Register Offset Register Offset Register Offset
S000 0x200414DE0 S001 0x200414DE4 S002 0x200414DE8 S003 0x200414DEC
S010 0x200414DF0 S011 0x200414DF4 S012 0x200414DF8 S013 0x200414DFC
S020 0x200414E00 S021 0x200414E04 S022 0x200414E08 S023 0x200414E0C
S030 0x200414E10 S031 0x200414E14 S032 0x200414E18 S033 0x200414E1C
S100 0x200414E20 S101 0x200414E24 S102 0x200414E28 S103 0x200414E2C
S110 0x200414E30 S111 0x200414E34 S112 0x200414E38 S113 0x200414E3C
S120 0x200414E40 S121 0x200414E44 S122 0x200414E48 S123 0x200414E4C
S130 0x200414E50 S131 0x200414E54 S132 0x200414E58 S133 0x200414E5C
S200 0x200414E60 S201 0x200414E64 S202 0x200414E68 S203 0x200414E6C
S210 0x200414E70 S211 0x200414E74 S212 0x200414E78 S213 0x200414E7C
S220 0x200414E80 S221 0x200414E84 S222 0x200414E88 S223 0x200414E8C
S230 0x200414E90 S231 0x200414E94 S232 0x200414E98 S233 0x200414E9C
S300 0x200414EA0 S301 0x200414EA4 S302 0x200414EA8 S303 0x200414EAC
S310 0x200414EB0 S311 0x200414EB4 S312 0x200414EB8 S313 0x200414EBC
S320 0x200414EC0 S321 0x200414EC4 S322 0x200414EC8 S323 0x200414ECC
S330 0x200414ED0 S331 0x200414ED4 S332 0x200414ED8 S333 0x200414EDC
S400 0x200414EE0 S401 0x200414EE4 S402 0x200414EE8 S403 0x200414EEC
S410 0x200414EF0 S411 0x200414EF4 S412 0x200414EF8 S413 0x200414EFC
S420 0x200414F00 S421 0x200414F04 S422 0x200414F08 S423 0x200414F0C
S430 0x200414F10 S431 0x200414F14 S432 0x200414F18 S433 0x200414F1C
S500 0x200414F20 S501 0x200414F24 S502 0x200414F28 S503 0x200414F2C
S510 0x200414F30 S511 0x200414F34 S512 0x200414F38 S513 0x200414F3C
S520 0x200414F40 S521 0x200414F44 S522 0x200414F48 S523 0x200414F4C
S530 0x200414F50 S531 0x200414F54 S532 0x200414F58 S533 0x200414F5C
S600 0x200414F60 S601 0x200414F64 S602 0x200414F68 S603 0x200414F6C
S610 0x200414F70 S611 0x200414F74 S612 0x200414F78 S613 0x200414F7C
S620 0x200414F80 S621 0x200414F84 S622 0x200414F88 S623 0x200414F8C
S630 0x200414F90 S631 0x200414F94 S632 0x200414F98 S633 0x200414F9C
S700 0x200414FA0 S701 0x200414FA4 S702 0x200414FA8 S703 0x200414FAC
S710 0x200414FB0 S711 0x200414FB4 S712 0x200414FB8 S713 0x200414FBC
S720 0x200414FC0 S721 0x200414FC4 S722 0x200414FC8 S723 0x200414FCC
S730 0x200414FD0 S731 0x200414FD4 S732 0x200414FD8 S733 0x200414FDC

Known issues[edit | edit source]

Issue Games affected Solution Description
No gamdata installation functionality (?)
Highly unoptimized graphics renderer Low fps
No support for some syscalls

LUA include files[edit | edit source]


Files that need to be placed in the /lua_include/ folder

uv-clamping.lua

print ("Loading uv-clamping.lua from global scripts")

UV_CLAMPING_ENABLE = true
UV_CLAMPING_DISABLE = false

UV_CLAMPING_USE_ZERO_EDGE_ALPHA = true
UV_CLAMPING_DONT_USE_ZERO_EDGE_ALPHA = false

emuObj = getEmuObject()

-- Turns off UV clamping for the given list of textures.
-- textureTable: A list of texture base addresses.
DisableUvClampingForTextures = function(textureTable)
	
	if emuObj.OverrideUvClampingState then
		for _, texAddr in ipairs(textureTable) do
			emuObj.OverrideUvClampingState(texAddr, UV_CLAMPING_DISABLE, UV_CLAMPING_DONT_USE_ZERO_EDGE_ALPHA);
		end
	else
		print ("This emulator does not support OverrideUvClampingState()")
	end
end

sce-locale.lua

print ("Loading sce-locale.lua from global scripts")

-- Language codes
--
-- ja     Japanese
-- en     English (US)
-- fr     French (France)
-- es     Spanish (Spain)
-- de     German
-- it     Italian
-- nl     Dutch
-- pt     Portuguese (Portugal)
-- ru     Russian
-- ko     Korean
-- zh-TW  Chinese (traditional)
-- zh-CN  Chinese (simplified)
-- fi     Finnish
-- sv     Swedish
-- da     Danish
-- no     Norwegian
-- pl     Polish
-- pt-BR  Portuguese (Brazil)
-- en-GB  English (UK)
-- tr     Turkish
-- es-MX  Spanish (Latin America)
-- ar     Arabic
-- fr-CA  French (Canada)
-- cs     Czech
-- hu     Hungarian
-- el     Greek ("Ελληνικά" in the system language menu)
-- ro     Romanian
-- th     Thai
-- vi     Vietnamese
-- id     Indonesian
-- uk     Ukrainian

-- returns locale (en-US) and language only (us), useful for lookups with fallback.
GetLocaleLangPair = function()
	local locale, lang
	locale = AppHost_GetLocaleTag()
	lang = locale:sub(1,2)     -- grab first two digits, eg. en-US -> en

	print ("[BOOT] App Host Langauge =", lang)

	if locale ~= nil then
		print ("[BOOT] App Host Locale =", locale)
	else
		print ("[BOOT] Deprecated Native Language =", lang)
	end

	return locale, lang
end

FindLocaleTableKey = function(table, primary, fallback, default)
	-- try for a specific Locale, and if that fails fallback on just a language (without region),
	-- and if that fails fallback on default.

	local keyres = primary
	if keyres == nil or table[keyres] == nil then
		keyres = fallback
	end

	if keyres == nil or table[keyres] == nil then
		print ("WARNING: No table entry for locale", primary, "or language", fallback, ", using default", default);
		keyres = default
	else
		print ("Found locale table entry", keyres);
	end

	return keyres
end

disc-selection.lua

print ("Loading disc-selection.lua from global scripts")
require "sce-locale"

-- Determines and sets the active SKU.
-- 
-- sku_map: Cannot be nil.  A table of the form 
-- {
-- 	en = <sku dir name>,
-- 	fr = <sku dir name>,
-- 	de = <sku dir name>,
-- 	it = <sku dir name>,
-- 	es = <sku dir name>,
--  ...
-- }
--
RegisterSkus = function(sku_map, default_locale)
	if default_locale == nil then
		default_locale = "en"
	end
	local locale, lang = GetLocaleLangPair()
	local key = FindLocaleTableKey(sku_map, locale, lang, default_locale)
	local sku_name = sku_map[key]

	if EM_SetActiveSku == nil then
		print "EM_SetActiveSku is undefined, use the stable branch of the packager or use a new version of the emulator."
	end
	EM_SetActiveSku(sku_name)

end

ax-gpr-alias.lua


-- Recommended method to import this module:
--   local gpr = require("ax-gpr-alias")


gpr = {}

gpr.zero = 0
gpr.at   = 1
gpr.v0   = 2
gpr.v1   = 3
gpr.a0   = 4
gpr.a1   = 5
gpr.a2   = 6
gpr.a3   = 7
gpr.t0   = 8
gpr.t1   = 9
gpr.t2   = 10
gpr.t3   = 11
gpr.t4   = 12
gpr.t5   = 13
gpr.t6   = 14
gpr.t7   = 15
gpr.s0   = 16
gpr.s1   = 17
gpr.s2   = 18
gpr.s3   = 19
gpr.s4   = 20
gpr.s5   = 21
gpr.s6   = 22
gpr.s7   = 23
gpr.t8   = 24
gpr.t9   = 25
gpr.k0   = 26
gpr.k1   = 27
gpr.gp   = 28
gpr.sp   = 29
gpr.fp   = 30
gpr.ra   = 31

return gpr

multiapp.lua

-- Recommended method to import this module:
--   local mapp = require("mapp")
--
-- Multi-application support module
-- Wraps common hook calls to support multiple executables
--

local emuObj	= getEmuObject() -- emulator
local axObj		= getAXObject() -- allegrex

mapp = {}
mapp.curAppName = emuObj.GetAppName()

mapp.AddBootHook = function(app, func)
	if mapp[app] == nil then
		mapp[app] = {}
	end

	mapp[app].boot = func
end

mapp.AddHook = function(app, pc, verify, func)
	if mapp[app] == nil then
		mapp[app] = {}
	end
	
	if mapp[app].hooks == nil then
		mapp[app].hooks = {}
		mapp[app].hookids = 1
	end
	
	local localid = mapp[app].hookids
	mapp[app].hookids = mapp[app].hookids + 1
	
	local handler = { addr = pc, v = verify, f = func, id = 0 }
		
	if mapp.curAppName == app then
		handler.id = axObj.AddHook(pc, verify, func)
	end
	
--	print(string.format("Added Hook for app: %s, pc=%08x, handler=%d", app, pc, localid))
	
	mapp[app].hooks[localid] = handler
	return localid
end

mapp.RemoveHook = function(app, hookid)
--	print(string.format("RemoveHook for app: %s, id=%d", app, hookid))
	
	if mapp[app] ~= nil then
		if mapp[app].hooks ~= nil then
			if mapp[app].hooks[hookid] ~= nil then
				local id = mapp[app].hooks[hookid].id
				mapp[app].hooks[hookid] = nil				-- WBD 7/6/2018
				if mapp.curAppName == app and id > 0 then
					axObj.RemoveHook(id)
				end
			end
		end
	end
end

mapp.GetHookPC = function(app, hookid)
	if mapp[app] ~= nil then
		if mapp[app].hooks ~= nil then
			if mapp[app].hooks[hookid] ~= nil then
				return mapp[app].hooks[hookid].addr
			end
		end
	end
	
	return 0
end

mapp.AddVSyncHook = function(app, func)
	if mapp[app] == nil then
		mapp[app] = {}
	end
	
	mapp[app].vsync = func
	
	if mapp.curAppName == app then
		emuObj.AddVsyncHook(func)
	end
end

mapp.RemoveVSyncHook = function(app)
	if mapp[app] == nil then
		mapp[app] = {}
	end
	
	if mapp[app].vsync ~= nil then
		table.remove(mapp[app].vsync)
	end
	
	if mapp.curAppName == app then
		emuObj.RemoveVsyncHook(func)
	end
end

-- Actual switch functionality
emuObj.AddBootHook(function()
	local app = emuObj.GetAppName()

	if app ~= mapp.curAppName then
		-- switch out the old handlers
--		print(string.format("Switching out handlers for app: %s", mapp.curAppName))
		if mapp[mapp.curAppName] ~= nil then
			if mapp[mapp.curAppName].vsync ~= nil then
				emuObj.RemoveVsyncHook()
			end
		
			if mapp[mapp.curAppName].hooks ~= nil then
				local hooks = mapp[mapp.curAppName].hooks
				
--				print(string.format("hooks: %d", #hooks))
				
				for k,v in pairs(hooks) do
					if v.id > 0 then
						axObj.RemoveHook(v.id)
						v.id = 0
					end
				end
			end
		end
		
		-- switch current app name
		mapp.curAppName = app
		
		-- install the new handlers
--		print(string.format("Switching in handlers for app: %s", mapp.curAppName))
		if mapp[mapp.curAppName] ~= nil then
			if mapp[mapp.curAppName].vsync ~= nil then
				emuObj.AddVsyncHook(mapp[mapp.curAppName].vsync)
			end
			
			if mapp[mapp.curAppName].hooks ~= nil then
				local hooks = mapp[mapp.curAppName].hooks
				
--				print(string.format("hooks: %d", #hooks))
				
				for k,v in pairs(hooks) do
					v.id = axObj.AddHook(v.addr, v.v, v.f)
				end
			end
		end
	end
	
	if mapp[mapp.curAppName] ~= nil then
		if mapp[mapp.curAppName].boot ~= nil then
			mapp[mapp.curAppName].boot()
		end
	end
end)

return mapp

pad.lua

-- Recommended method to import this module:
--   local pad = require("pad")
--
-- Buttons marked PS4 are not used by the emulator, but can be read from Lua
--
-- Read the Pad state with getEmuObject().PadRead()
-- ie:
-- local padstate = getEmuObject().PadRead()
--

pad = {}

pad.L3        = 0x00000002	-- L3 (PS4)
pad.R3        = 0x00000004	-- R3 (PS4)
pad.OPTIONS   = 0x00000008	-- Options (PS4)
pad.UP        = 0x00000010	-- Up
pad.RIGHT     = 0x00000020	-- Right
pad.DOWN      = 0x00000040	-- Down
pad.LEFT      = 0x00000080	-- Left
pad.L2        = 0x00000100	-- L2 (PS4)
pad.R2        = 0x00000200	-- R2 (PS4)
pad.L1        = 0x00000400	-- L1
pad.R1        = 0x00000800	-- R1
pad.TRIANGLE  = 0x00001000	-- Triangle
pad.CIRCLE    = 0x00002000	-- Circle
pad.CROSS     = 0x00004000	-- Cross
pad.SQUARE    = 0x00008000	-- Square
pad.SELECT    = 0x00010000	-- Select
pad.START     = 0x00020000	-- Start

-- Automap SELECT or START to the Options Button, leaving the full touchar for the opposite, with getEmuObject().PadSetButtonsMode(mode)
-- ie:
-- getEmuObject().PadSetButtonsMode(pad.BUTTONS_MODE_OPTION_IS_SELECT)

pad.BUTTONS_MODE_NORMAL = 0 -- Touch bar is split in two for Start/Select. Option is unmapped (default behaviour)
pad.BUTTONS_MODE_OPTION_IS_SELECT = 1 -- Touch bar is Start. Option is Select
pad.BUTTONS_MODE_OPTION_IS_START = 2 -- Touch bar is Select. Option is Start

return pad

Information[edit | edit source]

Note: Missing entries

Folder/File layout[edit | edit source]

├── assets
│   ├── common
│   └── PSPHD
├── app
│   └── USER_L0.IMG
├── lua_include
│   ├── ax-gpr-alias.lua
│   ├── multiapp.lua
│   ├── sce-locale.lua
│   ├── uv-clamping.lua
│   ├── disc-selection.lua
│   └── pad.lua
├── scripts
│  ├──XXXXYYYYY_patches.lua
│  ├──XXXXYYYYY_features.lua
│  ├──XXXXYYYYY_tooling.lua
│  └──XXXXYYYYY_trophies.lua
├── sce_module
├── sce_sys
├── vms
├── trophy_data
├── usermodule
│   └──libfont.lib
├── sce_discmap.plt
├── eboot.bin
├── revision.conf
├── package-ps4.conf
└── config-title.txt

Other[edit | edit source]

XXXXYYYYY_config.txt
videos/
.mp4
videos/%08x.mp4
audio/%08x.ogg

Paths: 

/app0/
/download0/
/savedata
/host/
/hostapp/
/data/

Sample[edit | edit source]

; PS4 configuration file for PSPHD
 
; Game Image
--image="data/USER_L0.IMG"
 
; Redirect host0: to a specific directory (uncomment to enable).
; By default it's mapped to either "/hostapp/" if available, or "/app0/" if "/hostapp/" is not available.
;--host="/hostapp/"
 
; To dump the original video in PMF format, uncomment the --dumpvideos line
; For example, with the current setting, it will save them in a "videos" directory inside the File Serving Directory
;--dumpvideos="host0:videos"
 
; To dump the original audio in Atrac3 format, uncomment the --dumpaudio line
; For example, with the current setting, it will save them in a "audio" directory inside the File Serving Directory
;--dumpaudio="host0:audio"
 
; To replace atrac3 audio samples, use this.
--samplereplace="host0:samplereplace"
 
; To save the in-game textures as the game runs, uncomment the --texsave line
; For example, with the current setting, it will save them in a "texdump" directory inside the File Serving Directory
;--texsave="host0:texdump"
;--texmissingsave="host0:texdump"
 
; To replace specific textures as the game runs, uncomment the --texreplace line
; For example, with the current setting, it will load them from the "texreplace" directory inside the File Serving Directory
--texreplace="host0:texreplace"
 
; This forces alpha blending to on for replaced textures. (uncomment to enable)
; With this we can freely make use of a normal alpha channel on replacement textures
--replacementalpha=true
 
; Antialiasing mode. SSAA4x looks best, MSAA4x only smooths edges.
; Choices: off, SSAA4x, MSAA4x
--antialias=SSAA4x
 
; Enable switching between original and replacement textures at runtime using the L3 button on a DS4 or the 'T' key on Windows
;--texswitch=true
 
; Turns on the auto-resampler. Assumes textures in texreplace are at 8x resolution and resamples them at load
--autoresampler=true
 
; Parappa Alpha Hack
--parappaalphahack=true

NIDs in HLE[edit | edit source]

|HLEInterruptManager|

sceKernelRegisterSubIntrHandler
sceKernelReleaseSubIntrHandler
sceKernelEnableSubIntr

|HLEStdioForUser|

sceIoOpen
sceIoClose
sceIoRead
sceIoWrite
sceIoLseek
sceIoLseek32
sceIoDopen
sceIoDread
sceIoDclose
sceIoChdir
sceIoGetstat
sceIoDevctl
sceIoRename
sceIoMkDir
sceIoChstat
sceIoRemove
sceIoRmdir
sceIoOpenAsync
sceIoReadAsync
sceIoIoctlAsync
sceIoWaitAsync
sceIoWaitAsyncCB
sceIoCloseAsync
sceIoSetAsyncCallback
sceIoPollAsync
sceIoLseekAsync
sceIoGetAsyncStat
asyncWaitTimerCallback
asyncCallbackTimerCallback
sceKernelStdin
sceKernelStdout
sceKernelStderr

|HLELoadExecForUser|

sceKernelCpuSuspendIntr
sceKernelCpuResumeIntr
sceKernelIsCpuIntrEnable
sceKernelExitGame
sceKernelRegisterExitCallback
sceKernelLoadModule
sceKernelUnloadModule
sceKernelStartModule
sceKernelStopModule
sceKernelStopUnloadSelfModule
sceKernelGetModuleIdByAddress
sceKernelStopUnloadSelfModuleWithStatus
sceKernelGetModuleId

|HLEsceAtrac3plus|

sceAtracReinit
sceAtracDecodeData
sceAtracGetNextDecodePosition
sceAtracSetHalfwayBufferAndGetID
sceAtracGetSoundSample
sceAtracGetStreamDataInfo
sceAtracGetRemainFrame
sceAtracSetLoopNum
sceAtracResetPlayPosition
sceAtracReleaseAtracID
sceAtracGetAtracID
sceAtracGetNextSample
sceAtracSetData
sceAtracAddStreamData

|HLEsceAudio|

sceAudioChReserve
sceAudioChRelease
sceAudioOutputBlocking
sceAudioChangeChannelConfig
sceAudioGetChannelRestLength
sceAudioChangeChannelVolume
sceAudioSetChannelDataLen
sceAudioOutputPanned
sceAudioOutputPannedBlocking
sceAudioGetChannelRestLen
sceAudioOutput2Reserve
sceAudioOutput2OutputBlocking
sceAudioOutput2Release
outputCallback

|HLEsceCtrl|

sceCtrlSetSamplingCycle
sceCtrlSetSamplingMode
sceCtrlReadBufferPositive
sceCtrlReadBufferNegative
sceCtrlPeekBufferPositive
sceCtrlPeekBufferNegative
sceCtrlGetIdleCancelThreshold
sceCtrlSetIdleCancelThreshold
sceCtrlReadLatch
sceCtrlPeekLatch
sampleControllerCallback
vibrationControllerCallback

|HLEsceDisplay|

sceDisplaySetMode
sceDisplaySetFramebuf
sceDisplayGetFramebuf
sceDisplayGetVcount
sceDisplayWaitVblankStart
sceDisplayWaitVblankStartCB
sceDisplayGetCurrentHcount
sceDisplayGetAccumulatedHcount
sceDisplayGetFramePerSec
sceDisplayWaitVblank
sceDisplayWaitVblankCB
sceDisplayIsVblank
sceDisplaySetHoldMode
vblankStart
vblankEnd

|HLEsceGe_user|

sceGeEdramGetAddr
sceGeEdramGetSize
sceGeGetCmd
sceGeGetMtx
sceGeListEnQueue
sceGeListEnQueueHead
sceGeListDeQueue
sceGeListSync
sceGeListUpdateStallAddr
sceGeDrawSync
sceGeSetCallback
sceGeUnsetCallback
sceGeBreak
sceGeContinue
interruptCallback

|HLEsceImpose|

sceImposeGetLanguageMode
sceImposeSetLanguageMode
sceImposeSetUMDPopup

|HLEsceMpeg|

sceMpegInit
sceMpegFinish
sceMpegCreate
sceMpegDelete
sceMpegQueryMemSize
sceMpegMallocAvcEsBuf
sceMpegFreeAvcEsBuf
sceMpegInitAu
sceMpegGetAvcAu
sceMpegGetAtracAu
sceMpegQueryAtracEsSize
sceMpegAtracDecode
sceMpegRingbufferQueryMemSize
sceMpegRingbufferConstruct
sceMpegRingbufferDestruct
sceMpegRingbufferPut
sceMpegRingbufferAvailableSize
sceMpegAvcCsc
sceMpegAvcDecodeMode
sceMpegAvcDecodeDetail
sceMpegAvcDecodeFlush
sceMpegAvcQueryYCbCrSize
sceMpegAvcInitYCbCr
sceMpegAvcDecodeYCbCr
sceMpegAvcDecodeStopYCbCr
sceMpegRegistStream
sceMpegUnRegistStream
sceMpegQueryStreamSize
sceMpegQueryStreamOffset
sceMpegFlushAllStream

|HLEsceNet|

sceNetInit
sceNetInetGetsockopt
sceNetInetSetsockopt
sceNetInetGetErrno

|HLEscePower|

scePowerRegisterCallback
scePowerUnregisterCallback
scePowerSetClockFrequency
scePowerSetCpuClockFrequency
scePowerSetBusClockFrequency

|HLEscePsmf|

scePsmfVerifyPsmf
scePsmfSetPsmf
scePsmfSpecifyStreamWithStreamTypeNumber
scePsmfCheckEPmap
scePsmfGetVideoInfo
scePsmfGetNumberOfStreams
scePsmfGetNumberOfEPentries
scePsmfGetEPWithId
scePsmfGetPsmfVersion
scePsmfGetNumberOfSpecificStreams
scePsmfSpecifyStream
scePsmfGetCurrentStreamType

|HLEscePsmfPlayer|

scePsmfPlayerCreate
scePsmfPlayerDelete
scePsmfPlayerSetPsmf
scePsmfPlayerReleasePsmf
scePsmfPlayerStart
scePsmfPlayerGetAudioOutSize
scePsmfPlayerStop
scePsmfPlayerUpdate
scePsmfPlayerGetVideoData
scePsmfPlayerGetAudioData
scePsmfPlayerGetCurrentStatus
scePsmfPlayerGetPsmfInfo
scePsmfPlayerConfigPlayer
scePsmfPlayerBreak
scePsmfPlayerChangePlayMode

|HLEsceRtc|

sceRtcGetCurrentTick
sceRtcGetAccumulativeTime
sceRtcGetCurrentClockLocalTime

|HLEsceSasCore|

sceSasInit
sceSasCore
sceSasCoreWithMix
sceSasGetEndFlag
sceSasGetPauseFlag
sceSasGetEnvelopeHeight
sceSasGetAllEnvelopeHeights
sceSasGetOutputMode
sceSasSetOutputMode
sceSasGetGrain
sceSasSetGrain
sceSasSetVoice
sceSasSetNoise
sceSasSetPitch
sceSasSetVolume
sceSasSetSimpleADSR
sceSasSetKeyOn
sceSasSetKeyOff
sceSasSetPause
sceSasSetSL
sceSasSetADSR
sceSasSetADSRMode
sceSasRevEVOL
sceSasRevType
sceSasRevParam
sceSasRevVON

|HLEsceSuspendForUser|

sceKernelPowerTick
sceKernelPowerLock
sceKernelPowerUnlock
sceKernelVolatileMemTryLock
sceKernelVolatileMemUnlock
sceKernelVolatileMemLock

|HLEsceUmdUser|

sceUmdActivate
sceUmdGetDriveStat
sceUmdCheckMedium
sceUmdRegisterUMDCallback
sceUmdUnRegisterUMDCallBack
sceUmdWaitDriveStat
sceUmdWaitDriveStatWithTimer
sceUmdWaitDriveStatCB
sceUmdCancelWaitDriveStat
_UmdWaitDriveTimeout

|HLEsceUtility|

sceUtilityLoadModule
sceUtilityUnloadModule
sceUtilityLoadNetModule
sceUtilityUnloadNetModule
sceUtilityLoadAvModule
sceUtilityUnloadAvModule
sceUtilityGetSystemParamInt
sceUtilityGetSystemParamString
sceUtilitySavedataGetStatus
sceUtilitySavedataShutdownStart
sceUtilitySavedataInitStart
sceUtilitySavedataUpdate
sceUtilityMsgDialogGetStatus
sceUtilityMsgDialogShutdownStart
sceUtilityMsgDialogInitStart
sceUtilityMsgDialogUpdate
sceUtilityMsgDialogAbort
sceUtilityOskGetStatus
sceUtilityOskShutdownStart
sceUtilityOskInitStart
sceUtilityOskUpdate
saveDataUpdateCallback
oskUpdateCallback

|HLEsceWlanDrv|

sceWlanGetSwitchState
sceWlanGetEtherAddr

|HLESysMemUserForUser|

sceKernelMaxFreeMemSize
sceKernelTotalFreeMemSize
sceKernelQueryMemoryInfo
sceKernelDevkitVersion
sceKernelPrintf
sceKernelGetPTRIG
sceKernelSetPTRIG
sceKernelAllocPartitionMemory
sceKernelFreePartitionMemory
sceKernelGetBlockHeadAddr
sceKernelGetMemoryBlockAddr
sceKernelAllocMemoryBlock
sceKernelFreeMemoryBlock
sceKernelSetCompilerVersion
sceKernelGetCompiledSdkVersion
sceKernelSetCompiledSdkVersion
sceKernelSetCompiledSdkVersion370
sceKernelSetCompiledSdkVersion380_390
sceKernelSetCompiledSdkVersion395
sceKernelSetCompiledSdkVersion401_402
sceKernelSetCompiledSdkVersion500_505
sceKernelSetCompiledSdkVersion507
sceKernelSetCompiledSdkVersion600_602
sceKernelSetCompiledSdkVersion603_605
sceKernelSetCompiledSdkVersion606
sceKernelSetUsersystemLibWork
sceKernelSysMemUserForUser_ACBD88CA
sceKernelSysMemUserForUser_D8DE5C1E
sceKernelSysMemUserForUser_945E45DA

|HLEThreadManForUser|

sceKernelDelayThread
sceKernelDelayThreadCB
sceKernelCreateCallback
sceKernelDeleteCallback
sceKernelSleepThread
sceKernelSleepThreadCB
sceKernelWakeupThread
sceKernelCreateMsgPipe
sceKernelDeleteMsgPipe
sceKernelSendMsgPipe
sceKernelTrySendMsgPipe
sceKernelReceiveMsgPipe
sceKernelTryReceiveMsgPipe
sceKernelReferMsgPipeStatus
sceKernelCreateThread
sceKernelStartThread
sceKernelExitThread
sceKernelDeleteThread
sceKernelExitDeleteThread
sceKernelGetThreadExitStatus
sceKernelTerminateThread
sceKernelTerminateDeleteThread
sceKernelWaitThreadEnd
sceKernelWaitThreadEndCB
sceKernelRotateThreadReadyQueue
sceKernelReferThreadStatus
sceKernelSuspendDispatchThread
sceKernelResumeDispatchThread
sceKernelSuspendThread
sceKernelResumeThread
sceKernelCancelWakeupThread
sceKernelGetThreadStackFreeSize
sceKernelGetSystemTimeLow
sceKernelGetSystemTime
sceKernelGetSystemTimeWide
sceKernelGetThreadCurrentPriority
sceKernelChangeCurrentThreadAttr
sceKernelGetThreadId
sceKernelChangeThreadPriority
sceKernelReferThreadProfiler
sceKernelCheckCallback
sceKernelCancelSema
sceKernelCreateSema
sceKernelDeleteSema
sceKernelPollSema
sceKernelSignalSema
sceKernelReferSemaStatus
sceKernelWaitSema
sceKernelWaitSemaCB
sceKernelCreateFpl
sceKernelDeleteFpl
sceKernelAllocateFpl
sceKernelAllocateFplCB
sceKernelTryAllocateFpl
sceKernelFreeFpl
sceKernelCancelFpl
sceKernelReferFplStatus
sceKernelCreateVpl
sceKernelDeleteVpl
sceKernelAllocateVpl
sceKernelAllocateVplCB
sceKernelTryAllocateVpl
sceKernelFreeVpl
sceKernelCancelVpl
sceKernelReferVplStatus
sceKernelCreateEventFlag
sceKernelSetEventFlag
sceKernelDeleteEventFlag
sceKernelClearEventFlag
sceKernelWaitEventFlag
sceKernelWaitEventFlagCB
sceKernelPollEventFlag
sceKernelCancelEventFlag
sceKernelReferEventFlagStatus
sceKernelCreateMbx
sceKernelDeleteMbx
sceKernelSendMbx
sceKernelReceiveMbx
sceKernelReceiveMbxCB
sceKernelPollMbx
sceKernelCancelReceiveMbx
sceKernelReferMbxStatus
sceKernelCreateMutex
sceKernelDeleteMutex
sceKernelLockMutex
sceKernelLockMutexCB
sceKernelTryLockMutex
sceKernelUnlockMutex
sceKernelCancelMutex
sceKernelReferMutexStatus
_sceKernelDelayThreadCallback
_sceKernelWaitThreadEndTimeout
_sceKernelAllocateFplTimeout
_sceKernelAllocateVplTimeout
_sceKernelWaitEventFlagTimeout
_sceKernelMsgPipeTimeout
_sceKernelLockMutexTimeout

|HLEUtilsForKernel|

sceKernelIcacheInvalidateRange

|HLEUtilsForUser|

sceKernelIcacheInvalidateRange
sceKernelDcacheInvalidateRange
sceKernelDcacheWritebackInvalidateRange
sceKernelDcacheWritebackAll
sceKernelDcacheWritebackRange
sceKernelDcacheWritebackInvalidateAll
sceKernelSetGPO
sceKernelGetGPI
sceKernelLibcClock
sceKernelLibcTime
sceKernelLibcGettimeofday 0x71EC4271

Unimplemented functions[edit | edit source]

sceIoChdir() unimplemented, ignoring
sceIoChstat unimplemented, ignoring
sceKernelExitGame() unimplemented
sceKernelStopUnloadSelfModule() unimplemented
sceKernelStopUnloadSelfModuleWithStatus() unimplemented
sceGeGetMtx() unimplemented
sceGeListDeQueue() unimplemented
sceGeBreak unimplemented
sceGeContinue unimplemented
sceNetInetGetsockopt() unimplemented
sceNetInetSetsockopt() unimplemented
sceNetInetGetErrno() unimplemented
sceWlanGetEtherAddr unimplemented
sceKernelQueryMemoryInfo() unimplemented
sceKernelGetPTRIG() unimplemented
sceKernelSetPTRIG() unimplemented
sceKernelSetCompiledSdkVersion401_402() unimplemented
sceKernelSetCompiledSdkVersion507() unimplemented
sceKernelSetCompiledSdkVersion600_602() unimplemented
sceKernelSetCompiledSdkVersion603_605() unimplemented
sceKernelSetUsersystemLibWork() unimplemented
sceKernelSysMemUserForUser_ACBD88CA() unimplemented
sceKernelSysMemUserForUser_D8DE5C1E() unimplemented -- sceKernelSafetyCheck0
sceKernelSysMemUserForUser_945E45DA() unimplemented
sceKernelTerminateDeleteThread() unimplemented
sceKernelCancelSema unimplemented
sceKernelCancelFpl unimplemented
sceKernelReferFplStatus unimplemented
sceKernelCancelVpl unimplemented
sceKernelCreateMbx unimplemented
sceKernelDeleteMbx unimplemented
sceKernelSendMbx unimplemented
sceKernelReceiveMbx unimplemented
sceKernelReceiveMbxCB unimplemented
sceKernelPollMbx unimplemented
sceKernelCancelReceiveMbx unimplemented
sceKernelReferMbxStatus unimplemented

Partially Supported[edit | edit source]

|sceIoIoctl|

supported:
 0x1010005 (UMD file seek set)
 0x1020006 (Get UMD file start sector) 

|sceIoDevctl|

supported:
 0x1F100A4 (Prepare UMD data into cache)
 0x2415821 (MScmRegisterMSInsertEjectCallback)
 0x2415822 (MScmUnregisterMSInsertEjectCallback)
 0x2025806 (Check if the device is inserted (mscmhc0))
 0x2425823 (Check if FAT enabled)
 0x2415823 (Set FAT as enabled), supported

Restricted[edit | edit source]

scePowerRegisterCallback - ignoring
scePowerUnregisterCallback - ignoring
scePowerSetClockFrequency - ignoring
scePowerSetCpuClockFrequency(%d) - ignoring
scePowerSetBusClockFrequency(%d) - ignoring
sceUtilityMsgDialogInitStart ignored

Links[edit | edit source]

More Information:[edit | edit source]