Exemple #1
0
void fsdb_init_file_info(fsdb_file_info *info)
{
    info->days = 0;
    info->mins = 0;
    info->ticks = 0;
    info->comment = NULL;
    info->mode = A_FIBF_READ | A_FIBF_WRITE | A_FIBF_EXECUTE | A_FIBF_DELETE;

    if (uae_deterministic_mode()) {
        // leave time at 0, 0, 0
    } else {
        fs_time_val tv;
        fs_get_current_time(&tv);
        struct mytimeval mtv;
        mtv.tv_sec = tv.tv_sec + fs_get_local_time_offset(tv.tv_sec);
        mtv.tv_usec = tv.tv_usec;
        timeval_to_amiga (&mtv, &info->days, &info->mins, &info->ticks, 50);
        if (g_fsdb_debug) {
            write_log("- initialized date/time from current time\n");
            write_log("- days %d mins %d ticks %d - %lld %d\n",
                    info->days, info->mins, info->ticks, mtv.tv_sec,
                    mtv.tv_usec);
        }
    }
}
Exemple #2
0
int amiga_send_input_event(int input_event, int state)
{
    static bool caps_lock_state;

//#ifdef DEBUG_SYNC
    write_sync_log("apply action %d state=%d\n", input_event, state);
//#endif

    if (g_fs_log_input) {
        write_log("amiga_send_input_event %d %d\n", input_event, state);
    }

    if (input_event > INPUTEVENT_PRIVATE_START) {
        return handle_custom_action(input_event, state);
    }

    int max = 1;  /* FIXME: is max = 1 always appropriate? */
    bool magic_mouse = currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC;
    if (uae_deterministic_mode()) {
        magic_mouse = false;
    }

    switch (input_event) {
    case INPUTEVENT_MOUSE1_HORIZ:
    case INPUTEVENT_MOUSE1_VERT:
        //printf("magic mouse %d\n", currprefs.input_magic_mouse);
        if (magic_mouse) {
            //printf("magic mouse %d %d\n",
            //       fs_emu_mouse_absolute_x, fs_emu_mouse_absolute_y);
            uae_mousehack_helper(fs_emu_mouse_absolute_x,
                                 fs_emu_mouse_absolute_y);
            return 1;
        }
    case INPUTEVENT_MOUSE1_WHEEL:
    case INPUTEVENT_MOUSE2_HORIZ:
    case INPUTEVENT_MOUSE2_VERT:
        max = 0;
        break;
    case INPUTEVENT_KEY_CAPS_LOCK:
        if (state && !caps_lock_state) {
            caps_lock_state = true;
        } else if (state && caps_lock_state) {
            caps_lock_state = false;
        }
        state = caps_lock_state;
#if 0
        // handled specially because of toggle mode
        // keyboard 0, using input event as scan code (correctly mapped
        // in keymap.cpp)
        inputdevice_translatekeycode(0, INPUTEVENT_KEY_CAPS_LOCK, state);
        return 1;
#endif
    }
    int autofire = 0;

    if (input_event == INPUTEVENT_JOY1_FIRE_BUTTON &&
            g_joystick_port_autofire[0]) {
        autofire = 1;
    } else if (input_event == INPUTEVENT_JOY2_FIRE_BUTTON &&
            g_joystick_port_autofire[1]) {
        autofire = 1;
    } else if (input_event == INPUTEVENT_PAR_JOY1_FIRE_BUTTON &&
            g_joystick_port_autofire[2]) {
        autofire = 1;
    } else if (input_event == INPUTEVENT_PAR_JOY2_FIRE_BUTTON &&
            g_joystick_port_autofire[3]) {
        autofire = 1;
    } else if ((input_event > INPUTEVENT_AUTOFIRE_BEGIN) &&
             (input_event < INPUTEVENT_AUTOFIRE_END)) {
        autofire = 1;
    }
    bool canstopplayback = 1;
    bool playbackevent = 0;

    //amiga_configure_port_from_input_event(input_event);
    int result = amiga_handle_input_event (
        input_event, state, max, autofire, canstopplayback, playbackevent);
    if (input_event >= INPUTEVENT_SPC_START && state == 0 && result == 0) {
        /* SPC / AKS keys do nothing for state 0 */
        result = 1;
    }
    if (result != 1) {
        write_log("amiga_handle_input_event(%d, %d, ...) failed with "
                  "result %d\n", input_event, state, result);
    }
    return result;
}