Tutorial Forcing 4:3 display in Wii retail VC injections

Vague Rant

Deceptively cute
OP
Member
Joined
Aug 7, 2008
Messages
2,389
Trophies
0
Location
Melbourne
Website
vaguerant.tumblr.com
XP
2,412
Country
Introduction

As a general rule, when you are running Wii mode software on the Wii U, it is displayed on your TV and GamePad using the aspect ratio configured in the Wii U settings. Wii BC modes inherit their aspect ratio from the Wii U, so if your Wii U is set to 16:9, then so is your vWii, and the Wii U knows to stretch the image output by the Wii to 16:9 to match. Up to a point, this is all fine, but there's one situation which isn't accounted for by this setup: even with the (v)Wii set to 16:9, some Wii games simply do not have widescreen support, and will continue to display a 4:3 image. The Wii U is broadly not prepared for this possibility, so it will continue to display those 4:3 games with an output aspect ratio of 16:9.

Now, Nintendo is not completely oblivious to the fact that some Wii software runs at 4:3. The DMCU microcontroller which receives the Wii image and passes it on to the Wii U for display is responsible for various scaling operations, one of which is a toggle between 4:3 and 16:9 scaling, independent of the Wii U's aspect ratio setting. Some time in about mid-2015, Nintendo pushed an update which used this feature to switch to 4:3 scaling when the user launched a Virtual Console game in Wii mode.

