Hacking Unity with WiiU

  • Thread starter Thread starter handy333
  • Start date Start date
  • Views Views 38,336
  • Replies Replies 163

(Wow, it was I that made this thread. I don't even remember it. Anyways...) having trouble editing...

That's interesting the way you did it. You may know more than I do so bare with me.

In the game I'm working on, I have a script that handles inputs in this fashion:

C#:
[REDACTED]

The code here was written during the beginning of development so it's probably flawed but it works well. This is how I access the inputs:
Code:
[REDACTED]

What I have here works on both in CEMU and on Hardware but in the past I have had trouble with CEMU getting certain inputs to work.
Here's some things to check:
1744154657543.png


The Emulated Controllers options sometime give me input errors. Since I play Tekken I swap the face[?] buttons to match the ps3 and flip flopping between these
cause some issues when playing other games.
With the Controllers options you may have to re-add the api. I'd try them all.

I kind of ran out of steam here. Let me know if there is something I missed. I'll be sure to take another look.

The areas marked with *, You have to set in the Player settings at least 1 wiimote to get it to work. This took me forever to figure out.

EDIT:
I think I posted illegal code...
 
Last edited by handy333,

(Wow, it was I that made this thread. I don't even remember it. Anyways...) having trouble editing...

That's interesting the way you did it. You may know more than I do so bare with me.

In the game I'm working on, I have a script that handles inputs in this fashion:

C#:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.WiiU;

public class GameInputManager : MonoBehaviour{
    public static GameInputManager instance; // Probably not the best idea but it works for me.
    bool modifiers; // Options for altering inputs like swapping the A and B buttons. This isn't important...
  
    // WiiU
    public GamePad _gamepad = GamePad.access;
  
    public bool _all, _of, _the, _games, _inputs;
  
    void Awake(){
        instance = this; // Probably not the best idea but it works for me.
        _gamepad.StopMotor(); // Following the example in the reference guide.
    }

    void Update(){
        // [some unimportant stuff]

        if(Application.isEditor) TestInputs(); else WiiuInputs(); // The Main Deal.      
        if(A_Setup.instance.gameSetupDone) GameInput.UpdateInput(); // Inputs during gameplay.
    }
  
    // I never got around to moving these to the top. I'm pretty much rewriting the script but I'm trying to keep everything in order.
    enum WiiUControllerIndex { GAMEPAD = 0, PROCONTROLLER = 1 }; // For swapping between inputs during gameplay. *MORE ON THIS ON THE OUTSIDE.
    WiiUControllerIndex _wiiuControllerIndex = WiiUControllerIndex.GAMEPAD;
  
    void WiiuInputs(){
        GamePadState _state = _gamepad.state;
        ProControllerState _proControllerState = Remote.Access(0).state.pro; // *MORE ON THIS ON THE OUTSIDE.
        /*
        code to swap between different controllers during gameplay.
        not too important
        */

        switch(_wiiuControllerIndex){
             case WiiUControllerIndex.GAMEPAD:
                 if(_state.gamePadErr == GamePadError.None){
                     _all           = _gamepad.state.IsTriggered(GamePadButton.Up);
                     _of           = _gamepad.state.IsTriggered(GamePadButton.Down);
                     _the         = _gamepad.state.IsTriggered(GamePadButton.Left);
                     _games   = _gamepad.state.IsTriggered(GamePadButton.Right);
                     _inputs    = _gamepad.state.IsPressed(GamePadButton.Up);
                 } else ; // not inportant for context
                 break;
             case WiiUControllerIndex.PROCONTROLLER:
                 _all         = _proControllerState.IsTriggered(ProControllerButton.Up);
                 _of         = _proControllerState.IsTriggered(ProControllerButton.Down);
                 _the       = _proControllerState.IsTriggered(ProControllerButton.Left);
                 _games = _proControllerState.IsTriggered(ProControllerButton.Right);
                 _inputs  = _proControllerState.IsPressed(ProControllerButton.Up);
                 break;
         }
    }

    // other functions and stuff
}

The code here was written during the beginning of development so it's probably flawed but it works well. This is how I access the inputs:
Code:
GameInputManager m_input;
void Start(){ m_input = GameInputManager.instance; } // Can't use lambda [=>] with this unity version. Irritating...
if(m_input._gamepadSystem_Pause) FUNCTION();

What I have here works on both in CEMU and on Hardware but in the past I have had trouble with CEMU getting certain inputs to work.
Here's some things to check:
View attachment 496794

The Emulated Controllers options sometime give me input errors. Since I play Tekken I swap the face[?] buttons to match the ps3 and flip flopping between these
cause some issues when playing other games.
With the Controllers options you may have to re-add the api. I'd try them all.

I kind of ran out of steam here. Let me know if there is something I missed. I'll be sure to take another look.

The areas marked with *, You have to set in the Player settings at least 1 wiimote to get it to work. This took me forever to figure out.
Post automatically merged:


just a ping.
I haven’t tested the game on retail hw yet but it’s weird because for example, touch/click works and I can move through UI navigation (with left joystick), but the rest of the inputs don’t work on the emulator and I don’t see the issue anywhere. :/
 
I haven’t tested the game on retail hw yet but it’s weird because for example, touch/click works and I can move through UI navigation (with left joystick), but the rest of the inputs don’t work on the emulator and I don’t see the issue anywhere. :/
Sorry I wasn't able to help but let me try something. I'm going to do a little experiment.


Edit:
Code:
...
    public static bool ExtremeTest(InputTest input){
        GamePadState state = GamePad.access.state;

        #if [REDACTED]
        switch(input){
        case InputTest.A: return [REDACTED];
        case InputTest.B: return [REDACTED];
        case InputTest.C: return [REDACTED];
        case InputTest.D: return [REDACTED];
        case InputTest.E: return [REDACTED];
        case InputTest.F: return [REDACTED];
        case InputTest.G: return [REDACTED];
        }
        #endif
        return false;
    }
}

public enum InputTest{ A, B, C, D, E, F, G }

Update Function
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

1744177780959.png


I have put together a bit of a simulation of your input code (which is more fantastic and compact than what I have going on) and everything works in CEMU, except for the X button.
Now I'm going to try it on actual hardware to see if it'll do the same thing.

Final Edit:
Same thing on hardware. But I also noticed that a C Input in my also doesn't work.

Stealth Edit:
False alarm. In game inputs C and Touch [X & Y on the gamepad] were swapped in CEMU for some reason. Touch is supposed to be the gamepad's touch screen but I have it mapped to the NORTH button for debugging.
But what still stands is the gamepad B button isn't being detected.

Stealth Edit2:
I an idiot.
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

Code works perfectly after fixing this issue.
 
Last edited by handy333,
Sorry I wasn't able to help but let me try something. I'm going to do a little experiment.


Edit:
Code:
...
    public static bool ExtremeTest(InputTest input){
        GamePadState state = GamePad.access.state;

        #if UNITY_WIIU
        switch(input){
        case InputTest.A: return state.IsPressed(GamePadButton.A);
        case InputTest.B: return state.IsPressed(GamePadButton.B);
        case InputTest.C: return state.IsPressed(GamePadButton.X);
        case InputTest.D: return state.IsPressed(GamePadButton.Y);
        case InputTest.E: return state.IsPressed(GamePadButton.ZL);
        case InputTest.F: return state.IsPressed(GamePadButton.ZR);
        case InputTest.G: return state.IsPressed(GamePadButton.Plus);
        }
        #endif
        return false;
    }
}

