Hacking New Classic Controller Hacks

  • Thread starter Thread starter Vague Rant
  • Start date Start date
  • Views Views 244,561
  • Replies Replies 687
  • Likes Likes 42
I don't, I'd have to look
Heres some information.
Do you know any sources that would have knowledge about WPAD and any low level hacking then?
 

Attachments

  • Screenshot 2024-12-15 194422.png
    Screenshot 2024-12-15 194422.png
    36 KB · Views: 38
That's odd! Has he tried to see all instances that write to these locations? What if there's other functions writing stuff to another location that is also used? So in terms of the WPAD problems, is it mostly it not working correctly or finding it?
 
That's odd! Has he tried to see all instances that write to these locations? What if there's other functions writing stuff to another location that is also used? So in terms of the WPAD problems, is it mostly it not working correctly or finding it?
This is what Vague said when they attempted the hack
I did look into Mario Strikers Charged and was having a lot of trouble, then realized it's another Next Level Games ... game. I've looked at three of theirs so far including Strikers: one that I completely failed at, and the other being Punch-Out!! The major quirk of NLG titles is that they all use the low-level controller report data rather than the more "friendly" processed data which almost all other games use.
There may be more locations and functions, but the tutorial is limited to KPADRead, so i sadly cannot answer all of that. Apologies.
I think the guy who attempted it wasnt able to look at any other functions because of the CC hack tutorial being limited.
Punch out used low level processing data aswell. Heres what vague said about punch out.
I originally picked up this game to investigate for a CC hack because it seemed like an easy one with its NES-style, sideways Wiimote controls. However, as mentioned in the General Notes, Punch-Out!! directly reads the WPAD controller reports rather than the more human-readable, parsed KPAD data which is what I'm familiar with. Whoops. Breaking down the code, the first C2 is pretty standard calc_dpd_variable() hacking. Because it only shows up in menus anyway, I don't have the sleep timer enabled for this game, the pointer is just always on.

On to the interesting part, the second C2 patches the WPAD __parse_cl_data() function. This function is used by several WPAD controller packet types to handle the Classic Controller portion of the report. Without getting into Starlet/ARM territory, this is about as low-level as you can get to read (or modify) the Classic Controller handling. Technically, it's not true that Punch-Out!! doesn't use KPAD for button reads, because the Home Button Menu still does. However, redirecting the Classic button reports into the Wiimote itself via WPAD, we fix both at the same time, since KPAD is ultimately reading the data it gets from WPAD.

In previous hacks, the way D-Pad Emulation is implemented is that I check the KPAD analog stick values and judge whether they've moved far enough to trigger adding the button presses to the KPAD button values. With this game's low-level button handling, this would require a hack using the raw, unprocessed analog stick data from WPAD, and currently I don't know where that data is or what it looks like.
 
I'd be down to help but not too soon, possibly sometime in the next year. I deleted my Discord but I made a new one to talk to a few people, if you want, you can add me: rogamer97_
 
I'd be down to help but not too soon, possibly sometime in the next year. I deleted my Discord but I made a new one to talk to a few people, if you want, you can add me: rogamer97_
Okay, that sounds great! You should talk with Vague Rant though, hes the person who makes these hacks. If you guys could work together in the future, you could get the hack done possibly! His discord is invagrante
 
Okay, sweet! Also, dumb question, I need RiiConnect24 to use these two channels, right? Just to test everything and make sure there's no problems
 
Okay, sweet! Also, dumb question, I need RiiConnect24 to use these two channels, right? Just to test everything and make sure there's no problems
Its WiiLink now, but yes. If you want to test the news channel 1 and 2 buttons in the slideshow mode (adding more time to the news) you will need Wiilink functionality to test all the buttons
 
Okay! Getting it. These codes will be for the latest version of the channels (v7). Surprisingly, I don't think they're region free but I kinda doubt addresses will shift
 
Alright. bye for now! Thanks for the help. One more thing: your discord isnt accepting friend requests lol
 
Noted! Thank you and see you soon. EDIT: Now allows FR
Post automatically merged:

@awesomeee Soooo, have you tried your codes for News Channel and Forecast Channel in an original WAD? For some reason, running codes in the WiiLink patched ones cause a blackscreen, even if the Gecko Code is a single line writing the original instruction of an address. I'm not sure why this happens and I can't bother for now. Probably another day, maybe if modifying the WAD to add the code it works, but it's a boring process.

Because of this, I can't properly test them, so for now, I'll drop the codes. ZL and ZR will behave as - and + too since I ported it from my Mii Channel code. If you can get it to work, let me know, and tell me if the control is good.

News Channel v7 (Working all region)
Classic Controller Support [Ro]
04144130 60000000
04143D8C 48000010
04143DD4 48000030
04144060 48000030
C21450EC 00000013
3D80801F A18CE4DA
A0E30000 718B0010
41820008 60E70800
718B0040 41820008
60E70400 718B0600
41820008 60E70010
718B3000 41820008
60E71000 718B0800
41820008 60E78000
718B008C 41820008
60E70200 718B0020
41820008 60E70100
718B0001 41820008
60E70008 718B4000
41820008 60E70004
718B0002 41820008
60E70001 718B8000
41820008 60E70002
60000000 00000000
C2144134 0000001C
4800001D 3CB020C5
BC6D9168 BF666666
BFD9999A 00000000
00000000 7D6802A6
C07E0070 C08B0000
39800002 895EFFFC
2C0A0000 40820014
898B0010 2C0C0000
40810008 398CFFFF
998B0010 2C0C0001
40820004 2C0A0000
40820020 2C0C0000
41820020 895E005F
2C0A0008 4082000C
C00B0014 C04B0014
D05E0020 D01E0024
C01E0020 C03E0024
C05E006C EC420132
C0AB0008 C0CB000C
EC00102A C08B0004
EC630132 EC21182A
FC003040 41800014
FCC03050 FC003040
41810008 D01E0020
FC012840 41800014
FCA02850 FC012840
41810008 D03E0024
60000000 00000000
C2144138 00000004
9BFEFFFC 899E005F
2C0C0008 40820008
3BE00002 9BFE005E
60000000 00000000
C2143E20 00000008
8983005F 2C0C0008
4082002C 8983FFFC
2C0C0000 40820020
4800000D 3F800000
BE800000 7D8802A6
C06C0000 D0610008
C04C0004 D041000C
60000000 00000000

