示例#1
0
文件: emu.c 项目: eehrich/fs-uae
static void on_quit() {
    fs_log("libfsemu:on_quit\n");
    g_fs_emu_quit_time = fs_emu_monotonic_time();
    if (g_quit_function) {
        g_quit_function();
    }
    // FIXME: detached?
    fs_thread_create("force-quit", force_quit_thread, NULL);
}
示例#2
0
文件: emu.c 项目: eehrich/fs-uae
int fs_emu_run(fs_emu_main_function function) {
    fs_emu_log("fs_emu_run, main_function at %p\n", function);

    // FIXME: should wait until we are certain that the video thread is
    // running (i.e. wait for a status / flag)

#ifdef WITH_NETPLAY
    // FIXME: MOVE
    if (fs_emu_netplay_enabled()) {
        fs_log("netplay is enabled\n");
        fs_emu_netplay_start();
    }
#endif

    g_emulation_thread = fs_thread_create(
                             "emulation", emulation_thread_entry, function);
    if (g_emulation_thread == NULL) {
        fs_emu_log("error starting video thread\n");
        // FIXME: ERROR MESSAGE HERE
        // FIXME: FATAL
    }

#ifdef FS_EMU_DRIVERS
    int result = fs_emu_main_loop();
#else
    int result = fs_ml_main_loop();
#endif
    fs_emu_log("fs_emu_run: main loop is done\n");

    if (g_fs_emu_benchmark_start_time) {
        int64_t t2 = fs_emu_monotonic_time();
        double ttime = ((t2 - g_fs_emu_benchmark_start_time) / 1000000.0);
        double sys_fps = g_fs_emu_total_sys_frames / ttime;
        double emu_fps = g_fs_emu_total_emu_frames / ttime;
        fs_log("average fps sys: %0.1f emu: %0.1f\n", sys_fps, emu_fps);
    }

    fs_emu_log("fs_emu_run: waiting for emulation thread to stop\n");
    while (g_fs_emu_emulation_thread_running) {
        fs_emu_msleep(1);
    }
    fs_emu_log("fs_emu_run: emulation thread stopped\n");

#ifdef USE_SDL_AUDIO
    fs_emu_log("fs_emu_run: calling SDL_CloseAudio\n");
    SDL_CloseAudio();
#endif

    fs_emu_audio_shutdown();
    fs_emu_log("fs_emu_run: returning\n");
    return result;
}
示例#3
0
文件: emu.c 项目: FrodeSolheim/fs-uae
static void on_quit()
{
    g_fs_emu_quit_time = fs_emu_monotonic_time();
    /*
    if (g_post_quit_function) {
        fs_log("libfsemu on_quit: executing quit function\n");
        g_post_quit_function();
    } else {
        fs_log("libfsemu on_quit: no quit function\n");
    }
    */
    // FIXME: detached?
    fs_thread_create("force-quit", force_quit_thread, NULL);
}
示例#4
0
文件: mouse.c 项目: alpine9000/fs-uae
static void init_manymouse(void)
{
    /* On OS X with HIDManager driver at least, the mice must be polled from
     * the same thread as the one which called ManyMouse_Init, so we do
     * everything (also enumeration in a worker thread) and wait for
     * enumeration to complete.*/

    fs_log("[MANYMOUSE] Copyright (c) 2005-2012 Ryan C. Gordon\n");
    g_manymouse_thread = fs_thread_create("manymouse", manymouse_thread, NULL);
    if (g_manymouse_thread == NULL) {
        fs_log("[MANYMOUSE] Error - could not create ManyMouse thread\n");
        // ManyMouse_Quit();
    } else {
        while (g_manymouse_last_index < 0) {
            fs_ml_usleep(1000);
        }
        g_fs_ml_input_device_count = g_manymouse_last_index;
    }
}
示例#5
0
int uae_start_thread (const char *name, uae_thread_function fn, void *arg,
        uae_thread_id *tid) {
    int result = 1;
    if (name != NULL) {
        write_log("uae_start_tread \"%s\" function at %p arg %p\n", name,
                fn, arg);
    }
    uae_thread_id thread_id = fs_thread_create(name, fn, arg);
    if (thread_id == NULL) {
        write_log("ERROR creating thread\n");
        result = 0;
    }
    if (tid) {
        *tid = thread_id;
    }
    else if (thread_id) {
        fs_thread_free(thread_id);
    }
    return result;
}