presonuss54
Member
Hello, master kazarovv. I have a question whether with this program I will run games that I care about the most are NBA 2K2, Sega Sports Tennis, SSX On Tour, Burnout Revenge, Black, HeadHunter, NFS Most Wanted and Killzone? Thank you and best regards
Ps2 emulation on PS4 is handled in very different way comparing to PS3. Emulator seems to be more open for configurations. We can basically change anything we want. Here comes kudos to developers, as many of this options are here to bring you 1:1 emulation. They implemented settings that can change almost everything in way how game is recompiled. Thread, and first post are constantly updated with knowledge that I'm gaining right now.
1. Custom config repository
2. Configuration Files used in emulator
3. Using PCSX2 settings on PS4
4. Known emulation settings/toggles [W.I.P.]
5. Patching ps2 emulated memory
6. Creating Advanced Hook
1. Custom config repository
You can find ready commands for games here: https://github.com/kozarovv/PS2-Configs
To use them, just add them to config-emu-ps4.txt or in lua case to XXXX-YYYYY_config.lua . Remember to remove old upscaler settings from config if you are adding new one.
2. Configuration Files used in emulator
Let start with small explanation about configuration files. There are 4 of them that we already found (there is minimum one more as far as I know).
config-emu-ps4.txt keep most basic settings related to emulator. Mostly paths, info about trophies support, title ID, Screen settings (aspect ratio, screen size, but games still require 16:9 patches to look like they should). This file also handle upscaling, and uprendering settings. So everything not strictly related to plain game code
XXXX-YYYYY_cli.conf store per game config with toggles, and not conditional hooks. So settings like enabling-disabling clamping, gs-precision settings, basically all that can be changed in emulation at PS4 side. Also this file store hooks that are no conditional and can be applied all the time.
Hook structure is:
Code:--<procesor type>-hook=0x<memory adrdress (uint_32)>,<function name> example = --ee-hook=0x0025b3b0,FastForwardClock
XXXX-YYYYY_config.lua used for more advanced patches like changing in-game opcodes at ee/iop code, conditional hooks, maybe more. More examples of this file is needed to get more commands.
File structure
require( "ee-gpr-alias" ) - we need to include it if we want to access EE GPR, the same apply to ee-hwaddr, and ee-cpr0-alias. So if our hook require access to any of registers related stuff (list here http://www.psdevwiki.com/ps3/PS2_Emulation#PS2_Memory_and_Hardware_Mapped_Registers_Layout) then we need to include mentioned options in our config.
apiRequest(X.X) - Required to make config work. Probably similar to config revision on ps3. Probably used as check for minimum version of api that work with this config. Which mean that emu is still upgraded.For now only known by me api version is 0.4
3. Using PCSX2 clamping settings on PS4
PCSX2 is very good place to find correct settings for our games. But there are slightly different named compared to emulator used in PS4.
Settings list: https://raw.githubusercontent.com/PCSX2/pcsx2/master/bin/GameIndex.dbf
Example from list:
Code:Serial = SCES-51719 Name = Gran Turismo 4 Region = PAL-M5 Compat = 5 //eeClampMode = 3 // Text in races works vuClampMode = 2 // Text in GT mode works
So looking at top of list we can find that eeClampMode = 3 is Full Clamping for FPU, and vuClampMode = 2 is Clamp Extra for vu0, vu1, and cop2
But how to apply settings like this to config files?
Code:--fpu-no-clamping=0 --fpu-clamp-operands=1 --fpu-clamp-results=1 --vu0-no-clamping=0 --vu1-no-clamping=0 --vu0-clamp-operands=1 --vu0-clamp-results=1 --vu1-clamp-operands=1 --vu1-clamp-results=1 --cop2-no-clamping=0 --cop2-clamp-operands=1 --cop2-clamp-results=1
Will do the same. First thing we need to do when we want to use ANY clamping is to add xxx-no-clamping=0 to allow clamp mode. Other modes are described below:
eeClampMode=0 eeClampMode=1 eeClampMode=2 eeClampMode=3 vuClampMode=0 vuClampMode=1 vuClampMode=2 vuClampMode=3
- --fpu-no-clamping=1 //or nothing
- --fpu-no-clamping=0
--fpu-clamp-results=1
//Unknown, closest known setting:
--fpu-no-clamping=0
--fpu-clamp-operands=1
--fpu-clamp-results=1
--fpu-no-clamping=0
--fpu-clamp-operands=1
--fpu-clamp-results=1
- --vu0-no-clamping=1
--vu1-no-clamping=1
--cop2-no-clamping=1
--vu0-no-clamping=0
--vu0-clamp-results=1
--vu1-no-clamping=0
--vu1-clamp-results=1
--cop2-no-clamping=0
--cop2-clamp-results=1
--vu0-no-clamping=0
--vu0-clamp-operands=1
--vu0-clamp-results=1
--vu1-no-clamping=0
--vu1-clamp-operands=1
--vu1-clamp-results=1
--cop2-no-clamping=0
--cop2-clamp-operands=1
--cop2-clamp-results=1
//Unknown, closest known setting:
--vu0-no-clamping=0
--vu0-clamp-operands=1
--vu0-clamp-results=1
--vu1-no-clamping=0
--vu1-clamp-operands=1
--vu1-clamp-results=1
--cop2-no-clamping=0
--cop2-clamp-operands=1
--cop2-clamp-results=1
Like you can see, we are able to use almost all clamping options that are used in PCSX2.
4. Best default config to use.
"Default Config" is universal CLI configuration that should be used when game have any issues. This file try to reproduce default PCSX2 settings. Can fix many minor to major issues. Speed issues, graphical issues, physics issues. Is first thing to try, when emu without config have game issues. Config is 100% safe for 99% games, and can only improve game compatibility, there should be absolutely no cons of using it.
Code:--fpu-no-clamping=0 --fpu-clamp-results=1 --vu0-no-clamping=0 --vu0-clamp-results=1 --vu1-no-clamping=0 --vu1-clamp-results=1 --cop2-no-clamping=0 --cop2-clamp-results=1 --vu0-opt-flags=1 --vu1-opt-flags=1 --cop2-opt-flags=1 --vu0-const-prop=0 --vu1-const-prop=0 --vu1-jr-cache-policy=newprog --vu1-jalr-cache-policy=newprog --vu0-jr-cache-policy=newprog --vu0-jalr-cache-policy=newprog
5. Known emulation settings/toggles
https://www.psdevwiki.com/ps4/PS2_Emulation#Emulator_Configuration
6. Patching ps2 emulated memory (work in progress)
Sony used here the same structure like in 0xA in ps2_netemu from PS3. Emotion Engine Instant Replace.
So command looks like this: eeInsnReplace(memory address, original opcode, replaced opcode)
Here is example:
Code:eeInsnReplace(0x13d7f0, 0x1000ffff, 0x0804f45d) -- retry FREAD() for fix #9025,
This code replace opcode 1000ffff to 0804f45d at 0x13d7f0 address. Like you can see above we can use comments. to add comment use "-- " without quote.
Keep in mind that address and opcode is Big Endian this time, so any ports from PS3 need reversed endianess.
7. Creating Advanced Hook (work in progress)
Code:local eeObj = getEEObject() -- Track# -- The Grand Reefs : 6 -- Ruins of Carnuss Gorgull : 9 eeObj.AddHook(0x187330, 0x3c010001, function() local track = eeObj.GetGpr(gpr.a1) print(string.format("Track : %d", track)) if track == 6 or track == 9 then eeObj.Vu1MpgCycles(1000) -- makes it be 30fps. else eeObj.Vu1MpgCycles(100) -- default value. end end)
187330 = memory address
3c0100001 = Original opcode in big endian
function() = kind of conditional replace opcode in this example
Sony this time abandoned all that crypto stuff, and we have even hook names, very promising for research in ps3 netemu.[/tab][/tabs]