Rework frontend - separate functions now for iterating per frame

and for doing teardown - Emscripten and Apple ports can make use
of this now so we don't need separate frontend implementations
This commit is contained in:
twinaphex 2013-12-28 21:08:30 +01:00
parent 43cc675a49
commit ff036066e2
15 changed files with 231 additions and 351 deletions

View File

@ -37,7 +37,8 @@ public class RetroActivityCamera extends RetroActivityCommon
if (camera_service_running) if (camera_service_running)
return; return;
mCamera.startPreview(); if (mCamera != null)
mCamera.startPreview();
camera_service_running = true; camera_service_running = true;
} }
@ -53,7 +54,8 @@ public class RetroActivityCamera extends RetroActivityCommon
if (!camera_service_running) if (!camera_service_running)
return; return;
mCamera.stopPreview(); if (mCamera != null)
mCamera.stopPreview();
camera_service_running = false; camera_service_running = false;
} }
@ -63,7 +65,9 @@ public class RetroActivityCamera extends RetroActivityCommon
public void onCameraFree() public void onCameraFree()
{ {
onCameraStop(); onCameraStop();
mCamera.release();
if (mCamera != null)
mCamera.release();
} }
/** /**
@ -138,7 +142,8 @@ public class RetroActivityCamera extends RetroActivityCommon
if (texture == null) if (texture == null)
onCameraTextureInit(gl_texid); onCameraTextureInit(gl_texid);
mCamera.setPreviewTexture(texture); if (mCamera != null)
mCamera.setPreviewTexture(texture);
} }
private final OnFrameAvailableListener onCameraFrameAvailableListener = new OnFrameAvailableListener() private final OnFrameAvailableListener onCameraFrameAvailableListener = new OnFrameAvailableListener()

View File

@ -43,6 +43,9 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
@Override @Override
public void onConnected(Bundle dataBundle) public void onConnected(Bundle dataBundle)
{ {
if (mLocationClient == null)
return;
// Display the connection status // Display the connection status
Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Connected", Toast.LENGTH_SHORT).show();
location_service_running = true; location_service_running = true;
@ -67,6 +70,9 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
@Override @Override
public void onDisconnected() public void onDisconnected()
{ {
if (mLocationClient == null)
return;
// Display the connection status // Display the connection status
Toast.makeText(this, "Disconnected. Please re-connect.", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Disconnected. Please re-connect.", Toast.LENGTH_SHORT).show();
@ -127,7 +133,10 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
public void onLocationSetInterval(int update_interval_in_ms, int distance_interval) public void onLocationSetInterval(int update_interval_in_ms, int distance_interval)
{ {
// Use high accuracy // Use high accuracy
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); if (mLocationRequest == null)
return;
mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
if (update_interval_in_ms == 0) if (update_interval_in_ms == 0)
mLocationRequest.setInterval(5 * 1000); // 5 seconds mLocationRequest.setInterval(5 * 1000); // 5 seconds
@ -166,10 +175,13 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
*/ */
public void onLocationStart() public void onLocationStart()
{ {
if (mLocationClient == null)
return;
mUpdatesRequested = true; mUpdatesRequested = true;
// Connect the client. // Connect the client.
mLocationClient.connect(); mLocationClient.connect();
} }
/** /**
@ -187,7 +199,8 @@ implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener
public void onLocationStop() public void onLocationStop()
{ {
// Disconnecting the client invalidates it. // Disconnecting the client invalidates it.
mLocationClient.disconnect(); if (mLocationClient != null && mUpdatesRequested)
mLocationClient.disconnect();
} }
/** /**

View File

@ -29,6 +29,5 @@ extern void apple_event_basic_command(enum basic_event_t action);
extern void apple_refresh_config(void); extern void apple_refresh_config(void);
extern int apple_rarch_load_content(int argc, char* argv[]); extern int apple_rarch_load_content(int argc, char* argv[]);
extern int apple_rarch_iterate_once();
#endif #endif

View File

@ -18,6 +18,7 @@
#import "RetroArch_Apple.h" #import "RetroArch_Apple.h"
#include "rarch_wrapper.h" #include "rarch_wrapper.h"
#include "../../frontend/frontend.h"
#include "apple_input.h" #include "apple_input.h"
@ -55,8 +56,11 @@ static void do_iteration()
{ {
if (iterate_observer && apple_is_running && !g_extern.is_paused) if (iterate_observer && apple_is_running && !g_extern.is_paused)
{ {
if (apple_rarch_iterate_once()) if (main_entry_iterate(0, NULL, NULL))
{
main_exit(NULL);
apple_rarch_exited(); apple_rarch_exited();
}
else else
CFRunLoopWakeUp(CFRunLoopGetMain()); CFRunLoopWakeUp(CFRunLoopGetMain());
} }

View File

@ -15,6 +15,7 @@
* If not, see <http://www.gnu.org/licenses/>. * If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "frontend.h"
#include "../general.h" #include "../general.h"
#include "../conf/config_file.h" #include "../conf/config_file.h"
#include "../file.h" #include "../file.h"
@ -92,38 +93,32 @@ static void rarch_get_environment_console(void)
#if defined(ANDROID) #if defined(ANDROID)
#define main_entry android_app_entry #define main_entry android_app_entry
#define returntype void #define returntype void
#define signature() void* data #define signature_expand() data
#define returnfunc() exit(0) #define returnfunc() exit(0)
#define returnfunc_oneshot() return
#define return_negative() return #define return_negative() return
#define return_var(var) return #define return_var(var) return
#define declare_argc() int argc = 0; #define declare_argc() int argc = 0;
#define declare_argv() char *argv[1] #define declare_argv() char *argv[1]
#define args_type() struct android_app*
#define args_initial_ptr() data #define args_initial_ptr() data
#elif defined(__APPLE__) || defined(HAVE_BB10) #elif defined(__APPLE__) || defined(HAVE_BB10)
#define main_entry rarch_main #define main_entry rarch_main
#define returntype int #define returntype int
#define signature() int argc, char *argv[] #define signature_expand() argc, argv
#define returnfunc() return 0 #define returnfunc() return 0
#define returnfunc_oneshot() return 0
#define return_negative() return 1 #define return_negative() return 1
#define return_var(var) return var #define return_var(var) return var
#define declare_argc() #define declare_argc()
#define declare_argv() #define declare_argv()
#define args_type() void*
#define args_initial_ptr() NULL #define args_initial_ptr() NULL
#else #else
#define main_entry main #define main_entry main
#define returntype int #define returntype int
#define signature() int argc, char *argv[] #define signature_expand() argc, argv
#define returnfunc() return 0 #define returnfunc() return 0
#define returnfunc_oneshot() return 0
#define return_negative() return 1 #define return_negative() return 1
#define return_var(var) return var #define return_var(var) return var
#define declare_argc() #define declare_argc()
#define declare_argv() #define declare_argv()
#define args_type() void*
#define args_initial_ptr() NULL #define args_initial_ptr() NULL
#endif #endif
@ -156,7 +151,7 @@ static void rarch_get_environment_console(void)
#endif #endif
#if defined(RARCH_CONSOLE) || defined(__QNX__) || defined(ANDROID) #if defined(RARCH_CONSOLE) || defined(__QNX__) || defined(ANDROID)
#define attempt_load_game_fails (1ULL << MODE_MENU) #define attempt_load_game_fails (1ULL << MODE_MENU_PREINIT)
#else #else
#define attempt_load_game_fails (1ULL << MODE_EXIT) #define attempt_load_game_fails (1ULL << MODE_EXIT)
#endif #endif
@ -165,12 +160,157 @@ static void rarch_get_environment_console(void)
#define menu_init_enable true #define menu_init_enable true
#define initial_lifecycle_state_preinit false #define initial_lifecycle_state_preinit false
int main_entry_iterate(signature(), args_type() args)
{
int i;
static retro_keyboard_event_t key_event;
if (g_extern.system.shutdown)
return 1;
else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
{
load_menu_game_prepare();
if (load_menu_game())
{
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
if (driver.video_poke && driver.video_poke->set_aspect_ratio)
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
}
else
{
// If ROM load fails, we exit RetroArch. On console it might make more sense to go back to menu though ...
g_extern.lifecycle_state = attempt_load_game_fails;
if (g_extern.lifecycle_state & (1ULL << MODE_EXIT))
{
if (frontend_ctx && frontend_ctx->shutdown)
frontend_ctx->shutdown(true);
return 1;
}
}
g_extern.lifecycle_state &= ~(1ULL << MODE_LOAD_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
{
bool r;
if (g_extern.is_paused && !g_extern.is_oneshot)
r = rarch_main_idle_iterate();
else
r = rarch_main_iterate();
if (r)
{
if (frontend_ctx && frontend_ctx->process_events)
frontend_ctx->process_events(args);
}
else
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
}
#ifdef HAVE_MENU
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU_PREINIT))
{
// Menu should always run with vsync on.
video_set_nonblock_state_func(false);
// Stop all rumbling when entering RGUI.
for (i = 0; i < MAX_PLAYERS; i++)
{
driver_set_rumble_state(i, RETRO_RUMBLE_STRONG, 0);
driver_set_rumble_state(i, RETRO_RUMBLE_WEAK, 0);
}
// Override keyboard callback to redirect to menu instead.
// We'll use this later for something ...
// FIXME: This should probably be moved to menu_common somehow.
key_event = g_extern.system.key_event;
g_extern.system.key_event = menu_key_event;
if (driver.audio_data)
audio_stop_func();
rgui->need_refresh= true;
rgui->old_input_state |= 1ULL << RARCH_MENU_TOGGLE;
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT);
g_extern.lifecycle_state |= (1ULL << MODE_MENU);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
{
if (menu_iterate())
{
if (frontend_ctx && frontend_ctx->process_events)
frontend_ctx->process_events(args);
}
else
{
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU);
driver_set_nonblock_state(driver.nonblock_state);
if (driver.audio_data && !g_extern.audio_data.mute && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
}
// Restore libretro keyboard callback.
g_extern.system.key_event = key_event;
}
}
#endif
else
return 1;
return 0;
}
void main_exit(args_type() args)
{
#ifdef HAVE_MENU
g_extern.system.shutdown = false;
menu_free();
if (g_extern.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
#endif
rarch_main_deinit();
rarch_deinit_msg_queue();
global_uninit_drivers();
#ifdef PERF_TEST
rarch_perf_log();
#endif
#if defined(HAVE_LOGGER) && !defined(ANDROID)
logger_shutdown();
#elif defined(HAVE_FILE_LOGGER)
if (g_extern.log_file)
fclose(g_extern.log_file);
g_extern.log_file = NULL;
#endif
if (frontend_ctx && frontend_ctx->deinit)
frontend_ctx->deinit(args);
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && frontend_ctx
&& frontend_ctx->exitspawn)
frontend_ctx->exitspawn();
rarch_main_clear_state();
if (frontend_ctx && frontend_ctx->shutdown)
frontend_ctx->shutdown(false);
}
returntype main_entry(signature()) returntype main_entry(signature())
{ {
declare_argc(); declare_argc();
declare_argv(); declare_argv();
args_type() args = (args_type())args_initial_ptr(); args_type() args = (args_type())args_initial_ptr();
unsigned i;
if (frontend_init_enable) if (frontend_init_enable)
{ {
@ -216,137 +356,12 @@ returntype main_entry(signature())
menu_rom_history_push_current(); menu_rom_history_push_current();
} }
do while(!main_entry_iterate(signature_expand(), args));
{
if (g_extern.system.shutdown)
break;
else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
{
load_menu_game_prepare();
// If ROM load fails, we exit RetroArch. On console it might make more sense to go back to menu though ...
if (load_menu_game())
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
else
{
g_extern.lifecycle_state = attempt_load_game_fails;
if (g_extern.lifecycle_state & (1ULL << MODE_EXIT))
{
if (frontend_ctx && frontend_ctx->shutdown)
frontend_ctx->shutdown(true);
return_negative();
}
}
g_extern.lifecycle_state &= ~(1ULL << MODE_LOAD_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
{
if (driver.video_poke && driver.video_poke->set_aspect_ratio)
driver.video_poke->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);
while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate())
{
if (frontend_ctx && frontend_ctx->process_events)
frontend_ctx->process_events(args);
if (!(g_extern.lifecycle_state & (1ULL << MODE_GAME)))
break;
}
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
{
g_extern.lifecycle_state |= 1ULL << MODE_MENU_PREINIT;
// Menu should always run with vsync on.
video_set_nonblock_state_func(false);
// Stop all rumbling when entering RGUI.
for (i = 0; i < MAX_PLAYERS; i++)
{
driver_set_rumble_state(i, RETRO_RUMBLE_STRONG, 0);
driver_set_rumble_state(i, RETRO_RUMBLE_WEAK, 0);
}
// Override keyboard callback to redirect to menu instead.
// We'll use this later for something ...
// FIXME: This should probably be moved to menu_common somehow.
retro_keyboard_event_t key_event = g_extern.system.key_event;
g_extern.system.key_event = menu_key_event;
if (driver.audio_data)
audio_stop_func();
while (!g_extern.system.shutdown && menu_iterate())
{
if (frontend_ctx && frontend_ctx->process_events)
frontend_ctx->process_events(args);
if (!(g_extern.lifecycle_state & (1ULL << MODE_MENU)))
break;
}
driver_set_nonblock_state(driver.nonblock_state);
if (driver.audio_data && !g_extern.audio_data.mute && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
}
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU);
// Restore libretro keyboard callback.
g_extern.system.key_event = key_event;
}
else
break;
}while(true);
if (g_extern.lifecycle_state & (1ULL << MODE_GAME_ONESHOT))
returnfunc_oneshot();
g_extern.system.shutdown = false;
menu_free();
if (g_extern.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
#else #else
while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate()); while ((g_extern.is_paused && !g_extern.is_oneshot) ? rarch_main_idle_iterate() : rarch_main_iterate());
#endif #endif
if (g_extern.lifecycle_state & (1ULL << MODE_GAME_ONESHOT)) main_exit(args);
returnfunc_oneshot();
rarch_main_deinit();
rarch_deinit_msg_queue();
global_uninit_drivers();
#ifdef PERF_TEST
rarch_perf_log();
#endif
#if defined(HAVE_LOGGER) && !defined(ANDROID)
logger_shutdown();
#elif defined(HAVE_FILE_LOGGER)
if (g_extern.log_file)
fclose(g_extern.log_file);
g_extern.log_file = NULL;
#endif
if (frontend_ctx && frontend_ctx->deinit)
frontend_ctx->deinit(args);
if (g_extern.lifecycle_state & (1ULL << MODE_EXITSPAWN) && frontend_ctx
&& frontend_ctx->exitspawn)
frontend_ctx->exitspawn();
rarch_main_clear_state();
if (frontend_ctx && frontend_ctx->shutdown)
frontend_ctx->shutdown(false);
returnfunc(); returnfunc();
} }

35
frontend/frontend.h Normal file
View File

@ -0,0 +1,35 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
* Copyright (C) 2012-2013 - Michael Lelli
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef _RARCH_FRONTEND_H
#define _RARCH_FRONTEND_H
#if defined(ANDROID)
#define args_type() struct android_app*
#define signature() void* data
#elif defined(__APPLE__) || defined(HAVE_BB10)
#define args_type() void*
#define signature() int argc, char *argv[]
#else
#define args_type() void*
#define signature() int argc, char *argv[]
#endif
int main_entry_iterate(signature(), args_type() args);
void main_exit(args_type() args);
#endif

View File

@ -1,105 +0,0 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2013 - Hans-Kristian Arntzen
* Copyright (C) 2011-2013 - Daniel De Matteis
* Copyright (C) 2012-2013 - Michael Lelli
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "../general.h"
#include "../conf/config_file.h"
#include "../file.h"
#ifdef HAVE_MENU
#include "../frontend/menu/menu_common.h"
#endif
static bool menuloop;
int apple_rarch_iterate_once(void)
{
if (g_extern.system.shutdown)
{
g_extern.system.shutdown = false;
menu_free();
if (g_extern.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
if (g_extern.main_is_init)
rarch_main_deinit();
rarch_deinit_msg_queue();
#ifdef PERF_TEST
rarch_perf_log();
#endif
rarch_main_clear_state();
return 1;
}
else if (menuloop)
{
if (!menu_iterate())
{
menuloop = false;
driver_set_nonblock_state(driver.nonblock_state);
if (driver.audio_data && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
}
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU);
}
}
else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
{
load_menu_game_prepare();
// If ROM load fails, we exit RetroArch. On console it might make more sense to go back to menu though ...
if (load_menu_game())
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
else
return 2;
g_extern.lifecycle_state &= ~(1ULL << MODE_LOAD_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
{
bool r;
if (g_extern.is_paused && !g_extern.is_oneshot)
r = rarch_main_idle_iterate();
else
r = rarch_main_iterate();
if (!r)
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
{
g_extern.lifecycle_state |= 1ULL << MODE_MENU_PREINIT;
// Menu should always run with vsync on.
video_set_nonblock_state_func(false);
if (driver.audio_data)
audio_stop_func();
menuloop = true;
}
else
{
g_extern.system.shutdown = true;
}
return 0;
}

View File

@ -20,102 +20,21 @@
#include "../conf/config_file.h" #include "../conf/config_file.h"
#include "../file.h" #include "../file.h"
#include "../emscripten/RWebAudio.h" #include "../emscripten/RWebAudio.h"
#include "frontend.h"
#ifdef HAVE_MENU #ifdef HAVE_MENU
#include "../frontend/menu/menu_common.h" #include "../frontend/menu/menu_common.h"
#endif #endif
static bool menuloop; static void emscripten_mainloop(void)
static void endloop(void)
{ {
g_extern.system.shutdown = false; if (!main_entry_iterate(0, NULL, NULL))
menu_free(); return;
if (g_extern.config_save_on_exit && *g_extern.config_path)
config_save_file(g_extern.config_path);
if (g_extern.main_is_init)
rarch_main_deinit();
rarch_deinit_msg_queue();
#ifdef PERF_TEST
rarch_perf_log();
#endif
rarch_main_clear_state();
main_exit(NULL);
exit(0); exit(0);
} }
static void mainloop(void)
{
if (g_extern.system.shutdown)
{
endloop();
}
else if (menuloop)
{
if (!menu_iterate())
{
menuloop = false;
driver_set_nonblock_state(driver.nonblock_state);
if (driver.audio_data && !audio_start_func())
{
RARCH_ERR("Failed to resume audio driver. Will continue without audio.\n");
g_extern.audio_active = false;
}
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU);
}
}
else if (g_extern.lifecycle_state & (1ULL << MODE_LOAD_GAME))
{
load_menu_game_prepare();
// If ROM load fails, we exit RetroArch. On console it might make more sense to go back to menu though ...
if (load_menu_game())
g_extern.lifecycle_state |= (1ULL << MODE_GAME);
else
{
#ifdef RARCH_CONSOLE
g_extern.lifecycle_state |= (1ULL << MODE_MENU);
#else
return;
#endif
}
g_extern.lifecycle_state &= ~(1ULL << MODE_LOAD_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_GAME))
{
bool r;
if (g_extern.is_paused && !g_extern.is_oneshot)
r = rarch_main_idle_iterate();
else
r = rarch_main_iterate();
if (!r)
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
}
else if (g_extern.lifecycle_state & (1ULL << MODE_MENU))
{
g_extern.lifecycle_state |= 1ULL << MODE_MENU_PREINIT;
// Menu should always run with vsync on.
video_set_nonblock_state_func(false);
if (driver.audio_data)
audio_stop_func();
menuloop = true;
}
else
{
g_extern.system.shutdown = true;
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
emscripten_set_canvas_size(800, 600); emscripten_set_canvas_size(800, 600);
@ -129,7 +48,6 @@ int main(int argc, char *argv[])
#ifdef HAVE_MENU #ifdef HAVE_MENU
menu_init(); menu_init();
g_extern.lifecycle_state |= 1ULL << MODE_GAME; g_extern.lifecycle_state |= 1ULL << MODE_GAME;
g_extern.lifecycle_state |= 1ULL << MODE_GAME_ONESHOT;
// If we started a ROM directly from command line, // If we started a ROM directly from command line,
// push it to ROM history. // push it to ROM history.
@ -137,7 +55,7 @@ int main(int argc, char *argv[])
menu_rom_history_push_current(); menu_rom_history_push_current();
#endif #endif
emscripten_set_main_loop(mainloop, g_settings.video.vsync ? 0 : INT_MAX, 1); emscripten_set_main_loop(emscripten_mainloop, g_settings.video.vsync ? 0 : INT_MAX, 1);
return 0; return 0;
} }

View File

@ -540,7 +540,7 @@ static void process_pending_intent(void *data)
if (startgame) if (startgame)
{ {
RARCH_LOG("Starting new game %s...\n", g_extern.fullpath); RARCH_LOG("Starting new game %s...\n", g_extern.fullpath);
g_extern.lifecycle_state &= ~(1ULL << MODE_MENU); g_extern.lifecycle_state &= ~(1ULL << MODE_MENU_PREINIT);
g_extern.lifecycle_state &= ~(1ULL << MODE_GAME); g_extern.lifecycle_state &= ~(1ULL << MODE_GAME);
load_menu_game_new_core(); load_menu_game_new_core();
} }

View File

@ -47,7 +47,7 @@ void apple_event_basic_command(enum basic_event_t action)
} }
} }
void apple_refresh_config() void apple_refresh_config(void)
{ {
// Little nudge to prevent stale values when reloading the confg file // Little nudge to prevent stale values when reloading the confg file
g_extern.block_config_read = false; g_extern.block_config_read = false;
@ -76,7 +76,6 @@ int apple_rarch_load_content(int argc, char* argv[])
menu_rom_history_push_current(); menu_rom_history_push_current();
g_extern.lifecycle_state |= 1ULL << MODE_GAME; g_extern.lifecycle_state |= 1ULL << MODE_GAME;
g_extern.lifecycle_state |= 1ULL << MODE_GAME_ONESHOT;
return 0; return 0;
} }

View File

@ -146,7 +146,7 @@ static void callback_sysutil_exit(uint64_t status, uint64_t param, void *userdat
{ {
case CELL_SYSUTIL_REQUEST_EXITGAME: case CELL_SYSUTIL_REQUEST_EXITGAME:
gl->quitting = true; gl->quitting = true;
g_extern.lifecycle_state &= ~((1ULL << MODE_MENU) | (1ULL << MODE_GAME)); g_extern.lifecycle_state &= ~((1ULL << MODE_MENU_PREINIT) | (1ULL << MODE_GAME));
break; break;
#ifdef HAVE_OSK #ifdef HAVE_OSK
case CELL_SYSUTIL_OSKDIALOG_LOADED: case CELL_SYSUTIL_OSKDIALOG_LOADED:

View File

@ -90,7 +90,6 @@ extern "C" {
enum menu_enums enum menu_enums
{ {
MODE_GAME = 0, MODE_GAME = 0,
MODE_GAME_ONESHOT,
MODE_LOAD_GAME, MODE_LOAD_GAME,
MODE_MENU, MODE_MENU,
MODE_EXIT, MODE_EXIT,

View File

@ -519,8 +519,6 @@ MAIN
============================================================ */ ============================================================ */
#if defined(XENON) #if defined(XENON)
#include "../frontend/frontend_xenon.c" #include "../frontend/frontend_xenon.c"
#elif defined(IOS) || defined(OSX)
#include "../frontend/frontend_apple.c"
#else #else
#include "../frontend/frontend.c" #include "../frontend/frontend.c"
#endif #endif

