コード例 #1
0
ファイル: command_event.c プロジェクト: hbfelizzola/RetroArch
static void event_deinit_core(bool reinit)
{
   global_t *global     = global_get_ptr();
   settings_t *settings = config_get_ptr();

   pretro_unload_game();
   pretro_deinit();

   if (reinit)
      event_command(EVENT_CMD_DRIVERS_DEINIT);

   /* per-core saves: restore the original path so the config is not affected */
   if(settings->sort_savefiles_enable)
      strlcpy(global->savefile_dir,orig_savefile_dir,sizeof(global->savefile_dir));
   if(settings->sort_savestates_enable)
      strlcpy(global->savestate_dir,orig_savestate_dir,sizeof(global->savestate_dir)); 
  
  /* auto overrides: reload the original config */
   if(global->overrides_active)
   {
      config_unload_override();
      global->overrides_active = false;
   }

   pretro_set_environment(rarch_environment_cb);
   uninit_libretro_sym();
}
コード例 #2
0
ファイル: command_event.c プロジェクト: Sotsukun/RetroArch
static void event_deinit_core(bool reinit)
{
#ifdef HAVE_CHEEVOS
   /* Unload the achievements from memory. */
   cheevos_unload();
#endif

   event_deinit_core_interfaces();
   core.retro_unload_game();
   core.retro_deinit();

   if (reinit)
      event_command(EVENT_CMD_DRIVERS_DEINIT);

   /* auto overrides: reload the original config */
   if (runloop_ctl(RUNLOOP_CTL_IS_OVERRIDES_ACTIVE, NULL))
   {
      config_unload_override();
      runloop_ctl(RUNLOOP_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
   }

   uninit_libretro_sym();
}
コード例 #3
0
ファイル: command_event.c プロジェクト: Gruncher/RetroArch
static void event_deinit_core(bool reinit)
{
   global_t *global     = global_get_ptr();

#ifdef HAVE_CHEEVOS
   /* Unload the achievements from memory. */
   cheevos_unload();
#endif

   core.retro_unload_game();
   core.retro_deinit();

   if (reinit)
      event_command(EVENT_CMD_DRIVERS_DEINIT);

  /* auto overrides: reload the original config */
   if(global->overrides_active)
   {
      config_unload_override();
      global->overrides_active = false;
   }

   uninit_libretro_sym();
}
コード例 #4
0
ファイル: core_impl.c プロジェクト: gouchi/RetroArch
void core_uninit_symbols(void)
{
   uninit_libretro_sym(&current_core);
   current_core.symbols_inited = false;
}
コード例 #5
0
bool core_ctl(enum core_ctl_state state, void *data)
{
    static bool   has_set_input_descriptors = false;
    static struct retro_callbacks retro_ctx;

    switch (state)
    {
    case CORE_CTL_RETRO_CHEAT_SET:
    {
        retro_ctx_cheat_info_t *info = (retro_ctx_cheat_info_t*)data;
        core.retro_cheat_set(info->index, info->enabled, info->code);
    }
    break;
    case CORE_CTL_RETRO_CHEAT_RESET:
        core.retro_cheat_reset();
        break;
    case CORE_CTL_RETRO_API_VERSION:
    {
        retro_ctx_api_info_t *api = (retro_ctx_api_info_t*)data;
        api->version = core.retro_api_version();
    }
    break;
    case CORE_CTL_SET_POLL_TYPE:
    {
        unsigned *poll_type = (unsigned*)data;
        core_poll_type = *poll_type;
    }
    break;
    case CORE_CTL_RETRO_SYMBOLS_INIT:
    {
        enum rarch_core_type *core_type = (enum rarch_core_type*)data;

        if (!core_type)
            return false;
        init_libretro_sym(*core_type, &core);
    }
    break;
    case CORE_CTL_RETRO_SET_CONTROLLER_PORT_DEVICE:
    {
        retro_ctx_controller_info_t *pad = (retro_ctx_controller_info_t*)data;
        if (!pad)
            return false;
        core.retro_set_controller_port_device(pad->port, pad->device);
    }
    break;
    case CORE_CTL_RETRO_GET_MEMORY:
    {
        retro_ctx_memory_info_t *info = (retro_ctx_memory_info_t*)data;
        if (!info)
            return false;
        info->size  = core.retro_get_memory_size(info->id);
        info->data  = core.retro_get_memory_data(info->id);
    }
    break;
    case CORE_CTL_RETRO_LOAD_GAME:
    {
        retro_ctx_load_content_info_t *load_info =
            (retro_ctx_load_content_info_t*)data;
        if (!load_info)
            return false;

        if (load_info->special)
            return core.retro_load_game_special(load_info->special->id, load_info->info, load_info->content->size);
        return core.retro_load_game(*load_info->content->elems[0].data ? load_info->info : NULL);
    }
    case CORE_CTL_RETRO_GET_SYSTEM_INFO:
    {
        struct retro_system_info *system = (struct retro_system_info*)data;
        if (!system)
            return false;
        core.retro_get_system_info(system);
    }
    break;
    case CORE_CTL_RETRO_UNSERIALIZE:
    {
        retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data;
        if (!info)
            return false;
        if (!core.retro_unserialize(info->data_const, info->size))
            return false;
    }
    break;
    case CORE_CTL_RETRO_SERIALIZE:
    {
        retro_ctx_serialize_info_t *info = (retro_ctx_serialize_info_t*)data;
        if (!info)
            return false;
        if (!core.retro_serialize(info->data, info->size))
            return false;
    }
    break;
    case CORE_CTL_RETRO_SERIALIZE_SIZE:
    {
        retro_ctx_size_info_t *info = (retro_ctx_size_info_t *)data;
        if (!info)
            return false;
        info->size = core.retro_serialize_size();
    }
    break;
    case CORE_CTL_RETRO_CTX_FRAME_CB:
    {
        retro_ctx_frame_info_t *info = (retro_ctx_frame_info_t*)data;
        if (!info || !retro_ctx.frame_cb)
            return false;

        retro_ctx.frame_cb(
            info->data, info->width, info->height, info->pitch);
    }
    break;
    case CORE_CTL_RETRO_CTX_POLL_CB:
        if (!retro_ctx.poll_cb)
            return false;
        retro_ctx.poll_cb();
        break;
    case CORE_CTL_RETRO_SET_ENVIRONMENT:
    {
        retro_ctx_environ_info_t *info = (retro_ctx_environ_info_t*)data;
        if (!info)
            return false;
        core.retro_set_environment(info->env);
    }
    break;
    case CORE_CTL_RETRO_GET_SYSTEM_AV_INFO:
    {
        struct retro_system_av_info *av_info = (struct retro_system_av_info*)data;
        if (!av_info)
            return false;
        core.retro_get_system_av_info(av_info);
    }
    break;
    case CORE_CTL_RETRO_RESET:
        core.retro_reset();
        break;
    case CORE_CTL_RETRO_INIT:
        core.retro_init();
        break;
    case CORE_CTL_RETRO_DEINIT:
        core.retro_deinit();
        uninit_libretro_sym(&core);
        break;
    case CORE_CTL_RETRO_UNLOAD_GAME:
        video_driver_ctl(RARCH_DISPLAY_CTL_DEINIT_HW_CONTEXT, NULL);
        audio_driver_ctl(RARCH_AUDIO_CTL_STOP, NULL);
        core.retro_unload_game();
        break;
    case CORE_CTL_RETRO_RUN:
        switch (core_poll_type)
        {
        case POLL_TYPE_EARLY:
            input_poll();
            break;
        case POLL_TYPE_LATE:
            core_input_polled = false;
            break;
        }
        if (core.retro_run)
            core.retro_run();
        if (core_poll_type == POLL_TYPE_LATE && !core_input_polled)
            input_poll();
        break;
    case CORE_CTL_SET_CBS:
        return retro_set_default_callbacks(data);
    case CORE_CTL_SET_CBS_REWIND:
        retro_set_rewind_callbacks();
        break;
    case CORE_CTL_INIT:
    {
        settings_t *settings = config_get_ptr();
        core_poll_type = settings->input.poll_type_behavior;
        if (!core_ctl(CORE_CTL_VERIFY_API_VERSION, NULL))
            return false;
        if (!retro_init_libretro_cbs(&retro_ctx))
            return false;
        core_ctl(CORE_CTL_RETRO_GET_SYSTEM_AV_INFO,
                 video_viewport_get_system_av_info());
        runloop_ctl(RUNLOOP_CTL_SET_FRAME_LIMIT, NULL);
    }
    break;
    case CORE_CTL_DEINIT:
        return retro_uninit_libretro_cbs(&retro_ctx);
    case CORE_CTL_VERIFY_API_VERSION:
    {
        unsigned api_version = core.retro_api_version();
        RARCH_LOG("Version of libretro API: %u\n", api_version);
        RARCH_LOG("Compiled against API: %u\n",    RETRO_API_VERSION);

        if (api_version != RETRO_API_VERSION)
        {
            RARCH_WARN("%s\n", msg_hash_to_str(MSG_LIBRETRO_ABI_BREAK));
            return false;
        }
    }
    break;
    case CORE_CTL_HAS_SET_INPUT_DESCRIPTORS:
        return has_set_input_descriptors;
    case CORE_CTL_SET_INPUT_DESCRIPTORS:
        has_set_input_descriptors = true;
        break;
    case CORE_CTL_UNSET_INPUT_DESCRIPTORS:
        has_set_input_descriptors = false;
        break;
    case CORE_CTL_NONE:
    default:
        break;
    }

    return true;
}
コード例 #6
0
ファイル: core_impl.c プロジェクト: Skylark13/RetroArch
void core_uninit_symbols(void)
{
   uninit_libretro_sym(&core);
   core_symbols_inited = false;
}