Skip to content

Commit

Permalink
Make debug builds open data/music.ogg from real filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
gustafla committed Aug 1, 2023
1 parent 76c7b48 commit 0fb1801
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/music_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,20 @@ static void callback(void *userdata, Uint8 *stream, int len) {
}

static stb_vorbis *open_vorbis(const char *filename) {
int error = VORBIS__no_error;

#ifdef DEBUG
stb_vorbis *vorbis = stb_vorbis_open_filename(filename, &error, NULL);
#else
unsigned int len;
const unsigned char *data = filesystem_open(filename, &len);
if (!data) {
SDL_Log("File %s not found\n", filename);
return NULL;
}

int error = VORBIS__no_error;
stb_vorbis *vorbis = stb_vorbis_open_memory(data, len, &error, NULL);
#endif

if (error != VORBIS__no_error) {
vorbis = NULL;
Expand Down

0 comments on commit 0fb1801

Please sign in to comment.