Tutorial  Updated

Forcing 4:3 display in Wii retail VC injections

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: 378
Last edited by Vague Rant,

Vague Rant

Deceptively cute
OP
Member
Joined
Aug 7, 2008
Messages
2,463
Trophies
2
Location
Melbourne
Website
vaguerant.tumblr.com
XP
3,302
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
40
XP
598
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
23
Trophies
0
Age
25
XP
92
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?
 

Shahaan

Well-Known Member
Member
Joined
Dec 29, 2018
Messages
103
Trophies
0
Age
18
Location
South Africa,Durban
XP
918
Country
South Africa
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:
View attachment 229819

  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:
View attachment 229818

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.
At the end I get told the AES key is the wrong size and it aborts, any ideas?
 

Keylogger

Well-Known Member
Member
Joined
May 3, 2006
Messages
2,639
Trophies
1
Age
34
Website
Visit site
XP
6,634
Country
France
Why do we need the htk.bin file as we dont seem to use it at all?
Post automatically merged:

I try to use this to patch MarioParty 8 into 4:3 to delete these black bars in game but i've followed the guide and I have an error when launching patched game
Error code 160-2793

This is the output from cmd:
Searching for AES key file...
AES key file found!
Wii common key found in source code!

Checking fw.img's revision number...
OK, revision 590 detected.

Patching fw.img.
Fakesign patching: Nothing to patch.

Homebrew-related patches:
* Disabling AHBPROT...
* Disabling MEMPROT...
* Nintendont patch 1...
* Nintendont patch 2...
* Nintendont patch 3...
Homebrew patching finished... (Patches applied: 5)


Read partition table...


Exception non gérée : System.IndexOutOfRangeException: L'index se trouve en dehors des limites du tableau.
à nfs2iso2nfs.Program.manipulateISO(String InFile, String OutFile, Boolean enc)
à nfs2iso2nfs.Program.Main(String[] args)
Post automatically merged:

ÉDIT: ok the game starts but it always in 16:9 with these fucking black bars
 
Last edited by Keylogger,

EuroMIX

Active Member
Newcomer
Joined
Jan 23, 2018
Messages
27
Trophies
0
Age
36
XP
193
Country
United Kingdom
Thanks for the guide. Trying to get this working with Warioware: Smooth Moves, but I'm stuck at step 3.

I get the following error, but your guide doesn't explain what to do in this case, and I can't find any information online about what to do:
C:\Program Files\Wiimm\SZS>wstrt patch main.dol --add-section Force43.gct PATCH main.dol * File not modified: DOL:main.dol

Even though your guide didn't state to do this, I copied the Force43.gct file over to the same directory under the assumption it would be needed for the patch to work.
 

CrazySquid

Well-Known Member
Member
Joined
May 27, 2017
Messages
220
Trophies
0
XP
839
Country
It's possible to do something like this to turn deflicker off on Wii Game Injects?
It should be possible, but this method doesn't work for that, I just tried. You need to manually patch every single game via the main.dol, which is a pain. I was hoping to get an universal fw.img that could remove deflicker just by replacing the fw.img file.
 
  • Like
Reactions: MG4M3R

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: Like not emulating the entire SNES but just a loader and the enhancement chips perhaps even...