Forecast Channel v7 (Working all region)
Classic Controller Support [Ro]
0412B4F0 60000000
0412B14C 48000010
0412B194 48000030
0412B420 48000030
C212C4AC 00000013
3D80801D A18C7382
A0E30000 718B0010
41820008 60E70800
718B0040 41820008
60E70400 718B0600
41820008 60E70010
718B3000 41820008
60E71000 718B0800
41820008 60E78000
718B008C 41820008
60E70200 718B0020
41820008 60E70100
718B0001 41820008
60E70008 718B4000
41820008 60E70004
718B0002 41820008
60E70001 718B8000
41820008 60E70002
60000000 00000000
C212B4F4 0000001C
4800001D 3CB020C5
BC6D9168 BF666666
BFD9999A 00000000
00000000 7D6802A6
C07E0070 C08B0000
39800002 895EFFFC
2C0A0000 40820014
898B0010 2C0C0000
40810008 398CFFFF
998B0010 2C0C0001
40820004 2C0A0000
40820020 2C0C0000
41820020 895E005F
2C0A0008 4082000C
C00B0014 C04B0014
D05E0020 D01E0024
C01E0020 C03E0024
C05E006C EC420132
C0AB0008 C0CB000C
EC00102A C08B0004
EC630132 EC21182A
FC003040 41800014
FCC03050 FC003040
41810008 D01E0020
FC012840 41800014
FCA02850 FC012840
41810008 D03E0024
60000000 00000000
C212B4F8 00000004
9BFEFFFC 899E005F
2C0C0008 40820008
3BE00002 9BFE005E
60000000 00000000
C212B1E0 00000008
8983005F 2C0C0008
4082002C 8983FFFC
2C0C0000 40820020
4800000D 3F800000
BE800000 7D8802A6
C06C0000 D0610008
C04C0004 D041000C
60000000 00000000


Adds Classic Controller support to News Channel Forecast Channel. Wiimote will still work as normal with no problems. Custom code, not reusing official code. It is very accurate to the Wii Menu control. Works in any region

Maybe at some point we could do it for all WIi channels and release it as a pack
 
Last edited by Ro_,
Noted! Thank you and see you soon. EDIT: Now allows FR
Post automatically merged:

@awesomeee Soooo, have you tried your codes for News Channel and Forecast Channel in an original WAD? For some reason, running codes in the WiiLink patched ones cause a blackscreen, even if the Gecko Code is a single line writing the original instruction of an address. I'm not sure why this happens and I can't bother for now. Probably another day, maybe if modifying the WAD to add the code it works, but it's a boring process.

Because of this, I can't properly test them, so for now, I'll drop the codes. ZL and ZR will behave as - and + too since I ported it from my Mii Channel code. If you can get it to work, let me know, and tell me if the control is good.

News Channel v7 (Working all region)
Classic Controller Support [Ro]
04144130 60000000
04143D8C 48000010
04143DD4 48000030
04144060 48000030
C21450EC 00000013
3D80801F A18CE4DA
A0E30000 718B0010
41820008 60E70800
718B0040 41820008
60E70400 718B0600
41820008 60E70010
718B3000 41820008
60E71000 718B0800
41820008 60E78000
718B008C 41820008
60E70200 718B0020
41820008 60E70100
718B0001 41820008
60E70008 718B4000
41820008 60E70004
718B0002 41820008
60E70001 718B8000
41820008 60E70002
60000000 00000000
C2144134 0000001C
4800001D 3CB020C5
BC6D9168 BF666666
BFD9999A 00000000
00000000 7D6802A6
C07E0070 C08B0000
39800002 895EFFFC
2C0A0000 40820014
898B0010 2C0C0000
40810008 398CFFFF
998B0010 2C0C0001
40820004 2C0A0000
40820020 2C0C0000
41820020 895E005F
2C0A0008 4082000C
C00B0014 C04B0014
D05E0020 D01E0024
C01E0020 C03E0024
C05E006C EC420132
C0AB0008 C0CB000C
EC00102A C08B0004
EC630132 EC21182A
FC003040 41800014
FCC03050 FC003040
41810008 D01E0020
FC012840 41800014
FCA02850 FC012840
41810008 D03E0024
60000000 00000000
C2144138 00000004
9BFEFFFC 899E005F
2C0C0008 40820008
3BE00002 9BFE005E
60000000 00000000
C2143E20 00000008
8983005F 2C0C0008
4082002C 8983FFFC
2C0C0000 40820020
4800000D 3F800000
BE800000 7D8802A6
C06C0000 D0610008
C04C0004 D041000C
60000000 00000000

Forecast Channel v7 (Working all region)
Classic Controller Support [Ro]
0412B4F0 60000000
0412B14C 48000010
0412B194 48000030
0412B420 48000030
C212C4AC 00000013
3D80801D A18C7382
A0E30000 718B0010
41820008 60E70800
718B0040 41820008
60E70400 718B0600
41820008 60E70010
718B3000 41820008
60E71000 718B0800
41820008 60E78000
718B008C 41820008
60E70200 718B0020
41820008 60E70100
718B0001 41820008
60E70008 718B4000
41820008 60E70004
718B0002 41820008
60E70001 718B8000
41820008 60E70002
60000000 00000000
C212B4F4 0000001C
4800001D 3CB020C5
BC6D9168 BF666666
BFD9999A 00000000
00000000 7D6802A6
C07E0070 C08B0000
39800002 895EFFFC
2C0A0000 40820014
898B0010 2C0C0000
40810008 398CFFFF
998B0010 2C0C0001
40820004 2C0A0000
40820020 2C0C0000
41820020 895E005F
2C0A0008 4082000C
C00B0014 C04B0014
D05E0020 D01E0024
C01E0020 C03E0024
C05E006C EC420132
C0AB0008 C0CB000C
EC00102A C08B0004
EC630132 EC21182A
FC003040 41800014
FCC03050 FC003040
41810008 D01E0020
FC012840 41800014
FCA02850 FC012840
41810008 D03E0024
60000000 00000000
C212B4F8 00000004
9BFEFFFC 899E005F
2C0C0008 40820008
3BE00002 9BFE005E
60000000 00000000
C212B1E0 00000008
8983005F 2C0C0008
4082002C 8983FFFC
2C0C0000 40820020
4800000D 3F800000
BE800000 7D8802A6
C06C0000 D0610008
C04C0004 D041000C
60000000 00000000


Adds Classic Controller support to News Channel Forecast Channel. Wiimote will still work as normal with no problems. Custom code, not reusing official code. It is very accurate to the Wii Menu control. Works in any region

Maybe at some point we could do it for all WIi channels and release it as a pack

Good job! I ran into the same issue with the black screen. Ill look into the nintendo channel when i have time.
Post automatically merged:

@Ro_ I actually did look into the Wii Speak Channel a while back, and i got the pointer emulation working, but couldnt get buttons working.
 
Last edited by awesomeee,
Do you think it's a good idea to make a WAD pack in the future? But it would be good to do it for WiiLink WAD, idk they would be fine with us releasing their WAD with the mod
 
