Hacking What are the debug options for Wii?

Archerite

Well-Known Member
OP
Member
GBAtemp Patron
Joined
Sep 16, 2018
Messages
209
Trophies
1
Age
41
XP
2,488
Country
Netherlands
I was unsure in which forum section to put this, but since "hacking" is much easier with debug tools I thought this might be a good place to start. I am working on a homebrew 2D platform game that generates textures on the fly from game specific files stored on the SD card (it's a remake of a PC game). I integrated ports to Linux and the 3DS which share most of the game code with the Wii version and it runs fine on those platforms and testing on Dolphin in debug mode helped a lot to fix some issues I had before.

Now my game is getting bigger in size and for the sake of simplicity I still use the Devkitpro generated textures on the Wii and 3DS versions. While construction the image that should be converted into a texture at runtime I am getting a lot of DSI crashes on the real Wii hardware (using Wiiload if that makes a difference), running the exact same build on Dolphin works fine and gives no memory errors in the log. It compiles to an uncompressed DOL of arround 4.8MB now of which most is the textures.

From what I could find the USB Gecko is the most recommended solution but I believe it is not sold anymore. I was hoping to hear what others are using and what my debug options are...before I implement a networked version of printf() to at least know where in the code my game crashes exactly.
 

eyeliner

Has an itch needing to be scratched.
Member
Joined
Feb 17, 2006
Messages
2,891
Trophies
2
Age
44
XP
5,537
Country
Portugal
Last edited by eyeliner,
  • Like
Reactions: Illuminaticy

The Real Jdbye

*is birb*
Member
Joined
Mar 17, 2010
Messages
23,293
Trophies
4
Location
Space
XP
13,850
Country
Norway
I was unsure in which forum section to put this, but since "hacking" is much easier with debug tools I thought this might be a good place to start. I am working on a homebrew 2D platform game that generates textures on the fly from game specific files stored on the SD card (it's a remake of a PC game). I integrated ports to Linux and the 3DS which share most of the game code with the Wii version and it runs fine on those platforms and testing on Dolphin in debug mode helped a lot to fix some issues I had before.

Now my game is getting bigger in size and for the sake of simplicity I still use the Devkitpro generated textures on the Wii and 3DS versions. While construction the image that should be converted into a texture at runtime I am getting a lot of DSI crashes on the real Wii hardware (using Wiiload if that makes a difference), running the exact same build on Dolphin works fine and gives no memory errors in the log. It compiles to an uncompressed DOL of arround 4.8MB now of which most is the textures.

From what I could find the USB Gecko is the most recommended solution but I believe it is not sold anymore. I was hoping to hear what others are using and what my debug options are...before I implement a networked version of printf() to at least know where in the code my game crashes exactly.
You could contact the guy behind Shuriken USB and see if he's still selling them: http://retro-system.com/shuriken_usb.htm
Can't seem to find contact info on that page though. He has a thread here, but hasn't been online since early this year: https://gbatemp.net/threads/shuriken-usb-usb-gecko-se-clone.384686/

There's also something called WifiGecko/WifiGeckoReader, I can't really find much information on it but it seems like it might be useful.
 
  • Like
Reactions: Archerite

Archerite

Well-Known Member
OP
Member
GBAtemp Patron
Joined
Sep 16, 2018
Messages
209
Trophies
1
Age
41
XP
2,488
Country
Netherlands
You could contact the guy behind Shuriken USB and see if he's still selling them: http://retro-system.com/shuriken_usb.htm
Can't seem to find contact info on that page though. He has a thread here, but hasn't been online since early this year: https://gbatemp.net/threads/shuriken-usb-usb-gecko-se-clone.384686/

There's also something called WifiGecko/WifiGeckoReader, I can't really find much information on it but it seems like it might be useful.

Your link reminded me that I had already seen that page before. Having a second look at the page I noticed he made his design open-source including the CPLD code and schematic and I have some of the exact chips he used on cheap demo boards in a box somewhere, although I am not sure I have the USB chip on a board but I know what it does. It's the same one used in the EverDrive USB port on the sega megadrive and is seen as a simple serial port.

Thank you.

--------------------- MERGED ---------------------------

I have an unused SD Gecko lying around. I am unsure if that is worth it to you to have it send after postage.
I apologise by not offering it for you, but I have a very tight wallet, and I have a new baby coming up (wife is at 4/5 months pregnancy)

Also, try this: https://www.amazon.com/Memory-Converter-Adapter-Nintendo-Wii-Gamecube/dp/B01GDIR5NC/
Also, some related products might be useful to you.

Thanks, but I already got a bunch of those very cheap on AliExpress a while ago. They are useful on a gamecube as an SD cardreader but not what I was looking for.
 

eyeliner

Has an itch needing to be scratched.
Member
Joined
Feb 17, 2006
Messages
2,891
Trophies
2
Age
44
XP
5,537
Country
Portugal
Isn't that an SDGecko?
I mean, I have one of those, and seems the same...
But, apologies if I've posted useless information.
 

MichiS97

"Leftist snowflake milennial"
Member
Joined
Jun 14, 2011
Messages
1,815
Trophies
2
Age
26
Location
Munich
XP
3,600
Country
Germany
The USB Gecko and its clones aren't available anymore.
I typically use Dolphin, launch it with the - d parameter to get breakpoints, a disassembler, etc.
 
Last edited by MichiS97,

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,649
Country
France
I don't think SDGecko will help you debug in real time.
You need either an USBGecko, or WifiGecko (over TCP).

Wifi gecko can't log if the network is not initialized, so all the launch sequence up until network init is done will not be logged.
I'm using wifigecko to debug usbloadergx on wiiu.

https://sourceforge.net/p/usbloadergx/code/HEAD/tree/trunk/source/
look in gecko.c and utils/wifi_gecko.c
I edit the line in gecko.c to enable wifi. I disable it when not needed due to a bug when launching a game, but it's fine enough to debug the loader's interface.

I'm using GeckoCLI as PC tool, there is also GeckoDotNet you can use, or geckoreader.
I uploaded the files below.


What I remember about pictures, their size (width and height) need to be multiple of 4.
maybe your pictures aren't, and emulators are always more error friendly than real hardware, catching bugs instead of crashing.
 

Attachments

  • Gecko readers.7z
    46.6 KB · Views: 201
Last edited by Cyan,
  • Like
Reactions: Archerite

Archerite

Well-Known Member
OP
Member
GBAtemp Patron
Joined
Sep 16, 2018
Messages
209
Trophies
1
Age
41
XP
2,488
Country
Netherlands
The USB Gecko and its clones aren't available anymore.
I typically use Dolphin, launch it with the - d parameter to get breakpoints, a disassembler, etc.
Like I said it works in Dolphin which the -d parameter and not a single error is logged to give a clue of what is going wrong. It has helped me solve many bugs with it's printf() capture.

I don't think SDGecko will help you debug in real time.
You need either an USBGecko, or WifiGecko (over TCP).

Wifi gecko can't log if the network is not initialized, so all the launch sequence up until network init is done will not be logged.
I'm using wifigecko to debug usbloadergx on wiiu.

https://sourceforge.net/p/usbloadergx/code/HEAD/tree/trunk/source/
look in gecko.c and utils/wifi_gecko.c
I edit the line in gecko.c to enable wifi. I disable it when not needed due to a bug when launching a game, but it's fine enough to debug the loader's interface.

I'm using GeckoCLI as PC tool, there is also GeckoDotNet you can use, or geckoreader.
I uploaded the files below.


What I remember about pictures, their size (width and height) need to be multiple of 4.
maybe your pictures aren't, and emulators are always more error friendly than real hardware, catching bugs instead of crashing.
I know SD Gecko is not meant for debugging which is why I said to eyeliner that is not what I was looking for. Although it could be used on the GameCube to write a log file on the SD card as a last resort, on the Wii it's much easier to just write to the build in SD card slot when needed.

I will definitely give wifi_gecko and thank you for providing the PC side tools for them...but is the source code for them available somewhere? I prefer native Linux apps or python scripts over windows EXE files if I can. Hope I do not sound ungrateful as I did not mean it that way :)

I have been using Valgrind on the Linux port to detect and report where memory leaks were and fixed a bunch of them already. I have also studied the source code of libogc and gxtexconv to learn how the textures get converted and loaded so I now have working conversion at runtime to RGB5A3 format. You are correct about the textures having to be stored in a 4x4 pixel block format. I might switch to the CI8 format later and I believe that uses 8x8 pixel blocks instead. I forgot that at first and even though the colors were correct the image looked really distorted until I fixed that. Not needing the textures included in the DOL reduced the size to a tiny 539,264 bytes! :D

Looking a little at how the USB Gecko actually works I got yet another crazy idea: Eliminate the FPGA/CPLD with external USB solution with a single USB capable ARM MCU. I totally understand why it was designed like that at the time since the EXI bus speed is very high, but microcontrollers got cheaper and their build in SPI ports got faster. But since my time is limited it might take a while....or never gets finished. ;)
 
