diff --git a/Makefile.common b/Makefile.common index 1eaf321535..821f34e03f 100644 --- a/Makefile.common +++ b/Makefile.common @@ -101,6 +101,7 @@ OBJ += frontend/frontend.o \ ui/drivers/ui_null.o \ libretro_version_1.o \ retroarch.o \ + system.o \ retroarch_info.o \ command_event.o \ runloop.o \ diff --git a/griffin/griffin.c b/griffin/griffin.c index dbf835a524..e14506d623 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -664,6 +664,7 @@ RETROARCH #include "../retroarch_info.c" #include "../runloop.c" #include "../runloop_data.c" +#include "../system.c" /*============================================================ diff --git a/retroarch.c b/retroarch.c index 838cae9e47..8dec817bb7 100644 --- a/retroarch.c +++ b/retroarch.c @@ -317,43 +317,6 @@ static void set_special_paths(char **argv, unsigned num_content) sizeof(settings->system_directory)); } -static rarch_system_info_t *g_system; - -static rarch_system_info_t *rarch_system_info_new(void) -{ - return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t)); -} - -rarch_system_info_t *rarch_system_info_get_ptr(void) -{ - if (!g_system) - g_system = rarch_system_info_new(); - return g_system; -} - -void rarch_system_info_free(void) -{ - if (!g_system) - return; - - if (g_system->core_options) - { - core_option_flush(g_system->core_options); - core_option_free(g_system->core_options); - } - - /* No longer valid. */ - if (g_system->special) - free(g_system->special); - g_system->special = NULL; - if (g_system->ports) - free(g_system->ports); - g_system->ports = NULL; - - free(g_system); - g_system = NULL; -} - void set_paths_redirect(const char *path) { global_t *global = global_get_ptr(); diff --git a/system.c b/system.c new file mode 100644 index 0000000000..1e6404ecf6 --- /dev/null +++ b/system.c @@ -0,0 +1,53 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include "system.h" + +static rarch_system_info_t *g_system; + +static rarch_system_info_t *rarch_system_info_new(void) +{ + return (rarch_system_info_t*)calloc(1, sizeof(rarch_system_info_t)); +} + +rarch_system_info_t *rarch_system_info_get_ptr(void) +{ + if (!g_system) + g_system = rarch_system_info_new(); + return g_system; +} + +void rarch_system_info_free(void) +{ + if (!g_system) + return; + + if (g_system->core_options) + { + core_option_flush(g_system->core_options); + core_option_free(g_system->core_options); + } + + /* No longer valid. */ + if (g_system->special) + free(g_system->special); + g_system->special = NULL; + if (g_system->ports) + free(g_system->ports); + g_system->ports = NULL; + + free(g_system); + g_system = NULL; +}