Do you think it's a good idea to make a WAD pack in the future? But it would be good to do it for WiiLink WAD, idk they would be fine with us releasing their WAD with the mod

Thats a fun idea. People would like it! We arent infringing any trademarks or getting into legal trouble, so it should be fine. Even staff think this whole hack is cool.
Post automatically merged:

@Vague Rant I just injected "Jett Rocket" successfully to the wii u menu. Thanks again for the possibility. Since you decided to keep the menu navigation sanity over the gameplay, I had an idea where you could have both. Just mirror the jump button to A and Y. In this case it's easy to hold Y for jump, B for interaction, ZR for shake/dash and ZL to re-center the camera. And you would have the A and B buttons for confirm and back prompts in the navigation menu. But of course if it's too much of a hassle, then it's ok like it is. If there's one thing I have learned here, then it's to believe the master when he says it's complicated 😂
Ill try and do this if i have time, i know how to use codewrite now!
 
Last edited by awesomeee,
@Vague Rant The reason i did wii play was so i could practice these hacks. Its fine if you dont want to fix the D pad emulation. After all this is a pretty wacky game lol

Re: twilight princess: That game actually has debug symbols lol. If you decide to look into it for any reason, theres a debugging map included on the disc to easily find KPAD functions 👍
Post automatically merged:

I also know you said Okami doesnt use kpad read at all, but it uses the nunchuk. I wonder how it reads the extension type and data then…

Perhaps this complicated low level hack would write in the data, or maybe okami just doesnt have enough debug symbols found yet, maybe it does use kpad read!
Post automatically merged:


I managed to actually make this possible!
I had to merge the disable extension error data and other code stuff into this new one that maps it like that. thanks @Vague Rant

A / B Jump / Run style controls (Awesomeee, Vague Rant, made the new cc hack and gave assembly info)

040DCDB0 38000000
041E6640 90BD1E98
041ECC0C 60000000
C21EB038 00000011
90010044 8803005C
2C000002 40820078
48000009 3F000000
7CA802A6 C0050000
80830000 70800060
4182001C 2C000060
41820014 2C000020
40820038 FC000050
48000030 80030064
2C000001 4182001C
C023007C FC200850
C0430080 FC21102A
EC000072 4800000C
C0230074 EC000072
D0030058 80010044
7C0803A6 38210040
4E800020 00000000
C21EB2E4 0000000B
C03E04DC 807E0004
70600080 4182001C
48000009 4059999A
7C8802A6 C0240000
D03E0060 4800002C
807E0000 70600080
4082000C 901E0060
48000018 C03E0060
2C140001 4082000C
FC000850 D01E0060
60000000 00000000
C21EBD28 0000001D
90010024 2C040000
408200D8 8803005C
2C000002 408200CC
48000015 801DD1D0
3FAAAAAB 3C75C28F
3F800000 7CA802A6
90A1000C 80030004
70008000 41820010
38000000 90030020
90030024 38C00002
98C3005E 81850000
7D8803A6 4E800021
2C030001 7FE3FB78
80A1000C C0450004
40820008 EC4200B2
C0650008 C0030020
C023006C FC211024
4800002D D0030020
C0030024 C0230070
FC200850 48000019
D0030024 80010024
7C0803A6 38210020
4E800020 FC0100FA
C025000C FC000800
4180000C FC000890
48000014 FC200850
FC000800 41810008
FC000890 4E800020
60000000 00000000
C21ECC38 00000012
4E800421 2C140001
40820084 4800000D
3F000000 00000000
7C6802A6 C0430000
C0630004 809EFFA0
80BEFFA4 80DEFFA8
C03E000C FC200850
39000004 48000021
C03E0010 39000001
48000015 909EFFA0
90BEFFA4 90DEFFA8
48000034 FC000A10
FC001040 4D800020
FC011840 41800008
5508083C 7CC04039
40820008 7CA54378
7C844378 7CC64079
4E800020 00000000
C21EAD34 00000021
2C040002 408200FC
38800000 71090800
41820008 60C68000
71090001 41820008
60C60002 71094000
41820008 60C60001
71090002 41820008
60C60008 71098000
41820008 60C60004
71090010 41820008
60C60100 71090040
41820008 60C60200
71090008 41820008
60C60080 71090020
41820008 60C60800
81230064 2C090001
41820038 71092000
41820008 60C60020
71090200 41820008
60C60040 71090080
41820008 60C60080
71090004 4182003C
60C60080 48000034
71092000 41820008
60C60080 71090200
41820008 60C60080
71090080 41820008
60C60020 71090004
41820008 60C60040
71090400 41820008
60C60010 71091000
41820008 60C61000
70C99FFF 00000000
What's this code for?
 
What's this code for?
NSMBWII b to run and A to jump mappings
Post automatically merged:

@Vague Rant Lmao remember how you could freeze fish in the ice form? That was funny to do! (In fluidity)
(There hasnt been much jokes here, and i know these hacks can be tiring, so i want to start showing funny things to cheer you up!)
I havent done these in a while, so heres a new one

Another thing funny i found about Jett rocket is that not even like 2 or 3 minutes after you get attacked by that big robot, you already get back to your base lol
And the way he screams while falling XD
 
Last edited by awesomeee,
I was thinking about "Nyx Quest" two days ago and now it's playable with a cc hack. Thank you very much for that. Is "Lost winds" on your list too? Might be easy to do, because it just have the swing wiimote action
Yep, both the Lost Winds games are definitely titles I want to look at, those were great games, I'd love to have them with Classic Controls.

@Vague Rant Thank you for those wiiware hacks.
Again, i have two questions LOL.

I have sneek on my Wii u. Is it possible To autoboot sneek vwii and launch a vwii nand title launcher through sneek emulated nand ?

Do you know if there is a kind of database or something with all wii games copy filter/dithering hexadecimal patterns ? Or Maybe gecko codes To disable it ?
The fix mentionned on the 710 post in this thread https://gbatemp.net/threads/possible-to-disable-the-wiis-de-flicker-filter.477163/post-10479236 doesn't work for all games. Some of those have different copy filter patterns.
Thanks.
I don't know anything at all about SNEEK, sorry. I think it involves using custom IOSes, right? In that case, they wouldn't work as a vWii NAND title injection (with GamePad support and all of that), but as simple channel forwarders I believe they'd work with a real Wiimote and Classic Controller.

I'm not aware of any central place for locations where the copy filter or other filters can be disabled. Finding Gecko codes to disable the copy filter is fairly simple because the filter is almost always triggered through the GXSetCopyFilter() SDK function. The Dolphin debugger is really good at locating that though Symbols > Generate Symbols From > Signature Database. Then you can just type its name into the Symbols field, click it and scroll down a bit until you see this part with all the -0x8000s:
gxsetcopyfilter.png

