PSP Emulation

From PS4 Developer wiki
Jump to navigation Jump to search

PSPHD

Commands

config-emu-ps4.txt commands

Command Values Notes Usage
--boot [disc0:/PSP_GAME/SYSDIR/BOOT.BIN - path (no loaders support like on PS3? vide ct2, psc)]
--notrophies
--xobuttonmode oenter, ocancel
--lang "CHOSEN LANGUAGE" Language selector, includes "en" "jp "es" "it" "fr" and others --lang="en"
--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
--volume ? (Adjusting volume level to %d%%)
--locale
--image umd0 ,disc0
--addon
--host host0, flash0
--texsave
--texmissingsave
--savedata-mode
--securesaves true, false Enable encrypted savegames --securesaves=true
--multisaves true false Enable Multiple Savegames --multisaves=true
--savedatamulti-size-game
--savedatamulti-size-user
--samplesave
--vramcopyback 45, Value ? --vramcopyback=45
--replacementfilter true,false This forces alpha blending to on for replaced textures. --replacementfilter=true
--texreplace
--samplereplace
--spu2Trace true,false --spu2Trace=true
--spu2-c1-memin-to-bgm true,false --spu2-c1-memin-to-bgm=true
--replacementalpha true,false --replacementalpha=true
--parappaalphahack true,false --parappaalphahack=true
--parappajapanesefonthack true,false Enables Support For Japanese Fonts ??
--locorocomeshsmooth true,false --locorocomeshsmooth=true
--godofwarhack true,false --godofwarhack=true
--locorocomeshsmoothnonindexed true,false --locorocomeshsmoothnonindexed=true
--clamp-line-thickness-min
--clamp-line-thickness-max
--gputhread true,false Run the PSP GPU on a separate thread
--antialias off, MSAA4x, SSAA4x
--texcachemode patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo --texcachemode=patchworkheroes
--texclutmode filter, full --texclutmode=full
--texloadmode launch, ondemand_lz4
--depthscalehack true,false --depthscalehack=true
--forcenobilinear true,false --forcenobilinear=true
--texloadcores 2, 12? texloadcores=2
--smoothlevel 0, 12? --smoothlevel=0
--anisolevel
--msxxadhoc
--parappareplacecolor The command expects 8 Hex values (rgb?)

Speedhacks

Command Values Notes Usage
--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 2, 48? Cores to use loading textures (higher count = more memory) --texloadcores=12
--smoothlevel 0,12 ? --smoothlevel=0
--texcachemode patchworkheroes drawbounds, drawboundsloco, patchworkheroes, locoroco2, rondo --texcachemode=patchworkheroes
--present vblankstart, setframebuf, drawsync Display on draw to reduce latency --present=setframebuf
--texrecent true Optimize texture hashes --texrecent=true
--umddelay true --umddelay=true

LUA Commands

Many of not all of the ps2's Lua commands can also be used on the PSP emulator. Your lua can be placed as \Image0\Patches\xxxxyyyyy_patches.lua
Requires Cleanup.

Command Usage Notes - Example
apiRequest apiRequest(<api version>) example: apiRequest(0.1)

Calling api is mandatory. some commands require higher versions.

