diff --git a/include/tic80_config.h b/include/tic80_config.h index c4322604f..2dafef999 100644 --- a/include/tic80_config.h +++ b/include/tic80_config.h @@ -33,29 +33,24 @@ // # endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ -#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) -# undef __TIC_WINDOWS__ -# define __TIC_WINDOWS__ 1 -# define TIC_MODULE_EXT ".dll" -# if defined(_MSC_VER) && defined(_USING_V110_SDK71_) -# define __TIC_WIN7__ 1 +#if !defined(__LIBRETRO__) +# if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) +# undef __TIC_WINDOWS__ +# define __TIC_WINDOWS__ 1 +# define TIC_MODULE_EXT ".dll" +# if defined(_MSC_VER) && defined(_USING_V110_SDK71_) +# define __TIC_WIN7__ 1 +# endif +# endif +# if defined(ANDROID) || defined(__ANDROID__) +# undef __TIC_ANDROID__ +# define __TIC_ANDROID__ 1 +# define TIC_MODULE_EXT ".so" +# elif (defined(linux) || defined(__linux) || defined(__linux__)) +# undef __TIC_LINUX__ +# define __TIC_LINUX__ 1 +# define TIC_MODULE_EXT ".so" # endif -#endif - -#if defined(ANDROID) || defined(__ANDROID__) -# undef __TIC_ANDROID__ -# define __TIC_ANDROID__ 1 -# define TIC_MODULE_EXT ".so" -#elif (defined(linux) || defined(__linux) || defined(__linux__)) -# undef __TIC_LINUX__ -# define __TIC_LINUX__ 1 -# define TIC_MODULE_EXT ".so" -#endif - -#if defined(__LIBRETRO__) -#ifdef TIC_MODULE_EXT -#undef TIC_MODULE_EXT -#endif #endif #if defined(TIC_RUNTIME_STATIC) diff --git a/src/script.c b/src/script.c index c5df96ede..ea2c02bb9 100644 --- a/src/script.c +++ b/src/script.c @@ -172,5 +172,7 @@ const tic_script* tic_get_script(tic_mem* memory) return script; } - return *Scripts; + static const tic_script empty; + + return *Scripts ? *Scripts : ∅ } diff --git a/src/studio/screens/console.c b/src/studio/screens/console.c index ecd692eb7..ae3feff56 100644 --- a/src/studio/screens/console.c +++ b/src/studio/screens/console.c @@ -764,7 +764,10 @@ static void loadCartSection(Console* console, const tic_cartridge* cart, const c static char* getDemoCartPath(char* path, const tic_script* script) { strcpy(path, TIC_LOCAL_VERSION "default_"); - strcat(path, script->name); + + if(script && script->name) + strcat(path, script->name); + strcat(path, ".tic"); return path; @@ -1216,7 +1219,7 @@ static void onNewCommandConfirmed(Console* console) } else if(count == 1) { - loadDemo(console, *tic_scripts()); + loadDemo(console, tic_get_script(console->tic)); done = true; } else if(console->desc->count) @@ -1732,7 +1735,7 @@ static void onConfigCommand(Console* console) { if (console->desc->count == 1) { - onLoadDemoCommand(console, *tic_scripts()); + onLoadDemoCommand(console, tic_get_script(console->tic)); } else { @@ -4313,7 +4316,7 @@ static void tick(Console* console) { if(!start->embed) { - loadDemo(console, *tic_scripts()); + loadDemo(console, tic_get_script(tic)); if(!console->args.cli) {