Last edited by Archerite,

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,649
Country
France
No harm taken, I'm just sorry I couldn't help you properly. I often forget about linux users.

I found geckoreader sources here :
http://wiibrew.org/wiki/Geckoreader
thought, it's C# (.net 2.0), but it contains libgecko to communicate with a gecko if you want to create your own console (log text window, not a gaming console) .
You can also look into the Discussion tab of the wiki page, there are some links, but it's very old so the sources you might find would be outdated.

I didn't search more, but sources for other consolesare probably available too.

Anyway, I'm curious to see what you can create from that, and I'm happy to see there are still some people interesting in releasing new things for old hardware.
We got a new exploit few days ago to hack the Wii without banner bomb, or the browser, or an SD card, just settings a DNS IPs and it's downloading/launching hackmii installer.
Good luck on your project, I hope you'll post things here if it ever happens.
 
Last edited by Cyan,
  • Like
Reactions: Archerite

Archerite

Well-Known Member
OP
Member
GBAtemp Patron
Joined
Sep 16, 2018
Messages
209
Trophies
1
Age
41
XP
2,488
Country
Netherlands
No harm taken, I'm just sorry I couldn't help you properly. I often forget about linux users.
You actually did help me by pointing me to the information for WifiGecko in the sources from USB LoaderGX. If I look around some more in those sources I could learn even more from it like how to use C++ in a better way. I am often guilty of the opposite so I won't blame you for not thinking of Linux users...but don't be surprised if there are more MacOS users these days too.

