Editing Talk:PS2 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: | ||
== | TODO: Please remove unneeded uppercase letters not at the start of sentences. | ||
* This Is Not Elon Musk Here :P - [[User:Roxanne|Roxanne]] | |||
==Regs== | |||
**1040000000 VU1 regs, mapping like on VU0. | **1040000000 VU1 regs, mapping like on VU0. | ||
**1050000000 VU1 micro data memory (1100C000 on real | **1050000000 VU1 micro data memory (1100C000 on real ps2 and pcsx2 debugger) size 0x4000. | ||
**1050004000 VU1 micro data memory mirror (1100C000 on real | **1050004000 VU1 micro data memory mirror (1100C000 on real ps2 and pcsx2 debugger) size 0x4000. Likely mirrored 2 more times on 8000 and c000 | ||
**104000C000 emulator place here VU1 constants used in popular operations. Eatan/eexp constants, masks for clamping, etc. Similar array can be found in | **104000C000 emulator place here VU1 constants used in popular operations. Eatan/eexp constants, masks for clamping, etc. Similar array can be found in Pcsx2 (mVU_Globals), Dobiestation (atan_const, etc), Play! (GenerateEATAN, etc.) | ||
**1030004000 emulator place here VU0 constants used in popular operations. Like above (vu0 don't have efu so placing there efu constants for eatan/eexp is pointless, but there they are). | **1030004000 emulator place here VU0 constants used in popular operations. Like above (vu0 don't have efu so placing there efu constants for eatan/eexp is pointless, but there they are). | ||
--[[User:Kozarovv|Kozarovv]] ([[User talk:Kozarovv|talk]]) 09:37, 5 January 2023 (UTC) | --[[User:Kozarovv|Kozarovv]] ([[User talk:Kozarovv|talk]]) 09:37, 5 January 2023 (UTC) | ||
== | =Misc info= | ||
Some data that eventually need to be posted on main emulation page. All data posted here is obtained from jak tpl (so called v1) emulator. All data is confirmed in code itself, no guessing (unless said otherwise). Time to start releasing that old work to public. | Some data that eventually need to be posted on main emulation page. All data posted here is obtained from jak tpl (so called v1) emulator. All data is confirmed in code itself, no guessing (unless said otherwise). Time to start releasing that old work to public. | ||
Line 24: | Line 26: | ||
*Default misc settings used by Jak TPL emu: https://pastebin.com/79JCRXkq (ps2_lang is changed later if host system match possible ps2 languages) | *Default misc settings used by Jak TPL emu: https://pastebin.com/79JCRXkq (ps2_lang is changed later if host system match possible ps2 languages) | ||
== | ==Misc misc info== | ||
*Both settings do the same thing: | *Both settings do the same thing: | ||
--external-hdd-fix | --external-hdd-fix | ||
Line 37: | Line 38: | ||
No matter which value is used, 1 is set. | No matter which value is used, 1 is set. | ||
== | ==Few popular misunderstandings== | ||
*vu-xgkick-delay take integer between 0-31 (confirmed on both emu and compiler side), and not float (0.5 is invalid, will be truncated to 0 probably) | |||
*Cop2 rounding in pcsx2 is governed by "EE/FPU" rounding setting, not by VU or VU0. | |||
*Cop2 clamping is hardcodded in pcsx2 as far as i know, if no then is likely also governed by EE/FPU setting not VU/VU0 | |||
*xx-no-clamping setting is not really no clamping known from pcsx2. This is special mode which can be used regardless of other clamp commands. To compare pcsx2 have similar mode only for FPU (Full), to fully mimic that mode we still need fpu-to-double enabled. | |||
==ee-native-function== | |||
Emulator have set of predefined functions used in popular PS2 SDK libraries. Those function are highly optimized to run natively on x64. <br> | Emulator have set of predefined functions used in popular PS2 SDK libraries. Those function are highly optimized to run natively on x64. <br> | ||
'''--ee-native-function=name,address''' under the hood this is hooking selected address, and replace it with jump to predefined function. Functions available in JAK TPL emu: | '''--ee-native-function=name,address''' under the hood this is hooking selected address, and replace it with jump to predefined function. Functions available in JAK TPL emu: | ||
Line 96: | Line 102: | ||
jr $ra | jr $ra | ||
addiu $sp, 0x30 | addiu $sp, 0x30 | ||
This is corner case example as floatdidf convert a 64bit signed integer to IEEE double, and PS2 developers generally had no reason to use doubles (fpu/vu are operating on 32 bit floats). But you can see that whole conversion is practically done in 1 opcode, while ps2 take massive function to do this. Other functions are usually less optimized, but still really worth it. | This is corner case example as floatdidf convert a 64bit signed integer to IEEE double, and PS2 developers generally had no reason to use doubles (fpu/vu are operating on 32 bit floats). But you can see that whole conversion is practically done in 1 opcode, while ps2 take massive function to do this. Other functions are usually less optimized, but still really worth it. | ||
== EE/VU injection == | ==EE/VU injection== | ||
"Injections" are special sets of precompiled functions, idea is known better as HLE emulation. Available injections can vary depend on ps2-compiler.self, because that's where lookup for available functions is done. This literally replace code that normally is recompiler, with optimized version when address and hash match. Probably not many games can use this. Good candidates are games that use the same engine as currently released ps2 classics. Many times VU1 programs are reused by the same developer. | |||
"Injections" are special sets of precompiled functions | <br>'''VU1''' | ||
<br | |||
'''VU1''' | |||
*Name + offset in JAK TPL compiler | *Name + offset in JAK TPL compiler | ||
*unk1 | *unk1 | ||
Line 245: | Line 248: | ||
Same goes for "kernel" injections, they are also based on ID + Hash + address. Generally all "injections" should be safe to be enabled by configs. There is really small chance for hash/address(and id) collision. Not to be confused with "native" / "native-patch" ! | Same goes for "kernel" injections, they are also based on ID + Hash + address. Generally all "injections" should be safe to be enabled by configs. There is really small chance for hash/address(and id) collision. Not to be confused with "native" / "native-patch" ! | ||
=RESEARCH TO DO= | |||
{| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | {| cellspacing="0" cellpadding="2" border="1" class="wikitable" style="text-align: center;" | ||
! Name !! Notes | ! Name !! Notes | ||
|- | |- | ||
| Locating the gs registers || | | 4-Player Multitap in urban reign || Weird why it isn't working. | ||
|- | |||
| Locating the gs registers || Never gonna happen it seems. | |||
|- | |||
| Fully understanding the hook functions || | |||
|- | |- | ||
| Trying to reverse-engineer any | | Trying to reverse-engineer any eboot to improve compatibility || | ||
|- | |- | ||
| Locating the proper CDVD read speed (God of war and Ratchet size matters [Both have affected music]) || IOP and CDVD commands help | | Locating the proper CDVD read speed (God of war and Ratchet size matters [Both have affected music]) || IOP and CDVD commands help | ||
|- | |- | ||
| Find out what some of the gs commands do and edit their description || | | Fully understand what the vif chunk command thingy does || Too low and your game will freeze at the intro | ||
|- | |||
| Find the the most GIF accurate emulator there is. || Kof98?? | |||
|- | |||
| Find out what some of the gs commands do and edit their description || | |||
|- | |||
| Implement a EE memory patch for ratchet up your arsenal || Not trivial obviously | |||
|- | |- | ||
| | | Fix the two tenchu and harry potter games || (eughhh) | ||
|- | |- | ||
|} | |} | ||
* GS registers aren't mapped in easy way comparing to other ones. Offsets will vary per emulator, and that's for sure. This is what you get in read mode on JAK emu (not sure if i have v1 or v2 to be honest, is known as ps2emu16): | |||
* GS registers | |||
gs_reg_SCISSOR_1 0000000001B11800 | gs_reg_SCISSOR_1 0000000001B11800 | ||
gs_reg_FBA_1 0000000001B11808 | gs_reg_FBA_1 0000000001B11808 | ||
Line 324: | Line 336: | ||
hwreg_GS_EXTWRITE 0000000007D89FB8 | hwreg_GS_EXTWRITE 0000000007D89FB8 | ||
hwreg_GS_BGCOLOR 0000000007D89FC0 | hwreg_GS_BGCOLOR 0000000007D89FC0 | ||
But keep in mind that GS regs can be "duplicated" for different emulation stages. GS is jited too, so it should have kind of pipeline too. | But keep in mind that GS regs can be "duplicated" for different emulation stages. GS is jited too, so it should have kind of pipeline too. | ||
"Implement a EE memory patch for ratchet up your arsenal" Game write data using qmtc2/ctc2 and expect VU0 to still run at this point, which is not always true. Mega high vu0 mpg cycles could potentially push it little further. Patching that will be pain just because Ratchet use code overlays. This mean you need to patch game image with the same patch in more than 20 places. Because what you see in | "Implement a EE memory patch for ratchet up your arsenal" Game write data using qmtc2/ctc2 and expect VU0 to still run at this point, which is not always true. Mega high vu0 mpg cycles could potentially push it little further. Patching that will be pain just because Ratchet use code overlays. This mean you need to patch game image with the same patch in more than 20 places. Because what you see in pcsx2 debugger / ps2dis will change depend on stage you play now. That's why PS3, and PCSX2 use dynamic jit patches (pcsx2 use it for different issue tho). --[[User:Kozarovv|Kozarovv]] ([[User talk:Kozarovv|talk]]) 14:20, 27 February 2023 (CET) | ||
== | |||
<br>-- Scalerize: I'm fully aware of the dynamic crap that the game uses, however, all I need is to find the CTC2 instruction that's causing this crap so I can advanceclock it, and then finding the rest of the locations that this offset resides in. It's also worth mentioning that I did find the vcallms instruction that causes the freeze, Although it's not a real fix. This game will need a lot of testing, but one thing is for sure, it's so well worth it. | |||
* PS3 with similar issue consider every "ctc2 $zero, vi1 (0x48C00800)" and every "ctc2 $zero, vi2 (0x48C01000)" as problematic, this should give you 12 offsets to patch. All of them are in the same function "CmeUnpack" (which like you already know will change offsets many times during game). --[[User:Kozarovv|Kozarovv]] ([[User talk:Kozarovv|talk]]) 18:56, 28 February 2023 (CET) | |||