Skip to content
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

PPU: Add new patch function for SONIC 06 #12962

Merged
merged 2 commits into from
Dec 9, 2022
Merged

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Nov 19, 2022

I wanted to add a new patch type for sonic. But then I realized I already implemented the needed functionality in #10859 and #10779, just need to add the new function for waiting for SNRs to empty.

Fixes SONIC THE HEDGEHOG graphics with a patch.

Patch: (currently only BLUS30008 1.01 is supported)

PPU-4b46d0161ca657ab16b0a779d9062810ea5ea2dd:
  Graphics Fix:
    Games:
      "SONIC THE HEDGEHOG":
        BLUS30008: [ 01.01 ]
    Author: elad335
    Notes: "Fixes missing graphics ingame."
    Patch Version: 1.0
    Patch:
      - [ calloc, 0x00f07714, 0x4 ]
      - [ be32  , 0x0, 0x38800003 ] # LI r4, 3
      - [ jumpf , 0x0, "RPCS3_HLE_LIBRARY:WaitForSPUsToEmptySNRs"] # Args: (SPU ID, 3)
      - [ be32  , 0x0, 0x38800000 ] # LI r4, 0
      - [ be32  , 0x0, 0x44000002 ] # SC

https://media.discordapp.net/attachments/272875751773306881/1050995217416867932/image.png

@kd-11
Copy link
Contributor

kd-11 commented Nov 19, 2022

just need to add the new function for waiting for SNRs to empty

Any idea why this works on realhw but not for us? I don't mean "make it work like realhw" I just mean for thorough documentation.
I'm not too comfortable opening pandora's box with full-on in-product c++ patches. Does SPU support checking if SNRs are empty? An SPU patch would make more sense in that case.

@MSuih MSuih added the Hack label Nov 19, 2022
@elad335
Copy link
Contributor Author

elad335 commented Nov 19, 2022

It's not able to be migrated to SPU code.

@elad335
Copy link
Contributor Author

elad335 commented Nov 19, 2022

Any idea why this works on realhw but not for us? I don't mean "make it work like realhw" I just mean for thorough documentation.

It's because SPU is too slow on rpcs3

@AniLeo
Copy link
Member

AniLeo commented Nov 20, 2022

IMO we should leave the game as is instead of going down this path

@elad335
Copy link
Contributor Author

elad335 commented Nov 20, 2022

It's a game bug and the patch is not even on by default. Maybe we will remove PRX patches as well that I implemented because it's not right to keep MGS4 playable without crashes according to your logic. OMG

@MastaG
Copy link

MastaG commented Nov 20, 2022

If I understand correctly, many issues occur from SPU emulation not being fast enough, causing race conditions, crashes, desyncs etc.
There are many game specific patches that mitigate this for example by removing tasks/workloads from the SPU.

So can't SPU emulation be made any better (as in faster with the same accuracy)?

@elad335
Copy link
Contributor Author

elad335 commented Nov 20, 2022

You can probably waste one's whole life making RPCS3 cycle accurate and still fail.

@elad335
Copy link
Contributor Author

elad335 commented Nov 22, 2022

There is the 360 version then.

@elad335 elad335 closed this Nov 22, 2022
@elad335 elad335 reopened this Nov 22, 2022
@Nekotekina
Copy link
Member

I suppose it's not possible to implement this game patch with only existing patch functionality? Maybe a more low level tool should be exposed to patches.

@elad335
Copy link
Contributor Author

elad335 commented Dec 9, 2022

Added some bugfixes, btw, if you want to create patches for the other game IDs search for sc #sys_spu_thread_write_snr instruction and apply the patch there.

Allow multiple entries for a single code.
@Windsurf7
Copy link

Hi @elad335
First of all, thank you so much for all your hard work on making this game playable on the emulator, please rest assured that many Sonic fans are very grateful.
I'm here to report that the patch applied together with any of the patches from Sonic '06 Mod Manager makes the graphics disappear again, as expected. I'm not familiar with the inner workings but I'm guessing they're conflicting with the changes they make in the executable.
There is really only one patch from Sonic '06 Mod Manager that is a must, the one named "Mid-air Control for Mach Speed". As you would easily guess, this improves the gameplay a lot.
Might you be interested in making a version of your canary patch that is compatible with this patch that fixes mach speed, or perhaps a combination of both, or a version of that patch that works with your canary patch?
Would appreciate it if you would consider. Cheers.

@elad335 elad335 deleted the sonic branch May 6, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants