Homebrew Any way to include resources inside 3ds, 3dsx or CIA files?

cebolleto

Well-Known Member
OP
Member
Joined
Mar 5, 2010
Messages
204
Trophies
1
Age
43
XP
2,524
Country
Yes, you are right
I have changed it to
Code:
u8 file_binary_lowpath[20]  = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
        FS_path fs_path = { PATH_BINARY, 20, file_binary_lowpath };

but it still doesn't work. I have configured romfsArchive as an empty path on purpose. Where should it point to?
 

elhobbs

Well-Known Member
Member
Joined
Jul 28, 2008
Messages
1,044
Trophies
1
XP
3,032
Country
United States
So fs_path looks good now. Take a look at savedatacheck_archive in the example. That is what romfsArchive should look like. You need to be supplying the file name you are trying to open. Plus the other values are different too.
 

cebolleto

Well-Known Member
OP
Member
Joined
Mar 5, 2010
Messages
204
Trophies
1
Age
43
XP
2,524
Country
But what is the path supposed to be?
It says in the documentation that OpenFile will return a handle to the romfs archive and parsing it has to be done manually
 

cebolleto

Well-Known Member
OP
Member
Joined
Mar 5, 2010
Messages
204
Trophies
1
Age
43
XP
2,524
Country
Back to this topic, I've been trying several attempts, even making sure the romfs is being included on the .cia but no matter what I try, it doesn't work

Could anyone help me?
 

cebolleto

Well-Known Member
OP
Member
Joined
Mar 5, 2010
Messages
204
Trophies
1
Age
43
XP
2,524
Country
Ok, I finally managed to get this working (with some help). Here is the code in case someone is interested

Code:
void romfsTest()
{
    FS_archive romfsArchive    = { ARCH_ROMFS, { PATH_EMPTY, 1, (u8*)"" } };

    Result rc = 0;
    rc = FSUSER_OpenArchive(NULL, &romfsArchive);
    if(rc == 0) {
       
        Handle fd;
        u8 file_binary_lowpath[20]  = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
        FS_path fs_path = { PATH_BINARY, 12, file_binary_lowpath};
        rc = FSUSER_OpenFile(NULL, &fd, romfsArchive, fs_path, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
        if(rc == 0) {
            char data[1024];
            u32 bytesRead;
            rc = FSFILE_Read(fd, &bytesRead, 0, data, (u32)1024);
            if(rc == 0) {
                printf("Data read:%d\n", (int)bytesRead);
                int i = 0;
                for(i = 0; i < bytesRead; ++i)
                {
                    printf("%c", data[i]);
                }
            } else {
                printf("FSFILE_Read failed(%x)\n", (int)rc);
            }
        } else {
            printf("FSUSER_OpenFile failed(%x)\n", (int)rc);
        }
    } else {
        printf("FSUSER_OpenArchive failed(%x)\n", (int)rc);
    }
}

this will print on the console the first 1024 characters of the romfs file if properly added to the .cia or .3ds
 
  • Like
Reactions: hippy dave

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/watch?v=pkYA4rALqEE