View File

@ -3037,7 +3037,7 @@ static inline bool check_enter_rgui(void)
bool rmenu_toggle = input_key_pressed_func(RARCH_MENU_TOGGLE) || (g_extern.libretro_dummy && !old_rmenu_toggle); bool rmenu_toggle = input_key_pressed_func(RARCH_MENU_TOGGLE) || (g_extern.libretro_dummy && !old_rmenu_toggle);
if (rmenu_toggle && !old_rmenu_toggle) if (rmenu_toggle && !old_rmenu_toggle)
{ {
g_extern.lifecycle_state |= (1ULL << MODE_MENU); g_extern.lifecycle_state |= (1ULL << MODE_MENU_PREINIT);
old_rmenu_toggle = true; old_rmenu_toggle = true;
g_extern.system.frame_time_last = 0; g_extern.system.frame_time_last = 0;
return true; return true;

View File

@ -375,7 +375,7 @@ void config_set_defaults(void)
#endif #endif
#ifdef RARCH_CONSOLE #ifdef RARCH_CONSOLE
g_extern.lifecycle_state |= (1ULL << MODE_MENU); g_extern.lifecycle_state |= (1ULL << MODE_MENU_PREINIT);
strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory)); strlcpy(g_settings.system_directory, default_paths.system_dir, sizeof(g_settings.system_directory));