The line I have selected there (beq- ->0x8038A0E0) is where the patch goes which skips applying the copy filter. To make a Gecko code out of this, right click that instruction and select "Copy Address". In this example, that puts this in my clipboard:
8038a0a0

Then go back and right click that instruction again and select "Copy Hex". Again, for this example, I got:
41820040

You've now got everything you need to disable the copy filter. First up, put those things next to each other in a text file:
8038a0a0 41820040

Next up, replace that 80 at the start with 04. That creates a Gecko code which writes the following word to the address in question. So your code currently looks like this:
0438a0a0 41820040

Right now, that Gecko code is just writing the same instruction back to where it was already, so it's not actually doing anything. We need to change the instruction that it writes. You need to replace 4182 with 4800, so now your code looks like this:
0438a0a0 48000040

You don't need to know this part to make a code, but if it helps anybody to understand what's going on, 4182 is machine code for "branch if equal" (beq-) and 4800 is machine code for "branch" (b), meaning it always branches no matter what. 0040 is the branch distance (how many bytes of code to jump over).

And that's it, you just made a Gecko code to disable the copy filter. But you know, also make it all caps, because it looks weird and gross otherwise.

@Vague Rant I can credit you for the PPC assembly example, do you want credit? Either way is fine.
Doesn't bother me. Personally, I would credit in that situation (similar to how I credited crediar on all of my CC hacks until I wrote my own button injector and was no longer using crediar's code) but many wouldn't have credited in that situation either. 🤷

Hmmmmmm, I'm not sure. The way I do it makes me feel like there's another way to do it. I manipulate the IR pointer location via controller stick. For everything to work properly, I make sure to check if the pointer doesn't go outside of the screen, also making checks for Wiimote so a regular Wiimote can work as it should, but when Classic is attached and Wiimote is not pointing to screen, the Classic code runs, plus other improvements such as making the channel buttons always on screen if Classic is attached and Wiimote is outside of screen. Also changing the pointer rotation.

I did my best to make it as accurate to the Wii Menu - speed, pointer rotation, screen boundaries etc. Rn I'm tweaking the News Channel code because it seems like the screen boundaries and pointer speed behaves differently

In another time, I could probably see how the code you guys are using as base works and use it
That's cool as hell, sounds like it's closer to native support than mine. The way my pointer handler works is that I inject it into the start of calc_dpd_variable() and it replaces that function entirely. I don't bother doing cursor rotation though, since there's no benefit for most games. I just take the analog stick input from the current frame, divide the X axis by the current aspect ratio (1.333... or 1.777...) then multiply both axes by a very low number and add the results to the current pointer X/Y positions. If they exceed the bounds set up in my code (generally, the edges of the screen) they're constrained to that value. Then I return without ever actually running the real calc_dpd_variable(). I do have a check that you've got a Classic Controller connected, so if that fails I jump back into standard execution (so that real IR pointing still works).

The main problem with my method currently is that it doesn't take real time into account, it just runs through its loop each time it gets hit. This is only really relevant in games that switch between 30 and 60 FPS, because the pointer will move twice as fast in 60 FPS areas compared to 30 FPS. So far, this hasn't bothered me enough to resolve, I just choose a sensible speed for the most important part of gameplay and deal with the cursor moving faster in menus or whatever. So far I haven't hit a point where a game uses the pointer often enough in diverse framerates to think any more about it, but it's very possible your approach is already better than mine.

That's odd! Has he tried to see all instances that write to these locations? What if there's other functions writing stuff to another location that is also used? So in terms of the WPAD problems, is it mostly it not working correctly or finding it?
Mario Strikers is by Next Level Games, and they almost always use WPAD, while it sounds like the person above was modifying the buttons in KPAD. For me, the problem with WPAD is mostly one of understanding its output. Which bytes are the accelerometer and what is their range? Which bytes are the Nunchuk stick? How can I fake having a Nunchuk accelerometer within the parsed controller report when it's in Classic Controller mode? Since the Nunchuk and Classic sticks use different bit depths, what should I do with the input Classic data to translate it into its Nunchuk equivalent? These are rhetorical, I'm not asking you, unless you know in which case I am. :P

Another complicating factor is that as far as I know, there's not really one central place in WPAD to modify to adjust inputs. Obviously in KPAD we can just find KPADRead() and poke it or its child functions, but my method of hacking buttons in WPAD-based games is to identify which Wiimote packet type the game uses and patch it inside the parser for that function. e.g. I just did a WPAD game (the one below) and I injected the buttons in the __a1_37_data_type() parser function.

Lastly, I'd say hacking via KPAD makes it pretty easy to create a Frankenstein report. For games where I'm emulating a Nunchuk, I actually just drop the Classic Controller left stick into the Nunchuk KPADStatus offset (which is normally where the Classic buttons go). I don't need the Classic buttons once I've already injected the inputs into the Wiimote/Nunchuk field, so I just never write those out. That frees up the button fields to be where the Classic left stick goes, and between both of those, I've now got three words (out of five) of the Nunchuk accelerometer, which for some games is enough that I can fake the Nunchuk accelerometer (the other two words overlap with the Classic Controller right stick). I considered mangling the Classic parsing in WPAD completely into a native Nunchuk report, but then I lose the Classic right stick, unless I want to write a low-level IR pointer handler within WPAD using that data, which no I'm not doing that.

So the tl;dr: it's not really that hacking via WPAD doesn't work or is that hard to locate, it's just more complicated and creates a bunch of problems which don't exist when going in via KPAD.

@awesomeee Soooo, have you tried your codes for News Channel and Forecast Channel in an original WAD? For some reason, running codes in the WiiLink patched ones cause a blackscreen, even if the Gecko Code is a single line writing the original instruction of an address. I'm not sure why this happens and I can't bother for now. Probably another day, maybe if modifying the WAD to add the code it works, but it's a boring process.

Because of this, I can't properly test them, so for now, I'll drop the codes. ZL and ZR will behave as - and + too since I ported it from my Mii Channel code. If you can get it to work, let me know, and tell me if the control is good.
If I had to guess at this, I'd say the authors of the hacked News/Forecast channels are already using embedded Gecko codes (or a similar method of embedding custom code) which is using the same code cave as the new code/s you're adding to the mix. So any code you add is corrupting their previous additions and then everything falls apart.

Sorry about the novel.



Spider-Man-_Friend_or_Foe-c.jpg


