From 58378d2711cbb9c2a01964adc19a3c0a80714b64 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Fri, 16 Sep 2016 02:49:17 -0700 Subject: [PATCH] Fix GME M3U playlist support. --- Plugins/GME/GameContainer.m | 13 +++++++------ Plugins/GME/GameDecoder.m | 8 ++++---- Plugins/GME/GameMetadataReader.m | 13 +++++++------ 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/Plugins/GME/GameContainer.m b/Plugins/GME/GameContainer.m index c21a97648..e6930c73f 100755 --- a/Plugins/GME/GameContainer.m +++ b/Plugins/GME/GameContainer.m @@ -66,16 +66,17 @@ NSURL *m3uurl = [url URLByDeletingPathExtension]; m3uurl = [m3uurl URLByAppendingPathExtension:@"m3u"]; - if ([source open:m3uurl]) + id m3usrc = [audioSourceClass audioSourceForURL:m3uurl]; + if ([m3usrc open:m3uurl]) { - if ([source seekable]) + if ([m3usrc seekable]) { - [source seek:0 whence:SEEK_END]; - size = [source tell]; - [source seek:0 whence:SEEK_SET]; + [m3usrc seek:0 whence:SEEK_END]; + size = [m3usrc tell]; + [m3usrc seek:0 whence:SEEK_SET]; data = malloc(size); - [source read:data amount:size]; + [m3usrc read:data amount:size]; error = gme_load_m3u_data(emu, data, size); free(data); diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index 54c6aca76..6a72c0f76 100755 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -86,12 +86,12 @@ gme_err_t readCallback( void* data, void* out, long count ) { if ([m3usrc seekable]) { - [source seek:0 whence:SEEK_END]; - long size = [source tell]; - [source seek:0 whence:SEEK_SET]; + [m3usrc seek:0 whence:SEEK_END]; + long size = [m3usrc tell]; + [m3usrc seek:0 whence:SEEK_SET]; void *data = malloc(size); - [source read:data amount:size]; + [m3usrc read:data amount:size]; gme_load_m3u_data(emu, data, size); free(data); diff --git a/Plugins/GME/GameMetadataReader.m b/Plugins/GME/GameMetadataReader.m index 3c68a1606..5c77c6752 100644 --- a/Plugins/GME/GameMetadataReader.m +++ b/Plugins/GME/GameMetadataReader.m @@ -73,16 +73,17 @@ NSURL *m3uurl = [url URLByDeletingPathExtension]; m3uurl = [m3uurl URLByAppendingPathExtension:@"m3u"]; - if ([source open:m3uurl]) + id m3usrc = [audioSourceClass audioSourceForURL:m3uurl]; + if ([m3usrc open:m3uurl]) { - if ([source seekable]) + if ([m3usrc seekable]) { - [source seek:0 whence:SEEK_END]; - long size = [source tell]; - [source seek:0 whence:SEEK_SET]; + [m3usrc seek:0 whence:SEEK_END]; + long size = [m3usrc tell]; + [m3usrc seek:0 whence:SEEK_SET]; void *data = malloc(size); - [source read:data amount:size]; + [m3usrc read:data amount:size]; gme_load_m3u_data(emu, data, size); free(data);