summaryrefslogtreecommitdiff
path: root/libretro.c
diff options
context:
space:
mode:
Diffstat (limited to 'libretro.c')
-rw-r--r--libretro.c87
1 files changed, 7 insertions, 80 deletions
diff --git a/libretro.c b/libretro.c
index 397cca2..165600e 100644
--- a/libretro.c
+++ b/libretro.c
@@ -4,8 +4,6 @@
#include <string.h>
#include <stdint.h>
#include "common.h"
-#include "libco.h"
-#include "retro_emu_thread.h"
#include "libretro.h"
#include "libretro_core_options.h"
#include "memmap.h"
@@ -76,10 +74,6 @@ static retro_environment_t environ_cb;
struct retro_perf_callback perf_cb;
-#if defined(USE_LIBCO)
-static cothread_t main_thread;
-static cothread_t cpu_thread;
-#endif
int dynarec_enable;
int use_libretro_save_method = 0;
@@ -95,58 +89,6 @@ static void (*video_post_process)(void) = NULL;
static bool post_process_cc = false;
static bool post_process_mix = false;
-void switch_to_main_thread(void)
-{
-#if defined(USE_LIBCO)
- co_switch(main_thread);
-#else
- retro_switch_thread();
-#endif
-}
-
-static inline void switch_to_cpu_thread(void)
-{
-#if defined(USE_LIBCO)
- co_switch(cpu_thread);
-#else
- retro_switch_thread();
-#endif
-}
-
-#if defined(USE_LIBCO)
-static void cpu_thread_entry(void)
-{
-#ifdef HAVE_DYNAREC
- if (dynarec_enable)
- execute_arm_translate(execute_cycles);
-#endif
- execute_arm(execute_cycles);
-}
-#endif
-
-static inline void init_context_switch(void)
-{
-#if defined(USE_LIBCO)
- main_thread = co_active();
- cpu_thread = co_create(0x20000, cpu_thread_entry);
-#else
- if (!retro_init_emu_thread(dynarec_enable, execute_cycles))
- if (log_cb)
- log_cb(RETRO_LOG_ERROR, "[gpSP]: Failed to initialize emulation thread!\n");
-#endif
-}
-
-static inline void deinit_context_switch(void)
-{
-#if defined(USE_LIBCO)
- co_delete(cpu_thread);
-#else
- retro_cancel_emu_thread();
- retro_join_emu_thread();
- retro_deinit_emu_thread();
-#endif
-}
-
#if defined(PSP)
static uint32_t next_pow2(uint32_t v)
{
@@ -649,12 +591,8 @@ void retro_set_controller_port_device(unsigned port, unsigned device) {}
void retro_reset(void)
{
- deinit_context_switch();
-
update_backup();
reset_gba();
-
- init_context_switch();
}
size_t retro_serialize_size(void)
@@ -930,8 +868,6 @@ bool retro_load_game(const struct retro_game_info* info)
reset_gba();
- init_context_switch();
-
set_memory_descriptors();
return true;
@@ -945,7 +881,6 @@ bool retro_load_game_special(unsigned game_type,
void retro_unload_game(void)
{
- deinit_context_switch();
update_backup();
}
@@ -1019,20 +954,6 @@ void retro_run(void)
{
bool updated = false;
-#if !defined(USE_LIBCO)
- if (!retro_is_emu_thread_initialized())
- {
- environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
- return;
- }
- if (retro_emu_thread_exited())
- {
- environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, NULL);
- retro_join_emu_thread();
- return;
- }
-#endif
-
update_input();
input_poll_cb();
@@ -1107,7 +1028,13 @@ void retro_run(void)
update_audio_latency = false;
}
- switch_to_cpu_thread();
+ /* This runs just a frame */
+ #ifdef HAVE_DYNAREC
+ if (dynarec_enable)
+ execute_arm_translate(execute_cycles);
+ else
+ #endif
+ execute_arm(execute_cycles);
render_audio();
video_run();