(SSNES_CONSOLE) Introduce HAVE_SSNES_MAIN_WRAP define

This commit is contained in:
Twinaphex 2012-04-13 20:40:22 +02:00
parent 782e8b8da9
commit 79737aecf3
7 changed files with 57 additions and 49 deletions

View File

@ -406,22 +406,7 @@ begin_loop:
else if(g_console.mode_switch == MODE_MENU)
{
menu_loop();
if(g_console.initialize_ssnes_enable)
{
if(g_console.emulator_initialized)
ssnes_main_deinit();
struct ssnes_main_wrap args = {0};
args.verbose = g_extern.verbose;
args.config_path = SYS_CONFIG_FILE;
args.rom_path = g_console.rom_path;
int init_ret = ssnes_main_init_wrap(&args);
g_console.emulator_initialized = 1;
g_console.initialize_ssnes_enable = 0;
}
ssnes_startup(SYS_CONFIG_FILE);
}
else
goto begin_shutdown;

View File

@ -68,7 +68,7 @@ endif
PPU_LDLIBS = -ldbgfont $(GL_LIBS) -lretro -lcgc -lgcm_cmd -lgcm_sys_stub -lresc_stub -lm -lio_stub -lfs_stub -lsysutil_stub -lsysutil_game_stub -lsysutil_screenshot_stub -lsysutil_np_stub -lpngdec_stub -ljpgdec_stub -lsysmodule_stub -laudio_stub -lnet_stub -lnetctl_stub -lpthread
DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL -DHAVE_CG -DHAVE_FBO -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(SSNES_VERSION)\" -Dmain=ssnes_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
DEFINES += -DSSNES_CONSOLE -DHAVE_OPENGL -DHAVE_CG -DHAVE_FBO -DHAVE_SSNES_MAIN_WRAP -DHAVE_LIBRETRO_MANAGEMENT -DHAVE_RSOUND -DHAVE_ZLIB -D__CELLOS_LV2__ -DHAVE_CONFIGFILE=1 -DHAVE_NETPLAY=1 -DHAVE_SOCKET_LEGACY=1 -DHAVE_GRIFFIN=1 -DPACKAGE_VERSION=\"$(SSNES_VERSION)\" -Dmain=ssnes_main -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g

View File

@ -620,3 +620,41 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
}
#endif
/*============================================================
SSNES MAIN WRAP
============================================================ */
#ifdef HAVE_SSNES_MAIN_WRAP
void ssnes_startup (const char * config_path)
{
if(g_console.initialize_ssnes_enable)
{
if(g_console.emulator_initialized)
ssnes_main_deinit();
#ifdef __cplusplus
struct ssnes_main_wrap args = {0};
args.verbose = g_extern.verbose;
args.config_path = config_path;
args.sram_path = g_console.default_sram_dir_enable ? g_console.default_sram_dir : NULL,
args.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL,
args.rom_path = g_console.rom_path;
#else
struct ssnes_main_wrap args = {
.verbose = g_extern.verbose,
.config_path = config_path,
.sram_path = g_console.default_sram_dir_enable ? g_console.default_sram_dir : NULL,
.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL,
.rom_path = g_console.rom_path
};
#endif
int init_ret = ssnes_main_init_wrap(&args);
g_console.emulator_initialized = 1;
g_console.initialize_ssnes_enable = 0;
}
}
#endif

View File

@ -86,3 +86,11 @@ bool ssnes_manage_libretro_core(const char *full_path, const char *path, const c
#endif
#endif
/*============================================================
SSNES MAIN WRAP
============================================================ */
#ifdef HAVE_SSNES_MAIN_WRAP
void ssnes_startup (const char * config_path);
#endif

View File

@ -112,7 +112,7 @@
<MinimalRebuild>true</MinimalRebuild>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.5";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;PACKAGE_VERSION="0.9.5";%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -150,7 +150,7 @@
<PREfast>AnalyzeOnly</PREfast>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;SSNES_CONSOLE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -189,7 +189,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<CallAttributedProfiling>Callcap</CallAttributedProfiling>
</ClCompile>
<Link>
@ -233,7 +233,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;PROFILE;FASTCAP;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;HAVE_CONFIGFILE;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -274,7 +274,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;main=ssnes_main;SSNES_CONSOLE=1;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -315,7 +315,7 @@
<ExceptionHandling>false</ExceptionHandling>
<BufferSecurityCheck>false</BufferSecurityCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_XBOX;LTCG;%(PreprocessorDefinitions);PACKAGE_VERSION="0.9.5";_CRT_SECURE_NO_WARNINGS;SSNES_CONSOLE;main=ssnes_main;HAVE_CONFIGFILE;HAVE_NETPLAY;HAVE_SOCKET_LEGACY;HAVE_ZLIB;HAVE_SSNES_MAIN_WRAP;HAVE_LIBRETRO_MANAGEMENT;D3DCOMPILE_USEVOIDS;HAVE_GRIFFIN</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>

View File

@ -436,28 +436,6 @@ static void get_environment_settings(int argc, char *argv[])
g_extern.verbose = false;
}
static void startup_ssnes(void)
{
if(g_console.initialize_ssnes_enable)
{
if(g_console.emulator_initialized)
ssnes_main_deinit();
struct ssnes_main_wrap args = {
.verbose = g_extern.verbose,
.config_path = SYS_CONFIG_FILE,
.sram_path = g_console.default_sram_dir_enable ? g_console.default_sram_dir : NULL,
.state_path = g_console.default_savestate_dir_enable ? g_console.default_savestate_dir : NULL,
.rom_path = g_console.rom_path
};
int init_ret = ssnes_main_init_wrap(&args);
g_console.emulator_initialized = 1;
g_console.initialize_ssnes_enable = 0;
}
}
int main(int argc, char *argv[])
{
SSNES_LOG("Registering system utility callback...\n");
@ -527,7 +505,7 @@ int main(int argc, char *argv[])
strncpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
g_console.initialize_ssnes_enable = 1;
g_console.mode_switch = MODE_EMULATION;
startup_ssnes();
ssnes_startup(SYS_CONFIG_FILE);
break;
}
@ -545,7 +523,7 @@ begin_loop:
else if(g_console.mode_switch == MODE_MENU)
{
menu_loop();
startup_ssnes();
ssnes_startup(SYS_CONFIG_FILE);
}
else
goto begin_shutdown;

View File

@ -2483,7 +2483,7 @@ void ssnes_main_deinit(void)
uninit_libretro_sym();
}
#if !defined(SSNES_CONSOLE) || defined(GEKKO)
#ifndef HAVE_SSNES_MAIN_WRAP
// Consoles use the higher level API.
int main(int argc, char *argv[])
{
@ -2495,4 +2495,3 @@ int main(int argc, char *argv[])
return 0;
}
#endif