I found geckoreader sources here :
http://wiibrew.org/wiki/Geckoreader
thought, it's C# (.net 2.0), but it contains libgecko to communicate with a gecko if you want to create your own console (log text window, not a gaming console) .
You can also look into the Discussion tab of the wiki page, there are some links, but it's very old so the sources you might find would be outdated.

I didn't search more, but sources for other consolesare probably available too.
I have no problem with C# since I can run and compile that almost natively on Linux with the use of Mono. This will help me even more in understanding what the USB Gecko does and a little of how it works. Please correct me if I am wrong but this is the picture I have about the device in my head right now:

- There is a little bit of code running on the Wii/GC that reads/writes to the memorycard slot
- Based on what commands are received it can dump or change memory locations or halt the running program...and probably!
- The CPLD/FPGA just did some EXI/SPI to 8bit parallel conversion to read and write to the FT245 USB chip that is seen as simple serial port.
- Then on the PC side this serial port is accessed by all the tools made for USB Gecko.

Then for those tools all that needs to be there is a simple serial port...unless the special drivers from FTDI are required which is mentioned on the shuriken USB website. If that is the case getting them to work with anything other than the real thing might take some more work. I have also been looking through the sourcecode of the Dolphin emulator to see how the memory card devices are emulated. I wanted to see if I could somehow add SD Gecko in the list for the GameCube and use the same sd.raw image from the Wii. I think it's possible but also a lot of work which made me think of using a super large 2042 block memory card instead...that translates to 16 MegaBytes of storage which is plenty for my current needs. I had to order one for the GameCube hardware since the biggest one I own is only 251 blocks.

Anyway, I'm curious to see what you can create from that, and I'm happy to see there are still some people interesting in releasing new things for old hardware.
We got a new exploit few days ago to hack the Wii without banner bomb, or the browser, or an SD card, just settings a DNS IPs and it's downloading/launching hackmii installer.
Good luck on your project, I hope you'll post things here if it ever happens.
The hardware might be old but as far as I am concerned it is not obsolete for many years, especially with the awesome devkitpro under active development. While I have not mastered the black art of GPU shaders yet I do understand what can be done...and it's a shame the Wii and GameCube don't have support for that. But from what I have read the same effects can also be done with the TEV...it's just that most third-party games were either PS2 ports done by lazy developers not taking the time to learn the wii's GPU. (this is only my interpretation from what I have read about it the last few months)

