Skip to content

Conversation

@GitHubProUser67
Copy link

@GitHubProUser67 GitHubProUser67 commented Nov 12, 2024

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:

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:

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.

@GitHubProUser67 GitHubProUser67 changed the title [Soft-Float] - Initial Intepreter Implementation of Ps2's floating point uint specification [Soft-Float] - Initial Intepreter Implementation of Ps2's floating point unit specification Nov 12, 2024
Copy link
Contributor

@github-actions github-actions bot left a 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!

@GitHubProUser67 GitHubProUser67 changed the title [Soft-Float] - Initial Intepreter Implementation of Ps2's floating point unit specification [Soft-Float] - Initial Interpreter Implementation of Ps2's floating point unit specification Nov 12, 2024
@seta-san
Copy link
Contributor

Does this work on the recompilers or just interpreter?

@refractionpcsx2
Copy link
Member

You should try reading the title.

@seta-san
Copy link
Contributor

You should try reading the title.

I don’t know why my brain just skimmed over that.

@MrCK1
Copy link
Member

MrCK1 commented Nov 12, 2024

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

@AmandaRoseChaqueta
Copy link

AmandaRoseChaqueta commented Nov 13, 2024

I can confirm with the multiplication setting that MHG and Dos not longer have bugged bounces! (Plus the build works on linux well! [as well as running interpreter can do, of course :'D])
Screenshot_20241112_234106
Monster Hunter G_SLPM-65869_20241112234029
Monster Hunter 2_SLPM-66280_20241112235154

@Shoegzer
Copy link

Shouldn't this help with #2990 as well?

@AmandaRoseChaqueta
Copy link

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

@Blackbird88
Copy link
Contributor

Blackbird88 commented Nov 13, 2024

Tourist Trophy NTSC works now too! For the first time License Tests in it work!
Requires: EE MUL/DIV

Some of the tests still don't work however.

Works
image
image

Hangs
image

@Tokman5
Copy link
Contributor

Tokman5 commented Nov 13, 2024

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.
However, there are still slight differences between the two, and both are far from matching the console playback.

comp.mp4

@Goatman13
Copy link
Contributor

Goatman13 commented Nov 13, 2024

Nice work!

I tested only 2 games for now. Hype Time Quest which if i remember correctly needs accurate fpu mul, and it works fine without patch.

Second game is THPS4. While here accurate VU1 add/sub fix issue which is normally fixed by VU1 rounding in database, accurate mul/div breaks game graphics. Of course, game don't need accurate VU1 mul/div to work correctly, but something seems to be off when enabled.

Accurate vu1 add/sub/sqrt:
image
Accurate vu1 mul/div (same place in game):
image

Edit: Maybe THPS4 is just passing some big float value to GS with accurate mul/div. That may not necessarily be an issue with the float operation itself.
Additionally, I tested Burnout 2 and accurate VU1 add/sub fixed issue that was previously fixed by VU1 rounding mode (white car parts).

Edit2: Freaky Flyers is fixed with accurate mul/div on VU1. Awesome! We weren't even sure if that's floating points issue until now.

@GitHubProUser67
Copy link
Author

GitHubProUser67 commented Nov 13, 2024

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.

@Shoegzer
Copy link

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

@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.

@weirdbeardgame
Copy link
Contributor

weirdbeardgame commented Nov 13, 2024

2024-11-10.14-28-32.mp4

This also affects the Fatal Frame 1 issue. Meaning this + the current GameDB patch will end up being the ultimate fix

@Goatman13
Copy link
Contributor

#3200 is fixed when tested with b7f3806
Require accurate mul/div for FPU.
I didn't tested, but Krome studio games should profit from this pr too, ones that have patches in game db. Like Spyro, Star Wars, one of Transformers game.

@ghost
Copy link

ghost commented Nov 13, 2024

This pr's EE interpreter fixes #11636 's gamedb issue.

@AmandaRoseChaqueta
Copy link

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

@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.

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.

@GitHubProUser67
Copy link
Author

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.

@Shoegzer
Copy link

@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?

@ArtificialSufficiency
Copy link

ArtificialSufficiency commented Nov 14, 2024

Nice to hear of stuntman finally faring better nowadays.

@Goatman13
Copy link
Contributor

Game Constantine, tested US version. On level 2 there is dumpster that we need to climb to progress in game. Recompiler get it fine with positive rounding for EE. This is currently not working with soft floats, no matter what.

Reproduction steps.

  • Launch first level of game.
  • Use this cheat to skip to level 2: Press select, go to the Journal Screen, and enter RIGHT, LEFT, RIGHT, LEFT, RIGHT, LEFT, SQUARE, CIRCLE, CIRCLE, SQUARE, SQUARE, SQUARE, SQUARE, CIRCLE, CIRCLE.
  • Jump thru fence, kill rats, there will be now dumpster on the right side, one that do not work.

@GitHubProUser67
Copy link
Author

GitHubProUser67 commented Nov 14, 2024

I managed to fix it, but the game requires accurate soft floats on the VU0 and the EE FPU, so far I tried with booth Add/Sub and Mul/Div on EE FPU/COP2 and VU0:

image

Edit: Positive rounding hack-fix it because it makes the float VU0 friendly. In fact the game does some weird EE FPU->VU0 communications with high floats.

@GitHubProUser67
Copy link
Author

Note to future tests:

The constantine case is a typical case of a hack fixing a problem that is related to what I call "float broadcasting".

A game might want to transfer a out of IEEE range float from the FPU to the VUs (and vice-versa).

When a game Database entry has a rounding mode, usually it covers a can of worms where the game requires accurate soft floats on more than one processor.

@ghost
Copy link

ghost commented May 31, 2025

how do you download this and put into pcsx2?

This isn’t complete nor is it tested. If you were inclined to want to test it you need to go to the “checks” part of this pr. Choose your OS and then download from the artifacts.

Ok. I'm just not very familiar with GitHub but thanks anyway.

@Tokman5
Copy link
Contributor

Tokman5 commented Jun 27, 2025

I tested Tokyo Xtreme Racer 0's replays (#5597) again after 5c5c4c2. All demo replays and the replays recorded on console were played perfectly!

commit5c5c4c2.mp4

(Note: I enabled some cheat codes on PCSX2, so there were some visual differences but these didn't affect car movements.)

@DanteDraconi
Copy link

Tested a few different license tests in Tourist Trophy and the player is no longer placed out of bounds
Default settings with EE recompiler disabled and only multiplication/division soft-float enabled

image

@kunit1
Copy link

kunit1 commented Aug 15, 2025

What's the plan for this PR?

@GitHubProUser67
Copy link
Author

I am on it, I know I am late, I will try to get back to it asap.

@Retroprogram
Copy link

Hello, any news on this PR? Will it be released now?

@GitHubProUser67
Copy link
Author

So, I will update it fairly soon with the review points, I couldn't before because of some issues I had to fix on my server.

I will try my best to finish it for december hopefully.

@mrrguest
Copy link

mrrguest commented Dec 19, 2025

In Xenosaga 3 if you run behind the chest and try to face it from behind the screen will turns black, the game and sound still work but the footstep sounds like if you are running in the forest since there is a forest in this area you can visit. The black screen issue is fixed with this PR
Xenosaga Episode 3

…terpreters.nit specification.

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/tree/main/BackendServices/PS2FloatLibrary

- https://github.com/Goatman13/pcsx2/tree/accurate_int_add_sub

- PCSX2 Team for their help and support in this massive journey.

Fixes codacity warnings.
This commit fixup a calculation mistake in add/sub when dealing with booth numbers that are denormals.
…/TheLastRar/pcsx2/tree/softfoat-ui

I am sorry for the manual merging, hopefully credits are enough in the commit title.
This commit fixes an XML syntax issue in the visual studio filters file.
We want 100% compatibility for EFU, which is not the case yet.
…e recommandations.

In some cases, a Zero value could have it's underflow flag skipped, this is fixed.

We also start to simplify the code a bit per recommandations done in the pull request.
@terremoth
Copy link

terremoth commented Jan 15, 2026

Wooow, updates! 👏👏🚀

This commit applies one of the PR requests for BSR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.