getEmuObject class
getEmuObject local emuObj = getEmuObject() Required for all functions using emuObj
AddVsyncHook emuObj.AddVsyncHook()
RemoveVsyncHook emuObj.RemoveVsyncHook()
AddBootHook emuObj.AddBootHook()
RemoveBootHook emuObj.RemoveBootHook()
Log emuObj.Log()
GetLanguage emuObj.GetLanguage()
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()
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()
AddGPUHook emuObj.AddGPUHook()
RescaleUForUpscale emuObj.RescaleUForUpscale()
RescaleVForUpscale emuObj.RescaleVForUpscale()
ShrinkUVRect emuObj.ShrinkUVRect()
ScalePosition emuObj.ScalePosition()
AdjustUVJitter emuObj.AdjustUVJitter()
OverrideFBSize emuObj.OverrideFBSize()
PadSetButtonsMode emuObj.PadSetButtonsMode() emuObj.PadSetButtonsMode(pad.BUTTONS_MODE_OPTION_IS_SELECT)
RemapSavedata emuObj.RemapSavedata() emuObj.RemapSavedata("UCUS98711", "CUSA06171", "504e802b04a1838c32b616abbe0b475fbea1c823825ef0df06cc2bad129ce2f7")
PadVibrate emuObj.PadVibrate() emuObj.PadVibrate(5,180,180)
NeoMode emuObj.NeoMode() Checks whether or not the ps4 is pro
ThrottleMax emuObj.ThrottleMax()
ThrottleFast emuObj.ThrottleFast()
ThrottleNorm emuObj.ThrottleNorm()
SetTextureHashMode emuObj.SetTextureHashMode()
SetTextureScaleOffset emuObj.SetTextureScaleOffset()
SetTextureSaveSubdir emuObj.SetTextureSaveSubdir()
SetDrawEDRam emuObj.SetDrawEDRam()
SetSampleTitle emuObj.SetSampleTitle()
ToggleTextures emuObj.ToggleTextures()
CopyFB emuObj.CopyFB()
getAXObject class
getAXObject local axObj = getAXObject() Required for all functions using AXObject
AddHook axObj.AddHook()
RemoveHook axObj.RemoveHook()
SetPC axObj.SetPC()
GetPC axObj.GetPC()
ReadMem32 axObj.ReadMem32() axObj.ReadMem32(0x87654321)
WriteMem32 axObj.WriteMem32() axObj.WriteMem32(0x87654321,0x87654321)
ReadMem16 axObj.ReadMem16()
WriteMem16 axObj.WriteMem16()
ReadMem8 axObj.ReadMem8()
WriteMem8 axObj.WriteMem8()
WriteMemStr16 axObj.WriteMemStr16()
WriteMemStr16Z axObj.WriteMemStr16Z()
ReadMemFloat axObj.ReadMemFloat()
WriteMemFloat axObj.WriteMemFloat()
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()
BurnCycles axobj.BurnCycles()
AddAOTBlock axObj.AddAOTBlock()
Overlay axObj.Overlay()
Other/Unknown/Standalone Commands
axFuncReplace axFuncReplace() axFuncReplace(0x8804670, "__ptmf_scall")

Examples

User made lua:

apiRequest(0.1)
local axObj = getAXObject()
local emuObj = getEmuObject()
local patcher = function()
axobj.WriteMem32(0x0053d5d4,0x21c828bd)
end

emuObj.AddVsyncHook(patcher)
Features.lua
-- 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")
local trophyObj	= getTrophyObject()

-- INIT --
local GLOBAL		= 0x8B7D088
local APPLICATION	= 0x8B4C8D4
local missionID = 0
local missionRunning = false
local colonyMode = 0

-- GAME FUNCTIONS --

local getApplication = function() -- getApplication
	local app = axObj.ReadMem32(APPLICATION) --> 0x8c99f60
	if app == 0 then
		return 0
	end
	return axObj.ReadMem32(app) --> 0x8b8c740
end

--- Scenes

local getSceneBase = function() -- from Application::initialize
	local app = getApplication()
	if app == 0 then
		return 0
	end
	return axObj.ReadMem32(app + 0xCB24) --  -0x34DC($v1)
end

local getNextSceneID = function() -- from System::SceneBase::setNextSceneId
	local base = getSceneBase()
	if base == 0 then
		return 0
	end
	return axObj.ReadMem32(base + 8)
end

local getBasesScene = function()
	local scene = getSceneBase()
	if scene == 0 then
		return 0
	end
	return axObj.ReadMem32(scene + 0xC)
end

