mirror of
https://github.com/libretro/RetroArch
synced 2025-03-31 01:21:03 +00:00
Merge branch 'master' of github.com:Themaister/SSNES into ssnes-consoles
This commit is contained in:
commit
3a47e2cd63
9
Makefile
9
Makefile
@ -2,11 +2,11 @@ include config.mk
|
|||||||
|
|
||||||
TARGET = ssnes tools/ssnes-joyconfig
|
TARGET = ssnes tools/ssnes-joyconfig
|
||||||
|
|
||||||
OBJ = ssnes.o file.o driver.o settings.o dynamic.o message.o rewind.o movie.o autosave.o gfx/gfx_common.o ups.o bps.o strl.o getopt.o screenshot.o thread.o audio/hermite.o
|
OBJ = ssnes.o file.o driver.o settings.o dynamic.o message.o rewind.o movie.o gfx/gfx_common.o ups.o bps.o strl.o getopt.o screenshot.o thread.o audio/hermite.o
|
||||||
JOYCONFIG_OBJ = tools/ssnes-joyconfig.o conf/config_file.o strl.o
|
JOYCONFIG_OBJ = tools/ssnes-joyconfig.o conf/config_file.o strl.o
|
||||||
HEADERS = $(wildcard */*.h) $(wildcard *.h)
|
HEADERS = $(wildcard */*.h) $(wildcard *.h)
|
||||||
|
|
||||||
LIBS = -lm -lpthread
|
LIBS = -lm
|
||||||
DEFINES = -DHAVE_CONFIG_H
|
DEFINES = -DHAVE_CONFIG_H
|
||||||
|
|
||||||
ifneq ($(findstring Darwin,$(OS)),)
|
ifneq ($(findstring Darwin,$(OS)),)
|
||||||
@ -27,6 +27,11 @@ ifneq ($(findstring Linux,$(OS)),)
|
|||||||
LIBS += -lrt
|
LIBS += -lrt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_THREADS), 1)
|
||||||
|
OBJ += autosave.o
|
||||||
|
LIBS += -lpthread
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_CONFIGFILE), 1)
|
ifeq ($(HAVE_CONFIGFILE), 1)
|
||||||
OBJ += conf/config_file.o
|
OBJ += conf/config_file.o
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
TARGET = ssnes.exe
|
TARGET = ssnes.exe
|
||||||
JTARGET = ssnes-joyconfig.exe
|
JTARGET = ssnes-joyconfig.exe
|
||||||
OBJ = ssnes.o file.o driver.o conf/config_file.o settings.o dynamic.o message.o rewind.o movie.o autosave.o gfx/gfx_common.o bps.o ups.o strl.o screenshot.o audio/hermite.o thread.o getopt.o
|
OBJ = ssnes.o file.o driver.o conf/config_file.o settings.o dynamic.o message.o rewind.o movie.o gfx/gfx_common.o bps.o ups.o strl.o screenshot.o audio/hermite.o thread.o getopt.o
|
||||||
JOBJ = conf/config_file.o tools/main-stub.o tools/ssnes-joyconfig.o strl.o
|
JOBJ = conf/config_file.o tools/main-stub.o tools/ssnes-joyconfig.o strl.o
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
@ -13,6 +13,7 @@ HAVE_SDL = 1
|
|||||||
HAVE_OPENGL = 1
|
HAVE_OPENGL = 1
|
||||||
HAVE_DYLIB = 1
|
HAVE_DYLIB = 1
|
||||||
HAVE_NETPLAY = 1
|
HAVE_NETPLAY = 1
|
||||||
|
HAVE_THREADS = 1
|
||||||
DYNAMIC = 1
|
DYNAMIC = 1
|
||||||
|
|
||||||
ifeq ($(SLIM),)
|
ifeq ($(SLIM),)
|
||||||
@ -39,6 +40,11 @@ ifeq ($(HAVE_SDL), 1)
|
|||||||
DEFINES += -ISDL -DHAVE_SDL
|
DEFINES += -ISDL -DHAVE_SDL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HAVE_THREADS), 1)
|
||||||
|
OBJ += autosave.o
|
||||||
|
DEFINES += -DHAVE_THREADS
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HAVE_OPENGL), 1)
|
ifeq ($(HAVE_OPENGL), 1)
|
||||||
DEFINES += -DHAVE_OPENGL
|
DEFINES += -DHAVE_OPENGL
|
||||||
LIBS += -lopengl32
|
LIBS += -lopengl32
|
||||||
|
@ -14,6 +14,12 @@ static const bool _sdl_supp = true;
|
|||||||
static const bool _sdl_supp = false;
|
static const bool _sdl_supp = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
static const bool _thread_supp = true;
|
||||||
|
#else
|
||||||
|
static const bool _thread_supp = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
static const bool _opengl_supp = true;
|
static const bool _opengl_supp = true;
|
||||||
#else
|
#else
|
||||||
|
@ -734,9 +734,13 @@ void netplay_post_frame(netplay_t *handle)
|
|||||||
while (first || (handle->tmp_ptr != handle->self_ptr))
|
while (first || (handle->tmp_ptr != handle->self_ptr))
|
||||||
{
|
{
|
||||||
psnes_serialize(handle->buffer[handle->tmp_ptr].state, handle->state_size);
|
psnes_serialize(handle->buffer[handle->tmp_ptr].state, handle->state_size);
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
lock_autosave();
|
lock_autosave();
|
||||||
|
#endif
|
||||||
psnes_run();
|
psnes_run();
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
unlock_autosave();
|
unlock_autosave();
|
||||||
|
#endif
|
||||||
handle->tmp_ptr = NEXT_PTR(handle->tmp_ptr);
|
handle->tmp_ptr = NEXT_PTR(handle->tmp_ptr);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ if [ $HAVE_DYNAMIC != yes ]; then
|
|||||||
add_define_make libsnes $LIBSNES
|
add_define_make libsnes $LIBSNES
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
check_lib THREADS -lpthread pthread_create
|
||||||
check_lib DYLIB $DYLIB dlopen
|
check_lib DYLIB $DYLIB dlopen
|
||||||
check_lib NETPLAY -lc socket
|
check_lib NETPLAY -lc socket
|
||||||
check_lib GETOPT_LONG -lc getopt_long
|
check_lib GETOPT_LONG -lc getopt_long
|
||||||
@ -78,25 +79,30 @@ fi
|
|||||||
check_pkgconf XML libxml-2.0
|
check_pkgconf XML libxml-2.0
|
||||||
check_pkgconf SDL_IMAGE SDL_image
|
check_pkgconf SDL_IMAGE SDL_image
|
||||||
|
|
||||||
if [ $HAVE_FFMPEG != no ]; then
|
if [ $HAVE_THREADS != no ]; then
|
||||||
check_pkgconf AVCODEC libavcodec
|
if [ $HAVE_FFMPEG != no ]; then
|
||||||
check_pkgconf AVFORMAT libavformat
|
check_pkgconf AVCODEC libavcodec
|
||||||
check_pkgconf AVUTIL libavutil
|
check_pkgconf AVFORMAT libavformat
|
||||||
check_pkgconf SWSCALE libswscale
|
check_pkgconf AVUTIL libavutil
|
||||||
|
check_pkgconf SWSCALE libswscale
|
||||||
|
|
||||||
( [ $HAVE_FFMPEG = auto ] && ( [ $HAVE_AVCODEC = no ] || [ $HAVE_AVFORMAT = no ] || [ $HAVE_AVUTIL = no ] || [ $HAVE_SWSCALE = no ] ) && HAVE_FFMPEG=no ) || HAVE_FFMPEG=yes
|
( [ $HAVE_FFMPEG = auto ] && ( [ $HAVE_AVCODEC = no ] || [ $HAVE_AVFORMAT = no ] || [ $HAVE_AVUTIL = no ] || [ $HAVE_SWSCALE = no ] ) && HAVE_FFMPEG=no ) || HAVE_FFMPEG=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $HAVE_FFMPEG = yes ]; then
|
if [ $HAVE_FFMPEG = yes ]; then
|
||||||
check_lib FFMPEG_ALLOC_CONTEXT3 "$AVCODEC_LIBS" avcodec_alloc_context3
|
check_lib FFMPEG_ALLOC_CONTEXT3 "$AVCODEC_LIBS" avcodec_alloc_context3
|
||||||
check_lib FFMPEG_AVCODEC_OPEN2 "$AVCODEC_LIBS" avcodec_open2
|
check_lib FFMPEG_AVCODEC_OPEN2 "$AVCODEC_LIBS" avcodec_open2
|
||||||
check_lib FFMPEG_AVIO_OPEN "$AVFORMAT_LIBS" avio_open
|
check_lib FFMPEG_AVIO_OPEN "$AVFORMAT_LIBS" avio_open
|
||||||
check_lib FFMPEG_AVFORMAT_WRITE_HEADER "$AVFORMAT_LIBS" avformat_write_header
|
check_lib FFMPEG_AVFORMAT_WRITE_HEADER "$AVFORMAT_LIBS" avformat_write_header
|
||||||
check_lib FFMPEG_AVFORMAT_NEW_STREAM "$AVFORMAT_LIBS" avformat_new_stream
|
check_lib FFMPEG_AVFORMAT_NEW_STREAM "$AVFORMAT_LIBS" avformat_new_stream
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $HAVE_FFMPEG = no ] && [ $HAVE_X264RGB = yes ]; then
|
if [ $HAVE_FFMPEG = no ] && [ $HAVE_X264RGB = yes ]; then
|
||||||
echo "x264 RGB recording is enabled, but FFmpeg is not. --enable-x264rgb will not have any effect."
|
echo "x264 RGB recording is enabled, but FFmpeg is not. --enable-x264rgb will not have any effect."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Not building with threading support. Will skip FFmpeg."
|
||||||
|
HAVE_FFMPEG=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_lib DYNAMIC $DYLIB dlopen
|
check_lib DYNAMIC $DYLIB dlopen
|
||||||
@ -118,7 +124,7 @@ check_pkgconf PYTHON python3
|
|||||||
add_define_make OS $OS
|
add_define_make OS $OS
|
||||||
|
|
||||||
# Creates config.mk and config.h.
|
# Creates config.mk and config.h.
|
||||||
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM X264RGB"
|
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL OPENGL DYLIB GETOPT_LONG THREADS CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO X11 XEXT NETPLAY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM X264RGB"
|
||||||
create_config_make config.mk $VARS
|
create_config_make config.mk $VARS
|
||||||
create_config_header config.h $VARS
|
create_config_header config.h $VARS
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ PACKAGE_VERSION=0.9.2
|
|||||||
# $3: Default arg. auto implies that HAVE_ALSA will be set according to library checks later on.
|
# $3: Default arg. auto implies that HAVE_ALSA will be set according to library checks later on.
|
||||||
add_command_line_enable DYNAMIC "Disable dynamic loading of libsnes library" yes
|
add_command_line_enable DYNAMIC "Disable dynamic loading of libsnes library" yes
|
||||||
add_command_line_string LIBSNES "libsnes library used" ""
|
add_command_line_string LIBSNES "libsnes library used" ""
|
||||||
|
add_command_line_enable THREADS "Threading support" auto
|
||||||
add_command_line_enable FFMPEG "Enable FFmpeg recording support" auto
|
add_command_line_enable FFMPEG "Enable FFmpeg recording support" auto
|
||||||
add_command_line_enable X264RGB "Enable lossless X264 RGB recording" no
|
add_command_line_enable X264RGB "Enable lossless X264 RGB recording" no
|
||||||
add_command_line_enable DYLIB "Enable dynamic loading support" auto
|
add_command_line_enable DYLIB "Enable dynamic loading support" auto
|
||||||
|
9
ssnes.c
9
ssnes.c
@ -406,6 +406,7 @@ static void print_features(void)
|
|||||||
puts("");
|
puts("");
|
||||||
puts("Features:");
|
puts("Features:");
|
||||||
_PSUPP(sdl, "SDL", "SDL drivers");
|
_PSUPP(sdl, "SDL", "SDL drivers");
|
||||||
|
_PSUPP(thread, "Threads", "Threading support");
|
||||||
_PSUPP(opengl, "OpenGL", "OpenGL driver");
|
_PSUPP(opengl, "OpenGL", "OpenGL driver");
|
||||||
_PSUPP(xvideo, "XVideo", "XVideo output");
|
_PSUPP(xvideo, "XVideo", "XVideo output");
|
||||||
_PSUPP(alsa, "ALSA", "audio driver");
|
_PSUPP(alsa, "ALSA", "audio driver");
|
||||||
@ -1212,6 +1213,7 @@ static void deinit_netplay(void)
|
|||||||
|
|
||||||
static void init_autosave(void)
|
static void init_autosave(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
int ram_types[2] = {-1, -1};
|
int ram_types[2] = {-1, -1};
|
||||||
const char *ram_paths[2] = {NULL, NULL};
|
const char *ram_paths[2] = {NULL, NULL};
|
||||||
|
|
||||||
@ -1261,15 +1263,18 @@ static void init_autosave(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void deinit_autosave(void)
|
static void deinit_autosave(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
for (unsigned i = 0; i < sizeof(g_extern.autosave)/sizeof(g_extern.autosave[0]); i++)
|
for (unsigned i = 0; i < sizeof(g_extern.autosave)/sizeof(g_extern.autosave[0]); i++)
|
||||||
{
|
{
|
||||||
if (g_extern.autosave[i])
|
if (g_extern.autosave[i])
|
||||||
autosave_free(g_extern.autosave[i]);
|
autosave_free(g_extern.autosave[i]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_savestate_auto_index(void)
|
static void set_savestate_auto_index(void)
|
||||||
@ -2032,7 +2037,9 @@ int main(int argc, char *argv[])
|
|||||||
// Run libsnes for one frame.
|
// Run libsnes for one frame.
|
||||||
if (!g_extern.is_paused || g_extern.is_oneshot)
|
if (!g_extern.is_paused || g_extern.is_oneshot)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
lock_autosave();
|
lock_autosave();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NETPLAY
|
#ifdef HAVE_NETPLAY
|
||||||
if (g_extern.netplay)
|
if (g_extern.netplay)
|
||||||
@ -2050,7 +2057,9 @@ int main(int argc, char *argv[])
|
|||||||
netplay_post_frame(g_extern.netplay);
|
netplay_post_frame(g_extern.netplay);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
unlock_autosave();
|
unlock_autosave();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user