Editing PSP Emulation

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
=='''PSPHD'''==
=='''PSPHD'''==
The new PS Plus PSP emulator includes plenty of undiscovered functionalities, it even allows patches directly to the emulated Allegrex cpu.
The new ps plus psp emulator has a lot 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.
Sadly sony has not made it easy for users to use CLI commands because sony mostly uses lua patches for the psp releases, thus, not many cli commands were needed to be added. Very few commands have a description to their usage inside of the eboot.bin, everything else is just guesswork from the scene. The psp emulator has not gained the same popularity as the ps2 emulator because currently, there is an unofficial PPSSPP core in the unofficial retroarch port for the ps4. and as far as the compatibility and performance goes, the retroarch core is second to no one. This emulator may still hold potential, though sadly it does not seem to have support for gamedata installation and that has led to render many games unplayable.


== Commands ==
== Commands ==
Line 18: Line 18:
|-
|-
| --notrophies || || Enable/disable trophies||  
| --notrophies || || Enable/disable trophies||  
|-
| --ps4-trophies  || || ||
|-
|-
| --locale || || ||
| --locale || || ||
Line 94: Line 92:
|-
|-
|-style="background-color:#7698FF"
|-style="background-color:#7698FF"
|  || Speedhacks / Possible duplicates|| ||
|  || Speedhacks || ||
|-
|-
| --antialias || off || Turning Anti-Alias Off Improves Performance||--antialias=off
| --antialias || off || Turning Anti-Alias Off Improves Performance||--antialias=off
Line 113: Line 111:
|-
|-
| --texrecent || true || Optimize texture hashes ||--texrecent=true
| --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
|-
|}
|}


Line 169: Line 134:


===XXXXYYYYY_patches.lua===
===XXXXYYYYY_patches.lua===
The lua can be placed as: '''scripts\XXXXYYYYY_patches.lua'''  
Your lua can be placed as '''scripts\XXXXYYYYY_patches.lua'''  
<br>'''Requires Cleanup'''.