Still, there's plenty of Wii software besides the Virtual Console which only supported 4:3, including many WiiWare and retail disc titles. If you're launching these titles normally via the vWii, you can use a homebrew tool such as angelXwind's WiiU-ARToggle. Nintendont, USB Loader GX and the Nintendo 64 emulator, Not64 all have similar features in order to allow you to switch to 4:3 as needed. Then, when it comes to things like WiiWare injections, you can use FIX94's wiivc_chan_booter to enable 4:3 mode before your title launches (this tool comes bundled with TeconMoon's WiiVC Injector, so you may already be using it without realizing).

But the one scenario in which we have no way to switch to 4:3 is when launching Wii VC injections of 4:3-only retail games. That's what this tutorial aims to address.

Files Required


Tutorial

Note that this tutorial is a somewhat inefficient way to go about this, because existing all-in-one, GUI injection tools don't include this feature, but I'm using them here anyway because they're convenient and people are used to them.

You are here:
SNMEAF-002-stretch.png

  1. Extract the main.dol from the Wii game you wish to inject. Using wit on the command line, you can do wit extract GAMEIMAGE DIRECTORY, e.g. wit extract STEETR.wbfs tetris, then enter the directory you created and find the main.dol under sys.
  2. Copy your main.dol to the wstrt directory.
  3. On the command line, run wstrt patch main.dol --add-section Force43.gct. It should tell you the patch was successful.
  4. Reinsert this patched main.dol into your disc image, e.g. in wit, you would copy the main.dol back into the sys directory where you found it, and then use wit again like so: wit copy DIRECTORY NEWGAMEIMAGE e.g. wit copy tetris Tetris43.wbfs
  5. Build an injection using this new patched image as you normally would in your preferred injection tool, selecting the options you want for this game, etc.
  6. Copy the files over and install the new injection to your Wii U. If you're overwriting a previous install of the same title, you may or may not need to delete the original first.
  7. Launch ftpiiu_everywhere and connect to it using your PC FTP client. Navigate to your installed title (storage_mlc or storage_usb, usr/title/00050002/, then the title ID of your game) and enter the code directory.
  8. Download the fw.img and htk.bin files into your nfs2iso2nfs directory.
  9. Obtain wii_common_key.bin and place it in your nfs2iso2nfs directory.
  10. Create an empty file (e.g. using Windows Notepad) named game.iso (this is the really gross and lazy part of the tutorial where we horribly misuse nfs2iso2nfs)
  11. Run nfs2iso2nfs -enc -fwimg fw.img -homebrew -key wii_common_key.bin on the command line. It will tell you about making various homebrew patches to your fw.img and then throw an error about your game.iso being a stupid lie that doesn't work because we're not interested in that part anyway. The error is fine!
  12. Upload your newly patched fw.img back into the code directory for the title you're working on.
  13. Launch your injected title, now with 4:3 support!

You are here:
SNMEAF-002.png

Conclusion

Hope it worked out for you, if not, that's a shame but I don't have any further ideas to help you. Everything within this tutorial could easily be automated, so those all-in-one injection tools could definitely do all this work for you if that functionality were added to them.

[citation needed]

All of this work is really down to FIX94's efforts--we're combining their DMCU register poke from wiivc_chan_booter with their AHBPROT-removing patch for fw.img (which is required as the DMCU's registers aren't supposed to be accessible to the PowerPC CPU).

If anybody's interested, here's what's going on in the 4:3 forcing GCT. It's a quick ASM hack using code directly from wiivc_chan_booter:
Code:
3D40CD80  lis   r10, 0xcd80
3D203000  lis   r9, 0x3000
614A06A0  ori   r10, r10, 0x6a0
61290002  ori   r9, r9, 2
912A0000  stw   r9, 0(r10)
7C0006AC  eieio 
394A0008  addi  r10, r10, 8
812A0000  lwz   r9, 0(r10)
7C0004AC  sync  0
61290002  ori   r9, r9, 2
912A0000  stw   r9, 0(r10)
7C0006AC  eieio
wiivc_chan_booter is licensed under MIT, so here is a link to those license terms in case anybody is worried that 12 lines of borrowed assembly is going to bring down society.
 

Attachments

  • Force43.zip
    213 bytes · Views: 255
Last edited by Vague Rant,

Vague Rant

Deceptively cute
OP
Member
Joined
Aug 7, 2008
Messages
2,389
Trophies
0
Location
Melbourne
Website
vaguerant.tumblr.com
XP
2,412
Country
Great job man
Do you think something like that could be made for video mode? for output in 480p or 720p
There is this fork of hbl2hbc which switches to 480p when you switch to vWii mode, but that doesn't do anything for Wii VC.

I'm sure something similar could be done for Wii VC, but it wouldn't really be anything like this 4:3-forcing hack, as this is all happening on the Wii side, while resolution changes happen on the Wii U side. It might be possible to patch the cafe2wii image to switch resolutions, similar to what mive's hbl2hbc fork does.
 
  • Like
Reactions: vbarros22

mive

Well-Known Member
Member
Joined
Jul 19, 2018
Messages
252
Trophies
0
Age
38
XP
577
Country
Germany
you could try with something like
Code:
void switch_video_mode(void)
{
        unsigned int avm_handle;
    OSDynLoad_Acquire("avm.rpl", &avm_handle);
    int (*AVMSetTVScanResolution)(int r3);
    int (*AVMGetCurrentPort)(int *port);
        int (*AVMSetTVAspectRatio) (int ar);
        OSDynLoad_FindExport(avm_handle, 0, "AVMSetTVScanResolution", &AVMSetTVScanResolution);
    OSDynLoad_FindExport(avm_handle, 0, "AVMGetCurrentPort", &AVMGetCurrentPort);
        OSDynLoad_FindExport(avm_handle, 0, "AVMSetTVAspectRatio", &AVMSetTVAspectRatio);
        int outPort = 0;
    AVMGetCurrentPort(&outPort);
        if(outPort > 3) outPort = 0;
        int wantRes = 3; // 480p

        if (outPort == 2 || outPort == 3)
        {
            return;
        }
        else
        {
            AVMSetTVScanResolution(wantRes);
            // 0 seems 4:3, 1 seems 16:9
            AVMSetTVAspectRatio(0);
            usleep(20000);
            return;
        }

}

int __entry_menu(int argc, char **argv)
{
    switch_video_mode();
    //! *******************************************************************
    //! *                 Jump to our application                    *
    //! *******************************************************************
    return Menu_Main();
}
in sign_c2w_patcher (entry.c).
but note:
https://maschell.github.io/WiiUPluginSystem/dev_using_system_functions

also maybe remove AVMSetTVAspectRatio(0); if you dont want to change aspect ratio there
 

jr299

Member
Newcomer
Joined
Mar 20, 2020
Messages
22
Trophies
0
Age
23
XP
60
Country
United States
because this method involves inserting a gct file into the inject,
would it be possible to insert cheats into wii vc injects too?
 
General chit-chat
Help Users
  • T @ trimesh:
    Yeah, the most obviously deranged indication of this are the heavy-duty console warriors
    Gift
  • KenniesNewName @ KenniesNewName:
    It happens outside of gaming it's just life
    Gift
  • T @ trimesh:
    Yeah, fanbois will fanboi
    Gift
  • KenniesNewName @ KenniesNewName:
    Kinda makes me sad everyone is believing in emulation gives less of a reason for consoles to exist
    Gift
  • T @ trimesh:
    I appreciate the convenience of emulation - but at the same time there is a feeling you get from using original hardware that's hard to match.
    Gift
  • KenniesNewName @ KenniesNewName:
    I feel like consoles will always be here just less of a demand
    Gift
  • KenniesNewName @ KenniesNewName:
    Next gen will probably be all portable
    Gift
  • T @ trimesh:
    Some things (like Super Famicom games) just feel right when you play them using the original hardware and a CRT
    Gift
  • KenniesNewName @ KenniesNewName:
    The PS tablet
    Gift
  • mthrnite tempBOT: @ mthrnite
    switches the box from tv to game
    Gift
  • T @ trimesh:
    Not so sure about that - the tendency for "graphics uber alles" tends to lead to very high power consumption
    Gift
  • KenniesNewName @ KenniesNewName:
    If you look at what's now portability graphics are catching up to console quality
    Gift
  • KenniesNewName @ KenniesNewName:
    Nintendy is a huge example of not everyone caring about powerful specs most that do will be hardcore PC players anyway
    Gift
  • T @ trimesh:
    The thing is that the IATA rules impose a pretty hard limit of 100Wh on battery sizes for lithium batteries - and it doesn't look like Li is going away soon
    Gift
  • T @ trimesh:
    So if you want (say) 4 hours of runtime you need a maximum system-level power consumption of 25W
    Gift
  • KenniesNewName @ KenniesNewName:
    Yeah but we already have AAA titles looking fine on tablet form 1080p displays
    Gift
  • KenniesNewName @ KenniesNewName:
    Human eye can only tell so much of a difference
    Gift
  • T @ trimesh:
    For reference, the PS5 is rated at 350W and the Xbox series X at 275W - and that's console only, without any display
    Gift
  • KenniesNewName @ KenniesNewName:
    But the future always holds performance never know what the aliens will donate from their left over tech
    Gift
  • T @ trimesh:
    Maybe :) - but batteries have turned out to be a pretty hard problem
    Gift
  • KenniesNewName @ KenniesNewName:
    Like I said most that will truly care will already be hard core gaming pcers
    Gift
  • T @ trimesh:
    And DF subscribers :)
    Gift
  • KenniesNewName @ KenniesNewName:
    I bet you could find a neighbor with a ps5 and they'd have no idea what the word spec means
    Gift
  • T @ trimesh:
    Yeah probably - people on forums seem to care a lot, but they are heavily self-selected
    Gift
  • KenniesNewName @ KenniesNewName:
    Most on forums try to get a good learning of actual tech
    Gift
    KenniesNewName @ KenniesNewName: Most on forums try to get a good learning of actual tech