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

VideoCommon: Tweak widescreen heuristic. #8584

Merged
merged 2 commits into from Apr 13, 2020

Conversation

jordan-woyak
Copy link
Member

@jordan-woyak jordan-woyak commented Jan 25, 2020

Consider a projection "anamorphic" when the projection aspect ratio divided by the viewport aspect ratio is near 1.333... ((16/9) / (4/3))
Previously only 4:3 viewport and 16:9 projection situations were considered anamorphic.
This fixes the widescreen GeckoCode in "Gauntlet: Dark Legacy" which seems to maybe render the game to only an upper portion of the screen.

Keep separate counts for perspective and orthographic projections and compare them separately, apples to apples.
If either type of projection look overly anamorphic, go 16:9.
Otherwise, if orthographic projections were anamorphic and are now normal or perspective projections are normal, go 4:3.
This fixes Animal Crossing's inventory screen where perspective projections are temporarily not used.
It also fixes menus in SSX3 from flashing between 16:9 and 4:3.

Count and use the vertices for each projection type in addition to flush counts.
Also add up data for projections which weren't anamorphic or normal for an accurate total.

Only run the heuristic update on non-duplicate frames.

Consolidated duplicate aspect ratio calculation and cropping logic.

If widescreen hack is enabled with a manually configured aspect ratio the heuristic is now used to adjust from the detected aspect ratio to any target aspect ratio.
(Only in GameCube mode of course)

This fixes:
https://bugs.dolphin-emu.org/issues/11243
https://bugs.dolphin-emu.org/issues/11951
https://bugs.dolphin-emu.org/issues/11960

Some other games I tested that still work:
Splinter Cell
Alien Hominid
Mario Kart Double Dash
Burnout 2
F-Zero GX
Animal Crossing

@slx7R4GDZM
Copy link
Contributor

I'm still getting the same issue with Lost Kingdoms 2 and Animal Crossing.

@jordan-woyak
Copy link
Member Author

@slx7R4GDZM Can you please provide fifologs demonstrating the problem?

@slx7R4GDZM
Copy link
Contributor

Alright, here. The LK2 fifo looks completely black on my end no matter the settings. I'm not sure what that's about.
I just noticed while recording those though that enabling immediately present XFB stops the flickering between aspect ratios on both games.

@jordan-woyak
Copy link
Member Author

@slx7R4GDZM Thanks. I've fixed this and those fifologs now work correctly.

@slx7R4GDZM
Copy link
Contributor

@jordan-woyak LK2 looks good now from what I can tell but Animal Crossing still freaks out. I'm not sure if it'll help but here's 2 more fifologs.

@jordan-woyak
Copy link
Member Author

@slx7R4GDZM Thanks.

I can't see a problem with "ac1.dff".

In "ac2.diff", when the menu pops up, literally nothing is rendered with a 16:9 perspective. All the 2D elements are drawn with a normal orthographic projection so there isn't any reason to consider it "widescreen".

Logic could be added to ignore orthographic (2D) projections after perspective (3D) projections were observed, but I'm worried this might break a 2D game with occasional 3D elements.

@slx7R4GDZM
Copy link
Contributor

slx7R4GDZM commented Jan 25, 2020

I can't see a problem with "ac1.dff".

Yeah, weird. It's happening in gameplay but not when rewatching the fifologs. Also the intro sequence doesn't flicker when immediately present XFB is enabled but the menus still do.

In "ac2.diff", when the menu pops up, literally nothing is rendered with a 16:9 perspective. All the 2D elements are drawn with a normal orthographic projection so there isn't any reason to consider it "widescreen".

Huh, interesting. It only happens sometimes though which is the odd thing. Especially when you do it in the inventory menu.
Maybe the widescreen code for that game is just busted.
I'm dumb, I think I copied the wrong 16:9 code from the wiki.
Nevermind on this again, I triple checked and the US widescreen code on the wiki did act crazy before the latest version of this PR. Not that it matters now anyways.

