Homebrew Official libiosuhax - PPC IPC library for communication to /dev/iosuhax

shinyquagsire23

SALT/Sm4sh Leak Guy
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States
I realized I had to edit the Makefile still but another error:
Code:
LIBS    := -lz -liosuhax
Code:
c:/devkitPro/portlibs/ppc/lib\libiosuhax.a(iosuhax.o): In function `IOSUHAX_Open':
iosuhax.c:(.text.IOSUHAX_Open+0x3e): undefined reference to `IOS_Open'
iosuhax.c:(.text.IOSUHAX_Open+0x42): undefined reference to `IOS_Open'
iosuhax.c:(.text.IOSUHAX_Open+0x72): undefined reference to `IOS_Ioctl'
iosuhax.c:(.text.IOSUHAX_Open+0x76): undefined reference to `IOS_Ioctl'
iosuhax.c:(.text.IOSUHAX_Open+0xaa): undefined reference to `IOS_Close'
iosuhax.c:(.text.IOSUHAX_Open+0xb2): undefined reference to `IOS_Close'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/d/Consoles/WiiU/Applications/Browser/tcpgecko/tcpgecko.elf] Error 1
make: *** [build] Error 2
It doesn't find the IOSU functions referenced in the library which is odd. How come?
They have to be defined? As far as browser stuff goes, you have to import and define everything manually. WUT and HBC samples have things which do this but for browser it's a little more tricky.
 

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,477
Country
Germany
They have to be defined? As far as browser stuff goes, you have to import and define everything manually. WUT and HBC samples have things which do this but for browser it's a little more tricky.
This is for the Homebrew Launcher. It builds an ELF. It's not for the browser (anymore).
 
Last edited by BullyWiiPlaza,

shinyquagsire23

SALT/Sm4sh Leak Guy
Member
Joined
Nov 18, 2012
Messages
1,977
Trophies
2
Age
26
Location
Las Vegas
XP
3,765
Country
United States

Nerdtendo

Your friendly neighborhood idiot
Member
Joined
Sep 29, 2016
Messages
1,770
Trophies
1
XP
4,641
Country
United States
So I was directed to this forum because I am considering developing. I'm still just learning programming (I've made 1 basic game using Python and am working on a more complex one) and I'm also pretty young (I would rather not specify my age) so who here can give me a noob rundown of homebrew development and how it works?
 

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,477
Country
Germany
So I was directed to this forum because I am considering developing. I'm still just learning programming (I've made 1 basic game using Python and am working on a more complex one) and I'm also pretty young (I would rather not specify my age) so who here can give me a noob rundown of homebrew development and how it works?
You learn C programming and then install devkitPro/with libraries potentially to get started with compiling projects. You better use some existing project and modify it to do what you want instead of starting from scratch.
 

Nerdtendo

Your friendly neighborhood idiot
Member
Joined
Sep 29, 2016
Messages
1,770
Trophies
1
XP
4,641
Country
United States
You learn C programming and then install devkitPro/with libraries potentially to get started with compiling projects. You better use some existing project and modify it to do what you want instead of starting from scratch.
Alright, that she all i need to know. I'll probably tinker with Python a bit more beforehand moving on to C but I'll look into this.
 

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,477
Country
Germany
Well, I used this library now but the console crashes on the very first call to IOSUHAX_Open(). Here is the code:
Code:
case COMMAND_IOSUHAX_READ_FILE: {
    log_print("COMMAND_IOSUHAX_READ_FILE");

    // TODO Crashes console on this call
    int returnValue = IOSUHAX_Open(NULL);
    log_print("IOSUHAX_Open Done");
    log_printf("IOSUHAX_Open: %i", returnValue);

    if (returnValue < 0) {
        goto IOSUHAX_OPEN_FAILED;
    }

    int fileSystemFileDescriptor = IOSUHAX_FSA_Open();
    log_printf("IOSUHAX_FSA_Open: %i", fileSystemFileDescriptor);

    if (fileSystemFileDescriptor < 0) {
        goto IOSUHAX_FSA_OPEN_FAILED;
    }

    int fileDescriptor;
    const char *filePath = "/vol/storage_usb/usr/title/0005000e/1010ed00/content/audio/stream/pBGM_GBA_CHEESELAND_F.bfstm";
    returnValue = IOSUHAX_FSA_OpenFile(fileSystemFileDescriptor, filePath, "rb", &fileDescriptor);
    log_printf("IOSUHAX_FSA_OpenFile: %i", returnValue);

    if (returnValue < 0) {
        goto IOSUHAX_OPEN_FILE_FAILED;
    }

    fileStat_s fileStat;
    returnValue = IOSUHAX_FSA_StatFile(fileSystemFileDescriptor, fileDescriptor, &fileStat);
    log_printf("IOSUHAX_FSA_StatFile: %i", returnValue);

    if (returnValue < 0) {
        goto IOSUHAX_READ_FILE_FAILED_CLOSE;
    }

    void *fileBuffer = MEMBucket_alloc(fileStat.size, 4);
    log_printf("File Buffer: %p", fileBuffer);

    if (!fileBuffer) {
        goto IOSUHAX_READ_FILE_FAILED_CLOSE;
    }

    size_t totalBytesRead = 0;
    while (totalBytesRead < fileStat.size) {
        size_t remainingBytes = fileStat.size - totalBytesRead;
        int bytesRead = IOSUHAX_FSA_ReadFile(fileSystemFileDescriptor,
                                             fileBuffer + totalBytesRead,
                                             0x01,
                                             remainingBytes,
                                             fileDescriptor,
                                             0);
        log_printf("IOSUHAX_FSA_ReadFile: %i", bytesRead);

        if (bytesRead <= 0) {
            goto IOSUHAX_READ_FILE_FAILED_CLOSE;
        } else {
            totalBytesRead += bytesRead;
        }
    }

    log_printf("Bytes read: %i", totalBytesRead);

    IOSUHAX_READ_FILE_FAILED_CLOSE:

    returnValue = IOSUHAX_FSA_CloseFile(fileSystemFileDescriptor, fileDescriptor);
    log_printf("IOSUHAX_FSA_CloseFile: %i", returnValue);

    IOSUHAX_OPEN_FILE_FAILED:

    returnValue = IOSUHAX_FSA_Close(fileSystemFileDescriptor);
    log_printf("IOSUHAX_FSA_Close: %i", returnValue);

    IOSUHAX_FSA_OPEN_FAILED:

    returnValue = IOSUHAX_Close();
    log_printf("IOSUHAX_Close: %i", returnValue);

    IOSUHAX_OPEN_FAILED:

    break;
}
I intend to read a file from Mario Kart 8 from the USB and hard-coded the path for testing. In case there is something wrong with it, thanks for any indications.

Only the first log is printed so it is obvious that it crashed exactly at the first call:
6jhzdxfw.png

I tried in the Wii U menu and in some Wii U game but same result. Why does it crash? Since the code compiled to begin with, the function is not undefined or anything so it should execute correctly. I didn't modify the libiosuhax at all. I only used CBHC booting the system menu with patches however, no Mocha. With Mocha, it freezes after the TCP Gecko Installer when the Wii U menu loads :/
 
Last edited by BullyWiiPlaza,

Maschell

Well-Known Member
Member
Joined
Jun 14, 2008
Messages
1,090
Trophies
2
XP
4,644
Country
Germany
Check the logs of the console with ftpiiu everywhere

Edit: ONLY Mocha supports libiosuhax on dev/iosuhax, so I guess thats the problem. It shouldn't crash though.
(CBHC needs some workarround I personally don't really like)
Probabaly the fact that the TCP Installer is crashing after using Mocha is the problem
 
Last edited by Maschell,

BullyWiiPlaza

Nintendo Hacking <3
Member
Joined
Aug 2, 2014
Messages
1,932
Trophies
0
XP
2,477
Country
Germany
Check the logs of the console with ftpiiu everywhere
What's the file path to check the logs?
Edit: ONLY Mocha supports libiosuhax on dev/iosuhax, so I guess thats the problem. It shouldn't crash though.
(CBHC needs some workarround I personally don't really like)
Probabaly the fact that the TCP Installer is crashing after using Mocha is the problem
So CBHC should use Mocha to avoid having more problems and the TCP Gecko Installer should be fixed so it doesn't crash in certain circumstances? It seems like it because I also don't like how some dimok tools don't work with CBHC's system menu patches. There is just no reason for that :D
 

Maschell

Well-Known Member
Member
Joined
Jun 14, 2008
Messages
1,090
Trophies
2
XP
4,644
Country
Germany
I also don't like how some dimok tools don't work with CBHC's system menu patches. There is just no reason for that :D
The otherway round. CBHC doesn't support libiosuhax, because it's "just" patching some function and is no real CFW.
I personally would just use Mocha and no CBHC at all ;)

The logs are in "storage_slc/logs"
 
  • Like
Reactions: BullyWiiPlaza

brienj

Trying to avoid getting cancer
Member
Joined
Jan 3, 2016
Messages
1,232
Trophies
0
Website
twitter.com
XP
2,142
Country
United States
Check the logs of the console with ftpiiu everywhere

Edit: ONLY Mocha supports libiosuhax on dev/iosuhax, so I guess thats the problem. It shouldn't crash though.
(CBHC needs some workarround I personally don't really like)
Probabaly the fact that the TCP Installer is crashing after using Mocha is the problem
I'm glad to learn I'm not the only one ...

I have a few homebrew projects I haven't bothered releasing, cause I didn't feel like making it work with the MCP hooks in Haxchi/CBHC.
 
  • Like
Reactions: Maschell

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Veho @ Veho: The cybertruck is a death trap.