Spider-Man: Friend or Foe was the final video game tie-in for the Raimi Spider-Man trilogy, encompassing elements from all three films and the wider Marvel universe. Next Level Games broke from the open-world NYC formula of the main trilogy games, creating a globe-trotting, level-based multiplayer platform/action/beat-'em-up game. Throughout the story, Spider-Man punches and/or recruits the titular friends and foes as playable characters in his quest to defeat the mind-controlling symbiote P.H.A.N.T.O.M.s. Helping achieve this goal is a pre-Sam Jackson Nick Fury in the floating S.H.I.E.L.D. helicarrier, which serves as a level hub while also providing a shop for permanent upgrades and items.

USA/EUR

  1. Code:
    Classic Controller Support [Vague Rant]
    040EB530 60000000
    C20EB54C 00000002
    28000001 41820008
    28000002 00000000
    C227ACF8 00000003
    82C10008 28160002
    40820008 3AC00001
    60000000 00000000
    C227B11C 00000006
    82C10008 2C160002
    4182000C 880100A8
    4800001C 38E00005
    A80100A6 7C003BD6
    980100A9 A80100A4
    7C003BD6 00000000
    C22ABCF8 0000000C
    C02304A4 8803005C
    2C000002 40820050
    2C0F0001 40820048
    4800000D 00000000
    40066666 7CA802A6
    C005000C 80830004
    70800040 4182000C
    3880000E 48000014
    80850000 2C040000
    40810014 3884FFFF
    90850000 C0050004
    D0030074 00000000
    C22AC8E0 0000001D
    90010024 2C040000
    408200DC 8803005C
    2C000002 408200D0
    9803005E 2C0F0001
    40820088 80030000
    70000040 4082007C
    48000015 803082B0
    3FAAAAAB 3D4CCCCD
    3F800000 7CA802A6
    80650000 28030001
    40810018 90A1000C
    7C6803A6 4E800021
    80A1000C 90650000
    2C030001 7FE3FB78
    C0450004 40820008
    EC4200B2 C0650008
    C0030020 C0230074
    FC211024 4800002D
    D0030020 C0030024
    C0230078 FC200850
    48000019 D0030024
    80010024 7C0803A6
    38210020 4E800020
    FC0100FA C025000C
    FC000800 4180000C
    FC000890 48000014
    FC200850 FC000800
    41810008 FC000890
    4E800020 00000000
    C22D10E8 00000018
    A87E0000 70040800
    41820008 60638000
    70040001 41820008
    60630008 70044000
    41820008 60630004
    70040002 41820008
    60630001 70048000
    41820008 60630002
    70040010 41820008
    60630400 70040040
    41820008 60632000
    70040008 41820008
    60630040 70040020
    41820008 60630800
    70042000 41820008
    60634000 70040200
    41820008 60634000
    70040080 41820008
    60630800 70040004
    41820008 60630400
    70040400 41820008
    60630010 70041000
    41820008 60631000
    B07E0000 00000000

Button Mapping​

Wii Remote/NunchukClassic ControllerFunction
Wiimote HomeHome
Remember that the Right Stick controls your pointer and your A buttons are Y/ZL
Open/Close Home Button Menu
Wiimote D-PadD-PadMenus
Navigation
Gameplay
Use Items
Wiimote AY
ZL
Menus
Confirm
Gameplay
Attack
Wiimote BA
ZR
Menus
Cancel
Gameplay
Web Moves
Wiimote 1 & 2Not mappedNot used?
Wiimote PlusPlusGameplay
Pause
Wiimote MinusMinusNot used?
Wiimote PointerRight StickMenus
Navigation
Wiimote ShakesNot mapped
(use buttons instead, see General Notes)
Gameplay
Modified Grabs
Nunchuk StickLeft StickMenus
Navigation
Gameplay
Movement
Nunchuk CL
R
Gameplay
Switch Web Move
Nunchuk ZBGameplay
Jump
Nunchuk ShakeXGameplay
Switch Character

General Notes​

  • This game got three regional releases: USA, EUR (En) and EUR (Fr, De, Es, It). The same hack works on all three game versions.

  • The various Wiimote motion attacks are not implemented here at all but only because they are already available via buttons. There are four types of grab attacks in this game, and they have the following control mappings in this hack:

    • Standard: A
    • Web Slam: A, Y
    • Air Web Slam: A, B
    • Web Throw: A, A

    This is exactly how grab moves work on the traditionally-controlled ports of Friend or Foe, the motion controls only provide an optional, alternative method to trigger the same moves.

  • I know this control scheme is nuts, hear me out. It's directly modeled on the controls from the Xbox 360 and PlayStation 2 versions of the game. In Wii terms, this means a bunch of absolute nonsense like Y/ZL to confirm and A/ZR to cancel. I decided it was better in this case to just match the intended gameplay layout for traditional controllers, as laid out in the other versions, and cope with the menu weirdness. If this layout is no good for you, feel free to remap using the button injector source in the Technical Notes.

    • The A and B buttons are additionally mapped to ZL/ZR, mainly for convenience while using the Right Stick IR pointer. If you feel like it, you can also use them as alternative Attack and Web buttons.

Technical Notes​

Code breakdown:
  • 04 and C2: bypass Nunchuk error
  • C2: read Nunchuk data even if Classic is connected
  • C2: if this is a Classic Controller, translate its stick data to (roughly) Nunchuk format and read that instead
  • C2 in read_kpad_acc(): fake Nunchuk shakes
  • C2 in calc_dpd_variable(): IR pointer emulation
  • C2 in __a1_37_data_type(): button injector
Code:
; __a1_37_data_type
; 802D10E8 for USA

  lha r3, 0x0(r30)

CLASSIC_HOME:
  andi. r4, r0, 0x800
  beq- CLASSIC_UP
  ori r3, r3, 0x8000    ; home

CLASSIC_UP:
  andi. r4, r0, 0x1
  beq- CLASSIC_DOWN
  ori r3, r3, 0x8       ; up (v) / left (h)

CLASSIC_DOWN:
  andi. r4, r0, 0x4000
  beq- CLASSIC_LEFT
  ori r3, r3, 0x4       ; down (v) / right (h)

CLASSIC_LEFT:
  andi. r4, r0, 0x2
  beq- CLASSIC_RIGHT
  ori r3, r3, 0x1       ; left (v) / down (h)

CLASSIC_RIGHT:
  andi. r4, r0, 0x8000
  beq- CLASSIC_A
  ori r3, r3, 0x2       ; right (v) / up (h)

CLASSIC_A:
  andi. r4, r0, 0x10
  beq- CLASSIC_B
  ori r3, r3, 0x400     ; b

CLASSIC_B:
  andi. r4, r0, 0x40
  beq- CLASSIC_X
  ori r3, r3, 0x2000    ; z

CLASSIC_X:
  andi. r4, r0, 0x8
  beq- CLASSIC_Y
  ori r3, r3, 0x40      ; nunchuk shake (swap characters)

