1. Vague Rant

    OP Vague Rant Deceptively cute
    Member

    Joined:
    Aug 7, 2008
    Messages:
    2,301
    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.
     

    Attached Files:

    Last edited by Vague Rant, Oct 19, 2020
  2. huma_dawii

    huma_dawii GBAtemp Psycho!
    Member

    Joined:
    Apr 3, 2014
    Messages:
    3,756
    Country:
    United States
    I just adjust the setting on my monitor, is there any difference?
     
    Scott_pilgrim likes this.
  3. Vague Rant

    OP Vague Rant Deceptively cute
    Member

    Joined:
    Aug 7, 2008
    Messages:
    2,301
    Country:
    This method will also make the game display in 4:3 on the Wii U GamePad, but otherwise adjusting on the monitor should do just fine.
     
  4. huma_dawii

    huma_dawii GBAtemp Psycho!
    Member

    Joined:
    Apr 3, 2014
    Messages:
    3,756
    Country:
    United States
    Thanks for clarifying that! Is good to have a more permanent option i think!
     
  5. vbarros22

    vbarros22 GBAtemp Regular
    Member

    Joined:
    Jun 20, 2017
    Messages:
    187
    Country:
    Brazil
    Great job man
    Do you think something like that could be made for video mode? for output in 480p or 720p
     
  6. Vague Rant

    OP Vague Rant Deceptively cute
    Member

    Joined:
    Aug 7, 2008
    Messages:
    2,301
    Country:
    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.
     
    vbarros22 likes this.
  7. mive

    mive GBAtemp Regular
    Member

    Joined:
    Jul 19, 2018
    Messages:
    124
    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
     
  8. jr299

    jr299 Member
    Newcomer

    Joined:
    Mar 20, 2020
    Messages:
    20
    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?
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - injections, Forcing, display