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

GameINI: Rayman Arena - Add Disable Culling Patch that fixes "Rise and Shrine" Hang #10016

Merged
merged 1 commit into from Mar 20, 2022

Conversation

JMC47
Copy link
Contributor

@JMC47 JMC47 commented Aug 10, 2021

So funny story: the author of the "widescreen" patch for Rayman Arena (which is a patch ported from gamemasterplc's widescreen code Rayman 3) told me that it fixes the infamous hang in Rise and Shrine. Now, Rayman Arena is a serious bastard of a game, and has hanged in Dolphin on this map as far back as I could get the game to run in Dolphin. I thought to myself:

"How in the world could a widescreen patch work-around the bug???"

So I tried it. And it worked. So I began studying the code and found out it wasn't exactly a widescreen patch, it was a no culling patch. But here's the thing: Rayman Arena already has almost no culling. The only thing it culls is a few character models and item boxes at the start of the match. The impact of the no culling cheat is actually very subtle, even when looking at statistics about what the game is rendering.

Before:
image
After:
image

The only difference is that the AI opponent is rendering. In the past, @leoetlino and I have experimented with trying to adjust the timings of Rayman Arena to work in Dolphin and found that the only way to fully avoid the hang is to set Dolphin's Emulated GPU Clock to 1% or lower in Single Core. And that leaves the game completely unplayable. Users have gone to another solution: changing the emulated CPU clock to 150% or above and mashing to skip the cutscene at the start of this level where the hang occurs.

The thing that truly confuses me is that if you're playing without the patch, the level never even starts rendering as far as I can tell. In order to get those statistics, I overclocked the CPU to 150% to get it to render a couple of frames before freezing, as at the base clock it will freeze while the loading screen is still up.

In terms of performance, the No Culling Patch is so lightweight that I see literally no difference in performance, and honestly I kind of think it performs slightly better but that may be confirmation bias creeping in.

For now, I'm just pushing this pull request to try and get some more eyes on yet another Ubisoft game doing something. Does anyone have any idea why such a minor different matters when doing wild changes to Dolphin's timings don't? This patch is useful as it gives us a side by side look with the failure state vs a successful state with minimal changes to the game or dolphin compared to previous efforts, but until we understand why the game is failing, I'm uncomfortable merging it.

@leoetlino
Copy link
Member

Worth noting that the game hasn't actually crashed -- it's just sleeping forever. Its only thread never wakes up after a call to GXDrawDone (IIRC, it's been a while since I looked at the game). This is very likely to be a GPU timing issue.

@RibShark
Copy link

To narrow it down further, it is the 2nd half of the codes (8005EF08 onwards) that is "fixing" this, so whatever culling is being disabled by the first 2 codes doesn't seem to affect this.

@JMC47 JMC47 force-pushed the ubisoftcodinground11 branch 2 times, most recently from 31159df to ec097d0 Compare November 15, 2021 12:29
@JMC47
Copy link
Contributor Author

JMC47 commented Nov 15, 2021

Addressed the comments.

I've disabled the hack by default. I've also clarified it's a hang, not a crash in the comments.

@JMC47 JMC47 changed the title [DO NOT MERGE] GameINI: Rayman Arena - Add/Enable Disable Culling Patch that fixes "Rise and Shrine" Hang GameINI: Rayman Arena - Add Disable Culling Patch that fixes "Rise and Shrine" Hang Nov 15, 2021
@AdmiralCurtiss
Copy link
Contributor

Should we merge this?

@Pokechu22
Copy link
Contributor

I don't think the mostly-blank GYR.ini needs to exist, and the patch name is still "Disable Culling to Fix Rise and Shrine Crash" when it should maybe say "hang" like the comment, but I think it's fine to merge it otherwise (I have done no testing and haven't investigated this game myself)

@JMC47
Copy link
Contributor Author

JMC47 commented Mar 19, 2022

I'll fix this in a bit then.

For unknown reasons, a Gecko Code on the Wiki for Rayman Arena that was
meant to help with widescreen patches.  This doesn't actually change
anything about the game unless you enable Dolphin's built-in widescreen
hack, where it will cause enemies and whatnot to render on the edges of
the screen.  This is because it patches out the culling function in the
game, which coincidentally is also the cause of the hang in Dolphin.
@AdmiralCurtiss AdmiralCurtiss merged commit 8368b87 into dolphin-emu:master Mar 20, 2022
10 checks passed
@icup321
Copy link
Contributor

icup321 commented Mar 20, 2022

Heads up, I just noticed that the game ID is wrong so it doesn't get detected by Dolphin, it's supposed to be GRYE41, not GYRE41.

@JMC47
Copy link
Contributor Author

JMC47 commented Mar 20, 2022

lol oops. I'll fix in the morning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
6 participants