local getMissionScene = function()
	local scene = getBasesScene()
	if scene == 0 then
		return 0
	end
	return axObj.ReadMem32(scene + 0xC)
end

local getGameScene = function()
	local scene = getMissionScene()
	if scene == 0 then
		return 0
	end
	return axObj.ReadMem32(scene + 0xC)
end

local getSceneID = function(scene)
	return axObj.ReadMem32(scene + 0x27354) -- from Labo::Game__Talk__CommandGame__getMissionId
end

local isTitle = function()
	return getMissionScene() == 0
end

local isCamp = function()
	return isTitle() == false and getGameScene() == 0
end

local isInMission = function()
	if isTitle() == true or isCamp() == true then
		return false
	end

	return getGameScene() ~= 0
end

--- Game functions ---

local getMissionID = function() -- from Game::Game::initialize
	if isCamp() == true then
		local scene = getMissionScene()
		return getSceneID(scene)
	elseif isInMission() == true then
		local scene = getGameScene()
		return getSceneID(scene)
	end
	
	return -1
end

function getMissionName() -- from Bases__Talk__CommandCamp__setMissionNameFromVar
	local missionName = ""
	local index = axObj.ReadMem32(GLOBAL)				 -- 0x8c9fbc0

	if index == 0 then
		return
	end
	local offset = axObj.ReadMem32(index + 0x10C0)	-- 0x8d07840

	if offset == 0 then
		return
	end
	local strPtr = axObj.ReadMem32(offset + 0x1070)
	local missionNamePtr = strPtr + 0x5FA2	-- is 0x8D38C62
	
	missionName = axObj.ReadMemStr16(missionNamePtr)
	
	return missionName
end

--[[ vibrate on objects --
emuObj.PadVibrate() causes the DS4 to vibrate. The parameters are as follow:
1st parameter: Large Motor speed (0=off, 1 to 255=speed)
2nd parameter: Small Motor speed (0=off, 1 to 255=speed)
3rd parameter: Duration of the vibration in milliseconds (1000 = 1 second, Max 6 seconds).
			   Once the time has elapsed both motors are turned off automatically.
]]--

local ctr = 0
local keyCtr = 0x0
local keyDown = 0
local noteCtr = 0
local playSeq = true
local lastSeq = 0