public enum InputTest{ A, B, C, D, E, F, G }

Update Function
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

View attachment 496840

I have put together a bit of a simulation of your input code (which is more fantastic and compact than what I have going on) and everything works in CEMU, except for the X button.
Now I'm going to try it on actual hardware to see if it'll do the same thing.

Final Edit:
Same thing on hardware. But I also noticed that a C Input in my also doesn't work.

Stealth Edit:
False alarm. In game inputs C and Touch [X & Y on the gamepad] were swapped in CEMU for some reason. Touch is supposed to be the gamepad's touch screen but I have it mapped to the NORTH button for debugging.
But what still stands is the gamepad B button isn't being detected.

Stealth Edit2:
I an idiot.
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

Code works perfectly after fixing this issue.
No idea why but my code works in an independent scene but it doesn't when the event system is focusing an item. Thanks anyway for the support! ^^
Post automatically merged:

Sorry I wasn't able to help but let me try something. I'm going to do a little experiment.


Edit:
Code:
...
    public static bool ExtremeTest(InputTest input){
        GamePadState state = GamePad.access.state;

        #if UNITY_WIIU
        switch(input){
        case InputTest.A: return state.IsPressed(GamePadButton.A);
        case InputTest.B: return state.IsPressed(GamePadButton.B);
        case InputTest.C: return state.IsPressed(GamePadButton.X);
        case InputTest.D: return state.IsPressed(GamePadButton.Y);
        case InputTest.E: return state.IsPressed(GamePadButton.ZL);
        case InputTest.F: return state.IsPressed(GamePadButton.ZR);
        case InputTest.G: return state.IsPressed(GamePadButton.Plus);
        }
        #endif
        return false;
    }
}

public enum InputTest{ A, B, C, D, E, F, G }

Update Function
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

View attachment 496840

I have put together a bit of a simulation of your input code (which is more fantastic and compact than what I have going on) and everything works in CEMU, except for the X button.
Now I'm going to try it on actual hardware to see if it'll do the same thing.

Final Edit:
Same thing on hardware. But I also noticed that a C Input in my also doesn't work.

Stealth Edit:
False alarm. In game inputs C and Touch [X & Y on the gamepad] were swapped in CEMU for some reason. Touch is supposed to be the gamepad's touch screen but I have it mapped to the NORTH button for debugging.
But what still stands is the gamepad B button isn't being detected.

