-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Soft-Float] - Initial Interpreter Implementation of Ps2's floating point unit specification #12001
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting a contribution to PCSX2
As this is your first pull request, please be aware of the contributing guidelines.
Additionally, as per recent changes in GitHub Actions, your pull request will need to be approved by a maintainer before GitHub Actions can run against it. You can find more information about this change here.
Please be patient until this happens. In the meantime if you'd like to confirm the builds are passing, you have the option of opening a PR on your own fork, just make sure your fork's master branch is up to date!
Does this work on the recompilers or just interpreter? |
You should try reading the title. |
…oint unit specification. This Pull Request implements the first take ever on real Soft-Float support in PCSX2. This work is a combination or several efforts and researches done prior. Credits: - https://www.gregorygaines.com/blog/emulating-ps2-floating-point-nums-ieee-754-diffs-part-1/ - https://github.com/GitHubProUser67/MultiServer3/blob/main/BackendServices/CastleLibrary/EmotionEngine.Emulator/Ps2Float.cs - https://github.com/Goatman13/pcsx2/tree/accurate_int_add_sub - PCSX2 Team for their help and support in this massive journey. This pull request should be tested with every games requiring a clamping/rounding mode (cf: GameDatabase). Currently, this PR fixes on the interpreters: - PCSX2#354 - PCSX2#11507 - PCSX2#10519 - PCSX2#8068 - PCSX2#7642 - PCSX2#5257 This is important to note, that this implementation, while technically fixing Gran Turismo 4 and Klonoa 2, makes the games crash due to very high floats being passed in the emu code, and failing at some points later in the process. This has not yet been ironed-out. Other than that, this sets the floor for Soft-Float in PCSX2, a long awaited contribution.
96414bd
to
de047ea
Compare
I don’t know why my brain just skimmed over that. |
I ran a bunch of tests for "Test Drive Unlimited" AI during the demo scene after sitting idle on the menu. No combination of settings/interpreters seems to have any effect on behavior. There must be something else going on |
Shouldn't this help with #2990 as well? |
I remember seeing on the public dev channel that stuntman not longer had AI issues with this and not longer the car AI failed? it's been a while |
I tested the demo replays of Tokyo Xtreme Racer Zero (see issue #5597 ) and noticed that the car movement in interpreter mode is now closer to the movement in recompiler mode. comp.mp4 |
The game sends some super low floats to the Mul unit. On PS2, floats with exponent zero should return zero, but this is not the case in Mul, the multiplier can work with denormals internally. I love when undocumented stuff is used by some games for their 3D engine ^^.
The Tony Hawk case is fixed, the game uses an un-documented behaviour in it's 3D engine. The PS2 has no denormals support .... except in the Mul unit apparently. The behaviour is now emulated properly. |
@AmyRoxwell Can you provide a reference to this? There's no indication of it being fixed in #2990, and I assume the devs would have closed it if it were. In any event it involves pathing in Driver 3 as well. |
2024-11-10.14-28-32.mp4This also affects the Fatal Frame 1 issue. Meaning this + the current GameDB patch will end up being the ultimate fix |
More accurate approach to compare.
This pr's EE interpreter fixes #11636 's gamedb issue. |
Implements accurate SQRT options, also removes Tri-Ace hack, which isn't needed anymore on the interpreter.
I meant like, while using this PR, not that is has been fixed. Sorry if it was misunderstood. But if it's not mention on the PR maybe the thing it needs it's not here by this initial implementation. |
Driv3r seemed fine when it was tested, Stuntman NTSC is a lot better but still can "slightly" deviate. I suspect it is once again, the interpreter rounding/clamping values somewhere. |
@AmyRoxwell Ah, I understand you now. That's great news. @GitHubProUser67 Thanks, nice to see Driv3r is looking better. Would it make sense to list these games in your OP? |
…lags + uses built-in clz for Add/Sub. Fixes a TON of games. The flags are not yet in use in the Interpreters, this will ideally be commited next (requires VU code changes). The Div/Sqrt method is unoptimized for now, the team is working on a faster equivalent.
And there we have our New-Year present! Fully accurate FPU in PCSX2! Aside a few things remaining to adjust (flags and newer Div/Sqrt method), we now have a solid basis that replicate the PS2 operations. The last commit fixes:
|
Jesus. This is amazing. many of the oldest issues are suddenly just fixed. This is truly God's work you and Tellow and everyone else has done here. |
Tested Colin McRae Rally 3 with this commit and the AI still goes out of sync and crashes into walls. What I should also add is that the AI keeps accelerating against the wall, then it "reminds" it could reverse as I can see it tries to back out from the wall, but it stays in place and goes nowhere. After almost 3 minutes, the AI "dies", as it probably thought it has finished the race. |
@LoStraniero91 |
You can download it yourself from the artifacts right below the comments. |
You only need a GitHub account to download the CI artifacts. And you can download it from here EDIT: |
Wonderful :O, I look forward to them soon being able to repair driver 3, it makes me want to play it again :D |
Demo replays of Tokyo Xtreme Racer 0 are MUCH closer to the ones running on console than ever! |
We use a faster checked method that achieve the same result.
41f561b
to
99ee5d5
Compare
I did some testing and PAL Stuntman seems massively improved with EE and VU0 soft-float. |
[Soft-Float] - Fixes Itof accuracy. The PS2 FP Unit behave differently if exponent is less than 158, we emulate this now. Also, forbid denormals in Ftoi. Expect some AI improvements, if any.
48bca2a
to
8914229
Compare
I tested Stuntman PAL version again on the new build and the "River race" can now be completed in the emulator. |
Something here is causing issues in the VU1 interpreter for Jak 3 (Pal) Test with EE rec, VU0 rec, VU1 Int with all Softfloat options disabled (or enabled results unchanged), the intro cutscene doesn't render. |
Would you be so kind as to run all the tests and comment if it works? What you have achieved is great, because if everything goes well, possibly the chase missions of driv3r (driver 3) would already be finished so we will finally be able to enjoy that title as well :D |
This might potentially fix #9681 aswell |
Could you try to test again and see if the problem is already fixed? pls |
@TheLastRar Thank you for the bug report, unfortunately, this will not be fixed quickly, I will have to completely re-do my initial work on the interpreters, since the current design of the VUs, and the FPU, doesn't allow for U/O/D/I flags propagation. This will be fixed when the PR will be ready. |
Hi bro,after this PR is merged, will the next step for recompiler be coming soon? |
We will see, I prefer focusing on the interpreter version for now, until is is good to integrate. |
@TheLastRar I identified the problem and where it came from, unfortunately it is due to a timing issue that got ported from this fork : https://github.com/Goatman13/pcsx2/tree/accurate_int_add_sub The problem resides is how the VU store the 2nd number in the x/w/z/y methods: But it needs (like master) to store the data before doing anything: So this is awesome news, I can fix it even with the current design, however, what a game this Jak3! They optimized the thing to it's absolute limits. |
…pport for VU operations. The flag support is not 100% accurate yet in FMAC methods (we need to carry mult flags to the add stage), but this is enough for Superman to work for now.
Improves performance of clip, while being accurate. Test Ratchet Gladiator to verify this commit (game needs this alongside accurate Mul support on the COP2 to fix some physics behaviours).
OMG Awesome to see this issue! I will try playing ASAP Driv3r too if it fixes my issue too #11714 |
The flag propagation is calculated, but not yet applied in the calculations (not used by any games apparently, but still needs to be done).
This Pull Request implements the first take ever on real Soft-Float support in PCSX2.
This work is a combination or several efforts and researches done prior.
Credits:
https://www.gregorygaines.com/blog/emulating-ps2-floating-point-nums-ieee-754-diffs-part-1/
https://github.com/assumenothing/Tommunism.SoftFloat/tree/main
https://github.com/GitHubProUser67/MultiServer3/blob/main/BackendServices/CastleLibrary/EmotionEngine.Emulator/Ps2Float.cs
https://github.com/Goatman13/pcsx2/tree/accurate_int_add_sub
PCSX2 Team for their help and support in this massive journey.
This pull request should be tested with every games requiring a clamping/rounding mode/float patches (cf: GameDatabase).
Currently, this PR fixes on the interpreters:
[BUG]: DJbox (Japan) - SCPS-15082 - 56275BE9 #5169
Ratchet & Clank 2 - Megaturret Doesn't Work Correctly #354
[BUG]: Tourist Trophy: License Tests are broken and not completeable, player is placed out of bounds #11507
[BUG]: Monster Hunter games: bounce calculation inaccuracy #10519
[BUG]: Opening demo desyncs. The Taxi 2 (SLPS-20478) #8068
[BUG]: Pride FC - Fighting Championship | Missing text and textures in Hardware and Software render modes. #7642
[BUG]: Jak & Daxter/Jak 3 -- Character slides on his own | Jak 2 -- Inclined Camera Drift #5257
[BUG]: Final Fantasy X Tidus Falls Through Lift #8228
[REGRESSION]: Final Fantasy X Bosses Turn Invisible During Death Animation #8595
[Feature Request]: Final Fantasy X GameDB Config #10885
[BUG]: Driv3r - Bizarre AI (?) problem: impossible to pass "Lead On Baccus" mission (the 2nd mission) #11714
[BUG]: Camera is static in Prince of Persia: Warrior Within menu #5070
[BUG] World Series of Poker 2008 - Battle for the Bracelets: Broken character geometry #4546
Meta: Games that don't like the Full fpu mode. #2245
[BUG]: FPU rounding issues in Shadow of the Colossus (SCUS-97472) #11528
[BUG]: Tourist Trophy: License Tests are broken and not completeable, player is placed out of bounds #11507
[BUG]: Disney's UP TLB Miss #4760
[BUG]: Need for Speed Undercover not loading save games properly unless they’re created within PCSX2 #9831
Gran Turismo 4 license tests
Mortal Combat Shaolin Monks
Tokyo Xtreme Racer Zero (Accurate Mul/Div for the EE FPU)
Any other games using the NegDiv hack or any other FPU rounding mode.
This sets the floor for Soft-Float in PCSX2, a long awaited contribution.