CLASSIC_Y:
  andi. r4, r0, 0x20
  beq- CLASSIC_L
  ori r3, r3, 0x800     ; a

CLASSIC_L:
  andi. r4, r0, 0x2000
  beq- CLASSIC_R
  ori r3, r3, 0x4000    ; c

CLASSIC_R:
  andi. r4, r0, 0x200
  beq- CLASSIC_ZL
  ori r3, r3, 0x4000    ; c

CLASSIC_ZL:
  andi. r4, r0, 0x80
  beq- CLASSIC_ZR
  ori r3, r3, 0x800     ; a

CLASSIC_ZR:
  andi. r4, r0, 0x4
  beq- CLASSIC_PLUS
  ori r3, r3, 0x400     ; b

CLASSIC_PLUS:
  andi. r4, r0, 0x400
  beq- CLASSIC_MINUS
  ori r3, r3, 0x10      ; plus

CLASSIC_MINUS:
  andi. r4, r0, 0x1000
  beq- CLASSIC_DONE
  ori r3, r3, 0x1000    ; minus

CLASSIC_DONE:
  sth r3, 0x0(r30)

The dreaded Next Level Games! Friend or Foe uses the 0x37 controller report type, so the button injection was patched into there. At an early point, I was also trying to do Nunchuk analog stick emulation in there, which worked but clobbered the right stick, making it no longer possible to control the IR pointer that way. So I gave up on the generic, portable approach and instead found where the data eventually gets read back and patched it there to read back the Classic data instead. I don't currently know whether this approach would be compatible with other Next Level Games titles.

Each Nunchuk stick axis is an 8-bit signed integer with a range that seemed to be about -0x64 to +0x63 (-100 to +99), give or take due to the vagaries of control stick gates (the ... circle around the stick that stops you pushing it any further). Conversely, the Classic Controller left stick (and maybe right stick, I didn't really look into it) is a 16-bit signed int with a range of about -512 to +511. To get these into the same ballpark, I'm just dividing the Classic stick by 5. This gives you a range of -0x66 to +0x66 (-102 to +102) which is within the margin of error.

The other bit of weirdness here is that for Nunchuk shakes, Friend or Foe does use KPAD (woo) but it reads the accelerometer magnitude value at 0x74 in KPADStatus. For the Classic Controller, that's the right stick's X axis. My solution to making these two play nice is just that when you're currently "shaking the Nunchuk" (pressing Classic X), the Nunchuk shake takes over that word and IR pointer calculation is stopped. This means you can't shake the Nunchuk and move the IR pointer at the same time. Once the shake is done, the analog stick gets control of the IR pointer back.
 
Last edited by Vague Rant,
Yep, both the Lost Winds games are definitely titles I want to look at, those were great games, I'd love to have them with Classic Controls.


I don't know anything at all about SNEEK, sorry. I think it involves using custom IOSes, right? In that case, they wouldn't work as a vWii NAND title injection (with GamePad support and all of that), but as simple channel forwarders I believe they'd work with a real Wiimote and Classic Controller.

I'm not aware of any central place for locations where the copy filter or other filters can be disabled. Finding Gecko codes to disable the copy filter is fairly simple because the filter is almost always triggered through the GXSetCopyFilter() SDK function. The Dolphin debugger is really good at locating that though Symbols > Generate Symbols From > Signature Database. Then you can just type its name into the Symbols field, click it and scroll down a bit until you see this part with all the -0x8000s:
View attachment 476401
The line I have selected there (beq- ->0x8038A0E0) is where the patch goes which skips applying the copy filter. To make a Gecko code out of this, right click that instruction and select "Copy Address". In this example, that puts this in my clipboard:
8038a0a0

Then go back and right click that instruction again and select "Copy Code Line". Again, for this example, I got:
41820040

You've now got everything you need to disable the copy filter. First up, put those things next to each other in a text file:
8038a0a0 41820040

Next up, replace that 80 at the start with 04. That creates a Gecko code which writes the following word to the address in question. So your code currently looks like this:
0438a0a0 41820040

Right now, that Gecko code is just writing the same instruction back to where it was already, so it's not actually doing anything. We need to change the instruction that it writes. You need to replace 4182 with 4800, so now your code looks like this:
0438a0a0 48000040

You don't need to know this part to make a code, but if it helps anybody to understand what's going on, 4182 is machine code for "branch if equal" (beq-) and 4800 is machine code for "branch" (b), meaning it always branches no matter what. 0040 is the branch distance (how many bytes of code to jump over).

And that's it, you just made a Gecko code to disable the copy filter. But you know, also make it all caps, because it looks weird and gross otherwise.


Doesn't bother me. Personally, I would credit in that situation (similar to how I credited crediar on all of my CC hacks until I wrote my own button injector and was no longer using crediar's code) but many wouldn't have credited in that situation either. 🤷


That's cool as hell, sounds like it's closer to native support than mine. The way my pointer handler works is that I inject it into the start of calc_dpd_variable() and it replaces that function entirely. I don't bother doing cursor rotation though, since there's no benefit for most games. I just take the analog stick input from the current frame, divide the X axis by the current aspect ratio (1.333... or 1.666...) then multiply both axes by a very low number and add the results to the current pointer X/Y positions. If they exceed the bounds set up in my code (generally, the edges of the screen) they're constrained to that value. Then I return without ever actually running the real calc_dpd_variable(). I do have a check that you've got a Classic Controller connected, so if that fails I jump back into standard execution (so that real IR pointing still works).

The main problem with my method currently is that it doesn't take real time into account, it just runs through its loop each time it gets hit. This is only really relevant in games that switch between 30 and 60 FPS, because the pointer will move twice as fast in 60 FPS areas compared to 30 FPS. So far, this hasn't bothered me enough to resolve, I just choose a sensible speed for the most important part of gameplay and deal with the cursor moving faster in menus or whatever. So far I haven't hit a point where a game uses the pointer often enough in diverse framerates to think any more about it, but it's very possible your approach is already better than mine.


Mario Strikers is by Next Level Games, and they almost always use WPAD, while it sounds like the person above was modifying the buttons in KPAD. For me, the problem with WPAD is mostly one of understanding its output. Which bytes are the accelerometer and what is their range? Which bytes are the Nunchuk stick? How can I fake having a Nunchuk accelerometer within the parsed controller report when it's in Classic Controller mode? Since the Nunchuk and Classic sticks use different bit depths, what should I do with the input Classic data to translate it into its Nunchuk equivalent? These are rhetorical, I'm not asking you, unless you know in which case I am. :P

Another complicating factor is that as far as I know, there's not really one central place in WPAD to modify to adjust inputs. Obviously in KPAD we can just find KPADRead() and poke it or its child functions, but my method of hacking buttons in WPAD-based games is to identify which Wiimote packet type the game uses and patch it inside the parser for that function. e.g. I just did a WPAD game (the one below) and I injected the buttons in the __a1_37_data_type() parser function.