local H1 = function() -- sgxResFindSeq
	local id = axObj.GetGpr(gpr.a1)
	if playSeq == true then
		lastSeq = 0 -- reset
		playSeq = false
	end
	if id == lastSeq then
		return	-- don't repeat
	end
	
	-- allow repeat for "step" sounds: dragon,frog,manbroth,demon,worm,plant,machine,crab,crab,
	-- machine,demon dragon,demon dragon,demon dragon,worm,worm,kamen rock
	if id ~= 0x41c and id ~= 0x418 and id ~= 0x35c and id ~= 0x7cc and id ~= 0x560 and id ~= 0x470
		and id ~= 0x4c4 and id ~= 0x39c and id ~= 0x3c8 and id ~= 0x51c and id ~= 0x800
		and id ~= 0x82c and id ~= 0xd54 and id ~= 0x484 and id ~= 0x19c then
		if id == lastSeq then
			return	-- don't repeat
		end
	end
	lastSeq = id
	local missionID = getMissionID()

	-- all levels --
	if missionID == 0 then
		if id == 0x898 then
			emuObj.PadVibrate(0,255,100)	-- When a Patapon unit is created for tree of life.
		end
	end
	
	if id == 0x670 then
		emuObj.PadVibrate(50,255,250)	-- After the player looses “Fever” mode (whistle down sound)
	elseif id == 0x9f0 or id == 0x910 then	-- (was 8f0)
		emuObj.PadVibrate(0,240,80)		-- New Patapon created.
	elseif id == 0x3f8 then
		emuObj.PadVibrate(20,0,200)		-- Kaching collected
	end
	
	if missionID > 0 then
		if id == 0x568 or id == 0x53c then		-- yippe or fireworks after complete. (was 508)
			missionRunning = false	-- ? 31c 568 3a0
		end
		if missionRunning == false then
			return
		end
		
		if missionID < 123 then
			----- non-boss levels -----
			if id == 0x2d0 or id == 0x354 or id == 0x2a4 or id == 0x80 then
				emuObj.PadVibrate(100,10,260)	-- falling building/object
			elseif id == 0x47c or id == 0x450 then
				emuObj.PadVibrate(0,150,100)	-- picked up object
			elseif id == 0x510 then
				emuObj.PadVibrate(0,255,100)	-- totem award
			elseif id == 0x328 then
				emuObj.PadVibrate(16,40,200)	-- Stick barrier break
			elseif id == 0x170 then
				emuObj.PadVibrate(66,180,900)	-- Windmill breaking
			elseif id == 0x334 then
				emuObj.PadVibrate(80,40,200)	-- Cannon ball blast
			elseif id == 0x2b0 then
				emuObj.PadVibrate(120,20,300)	-- Gillotine
			elseif id == 0x19c then
				emuObj.PadVibrate(130,30,300)	-- Karmemen Rock Toss
			end
			
			if id == 0x124 and missionID == 118 then
				emuObj.PadVibrate(55,0,7000)	-- Gate collapse
			end
			if id == 0x13c and missionID == 121 then
				emuObj.PadVibrate(55,0,500)	-- Fort collapse
			end
		else
			----- boss levels -----

			-- Dragon --
			if id == 0x41c then
				emuObj.PadVibrate(10,0,100)		-- Dragon step
			elseif id == 0x448 then
				emuObj.PadVibrate(10,0,200)		-- Dragon jump, retreat, etc.
			elseif id == 0x4f8 then
				emuObj.PadVibrate(10,50,100)	-- Dragon jump, retreat, etc.
			elseif id == 0x5a8 then
				emuObj.PadVibrate(120,0,900)	-- Dragon fall/dead

			-- Demon Dragon --
			elseif id == 0x800 then
				emuObj.PadVibrate(30,0,100)		-- Demon Dragon step
			elseif id == 0x82c then
				emuObj.PadVibrate(0,130,100)	-- Demon Dragon short step
			elseif id == 0xd54 then
				emuObj.PadVibrate(0,170,50)		-- Demon Dragon wing flap
			elseif id == 0xb9c then
				emuObj.PadVibrate(170,0,250)	-- Demon Dragon fireball
			elseif id == 0xbf4 then
				emuObj.PadVibrate(190,0,900)	-- Demon Dragon fall/dead
				
			-- FrogRobot --
			elseif id == 0x418 then
				emuObj.PadVibrate(15,0,200)		-- FrogRobot / Spider step
			elseif id == 0x5d0 then
				emuObj.PadVibrate(15,0,200)		-- FrogRobot jump, crawl
			elseif id == 0x4f4 then
				emuObj.PadVibrate(15,0,200)		-- FrogRobot fist slam
			elseif id == 0x4c8 then
				emuObj.PadVibrate(0,10,2000)	-- FrogRobot laser / Plant gas
			elseif id == 0x520 then 			-- cant use 0x54c
				emuObj.PadVibrate(150,0,1000)	-- FrogRobot fall/dead
				
			-- Manbroth --
			elseif id == 0x35c then
				emuObj.PadVibrate(15,0,400)		-- Manbroth step
			elseif id == 0x388 then
				emuObj.PadVibrate(15,0,400)		-- Manbroth stomp
			elseif id == 0x438 then
				emuObj.PadVibrate(0,150,500)	-- Manbroth: snow spray / Firebird gas
			elseif id == 0x40c then
				emuObj.PadVibrate(0,10,500)		-- Manbroth: scoop
			elseif id == 0x330 then
				emuObj.PadVibrate(150,0,700)	-- Manbroth: fall/dead
				
			-- Demon --
			elseif id == 0x7cc then
				emuObj.PadVibrate(45,5,400)		-- Demon step 1
			elseif id == 0x5d8 or id == 0x9dc or id == 0x9b0 then
				emuObj.PadVibrate(85,10,180)	-- Demon step 2
			elseif id == 0x7a0 then
				emuObj.PadVibrate(10,10,180)	-- Demon jump
			elseif id == 0x7f8 then
				emuObj.PadVibrate(0,220,90)		-- Demon breath
			elseif id == 0x380 then
				emuObj.PadVibrate(200,0,150)	-- Demon meteors
			elseif id == 0x92c then
				emuObj.PadVibrate(170,0,2000)	-- Demon: fall/dead
				
			-- Firebird --
			elseif id == 0x598 then -- or 0x678?
				emuObj.PadVibrate(55,5,450)		-- Firebird slam
			elseif id == 0x540 then
				emuObj.PadVibrate(10,160,180)	-- Firebird peck
			elseif id == 0x6d0 then
				emuObj.PadVibrate(10,230,500)	-- Firebird gas
			elseif id == 0x490 then
				emuObj.PadVibrate(200,0,1000)	-- Firebird: fall/dead
				
			-- Worm --
			elseif id == 0x3d4 or id == 0x400 then
				emuObj.PadVibrate(5,55,250)		-- Worm burrow
			elseif id == 0x534 or id == 0x508 then
				emuObj.PadVibrate(5,55,250)		-- Worm slide
			elseif id == 0x4b0  then
				emuObj.PadVibrate(5,155,1100)	-- Worm fire
			elseif id == 0x484 then
				emuObj.PadVibrate(75,10,350)	-- Worm slam
			elseif id == 0x560 then
				emuObj.PadVibrate(175,190,850)	-- Worm roll
			elseif id == 0x3a8 then
				emuObj.PadVibrate(140,0,2000)	-- Worm: fall/dead
				
			-- Plant --
			elseif id == 0x470 then
				emuObj.PadVibrate(5,55,250)		-- Plant jump
			elseif id == 0x49c then
				emuObj.PadVibrate(200,0,800)	-- Plant fall/dead
				
			-- Machine --
			elseif id == 0x4c4 then
				emuObj.PadVibrate(15,0,500)		-- Machine step
			elseif id == 0x574 then
				emuObj.PadVibrate(180,0,400)	-- Machine bomb
			elseif id == 0x51c then
				emuObj.PadVibrate(10,220,200)	-- Machine gun
			elseif id == 0x6a8 then
				emuObj.PadVibrate(255,220,1000)	-- Machine cannon
			elseif id == 0x5cc then
				emuObj.PadVibrate(100,12,300)	-- Machine ball & chain
			elseif id == 0x498 then
				emuObj.PadVibrate(210,0,900)	-- Machine fall/dead
				
			-- Crab --
			elseif id == 0x39c then
				emuObj.PadVibrate(85,10,180)	-- Crab step
			elseif id == 0x3c8 then
				emuObj.PadVibrate(190,0,400)	-- Crab jump
			elseif id == 0x420 then
				emuObj.PadVibrate(5,180,180)	-- Crab claw
			elseif id == 0x370 then
				emuObj.PadVibrate(240,10,600)	-- Crab fall/dead
			-- Spider --
			elseif id == 0x3ec then
				emuObj.PadVibrate(210,50,700)	-- Spider fall/dead

			-- OTHER --
			elseif id == 0x65c then
				emuObj.PadVibrate(0,200,80)		-- fire (patapon yipe)
			elseif id == 0x5ac then
				emuObj.PadVibrate(0,200,80)		-- fire burn(patapon yipe)
			end
		end
	end