====Emulator commands====
====Emulator commands====
Line 368: Line 334:
|GetReg||axObj.GetReg()||
|GetReg||axObj.GetReg()||
|-style="background-color:#D7EF54"
|-style="background-color:#D7EF54"
| Memory editing || || Do note that the offsets on PPSSPP are mapped differently than the ones on the PS4  
| Memory editing || || Do note that the offsets on PPSSPP are different than the ones on the PS4  
|-
|-
| ReadMem32 || axObj.ReadMem32() || Read 4 bytes from offset
| ReadMem32 || axObj.ReadMem32() || Read 4 bytes from offset
Line 422: Line 388:
[https://www.psdevwiki.com/ps4/Talk:PSP_Emulator_Compatibility_List#Official_PSPemu_Configuration_Files More patches can be found here]
[https://www.psdevwiki.com/ps4/Talk:PSP_Emulator_Compatibility_List#Official_PSPemu_Configuration_Files More patches can be found here]
=====Patches.lua=====
=====Patches.lua=====
======Syphon Filter: Dark Mirror======
'''An official lua created by sony for Patapon 2'''
 
<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>
<pre>
-- Lua 5.3
-- Lua 5.3
Line 899: Line 794:


== Emulators ==
== 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>
<pre>Every emulator is programmed in a different way, 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;"
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Emulator !! Usage !! API Version !! Similar emulators (compatibility)
! Emulator !! Usage !! API Version !! Similar emulators (compatibility)
Line 916: Line 811:
|-
|-
| PaRappa the Rapper || An unofficial emulator developed by sony with very bad compatibility ||  ? || ?
| PaRappa the Rapper || An unofficial emulator developed by sony with very bad compatibility ||  ? || ?
|-
| Syphon Filter: Dark Mirror || ? || ? || ?
|-
|-
|}
|}
Line 924: Line 817:
<br>'''Note''': The memory on PPSSPP is 0x4000 offsets ahead of the memory on the PS4
<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;"
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Size !! Offset From -> Offset To !! Name
! Offset From !! Offset To !! Name
|-
| || 1008000000 -> 10887FFFFF ||  Allegrex memory(?)
|-
|-
|640.00MB  || 228200000 -> 250200000 ||
| 0x1008000000 || 0x10887FFFFF ||  Allegrex memory(?)
|-
|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 ||
|-
|-
|}
|}
Line 948: Line 825:
===Registers map===
===Registers map===
<br>Registers that are marked with '''(?)''' are untested but should be accurate.
<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
<br>*'''Note''': The offsets positions change as the CLI file's content increases, but the offsets should still be somewhere nearby the offsets below and the layout should be the same regardless.
{| class=wikitable style="border: none; background: none;"
{| class=wikitable style="border: none; background: none;"
! scope=col | GPR
! scope=col | GPR
Line 1,034: Line 911:
|-
|-
|}
|}
====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'''
'''VFPU'''
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;"
! Register !! Offset !! Register !! Offset !! Register !! Offset !! Register !! Offset  
! Register !! Offset !! Register !! Offset !! Register !! Offset !! Register !! Offset  
|-
|-
| S000|| 0x200414DE0 || S001|| 0x200414DE4 || S002|| 0x200414DE8 || S003|| 0x200414DEC
| S000|| 0x200414DE0  
|-
| 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
| S010|| 0x200414DF0
|-
|-
| S120|| 0x200414E40  || S121|| 0x200414E44 || S122|| 0x200414E48 || S123|| 0x200414E4C
| S020|| 0x200414E00
|-
|-
|S130|| 0x200414E50 || S131||0x200414E54  || S132|| 0x200414E58  || S133|| 0x200414E5C
|S030|| 0x200414E10
|-
|-
|S200|| 0x200414E60 || S201|| 0x200414E64 || S202||  0x200414E68 || S203||0x200414E6C
|S100|| 0x200414E20  
|-
|-
|S210|| 0x200414E70 || S211|| 0x200414E74 || S212||  0x200414E78 || S213|| 0x200414E7C
| S110 || 0x200414E30  
|-
|-
|S220|| 0x200414E80 || S221|| 0x200414E84 || S222|| 0x200414E88 || S223|| 0x200414E8C
| S120|| 0x200414E40  
|-
|-
|S230|| 0x200414E90 || S231|| 0x200414E94 || S232||  0x200414E98 || S233|| 0x200414E9C
|S130|| 0x200414E50
|-
|-
|S300|| 0x200414EA0 || S301|| 0x200414EA4 || S302||  0x200414EA8 || S303|| 0x200414EAC
|S200|| -  
|-
|-
|S310|| 0x200414EB0 || S311|| 0x200414EB4 || S312|| 0x200414EB8  || S313|| 0x200414EBC
|S210|| -  
|-
|-
|S320|| 0x200414EC0 || S321|| 0x200414EC4 || S322|| 0x200414EC8 || S323||0x200414ECC
|S220|| -  
|-
|-
|S330|| 0x200414ED0 || S331|| 0x200414ED4 || S332|| 0x200414ED8 || S333||0x200414EDC
|S230|| -
|-
|-
|S400|| 0x200414EE0 || S401||  0x200414EE4 || S402|| 0x200414EE8 || S403|| 0x200414EEC
|S300|| -  
|-
|-
|S410|| 0x200414EF0 || S411||  0x200414EF4 || S412||  0x200414EF8 || S413|| 0x200414EFC
|S310|| -  
|-
|-
|S420|| 0x200414F00 || S421|| 0x200414F04 || S422||  0x200414F08 || S423|| 0x200414F0C
|S320|| -  
|-
|-
|S430|| 0x200414F10 || S431|| 0x200414F14 || S432||  0x200414F18 || S433|| 0x200414F1C
|S330|| -
|-
|-
|S500|| 0x200414F20 || S501|| 0x200414F24|| S502|| 0x200414F28 || S503|| 0x200414F2C
|S400||
|-
|-
|S510|| 0x200414F30 || S511|| 0x200414F34 || S512|| 0x200414F38 || S513|| 0x200414F3C
|S410|| -  
|-
|-
|S520|| 0x200414F40 || S521|| 0x200414F44 || S522|| 0x200414F48 || S523||0x200414F4C
|S420|| -
|-
|-
|S530 || 0x200414F50|| S531|| 0x200414F54 || S532||  0x200414F58|| S533|| 0x200414F5C
|S430|| -
|-
|-
|S600|| 0x200414F60 || S601|| 0x200414F64 || S602|| 0x200414F68 || S603|| 0x200414F6C
|S500||  
|-
|-
|S610|| 0x200414F70 || S611|| 0x200414F74 || S612||  0x200414F78 || S613||0x200414F7C
|S510|| 0x200414F30  
|-
|-
|S620|| 0x200414F80 || S621|| 0x200414F84 || S622|| 0x200414F88 || S623|| 0x200414F8C
|S520|| -  
|-
|-
|S630 || 0x200414F90 || S631|| 0x200414F94 || S632||  0x200414F98 || S633|| 0x200414F9C
|S530 || -
|-
|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
|-
|-
|}
|}
Line 1,115: Line 969:
! Issue !! Games affected !! Solution !! Description
! Issue !! Games affected !! Solution !! Description
|-
|-
| No gamdata installation functionality (?)|| || ||
| Lack of ability to install gamedata (?)|| || ||
|-
| Highly unoptimized graphics renderer || || || Low fps
|-
| No support for some syscalls || || ||
|-
|-
|}
|}
Line 1,125: Line 975:
=LUA include files=
=LUA include files=
<br>Files that need to be placed in the '''/lua_include/''' folder
<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'''
'''ax-gpr-alias.lua'''
Line 1,523: Line 1,238:
│  ├── ax-gpr-alias.lua
│  ├── ax-gpr-alias.lua
│  ├── multiapp.lua
│  ├── multiapp.lua
│  ├── sce-locale.lua
│  ├── uv-clamping.lua
│  ├── disc-selection.lua
│  └── pad.lua
│  └── pad.lua
├── scripts
├── scripts
Please note that all contributions to PS4 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS4 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)