Lastly, I'd say hacking via KPAD makes it pretty easy to create a Frankenstein report. For games where I'm emulating a Nunchuk, I actually just drop the Classic Controller left stick into the Nunchuk KPADStatus offset (which is normally where the Classic buttons go). I don't need the Classic buttons once I've already injected the inputs into the Wiimote/Nunchuk field, so I just never write those out. That frees up the button fields to be where the Classic left stick goes, and between both of those, I've now got three words (out of five) of the Nunchuk accelerometer, which for some games is enough that I can fake the Nunchuk accelerometer (the other two words overlap with the Classic Controller right stick). I considered mangling the Classic parsing in WPAD completely into a native Nunchuk report, but then I lose the Classic right stick, unless I want to write a low-level IR pointer handler within WPAD using that data, which no I'm not doing that.

So the tl;dr: it's not really that hacking via WPAD doesn't work or is that hard to locate, it's just more complicated and creates a bunch of problems which don't exist when going in via KPAD.


If I had to guess at this, I'd say the authors of the hacked News/Forecast channels are already using embedded Gecko codes (or a similar method of embedding custom code) which is using the same code cave as the new code/s you're adding to the mix. So any code you add is corrupting their previous additions and then everything falls apart.

Sorry about the novel.



View attachment 476402

Spider-Man: Friend or Foe was the final video game tie-in for the Raimi Spider-Man trilogy, encompassing elements from all three films and the wider Marvel universe. Next Level Games broke from the open-world NYC formula of the main trilogy games, creating a globe-trotting, level-based multiplayer platform/action/beat-'em-up game. Throughout the story, Spider-Man punches and/or recruits the titular friends and foes as playable characters in his quest to defeat the mind-controlling symbiote P.H.A.N.T.O.M.s. Helping achieve this goal is a pre-Sam Jackson Nick Fury in the floating S.H.I.E.L.D. helicarrier, which serves as a level hub while also providing a shop for permanent upgrades and items.

USA/EUR

  1. Code:
    Classic Controller Support [Vague Rant]
    040EB530 60000000
    C20EB54C 00000002
    28000001 41820008
    28000002 00000000
    C227ACF8 00000003
    82C10008 28160002
    40820008 3AC00001
    60000000 00000000
    C227B11C 00000006
    82C10008 2C160002
    4182000C 880100A8
    4800001C 38E00005
    A80100A6 7C003BD6
    980100A9 A80100A4
    7C003BD6 00000000
    C22ABCF8 0000000C
    C02304A4 8803005C
    2C000002 40820050
    2C0F0001 40820048
    4800000D 00000000
    40066666 7CA802A6
    C005000C 80830004
    70800040 4182000C
    3880000E 48000014
    80850000 2C040000
    40810014 3884FFFF
    90850000 C0050004
    D0030074 00000000
    C22AC8E0 0000001D
    90010024 2C040000
    408200DC 8803005C
    2C000002 408200D0
    9803005E 2C0F0001
    40820088 80030000
    70000040 4082007C
    48000015 803082B0
    3FAAAAAB 3D4CCCCD
    3F800000 7CA802A6
    80650000 28030001
    40810018 90A1000C
    7C6803A6 4E800021
    80A1000C 90650000
    2C030001 7FE3FB78
    C0450004 40820008
    EC4200B2 C0650008
    C0030020 C0230074
    FC211024 4800002D
    D0030020 C0030024
    C0230078 FC200850
    48000019 D0030024
    80010024 7C0803A6
    38210020 4E800020
    FC0100FA C025000C
    FC000800 4180000C
    FC000890 48000014
    FC200850 FC000800
    41810008 FC000890
    4E800020 00000000
    C22D10E8 00000018
    A87E0000 70040800
    41820008 60638000
    70040001 41820008
    60630008 70044000
    41820008 60630004
    70040002 41820008
    60630001 70048000
    41820008 60630002
    70040010 41820008
    60630400 70040040
    41820008 60632000
    70040008 41820008
    60630040 70040020
    41820008 60630800
    70042000 41820008
    60634000 70040200
    41820008 60634000
    70040080 41820008
    60630800 70040004
    41820008 60630400
    70040400 41820008
    60630010 70041000
    41820008 60631000
    B07E0000 00000000

Button Mapping​

[TABLE=full]
[TR]
[TH]Wii Remote/Nunchuk[/TH]
[TH]Classic Controller[/TH]
[TH]Function[/TH]
[/TR]
[TR]
[TD]Wiimote Home[/TD]
[TD]Home
Remember that the Right Stick controls your pointer and your A buttons are Y/ZL[/TD]
[TD]Open/Close Home Button Menu[/TD]
[/TR]
[TR]
[TD]Wiimote D-Pad[/TD]
[TD]D-Pad[/TD]
[TD]Menus
Navigation
Gameplay
Use Items[/TD]
[/TR]
[TR]
[TD]Wiimote A[/TD]
[TD]Y
ZL[/TD]
[TD]Menus
Confirm
Gameplay
Attack[/TD]
[/TR]
[TR]
[TD]Wiimote B[/TD]
[TD]A
ZR[/TD]
[TD]Menus
Cancel
Gameplay
Web Moves[/TD]
[/TR]
[TR]
[TD]Wiimote 1 & 2[/TD]
[TD]Not mapped[/TD]
[TD]Not used?[/TD]
[/TR]
[TR]
[TD]Wiimote Plus[/TD]
[TD]Plus[/TD]
[TD]Gameplay
Pause[/TD]
[/TR]
[TR]
[TD]Wiimote Minus[/TD]
[TD]Minus[/TD]
[TD]Not used?[/TD]
[/TR]
[TR]
[TD]Wiimote Pointer[/TD]
[TD]Right Stick[/TD]
[TD]Menus
Navigation[/TD]
[/TR]
[TR]
[TD]Wiimote Shakes[/TD]
[TD]Not mapped
(use buttons instead, see General Notes)[/TD]
[TD]Gameplay
Modified Grabs[/TD]
[/TR]
[TR]
[TD]Nunchuk Stick[/TD]
[TD]Left Stick[/TD]
[TD]Menus
Navigation
Gameplay
Movement[/TD]
[/TR]
[TR]
[TD]Nunchuk C[/TD]
[TD]L
R[/TD]
[TD]Gameplay
Switch Web Move[/TD]
[/TR]
[TR]
[TD]Nunchuk Z[/TD]
[TD]B[/TD]
[TD]Gameplay
Jump[/TD]
[/TR]
[TR]
[TD]Nunchuk Shake[/TD]
[TD]X[/TD]
[TD]Gameplay
Switch Character[/TD]
[/TR]
[/TABLE]