end

local H2 = function() -- Labo::Talk::CommandEffect::generateCapEffect
	emuObj.PadVibrate(0,255,150)	-- When a Patapon unit from the players army is defeated or new special patapon created.
end

local H3 = function() -- Labo::Talk::CommandEffect::killEffect
	emuObj.PadVibrate(0,255,250)	-- Thunder/Lightning
end

local H4 = function() -- MainGame__Mission__MissionScene__initialize__4LaboFv
	missionRunning = true
	getMissionName()
end

--- HOOKS ---
local hook1 = axObj.AddHook(0x8828AA0, 0x8FBF0008, H1)		-- sgxResFindSeq
local hook2 = axObj.AddHook(0x8901B84, 0x27BDFFC0, H2)		-- Labo::Talk__CommandEffect__generateCapEffect
local hook3 = axObj.AddHook(0x89825B8, 0x27BDFF80, H3)		-- Labo::Game__Map__ThunderLayer__generateThunder
local hook4 = axObj.AddHook(0x8914844, 0x27BDFFF0, H4)		-- MainGame__Mission__MissionScene__initialize__4LaboFv

Patches.lua
-- 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)

basic

  • axInsnReplace (mem, org opcode, new opcode) - Replace allegrex memory
  • axFuncReplace - Replace allegrex function. Known implemented functions are: I3dVecSet, I3dRender__ReserveTrashQwc, I3dVecAdd, I3dVecScaleXYZ, I3dGuSetMatrix_PSP, patapon_memcpy


