Esempio n. 1
0
int native2amiga_isfree (void)
{
	return comm_pipe_has_data (&native2amiga_pending) == 0;
}
Esempio n. 2
0
/*
 * gui_handle_events()
 *
 * This is called from the main UAE thread to process events sent from
 * the GUI thread.
 *
 * If the UAE emulation proper is not running yet or is paused,
 * this loops continuously waiting for and responding to events
 * until the emulation is started or resumed, respectively. When
 * the emulation is running, this is called periodically from
 * the main UAE event loop.
 */
void gui_handle_events (void)
{
    /* Read GUI command if any. */

    /* Process it, e.g., call uae_reset(). */
    while (comm_pipe_has_data (&from_gui_pipe) || gui_pause_uae) {
        DEBUG_LOG("gui_handle_events: trying to read...\n");
        int32_t cmd = read_comm_pipe_int_blocking (&from_gui_pipe);
        DEBUG_LOG("gui_handle_events: %i\n", cmd);

        switch (cmd) {
        case UAECMD_EJECTDISK: {
            int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe);
            uae_sem_wait(&gui_sem);
            changed_prefs.floppyslots[n].df[0] = '\0';
            uae_sem_post(&gui_sem);
            continue;
        }
        case UAECMD_INSERTDISK: {
            int32_t n = read_comm_pipe_int_blocking (&from_gui_pipe);
            if (using_restricted_cloanto_rom) {
                write_log("Loading other disks is not permitted under the "
                          "license for the built-in Cloanto Kickstart "
                          "ROM.\n");
                continue;
            }
            uae_sem_wait(&gui_sem);
            strncpy (changed_prefs.floppyslots[n].df, new_disk_string[n], 255);
            free (new_disk_string[n]);
            new_disk_string[n] = 0;
            changed_prefs.floppyslots[n].df[255] = '\0';
            uae_sem_post(&gui_sem);
            continue;
        }
        case UAECMD_RESET:
            uae_reset(1);
            break; // Stop GUI command processing until UAE is ready again.
        case UAECMD_PAUSE:
            gui_pause_uae = 1;
            continue;
        case UAECMD_RESUME:
            gui_pause_uae = 0;
            continue;
        case UAECMD_SELECT_ROM:
            uae_sem_wait(&gui_sem);
            strncpy(changed_prefs.romfile, gui_romname, 255);
            changed_prefs.romfile[255] = '\0';
            free(gui_romname);
            gui_romname = 0;

            /* Switching to non-restricted ROM; rebooting. */
            using_restricted_cloanto_rom = 0;
            uae_reset(1);

            uae_sem_post(&gui_sem);
            continue;
        case UAECMD_RESIZE: {
            int32_t width = read_comm_pipe_int_blocking(&from_gui_pipe);
            int32_t height = read_comm_pipe_int_blocking(&from_gui_pipe);
            screen_size_changed(width, height);
            continue;
        }
        default:
            DEBUG_LOG("Unknown command %d received from GUI.\n", cmd);
            continue;
        }
    }
}