Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
libretro-gme
Commits
bda7032a
Unverified
Commit
bda7032a
authored
Sep 24, 2021
by
Libretro-Admin
Committed by
GitHub
Sep 24, 2021
Browse files
Merge pull request #24 from jdgleaver/load-content-fix
Fix content loading
parents
c587cfd9
d1cc63ba
Pipeline
#56401
passed with stages
in 9 minutes and 46 seconds
Changes
5
Pipelines
10
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
bda7032a
...
@@ -477,6 +477,10 @@ endif
...
@@ -477,6 +477,10 @@ endif
CFLAGS
+=
-Wall
$(INCFLAGS)
$(INCFLAGS_PLATFORM)
CFLAGS
+=
-Wall
$(INCFLAGS)
$(INCFLAGS_PLATFORM)
CXXFLAGS
+=
-Wall
$(INCFLAGS)
$(INCFLAGS_PLATFORM)
CXXFLAGS
+=
-Wall
$(INCFLAGS)
$(INCFLAGS_PLATFORM)
ifeq
($(DEBUG),1)
CFLAGS
+=
-O0
-g
endif
ifneq
(,$(findstring msvc,$(platform)))
ifneq
(,$(findstring msvc,$(platform)))
ifeq
($(DEBUG),1)
ifeq
($(DEBUG),1)
CFLAGS
+=
-MTd
CFLAGS
+=
-MTd
...
...
src/fileformat.c
View file @
bda7032a
...
@@ -187,9 +187,11 @@ bool get_file_data(const char *path,file_data ***dest_files, int *dest_numfiles)
...
@@ -187,9 +187,11 @@ bool get_file_data(const char *path,file_data ***dest_files, int *dest_numfiles)
else
else
{
{
file_data
*
fd
;
file_data
*
fd
;
fp
=
fopen
(
path
,
"rb"
);
if
(
!
fp
)
return
false
;
files
=
malloc
(
sizeof
(
file_data
*
));
files
=
malloc
(
sizeof
(
file_data
*
));
fd
=
malloc
(
sizeof
(
file_data
));
fd
=
malloc
(
sizeof
(
file_data
));
fp
=
fopen
(
path
,
"rb"
);
//get file length
//get file length
fseek
(
fp
,
0
,
SEEK_END
);
fseek
(
fp
,
0
,
SEEK_END
);
fd
->
length
=
ftell
(
fp
);
fd
->
length
=
ftell
(
fp
);
...
...
src/libretro.c
View file @
bda7032a
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include "log.h"
#include "log.h"
// Static globals
// Static globals
static
surface
*
framebuffer
=
NULL
;
;
static
surface
*
framebuffer
=
NULL
;
static
uint16_t
previnput
=
0
;
static
uint16_t
previnput
=
0
;
// Callbacks
// Callbacks
...
@@ -87,7 +87,7 @@ void retro_get_system_info(struct retro_system_info *info)
...
@@ -87,7 +87,7 @@ void retro_get_system_info(struct retro_system_info *info)
memset
(
info
,
0
,
sizeof
(
*
info
));
memset
(
info
,
0
,
sizeof
(
*
info
));
info
->
library_name
=
"Game Music Emulator"
;
info
->
library_name
=
"Game Music Emulator"
;
info
->
library_version
=
"v0.6.1"
;
info
->
library_version
=
"v0.6.1"
;
info
->
need_fullpath
=
fals
e
;
info
->
need_fullpath
=
tru
e
;
info
->
valid_extensions
=
"ay|gbs|gym|hes|kss|nsf|nsfe|sap|spc|vgm|vgz|zip"
;
info
->
valid_extensions
=
"ay|gbs|gym|hes|kss|nsf|nsfe|sap|spc|vgm|vgz|zip"
;
info
->
block_extract
=
true
;
info
->
block_extract
=
true
;
}
}
...
@@ -123,7 +123,9 @@ void retro_init(void)
...
@@ -123,7 +123,9 @@ void retro_init(void)
// End of retrolib
// End of retrolib
void
retro_deinit
(
void
)
void
retro_deinit
(
void
)
{
{
free
(
framebuffer
);
if
(
framebuffer
)
free_surface
(
framebuffer
);
framebuffer
=
NULL
;
}
}
// Reset gme
// Reset gme
...
@@ -171,8 +173,7 @@ bool retro_load_game(const struct retro_game_info *info)
...
@@ -171,8 +173,7 @@ bool retro_load_game(const struct retro_game_info *info)
{
{
long
sample_rate
=
44100
;
long
sample_rate
=
44100
;
// ensure there is ROM data
if
(
!
info
)
if
(
!
info
||
!
info
->
data
)
return
false
;
return
false
;
if
(
open_file
(
info
->
path
,
sample_rate
))
if
(
open_file
(
info
->
path
,
sample_rate
))
...
...
src/player.c
View file @
bda7032a
...
@@ -37,7 +37,8 @@ bool open_file(const char *path, long sample_rate)
...
@@ -37,7 +37,8 @@ bool open_file(const char *path, long sample_rate)
void
close_file
(
void
)
void
close_file
(
void
)
{
{
gme_delete
(
emu
);
gme_delete
(
emu
);
emu
=
NULL
;
if
(
plist
!=
NULL
)
if
(
plist
!=
NULL
)
cleanup_playlist
(
plist
);
cleanup_playlist
(
plist
);
}
}
...
...
src/playlist.c
View file @
bda7032a
...
@@ -9,23 +9,19 @@
...
@@ -9,23 +9,19 @@
bool
get_playlist
(
const
char
*
path
,
playlist
**
dest_pl
)
bool
get_playlist
(
const
char
*
path
,
playlist
**
dest_pl
)
{
{
//local variables
//local variables
int
i
,
j
,
position
;
int
i
,
j
;
Music_Emu
*
temp_emu
;
int
position
=
0
;
gme_file_data
*
gfd
;
Music_Emu
*
temp_emu
=
NULL
;
gme_file_data
*
gfd
=
NULL
;
gme_err_t
err_msg
;
gme_err_t
err_msg
;
playlist
*
pl
;
playlist
*
pl
=
NULL
;
//init playlist
//init playlist
pl
=
malloc
(
sizeof
(
playlist
));
pl
=
(
playlist
*
)
calloc
(
1
,
sizeof
(
playlist
));
pl
->
num_files
=
0
;
pl
->
files
=
NULL
;
pl
->
num_tracks
=
0
;
pl
->
tracks
=
NULL
;
//load libretro content file
//load libretro content file
if
(
get_playlist_gme_files
(
path
,
&
(
pl
->
files
),
&
(
pl
->
num_files
),
&
(
pl
->
num_tracks
)))
if
(
get_playlist_gme_files
(
path
,
&
(
pl
->
files
),
&
(
pl
->
num_files
),
&
(
pl
->
num_tracks
)))
{
{
pl
->
tracks
=
malloc
(
sizeof
(
gme_track_data
*
)
*
pl
->
num_tracks
);
pl
->
tracks
=
(
gme_track_data
**
)
calloc
(
pl
->
num_tracks
,
sizeof
(
gme_track_data
*
)
);
//read tracks
//read tracks
position
=
0
;
for
(
i
=
0
;
i
<
pl
->
num_files
;
i
++
)
for
(
i
=
0
;
i
<
pl
->
num_files
;
i
++
)
{
{
gfd
=
pl
->
files
[
i
];
gfd
=
pl
->
files
[
i
];
...
@@ -42,13 +38,26 @@ bool get_playlist(const char *path, playlist **dest_pl)
...
@@ -42,13 +38,26 @@ bool get_playlist(const char *path, playlist **dest_pl)
}
}
}
}
else
else
return
false
;
goto
error
;
gme_delete
(
temp_emu
);
temp_emu
=
NULL
;
}
}
}
}
else
else
return
false
;
goto
error
;
*
dest_pl
=
pl
;
*
dest_pl
=
pl
;
return
true
;
return
true
;
error:
if
(
temp_emu
)
gme_delete
(
temp_emu
);
if
(
pl
)
cleanup_playlist
(
pl
);
return
false
;
}
}
bool
get_playlist_gme_files
(
const
char
*
path
,
gme_file_data
***
dest_files
,
int
*
dest_num_files
,
int
*
dest_num_tracks
)
bool
get_playlist_gme_files
(
const
char
*
path
,
gme_file_data
***
dest_files
,
int
*
dest_num_files
,
int
*
dest_num_tracks
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment