Editing PS1 Emulation
Jump to navigation
Jump to search
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: | ||
== | == Description == | ||
Playstation 1 emulator called internally ps1hd. Emulation on PS4 is handled differently comparing to PS3. Each PS1 game PS4 package file (.pkg) include emulator itself, so there is no included emulator in PS4 firmware. | |||
Fact that emulator is now included in game pkg, is slightly complicating providing [[PS1_Classics_Emulator_Compatibility_List|compatibility list]], as emulators include some per title patches, and different default settings. | |||
Next difference is that BIOS/ROM in external file is included in .pkg, emu need different region bios for different region titles. This time bios is not any special version, standard SCPH-550X is used. | |||
PS1 Emulator supports LUA scripting by "Lua Bridge", is powerful interface that provide many possibilities to improve compatibility. | |||
Memory card is created at first run of emulator, so you don't need to include one in pkg. | |||
Emulator have some leftovers from PSP emulator (like axinsnreplace), so core of non PS1 specific functions is the same as in PSP emu. Rest of emu seems to be "inspired" by mednafen. | |||
== Folder/File layout == | |||
Example: Medievil internal emulator, standalone pkg can differ. | |||
<pre> | |||
├──bios | |||
│ ├── scph5500.bin | |||
│ ├── scph5501.bin | |||
│ └── scph5502.bin | |||
├──config-emu-ps4.txt | |||
├──data | |||
│ └── image.bin | |||
├──eboot.bin | |||
├──sce_module | |||
│ ├── libc.prx | |||
│ ├── libSceAudioLatencyEstimation.prx | |||
│ ├── libSceFace.prx | |||
│ ├── libSceFaceTracker.prx | |||
│ ├── libSceFios2.prx | |||
│ ├── libSceHand.prx | |||
│ ├── libSceHandTracker.prx | |||
│ ├── libSceHeadTracker.prx | |||
│ ├── libSceJobManager.prx | |||
│ ├── libSceNpToolkit2.prx | |||
│ └── libSceS3DConversion.prx | |||
├──sce_sys | |||
│ └── param.sfo | |||
├──scripts | |||
│ └── patches.lua | |||
</pre> | |||
== Configuration Files == | == Configuration Files == | ||
=== config-emu-ps4.txt === | |||
=== config- | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! style="width:10%" | Command !! style="width:15%" | Values !! Notes !! style="width:20%" | Usage | ! style="width:10%" | Command !! style="width:15%" | Values !! Notes !! style="width:20%" | Usage | ||
|- | |- | ||
| --region|| SCEE SCEA SCEI || Image/Bios region || --region="SCEE" | | --region|| SCEE SCEA SCEI || Image/Bios region || --region="SCEE" | ||
Line 122: | Line 47: | ||
| --image|| path || game image path, sandbox root relative || "data/MyGame.bin" | | --image|| path || game image path, sandbox root relative || "data/MyGame.bin" | ||
|- | |- | ||
| --libcrypt|| | | --libcrypt|| CRC16 || Libcrypt magic, unknown what is really hashed. required for many PAL games || --libcrypt="0xAB34" | ||
|- | |- | ||
| --scale|| 1 , 2 , 4 | | --scale|| 1 , 2 , 4, auto || 1 = 1280x720, 2 = 1920x1080, 4 = 3840x2160, auto= same as ps4 video settings(?) please keep in mind that even using scale=1 can cause upscaling glitches || scale=2 | ||
|- | |- | ||
| --antialias|| | | --antialias|| SSAA4x , MSAA4x || same as above, using this can cause visual glitches on games that scales bad || --antialias=SSAA4x | ||
|- | |- | ||
| -- | | --softgpu|| || || | ||
|- | |- | ||
| -- | | --state-restore|| || || | ||
|- | |- | ||
| -- | | --wait|| || || | ||
|- | |- | ||
| -- | | --mcd0|| || || | ||
|- | |- | ||
| -- | | --mcd1|| || || | ||
|- | |- | ||
| -- | | --bios|| path || Need to match region of game, relative to sandbox root || --bios="BIOS/SCPH5502.bin" | ||
|- | |- | ||
| -- | | --configpath|| || || | ||
|- | |- | ||
| -- | | --texdump|| || || | ||
|- | |- | ||
| -- | | --texreplace|| || || | ||
|- | |- | ||
| -- | | --texrecent|| true , false || unk || --texrecent=true | ||
|- | |- | ||
| | |} | ||
=== patches.lua === | |||
Lua patches are split between 3 categories R3K (r3000 mips), and EM (emulator), TR (trophies). Called by getXXXObject. Only exception from that is apiRequest. | |||
| | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! Command !! Usage !! Notes | |||
|- | |- | ||
| | | apiRequest || apiRequest(<api version>) || example: apiRequest(1.0) | ||
Different emu versions support different highest api. Medievil emu support api up to 1.0 | |||
Calling api is mandatory. | |||
|- | |- | ||
|} | |} | ||
=== | ==== getR3KObject() ==== | ||
For usage examples lets declare getR3KObject() as r3k [ local r3k = getR3KObject() ] to make things closer to official configs. | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! Command !! Usage | ! Command !! style="width:40%" | Usage !! Notes | ||
|- | |- | ||
|GetPC || | |GetPC || r3k.GetPC() || Return current PC. | ||
|- | |- | ||
|SetPC || | |SetPC || r3k.SetPC(address) || Set current PC to address. | ||
|- | |- | ||
|GetHi || | |GetHi || r3k.GetHi || Return Hi register value. | ||
|- | |- | ||
|SetHi || | |SetHi || r3k.SetHi(value) || Set Hi register value. | ||
|- | |- | ||
|GetLo || | |GetLo || r3k.GetLo || Return Lo register value. | ||
|- | |- | ||
|SetLo || | |SetLo || r3k.SetLo(value) || Set Lo register value. | ||
|- | |- | ||
|GetGpr || | |GetGpr || r3k.GetGpr(reg) || Return register value, require formatting like here: r3k.GetGpr(gpr.a0). | ||
|- | |- | ||
|SetGpr || | |SetGpr || r3k.SetGpr(reg, value) || Set register value, require formatting like here: r3k.GetGpr(gpr.a0, value). | ||
|- | |- | ||
|ReadMem8 || | |ReadMem8 || r3k.ReadMem8(address) || Read/return byte from address. | ||
|- | |- | ||
|ReadMem16 || | |ReadMem16 || r3k.ReadMem16(address) || Read/return half from address. | ||
|- | |- | ||
|ReadMem32 || | |ReadMem32 || r3k.ReadMem32(address) || Read/return word from address. | ||
|- | |- | ||
|ReadMemFloat || | |ReadMemFloat || r3k.ReadMemFloat(address) || Read/return float from address. | ||
|- | |- | ||
|ReadMemStr || | |ReadMemStr || r3k.ReadMemStr(address) || Read/return string from address. | ||
|- | |- | ||
|WriteMem8 || | |WriteMem8 || r3k.WriteMem8(address, value) || Write/set selected memory as byte to value. | ||
|- | |- | ||
|WriteMem16 || | |WriteMem16 || r3k.WriteMem16(address, value) || Write/set selected memory as half to value. | ||
|- | |- | ||
|WriteMem32 || | |WriteMem32 || r3k.WriteMem32(address, value) || Write/set selected memory as word to value. | ||
|- | |- | ||
|WriteMemFloat || | |WriteMemFloat || r3k.WriteMemFloat(address, value) || Write/set selected memory as float to value. | ||
|- | |- | ||
|WriteMemStr || | |WriteMemStr || r3k.WriteMemStr(address, value) || Write/set selected memory as string to value. | ||
|- | |- | ||
|WriteMemStrZ || | |WriteMemStrZ || r3k.WriteMemStrZ(address, value) || | ||
|- | |- | ||
|AddHook || | |AddHook || r3k.AddHook(address, original opcode, function/hook) || Add hook into mips code. | ||
|- | |- | ||
|RemoveHook|| | |RemoveHook || r3k.RemoveHook(?) || Remove hook from mips code. | ||
|- | |- | ||
|InsnReplace || | |InsnReplace || r3k.InsnReplace(address, original opcode, replace opcode) || similar to pcsx2 pnach, but additionally use original opcode as a check. | ||
|- | |- | ||
|FuncReplace || | |FuncReplace || r3k.FuncReplace(address, original opcode, function name) || Hook/replace function in mips code with predefinied one. | ||
|- | |- | ||
|BurnCycles || | |BurnCycles || || | ||
|- | |- | ||
|FlushCache || | |FlushCache || r3k.FlushCache() || Flush mips cache (D + I ?). | ||
|- | |- | ||
|} | |} | ||
==== | ==== getEmuObject() ==== | ||
For usage examples lets declare getEmuObject() as emu [ local emu = getEmuObject() ] to make things closer to official configs. | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! Command !! Usage | ! Command !! Usage !! Notes | ||
|- | |- | ||
|PadRead || | |PadRead || emu.PadRead() || Return pad state (pushed buttons). | ||
|- | |- | ||
|PadReadLeftStick || | |PadReadLeftStick || emu.PadReadLeftStick() || Return pad left stick state. | ||
|- | |- | ||
|PadReadRightStick || | |PadReadRightStick || emu.PadReadRightStick() || Return pad right stick state. | ||
|- | |- | ||
|PadSetButtonsMode || | |PadSetButtonsMode || emu.PadSetButtonMode(value) || Set some pad mode, in one of official configs described as "switch Select/Start -> Touchpad/Options mode" with used value 2. | ||
|- | |- | ||
|AddVsyncHook || | |AddVsyncHook || || | ||
|- | |- | ||
|RemoveVsyncHook|| | |RemoveVsyncHook || || | ||
|- | |- | ||
|ThrottleMax || | |ThrottleMax || emu.ThrottleMax() || Remove framelimiter, used frequently for loadings. | ||
|- | |- | ||
|ThrottleNormal || | |ThrottleNormal || emu.ThrottleNormal() || Set framelimiter to default game value. | ||
|- | |- | ||
|Log || | |Log || emu.Log(value) || Print debug messages to userland console, ex. emu.Log(string.format("Overlay: %02x", overlay)). | ||
|- | |- | ||
|GetNativeLanguage|| | |GetNativeLanguage || emu.GetNativeLanguage() || Return used PS4 language. | ||
|- | |- | ||
|LoadConfig | |LoadConfig || || | ||
|- | |- | ||
|SaveConfig | |SaveConfig || || | ||
|- | |- | ||
|LoadState|| | |LoadState || || | ||
|- | |- | ||
|SaveState|| | |SaveState || || | ||
|- | |- | ||
|PostEffect | |PostEffect || || | ||
|- | |- | ||
|PostEffectParams | |PostEffectParams || || | ||
|- | |- | ||
|NeoMode|| | |NeoMode || emu.NeoMode() || Return ps4 mode. | ||
|- | |- | ||
|CRC32 | |CRC32 || || | ||
|- | |- | ||
|AddFBMapping|| | |AddFBMapping || emu.AddFBMapping( , , , ) || Add framebffer mapping, in Medievil used with emu.AddFBMapping(768, 256, 180, 256) values. | ||
|- | |- | ||
|RemoveFBMapping|| | |RemoveFBMapping || emu.RemoveFBMapping( , ) || Remove framebffer mapping, in Medievil used with emu.RemoveFBMapping(768, 256) values. | ||
|- | |- | ||
|Launch || | |Launch || emu.Launch("path") || Emulator is able to launch selfs in own sandbox (or maybe more? ;) ), require full path (for example "/app0/folder/my_self.bin"), can be used for multidisc games. | ||
|- | |- | ||
|} | |} | ||
==== getTrophyObject() ==== | |||
For usage examples lets declare getTrophyObject() as trp [ local trp = getYtophyObject() ] to make things closer to official configs. | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! | ! Command !! Usage !! Notes | ||
|- | |- | ||
| | | Unlock || trp.Unlock(trophy id) || Unlock trophy by id | ||
|- | |- | ||
|} | |} | ||
== PAL Libcrypt games == | == PAL Libcrypt games == | ||
Some PAL PSX games include libcrypt protection, those are known to cause issues for emulators. | |||
Some PAL PSX games include libcrypt protection, those are known to | </br>More info here: http://wiki.redump.org/index.php?title=PlayStation_1:_LibCrypt_protection_(Old) | ||
==List== | |||
* Actua Ice Hockey 2 (Europe) | * Actua Ice Hockey 2 (Europe) | ||
Line 403: | Line 312: | ||
* Vagrant Story (Europe) , (France) , (Germany) | * Vagrant Story (Europe) , (France) , (Germany) | ||
* Walt Disney World Quest - Magical Racing Tour (Europe) (En,Fr,De,Es,It,Nl,Sv,No,Da) | * Walt Disney World Quest - Magical Racing Tour (Europe) (En,Fr,De,Es,It,Nl,Sv,No,Da) | ||
* Wip3out (Europe) (En,Fr,De,Es,It) | * Wip3out (Europe) (En,Fr,De,Es,It) | ||
=== Known Issues === | === Known Issues === | ||
Some libcrypt issues are known to community. Here is list of them. | |||
All that can be patched before creating pkg, or fixed by using --libcrypt command in emu config. | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
Line 417: | Line 325: | ||
|- | |- | ||
|Crash Team Racing (PAL) || | |Crash Team Racing (PAL) || | ||
Game will hang at the end of the loading screen | Game will hang once at the end of the loading screen (for the level itself). | ||
|- | |- | ||
|Legacy of Kain: Soul Reaver (PAL) || | |Legacy of Kain: Soul Reaver (PAL) || | ||
Line 448: | Line 353: | ||
|V-Rally: Championship Edition 2 (PAL) || | |V-Rally: Championship Edition 2 (PAL) || | ||
The game will endlessly load on the heartbeat loading screen (with no disc activity). | The game will endlessly load on the heartbeat loading screen (with no disc activity). | ||
|- | |- | ||
|Wip3out (PAL) || | |Wip3out (PAL) || | ||
Line 460: | Line 359: | ||
|} | |} | ||
* Libcrypt | * Libcrypt info took from: https://github.com/Kippykip/SBITools#libcrypt-failed-check-causes-and-effects | ||
== Multi-Disc support == | == Multi-Disc support == | ||
This needs more [[User talk:139.47.102.134|testing]] but in theory it should work as follows. | This needs more [[User talk:139.47.102.134|testing]] but in theory it should work as follows. | ||
=== On Real PS1 Hardware, PS2, PSP, | === On Real PS1 Hardware, PS2, PSP, PSV, PS3 === | ||
Example Game: '''Final Fantasy VII''' containing 3 Discs: | Example Game: '''Final Fantasy VII''' containing 3 Discs: | ||
* Before the Game asks you to change Discs, it will ask you if you wish to save the Game. | * Before the Game asks you to change Discs, it will ask you if you wish to save the Game. | ||
Line 479: | Line 376: | ||
=== So how to do this on a PS4? === | === So how to do this on a PS4? === | ||
Since as mentioned [[PS1 Emulation#Description|above]] the problematic we have is that every PKG contains not only the Game as an Image-File, but also the [[PS1 Emulation|Emulator]] and a Save File itself. So a workaround is needed: | Since as mentioned [[PS1 Emulation#Description|above]] the problematic we have is that every PKG contains not only the Game as an Image-File, but also the [[PS1 Emulation|Emulator]] and a Save File itself. So a workaround is needed: | ||
* You create a FPKG containing '''Disc 1''' of Final Fantasy VII '''only''' (Example [[Content ID]] = CUSAFF7'''D1'''). | * You create a FPKG containing '''Disc 1''' of Final Fantasy VII '''only''' (Example [[Content ID]] = CUSAFF7'''D1'''). | ||
Line 490: | Line 386: | ||
* Do the same process for every other additional Disc. | * Do the same process for every other additional Disc. | ||
=== | == Links == | ||
* https://www.psx-place.com/threads/psx-fpkg-0-2-by-jabu-new-tool-to-convert-ps1-games-for-ps4.30498/ | * https://www.psx-place.com/threads/psx-fpkg-0-2-by-jabu-new-tool-to-convert-ps1-games-for-ps4.30498/ | ||
* https://twitter.com/Vitt0x_Lar_YT/status/1284239865027198976 | * https://twitter.com/Vitt0x_Lar_YT/status/1284239865027198976 | ||
* https://github.com/Zcor3x/Ps1HDemu-for-Playstation-4 | * https://github.com/Zcor3x/Ps1HDemu-for-Playstation-4 | ||
* https://www.youtube.com/watch?v=04EY7huZq9M | * https://www.youtube.com/watch?v=04EY7huZq9M | ||
{{Reverse Engineering}} | {{Reverse Engineering}} | ||
<noinclude> | <noinclude>[[Category:Main]]</noinclude> | ||
[[Category:Main]] | |||
</noinclude> |