hooks/registers

Hooks, and registers that can be called in lua api.

Allegrex (usage - remove AX_):

  • AX_GetPC
  • AX_SetPC
  • AX_GetHi
  • AX_SetHi
  • AX_GetLo
  • AX_SetLo
  • AX_GetReg
  • AX_SetReg
  • AX_GetFpr
  • AX_SetFpr
  • AX_ReadMem8
  • AX_ReadMem16
  • AX_ReadMem32
  • AX_ReadMemFloat
  • AX_ReadMemString
  • AX_WriteMem8
  • AX_WriteMem16
  • AX_WriteMem32
  • AX_WriteMemFloat
  • AX_WriteMemString
  • AX_WriteMemStringZ
  • AX_AddHook
  • AX_RemoveHook
  • AX_Overlay
  • AX_InsnReplace
  • AX_FuncReplace

Emulator (usage - remove EM_):

  • EM_SetTextureHashMode
  • EM_SetTextureScaleOffset
  • EM_SetTextureSaveSubdir
  • EM_SetSampleTitle
  • EM_SetDrawEDRam
  • EM_ToggleTextures
  • EM_PadRead
  • EM_PadReadPitch
  • EM_PadReadRoll
  • EM_PadVibrate
  • EM_PadRegisterSamples
  • EM_PadSetButtonsMode
  • EM_AddVsyncHook
  • EM_RemoveVsyncHook
  • EM_ThrottleMax
  • EM_ThrottleNormal
  • EM_Log
  • EM_GetLanguage
  • EM_GetNativeLanguage
  • EM_DisplayManual
  • EM_LoadConfig
  • EM_SaveConfig
  • EM_LoadMIDI
  • EM_GetMIDINotesAtTick
  • EM_LoadSlideshow
  • EM_StartSlideshow
  • EM_LoadState
  • EM_SaveState

Standard:

  • patches/
  • _patches.lua
  • feature_data/
  • _features.lua
  • tooling/
  • _tooling.lua
  • trophy_data/
  • _trophies.lua

Information

other

  • XXXXYYYYY_config.txt
  • --vms
  • --autoresampler [true]
  • videos/
  • .mp4
  • videos/%08x.mp4
  • audio/%08x.ogg
  • --texswitch [original, replacement]

Paths:

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

sample

; 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
 
; This enables bilinear filtering on replaced textures. (uncomment to enable)
--replacementfilter=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
 
; Adjust overall volume level (does not include pad speaker volume). Range from 0.0 (min) to 1.0 (max)
--volume="0.25"

NIDs in HLE

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

  • 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

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

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

More Information: