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

Open
wants to merge 2 commits into
base: master
from

Conversation

@jordan-woyak
Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

slx7R4GDZM commented Jan 25, 2020

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

@jordan-woyak

This comment has been minimized.

Copy link
Member Author

jordan-woyak commented Jan 25, 2020

@slx7R4GDZM Can you please provide fifologs demonstrating the problem?

@slx7R4GDZM

This comment has been minimized.

Copy link
Contributor

slx7R4GDZM commented Jan 25, 2020

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 jordan-woyak force-pushed the jordan-woyak:widescreen-heuristic-fix branch from 68a9e7a to da1368e Jan 25, 2020
@jordan-woyak

This comment has been minimized.

Copy link
Member Author

jordan-woyak commented Jan 25, 2020

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

@slx7R4GDZM

This comment has been minimized.

Copy link
Contributor

slx7R4GDZM commented Jan 25, 2020

@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

This comment has been minimized.

Copy link
Member Author

jordan-woyak commented Jan 25, 2020

@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

This comment has been minimized.

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 jordan-woyak force-pushed the jordan-woyak:widescreen-heuristic-fix branch from da1368e to e80fca4 Jan 25, 2020
@jordan-woyak

This comment has been minimized.

Copy link
Member Author

jordan-woyak commented Jan 25, 2020

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

@jordan-woyak jordan-woyak force-pushed the jordan-woyak:widescreen-heuristic-fix branch from e80fca4 to 02e7674 Jan 25, 2020
@slx7R4GDZM

This comment has been minimized.

Copy link
Contributor

slx7R4GDZM commented Jan 25, 2020

@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

This comment has been minimized.

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 jordan-woyak:widescreen-heuristic-fix branch 2 times, most recently from e988752 to 8c9d425 Jan 26, 2020
@slx7R4GDZM

This comment has been minimized.

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

This comment has been minimized.

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 jordan-woyak:widescreen-heuristic-fix branch 2 times, most recently from 32fe221 to 6e268a9 Jan 26, 2020
@jordan-woyak jordan-woyak changed the title WIP - VideoCommon: Tweak widescreen heuristic. VideoCommon: Tweak widescreen heuristic. Jan 26, 2020
@jordan-woyak jordan-woyak force-pushed the jordan-woyak:widescreen-heuristic-fix branch from 6e268a9 to 14eb808 Jan 31, 2020
@iwubcode

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

@jordan-woyak jordan-woyak force-pushed the jordan-woyak:widescreen-heuristic-fix branch from 14eb808 to 7cbb982 Feb 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.