General Notes​

  • This game got three regional releases: USA, EUR (En) and EUR (Fr, De, Es, It). The same hack works on all three game versions.

  • The various Wiimote motion attacks are not implemented here at all but only because they are already available via buttons. There are four types of grab attacks in this game, and they have the following control mappings in this hack:
    • Standard: A
    • Web Slam: A, Y
    • Air Web Slam: A, B
    • Web Throw: A, A

    This is exactly how grab moves work on the traditionally-controlled ports of Friend or Foe, the motion controls only provide an optional, alternative method to trigger the same moves.

  • I know this control scheme is nuts, hear me out. It's directly modeled on the controls from the Xbox 360 and PlayStation 2 versions of the game. In Wii terms, this means a bunch of absolute nonsense like Y/ZL to confirm and A/ZR to cancel. I decided it was better in this case to just match the intended gameplay layout for traditional controllers, as laid out in the other versions, and cope with the menu weirdness. If this layout is no good for you, feel free to remap using the button injector source in the Technical Notes.
    • The A and B buttons are additionally mapped to ZL/ZR, mainly for convenience while using the Right Stick IR pointer. If you feel like it, you can also use them as alternative Attack and Web buttons.

Technical Notes​

Code breakdown:
  • 04 and C2: bypass Nunchuk error
  • C2: read Nunchuk data even if Classic is connected
  • C2: if this is a Classic Controller, translate its stick data to (roughly) Nunchuk format and read that instead
  • C2 in read_kpad_acc(): fake Nunchuk shakes
  • C2 in calc_dpd_variable(): IR pointer emulation
  • C2 in __a1_37_data_type(): button injector
Code:
; __a1_37_data_type
; 802D10E8 for USA

  lha r3, 0x0(r30)

CLASSIC_HOME:
  andi. r4, r0, 0x800
  beq- CLASSIC_UP
  ori r3, r3, 0x8000    ; home

CLASSIC_UP:
  andi. r4, r0, 0x1
  beq- CLASSIC_DOWN
  ori r3, r3, 0x8       ; up (v) / left (h)

CLASSIC_DOWN:
  andi. r4, r0, 0x4000
  beq- CLASSIC_LEFT
  ori r3, r3, 0x4       ; down (v) / right (h)

CLASSIC_LEFT:
  andi. r4, r0, 0x2
  beq- CLASSIC_RIGHT
  ori r3, r3, 0x1       ; left (v) / down (h)

CLASSIC_RIGHT:
  andi. r4, r0, 0x8000
  beq- CLASSIC_A
  ori r3, r3, 0x2       ; right (v) / up (h)

CLASSIC_A:
  andi. r4, r0, 0x10
  beq- CLASSIC_B
  ori r3, r3, 0x400     ; b

CLASSIC_B:
  andi. r4, r0, 0x40
  beq- CLASSIC_X
  ori r3, r3, 0x2000    ; z

CLASSIC_X:
  andi. r4, r0, 0x8
  beq- CLASSIC_Y
  ori r3, r3, 0x40      ; nunchuk shake (swap characters)

CLASSIC_Y:
  andi. r4, r0, 0x20
  beq- CLASSIC_L
  ori r3, r3, 0x800     ; a

CLASSIC_L:
  andi. r4, r0, 0x2000
  beq- CLASSIC_R
  ori r3, r3, 0x4000    ; c

CLASSIC_R:
  andi. r4, r0, 0x200
  beq- CLASSIC_ZL
  ori r3, r3, 0x4000    ; c

CLASSIC_ZL:
  andi. r4, r0, 0x80
  beq- CLASSIC_ZR
  ori r3, r3, 0x800     ; a

CLASSIC_ZR:
  andi. r4, r0, 0x4
  beq- CLASSIC_PLUS
  ori r3, r3, 0x400     ; b

CLASSIC_PLUS:
  andi. r4, r0, 0x400
  beq- CLASSIC_MINUS
  ori r3, r3, 0x10      ; plus

CLASSIC_MINUS:
  andi. r4, r0, 0x1000
  beq- CLASSIC_DONE
  ori r3, r3, 0x1000    ; minus

CLASSIC_DONE:
  sth r3, 0x0(r30)

The dreaded Next Level Games! Friend or Foe uses the 0x37 controller report type, so the button injection was patched into there. At an early point, I was also trying to do Nunchuk analog stick emulation in there, which worked but clobbered the right stick, making it no longer possible to control the IR pointer that way. So I gave up on the generic, portable approach and instead found where the data eventually gets read back and patched it there to read back the Classic data instead. I don't currently know whether this approach would be compatible with other Next Level Games titles.

Each Nunchuk stick axis is an 8-bit signed integer with a range that seemed to be about -0x64 to +0x63 (-100 to +99), give or take due to the vagaries of control stick gates (the ... circle around the stick that stops you pushing it any further). Conversely, the Classic Controller left stick (and maybe right stick, I didn't really look into it) is a 16-bit signed int with a range of about -512 to +511. To get these into the same ballpark, I'm just dividing the Classic stick by 5. This gives you a range of -0x66 to +0x66 (-102 to +102) which is within the margin of error.

The other bit of weirdness here is that for Nunchuk shakes, Friend or Foe does use KPAD (woo) but it reads the accelerometer magnitude value at 0x74 in KPADStatus. For the Classic Controller, that's the right stick's X axis. My solution to making these two play nice is just that when you're currently "shaking the Nunchuk" (pressing Classic X), the Nunchuk shake takes over that word and IR pointer calculation is stopped. This means you can't shake the Nunchuk and move the IR pointer at the same time. Once the shake is done, the analog stick gets control of the IR pointer back.
Thanks for reply. I Will look into this. Thanks for spiderman.
 
  • Like
Reactions: Vague Rant
Good job! Spider man seems tedious, glad you got a hack working 👍

I looked into epic mickey 2 and luckily it uses select_1obj_continue so no need to scramble through WPADProbe lol
Post automatically merged:

@Vague Rant
Re: Accelerometer data
Do you have an example PPC assembly for accelerometer stuff? I know i put the 0x20 wiimote unused values in the button assembly, but we need an example for the calc_acc assembly part 👍
Post automatically merged:

Doesn't bother me. Personally, I would credit in that situation (similar to how I credited crediar on all of my CC hacks until I wrote my own button injector and was no longer using crediar's code) but many wouldn't have credited in that situation either. 🤷
Credited, also sorry for the multiple pings. This is another example of me doing things too much, im going to take a break from replying so much. sorry!
 
Last edited by awesomeee,
  • Like
Reactions: Vague Rant

Site & Scene News

Popular threads in this forum