I had not heard about that new exploit yet but I did read in to it and that is a really cool trick. Too bad not more info is given about how it actually works after the "fake EULA page" has loaded...but it's very new ofcourse and I understand how the code or documentation may need some cleanup first. I have just today received my third wii as a backup in case I screw up anything up with loose wires and stuff to debug on the hardware :D...that one might be a good candidate to try this new method on. And if it work well I might use it on the second one I got a few months ago...still unmodded.

I will definitely post here if anything useful comes out of my tinkering with all the Gecko related sourcecode. If you meant about my homebrew game I have already started a thread about it and ask a few questions...but seeing you are a moderator you might be able to answer one of my questions. I would like to post a few pictures and link to some video's on youtube (made by others) that show what the game is about and maybe eventually a demo that can be played. The problem is that I am using the graphics from an old PC game that was given out as a promotional campaign in the Netherlands back in 1995 when recycling 15 batteries. I have explained in my other thread that the game has been released as a freeware around 2007 and could be download from the original organization but they do not offer the download anymore or even talk about it on their website. I have the original CD-ROM myself but for others to be able to play it they would have to download it from...somewhere else. For more info about it you could read my thread: Batterycheck - Remake of an old PC platformer or on the jazz2online wiki

Thanks again for the info and sorry for the long post...I hope you can answer my question about posting images and a demo for my homebrew.
 
Last edited by Archerite,

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,649
Country
France
Sorry, I can't help you on the hardware and communication part. I never try to understant how the EXI port was working, I think it's communicating using the serial port on PC. The usb gecko was released with a driver, and I had to go to hardware setting and edit an option to force a communication method (it's very blurry sorry, I did it long time ago). that's all I know.

The Shuriken's author is not manufacturing devices, but he might be able to help understanding how it works.

About sharing your game's assets for your project, this is a tricky situation. it was available for free, but it's not anymore. To me, it's up to the owner to decide to share these files (again) directly to people, and you shouldn't provide them without their agreement. this is common sense and respect over the company.
Maybe they would allow it ! you know, some companies are happy to see their project being kept alive by fans. Last project I remember is Postal, the company even made a news on their official page about the switch homebrew.

if you have a working demo, or complete project, you could try to contact your game's company to show them what you did, and explain you'd be interesting to either have their files provided again (by them) for other people to be able to get, or ask if you are allowed to include them in your project ! officially mentioning their name to say they kindly gave their agreement of course. to me, it's always better to try the nice way. doing things in the back is not well seen.
 
Last edited by Cyan,

Archerite

Well-Known Member
OP
Member
GBAtemp Patron
Joined
Sep 16, 2018
Messages
209
Trophies
1
Age
41
XP
2,488
Country
Netherlands
No problem, I know a little about the FT245 chip since it's the same one that's used in the MegaEverdrive flashcard for the Sega Megadrive/Genesis. I have worked with a few people on a project to get the Sega online...but along the way we lost contact...or interest I guess. Anyway what I meant is that I used the chip before in it's serialport mode and from what you said I now understand the USB gecko required the other "direct driver" mode. I never used that mode before but it should give more speed than a virtual USB serial port. I have no idea if I will be able to make something new that could replace it, but I do have many experiments planned for the Wii and Gamecube hardware. The homebrew game was meant to make me familiar with how the machines worked and that it did...but also made me spend less time on other projects. If something noticeable happens I will post back in here.


And to go a little of topic again...sorry for that btw...

I was actually asking two questions in one and the real question was if it would be allowed to post pictures of my version working on the Wii and 3DS and some of the rare youtube reviews of the original game. I know sharing the games assets without permission would be a bad thing and that was never my intention. I planned on giving instructions of where to put the files on an SD card for my game to find them which would require the user to have the game installed.

I totally agree with your view that it's up to the original owner to provide the files or give permission to share them...and for that reason I have made an effort in contacting them. Not sure if it's the right company but they worked on the game under their old name which is even in the credits "image". They have have an active download page where the game can be downloaded among a few other educational games they have made. It looks very weird and sketchy but I confirmed the downloaded installers hash with my own copy and they match, so at least no viruses in the "new" download. I will await their response and see where it leads. I think full completion of the project will take a few more months but a working demo is indeed a good way to show what I did.

Thank you for motivating me into going the "nice way" on this,
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: or well somewhat