static void _game_deinit() { /* deinit systems */ system_deinit(); /* deinit glfw */ glfwTerminate(); }
int main(int argc, char *argv[]) { system_init(); get_environment_settings(argc, argv); salamander_init_settings(); system_deinit(); system_exitspawn(); return 1; }
/** ============================================================================ * * @Function: Public function definition. * * @Description: // 函数功能、性能等的描述 * * @Calls: // 被本函数调用的函数清单 * * @Called By: // 调用本函数的函数清单 * * @Table Accessed:// 被访问的表(此项仅对于牵扯到数据库操作的程序) * * @Table Updated: // 被修改的表(此项仅对于牵扯到数据库操作的程序) * * @Input: // 对输入参数的说明 * * @Output: // 对输出参数的说明 * * @Return: // 函数返回值的说明 * * @Enter // Precondition * * @Leave // Postcondition * * @Others: // 其它说明 * * ============================================================================ */ int main(int argc, char *argv[]) { status_t status; system_init(&glb_console_obj); status = tsk_mgr_daemon(&glb_console_obj); system_deinit(&glb_console_obj); return status; }
/********************************************************************* * @brief Function used to initialize various system components * Each component is initialized using a proper API * * @param[in] NA * * @retval NA * * @note NA * * @end *********************************************************************/ void system_init() { /* Initialize platform */ VENDOR_PLATFORM_INIT(); /*Initialize logging, Not handling error as openlog() does not return anything*/ logging_init(); /*Initialize Module manager*/ if (modulemgr_init() != BVIEW_STATUS_SUCCESS) { LOG_POST (BVIEW_LOG_CRITICAL, "Failed to initialize Module Manager\r\n"); } /*Initialize south-bound plugin*/ if (sb_redirector_init() != BVIEW_STATUS_SUCCESS) { LOG_POST (BVIEW_LOG_CRITICAL, "Failed to initialize south-bound plugin\r\n"); } /*Initialize south-bound BST plugin*/ if (sbplugin_common_init() != BVIEW_STATUS_SUCCESS) { LOG_POST (BVIEW_LOG_CRITICAL, "Failed to initialize south-bound BST plugin r\n"); } /*Initialize BST application*/ if (bst_main() != BVIEW_STATUS_SUCCESS) { LOG_POST (BVIEW_LOG_CRITICAL, "Failed to initialize BST application\r\n"); } /*Initialize REST*/ if (rest_init() != BVIEW_STATUS_SUCCESS) { LOG_POST (BVIEW_LOG_CRITICAL, "Failed to initialize REST \n All components must be De-initialized\r\n"); system_deinit(); } }
int rarch_main(int argc, char *argv[]) { system_init(); rarch_main_clear_state(); verbose_log_init(); get_environment_settings(argc, argv); config_load(); init_libretro_sym(); rarch_init_system_info(); global_init_drivers(); #ifdef HAVE_LIBRETRO_MANAGEMENT char core_exe_path[PATH_MAX]; char path_prefix[PATH_MAX]; const char *extension = DEFAULT_EXE_EXT; char slash; #if defined(_WIN32) slash = '\\'; #else slash = '/'; #endif snprintf(path_prefix, sizeof(path_prefix), "%s%c", default_paths.core_dir, slash); snprintf(core_exe_path, sizeof(core_exe_path), "%sCORE%s", path_prefix, extension); if (path_file_exists(core_exe_path)) { RARCH_LOG("core_exe_path: %s\n", core_exe_path); if (install_libretro_core(core_exe_path, path_prefix, extension)) { RARCH_LOG("New default libretro core saved to config file: %s.\n", g_settings.libretro); config_save_file(g_extern.config_path); } } #endif init_libretro_sym(); system_post_init(); menu_init(); system_process_args(argc, argv); begin_loop: if(g_extern.lifecycle_mode_state & (1ULL << MODE_GAME)) { driver.input->poll(NULL); if (driver.video_poke->set_aspect_ratio) driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx); if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_THROTTLE_ENABLE)) audio_start_func(); while(rarch_main_iterate()); if (g_extern.lifecycle_mode_state & (1ULL << MODE_VIDEO_THROTTLE_ENABLE)) audio_stop_func(); g_extern.lifecycle_mode_state &= ~(1ULL << MODE_GAME); } else if (g_extern.lifecycle_mode_state & (1ULL << MODE_INIT)) { if(g_extern.main_is_init) rarch_main_deinit(); struct rarch_main_wrap args = {0}; args.verbose = g_extern.verbose; args.sram_path = (g_extern.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_SRAM_DIR_ENABLE)) ? g_extern.console.main_wrap.default_sram_dir : NULL; args.state_path = (g_extern.lifecycle_mode_state & (1ULL << MODE_LOAD_GAME_STATE_DIR_ENABLE)) ? g_extern.console.main_wrap.default_savestate_dir : NULL; args.rom_path = g_extern.fullpath; args.libretro_path = g_settings.libretro; if (path_file_exists(g_extern.config_path)) args.config_path = g_extern.config_path; else args.config_path = NULL; if (rarch_main_init_wrap(&args) == 0) { RARCH_LOG("rarch_main_init succeeded.\n"); g_extern.lifecycle_mode_state |= (1ULL << MODE_GAME); } else { RARCH_ERR("rarch_main_init failed.\n"); g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU); menu_settings_msg(S_MSG_ROM_LOADING_ERROR, 180); } g_extern.lifecycle_mode_state &= ~(1ULL << MODE_INIT); } else if(g_extern.lifecycle_mode_state & (1ULL << MODE_MENU)) { g_extern.lifecycle_mode_state |= (1ULL << MODE_MENU_PREINIT); while (menu_iterate()); g_extern.lifecycle_mode_state &= ~(1ULL << MODE_MENU); } else goto begin_shutdown; goto begin_loop; begin_shutdown: config_save_file(g_extern.config_path); system_deinit_save(); if(g_extern.main_is_init) rarch_main_deinit(); menu_free(); global_uninit_drivers(); #ifdef PERF_TEST rarch_perf_log(); #endif system_deinit(); if (g_extern.lifecycle_mode_state & (1ULL << MODE_EXITSPAWN)) system_exitspawn(); return 1; }