Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
NativeMidi: Allow RMI files be opened correctly
  • Loading branch information
Wohlstand committed Nov 26, 2019
1 parent b3d8a35 commit 3571243
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/codecs/native_midi/native_midi_common.c
Expand Up @@ -30,6 +30,8 @@

/* The constant 'MThd' */
#define MIDI_MAGIC 0x4d546864
/* The constant 'RIFF' */
#define RIFF_MAGIC 0x52494646

/* A single midi track as read from the midi file */
typedef struct
Expand Down Expand Up @@ -293,6 +295,10 @@ static int ReadMIDIFile(MIDIFile *mididata, SDL_RWops *src)

/* Make sure this is really a MIDI file */
SDL_RWread(src, &ID, 1, 4);
if (BE_LONG(ID) == RIFF_MAGIC) {
SDL_RWseek(src, 16, RW_SEEK_CUR);
SDL_RWread(src, &ID, 1, 4);
}
if (BE_LONG(ID) != MIDI_MAGIC)
return 0;

Expand Down

0 comments on commit 3571243

Please sign in to comment.