Homebrew Homebrew Development

  • Thread starter Thread starter aliak11
  • Start date Start date
  • Views Views 1,475,114
  • Replies Replies 6,048
  • Likes Likes 54
Is it normal that when i try to do an FSFILE_Write to an opened file if you have a text in the file like this: "HELLO WORLD!" and you give as buffer to write to FSFILE_Write the string "WHAT?" i'll find in my file the text "WHAT? WORLD!" instead of only "WHAT?" ?
How can i fix this if i'm working on extdata Archive? (For SD Archive i solved deleting file if exist before starting writing but i don't know if i can just delete a file in an extdata archive).


Most file readers/writers are stream writers, that means if theres more data on the spot you're writing it won't get cut off, so basically you're overwriting the first part and leaving the last part untouched..
You'd have to delete the file first if it exists and then write a new file or zero-fill the whole thing and somehow reduce it's size (it'd be easier to just delete it first)
 
It seems deleting a file in extdata cause you not to rewrite it (And you have to restore an extdata backup to fix this...). Sounds strange, tools like 3ds_homemenu_extdatatool how can restore in extdata files with a lower filesize? (Like BGM.bcstm for BgmCache.bin which can be < 3.21 MB)
 
Is it possible with ninjhax to start a secondary thread on our homebrews? It could be very useful for audio/video streaming.

eg
Code:
ThreadFunc test() {
    while (true) {
        print("ping\n");
        gspWaitForVBlank();
    }
}
...
Handle threadHandle;
u32 *stack = (u32*)malloc(0x4000);
svcCreateThread(&threadHandle, test(),0, &stack[0x4000 >> 2], 1, 1);

EDIT:
the code above seems to freeze the main thread, hmm.
 
Does someone knows how WAV subchunks works?

I'm trying to extract Author and Title from WAVs files but i get strange results:

Chunks seems equal (as syntax) on HEX Editor:
wavs.png


But when i go to extract title and author, i get only the author of the first file (with the same code :/).

Here's the code:
Code:
//Chunk LIST detection
    if (chunk == 0x5453494C){
        u32 chunk_size;
        u32 subchunk;
        u32 subchunk_size;
        u32 sub_pos = pos+4;
        FSFILE_Read(fileHandle, &bytesRead, sub_pos, &subchunk, 4);
        if (subchunk == 0x4F464E49){
            sub_pos = sub_pos+4;
            FSFILE_Read(fileHandle, &bytesRead, pos, &chunk_size, 4);
            while (sub_pos < (chunk_size - pos - 4)){
                FSFILE_Read(fileHandle, &bytesRead, sub_pos, &subchunk, 4);
                FSFILE_Read(fileHandle, &bytesRead, sub_pos+4, &subchunk_size, 4);
                if (subchunk == 0x54524149){
                    char* author = (char*)malloc(subchunk_size * sizeof(char));
                    FSFILE_Read(fileHandle, &bytesRead, sub_pos+8, author, subchunk_size);
                    strcpy(wav_file->author,author);
                    wav_file->author[subchunk_size+1] = 0;
                    free(author);
                }else if (subchunk == 0x4D414E49){
                    char* title = (char*)malloc(subchunk_size * sizeof(char));
                    FSFILE_Read(fileHandle, &bytesRead, sub_pos+8, title, subchunk_size);
                    strcpy(wav_file->title,title);
                    wav_file->title[subchunk_size+1] = 0;
                    free(title);
                }
                sub_pos = sub_pos + 8 + subchunk_size;
            }
        }
    }
 
Does someone knows how WAV subchunks works?

I'm trying to extract Author and Title from WAVs files but i get strange results:

[/CODE]


Study this: http://stackoverflow.com/questions/13660777/c-reading-the-data-part-of-a-wav-file

The header size of a .wav file is always the same on every .wav file, if it's not then it's not a valid .wav file
It should be 44 bytes if I'm correct.

Artist info and song name should be in the metadata and not the header though.. So you need to figure out where that resides and how to access it
 
I'm having a problem with 3DS Banner Maker when i try to make a banner.bnr ( IndexError: tuple index out of range) and i don't know very well python to fix it. Does someone knows how to fix? (I'm using a 256x128 PNG image for banner.)
 
I'm having a problem with 3DS Banner Maker when i try to make a banner.bnr ( IndexError: tuple index out of range) and i don't know very well python to fix it. Does someone knows how to fix? (I'm using a 256x128 PNG image for banner.)
The png needs to be 24 or 32 bit. A quick way to fix is to open and save it in mspaint.
 
It was created with mspaint...if you can (and want), i can give you the image and try to convert it.
Code:
from PIL import Image, ImageDraw
import sys,os
 
f=open('256x128.png','rb')
image=Image.open(f)
image=image.convert("RGBA") # <--- open banner.py and add this line
Try that.
 
I made a Makefile project template for 3DS homebrew that creates elf, 3dsx, smdh, cia, and 3ds files. All that needs to be supplied is code, 3ds.rsf, AppData.txt, banner.png, cia.rsf, icon24.png, and icon48.png. Templates for these files are provided. The banner generating is done automatically by the Makefile from png images, making it super convenient.

Here it is if anyone is interested: https://github.com/Steveice10/3DSHomebrewTemplate
 

Site & Scene News

Popular threads in this forum