2022/08/01
If you are using GRRLIB for graphics in your Wii/GameCube homebrew, you may have noticed that by default, the aspect ratio is, quite frankly, atrocious. For some reason, even after a decade, no one has bothered to fix this issue. If you do like your squares not to be rectrangles, however, follow along to correct the aspect ratio to what I would call an "acceptable" level.
I found this patch on the WiiBrew Wiki. All credits go to "CarstenK". Whoever you are, I am indebted! They link to the GRRLIB forums and eventually propose this fix for GRRLIB:
f32 vcorrection = (rmode->xfbHeight-426)/2; //fudge factor
f32 hcorrection = 0.0f;
if( CONF_GetAspectRatio() ) {
hcorrection = (rmode->xfbHeight-(9.0f*rmode->xfbHeight/16.0f))/2;
}
guOrtho(orthographic,0.0f-vcorrection,rmode->xfbHeight+vcorrection,
0.0f-hcorrection,rmode->fbWidth+hcorrection,0.0f,300.0f); //tblr
I will not pretend to know what is going on here, but all I can tell you is how to actually apply this patch to GRRLIB, even the latest version (the patch was written in 2008, so 14 years ago -- yikes)
- Go to the directory on your computer where the GRRLIB source code lives. This is usually
C:\grr\GRRLIB\GRRLIB
(Linux users, I expect you to know where your GRRLIB installation is). - On line 184 (or wherever it is in your version of GRRLIB), find the function call to
guOrtho
. - Replace the entire line with the code in the snippet above.
Congratulations! This should fix your aspect ratio issues. I have found that it is unfortunately still not quite perfect (some horizontal pixels are still missing), but it is still much better than the default code.
I have only tested this code using Dolphin set to NTSC-U. In the PAL setting, the vertical resolution is increased and the aspect ratio looks really weird. I will test the code on an actual GameCube once my SD Gecko arrives, and then I will update this article.