Stealth Edit2:
I an idiot.
Code:
void Update(){
        if(GameInputManager.ExtremeTest(InputTest.A)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "A";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "B";
        >>> if(GameInputManager.ExtremeTest(InputTest.B)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "C";
        if(GameInputManager.ExtremeTest(InputTest.D)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "D";
        if(GameInputManager.ExtremeTest(InputTest.E)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "E";
        if(GameInputManager.ExtremeTest(InputTest.F)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "F";
        if(GameInputManager.ExtremeTest(InputTest.G)) GameObject.FindWithTag("DebugText").GetComponent<UnityEngine.UI.Text>().text = "G";
}

Code works perfectly after fixing this issue.
found the issue:

- on build my inputs were not working due to JIT compile in AOT-Only mode in that exact script which makes it to be disabled by unity. Using odin serializer to have AOT runtime references fixed the issue and input went back to normal ^^
 
Last edited by Manurocker95,
  • Like
Reactions: handy333
Hey guys! I've already managed to make two homebrew ports for WiiU using Unity but I had problems like the game crashes when calling a generic method (and only solution for this is to get rid of genericness).
Right now I'm trying to port another game made with Unity but it crashes instantly when launching on WiiU/Cemu.
Do you know any other reasons why the game might crash?
(I use CafeSDK 2.12.13 and Unity 2017.4.40f1)
 
Hey guys! I've already managed to make two homebrew ports for WiiU using Unity but I had problems like the game crashes when calling a generic method (and only solution for this is to get rid of genericness).
Right now I'm trying to port another game made with Unity but it crashes instantly when launching on WiiU/Cemu.
Do you know any other reasons why the game might crash?
(I use CafeSDK 2.12.13 and Unity 2017.4.40f1)
I know some time back I had an issue with Cemu crashing because files had square brackets in the name. The weird thing is that on the Wii U it wouldn't crash but the game would hang because a resource wouldn't load because of the file name.

Sometimes for me Cemu crashes but the Wii U won't and that's usually because in Unity I would have a minor error and Cemu would flip out on launch.

I hope that helps.
 
I know some time back I had an issue with Cemu crashing because files had square brackets in the name. The weird thing is that on the Wii U it wouldn't crash but the game would hang because a resource wouldn't load because of the file name.

Sometimes for me Cemu crashes but the Wii U won't and that's usually because in Unity I would have a minor error and Cemu would flip out on launch.

I hope that helps.
Thanks, I'll try.
It's just strange to me that the code works on any other platform, but on WiiU the same code causes a crash.
 
How big is the game? Also is it possible to stop the game's execution at the start?
It's only ±150 MB.
The previous ones at least loaded and I could understand at which moment the game crashes in order to fix it in the code.
But the current one is doesn't even boot.
 
It's only ±150 MB.
The previous ones at least loaded and I could understand at which moment the game crashes in order to fix it in the code.
But the current one is doesn't even boot.
When you build the game, do you use the WiiU Cafe SDK Deluxe program?
Is it a 3d game with lots of effects?
 
When you build the game, do you use the WiiU Cafe SDK Deluxe program?
Is it a 3d game with lots of effects?
I use unpacked build for testing in Cemu and Cafe SDK Deluxe for building WUP for WiiU.
It is a 2D game without complex shaders.
 
Does cemu dump a crash log? I've never been good at reading them but they have helped me a couple of times.
Yes and there is nothing useful there.
Post automatically merged:

Yes and there is nothing useful there.
Well I tested the master build and maybe there will be something if i will use development build
 
Hey guys! I've already managed to make two homebrew ports for WiiU using Unity but I had problems like the game crashes when calling a generic method (and only solution for this is to get rid of genericness).
Right now I'm trying to port another game made with Unity but it crashes instantly when launching on WiiU/Cemu.
Do you know any other reasons why the game might crash?
(I use CafeSDK 2.12.13 and Unity 2017.4.40f1)
The issue is mainly due to AOT. if you make a simple log catcher, you will see that WiiU can't handle any generic method or type not pre-defined. This means that if you are using void TriggerEvent<T> that defines a UnityEvent<T>, for example, you need to make a definition for every type of every event you make like TriggerStringEvent that uses UnityEvent<string>.

This doesn't happen on other platforms because they can handle these things by using IL2CPP but wii u doesn't as Unity didn't support that backend. Btw, this issue also happens on platforms like PlayStation Vita and PlayStation 3. It's a pain to debug as Dictionaries, List, unity events and types need to have a defined type. You can't initialize types dynamically either, btw. I have tons of generic stuff in my game core and I spent days just fixing those AOT calls. The easiest way to debug them is having a devkit but as you are using Cemu as debugger, make a log catcher and keep saving them by input/time and use those as debugging tool.

Edit: Oh, I forgot to say that even if 2017.4 LTS works, the most stable version is 2017.1.3p3. You will save time by using that version instead as 2017.4.40LTS leads to random crashes even using latest CAFE SDK.
 
Last edited by Manurocker95,
  • Like
Reactions: gomus and handy333

Site & Scene News

Popular threads in this forum