raysan5 / rres

A simple and easy-to-use file-format to package resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault loading sounds from unpacked wave files.

H-Art-Src opened this issue · comments

Sound SOUND;
int id = rresGetResourceId(ASSETS_DIR , filename);
if(id)
{
      printf("~Loaded sound from rres~\n");
      rresResourceChunk chunk = rresLoadResourceChunk( "resources/DATA.rres" , id);
      UnpackResourceChunk(&chunk);
          Wave tempWave = LoadWaveFromResource(rresLoadResourceChunk( "resources/DATA.rres" , id));
          SOUND = LoadSoundFromWave(tempWave);
          UnloadWave(tempWave);
      rresUnloadResourceChunk(chunk);
}

If the packaged wav file is too large, approximately > 10 mb, LoadSoundFromWave() segfaults.

Possibly related to raysan5/raylib#1423

commented

@H-Art-Src Thanks for reporting! Did you verify the data returned by LoadWaveFromResource() is correct?

    Sound SOUND;
    int id = rresGetResourceId(ASSETS_DIR , filename);
    if(id)//raysan made this shit bugged for certain wav files I'M GOING TO WORK ON RAYLIB
    {
        printf("~Loaded sound from rres~\n");
        rresResourceChunk chunk = rresLoadResourceChunk( "resources/DATA.rres" , id);
        UnpackResourceChunk(&chunk);
            Wave tempWave = LoadWaveFromResource(chunk);
            SOUND = LoadSoundFromWave(tempWave); // still segfaults here
            UnloadWave(tempWave);
        rresUnloadResourceChunk(chunk);
    }

Realized LoadWaveFromResource() should be passing chunk, but it's still segfaulting from LoadSoundFromWave().

Unpacked sound is reported to be 28,653,396 bytes from FS.

What the log shows when commentating out SOUND = LoadSoundFromWave(tempWave);:

RRES: INFO: Loading resource from file: resources/DATA.rres
RRES: INFO: Found requested resource id: 0x18705889
RRES: WAVE: Id: 0x18705889 | Base size: 28653372 | Packed size: 28653372
RRES: WAVE: WARNING: Data must be decompressed/decrypted
commented

@H-Art-Src Please, could you provide some sample with files for testing?