The codes for the Lost Kingdoms games seem to work perfectly now so everything looks good now.

@jordan-woyak
Copy link
Member Author

@slx7R4GDZM Whelp, I fixed your fifologs anyways. Just keep throwing them at me if you keep finding broken things. :P

@slx7R4GDZM
Copy link
Contributor

@jordan-woyak Now it works even with the code I previously tried. No more flickering or anything in AC.

Behavior on Lost Kingdoms 2 seems different. On the build of the PR before this one it used to be 4:3 on title menus, world map, videos, etc and only 16:9 on gameplay and loading screens. Now it will start off on 4:3 but once it enters gameplay everything else will stay widescreen and get stretched, even the menus.

@jordan-woyak
Copy link
Member Author

jordan-woyak commented Jan 25, 2020

@slx7R4GDZM Yeah.. I broke something. :P I'll push a fix in a bit.
Edit: Should be good now.

@jordan-woyak jordan-woyak changed the title VideoCommon: Tweak widescreen heuristic. WIP - VideoCommon: Tweak widescreen heuristic. Jan 25, 2020
@jordan-woyak jordan-woyak force-pushed the widescreen-heuristic-fix branch 2 times, most recently from e988752 to 8c9d425 Compare January 26, 2020 03:18
@slx7R4GDZM
Copy link
Contributor

slx7R4GDZM commented Jan 26, 2020

@jordan-woyak

Should be good now.

This new behavior might be a consequence of getting Animal Crossing working properly. Seems like LK2 still likes to stay in 16:9 after the loading screen.

@JMC47
Copy link
Contributor

JMC47 commented Jan 26, 2020

If there's nothing in 4:3, I don't think it'd be right to switch back. The way it'd work on a T.V. is that it'd just be stuck in 16:9.

@jordan-woyak jordan-woyak force-pushed the widescreen-heuristic-fix branch 2 times, most recently from 32fe221 to 6e268a9 Compare January 26, 2020 05:33
@jordan-woyak jordan-woyak changed the title WIP - VideoCommon: Tweak widescreen heuristic. VideoCommon: Tweak widescreen heuristic. Jan 26, 2020
@iwubcode
Copy link
Contributor

iwubcode commented Feb 5, 2020

Very nice ! I did some testing on a handful of games (Tales of Symphonia, Soul Calibur 2, Star Fox Adventures, Zelda Collector's Edition, Last Story, Pandora's Tower, Bubble Bobble Plus, some VC games) and was really happy with the results. Will give the code a more thorough look later.

@mbc07
Copy link
Contributor

mbc07 commented Feb 9, 2020

Right now I remember of WarioWare: Smooth Moves, which is a 4:3 only Wii game...

@JosJuice
Copy link
Member

JosJuice commented Feb 9, 2020

Yes, but it's 2D only as far as I can recall, which would make it useless for testing the behavior of the widescreen hack. (Or are the 2D elements actually rendered in a 3D environment?)

@mbc07
Copy link
Contributor

mbc07 commented Feb 9, 2020

The city map (where you select the stages) and various micro games are actually rendered in 3D and/or have 3D models on them AFAIK...

@Tenome
Copy link

Tenome commented Apr 7, 2020

Thanks for working on this.

@JMC47 JMC47 merged commit c0ae9cb into dolphin-emu:master Apr 13, 2020
@pyromancer5
Copy link

m8 plz ur dolphin 5.0-11841 by jordan-woyak — VideoCommon: Tweak widescreen heuristic. missed up YU GI OH FALSEBOUND KINGDOM its unplayable now :( the screen keep bugging up during combat it go wide then bk wide bk ...plz fix it

@jordan-woyak
Copy link
Member Author

@pyromancer5 File an issue report: https://bugs.dolphin-emu.org/projects/emulator/issues
Make sure to include a FIFO log!

@jordan-woyak jordan-woyak deleted the widescreen-heuristic-fix branch December 30, 2020 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
9 participants