Update the automation to not use internel APIs for input

This commit is contained in:
Lior Halphon 2020-02-11 00:11:17 +02:00
parent 8b7805b95d
commit 0677b1d099

View File

@ -73,38 +73,38 @@ static void handle_buttons(GB_gameboy_t *gb)
frames) % combo_length + (start_is_bad? 20 : 0) ) { frames) % combo_length + (start_is_bad? 20 : 0) ) {
case 0: case 0:
if (!limit_start || frames < 20 * 60) { if (!limit_start || frames < 20 * 60) {
gb->keys[0][push_right? 0 : 7] = true; // Start (Or right) down GB_set_key_state(gb, push_right? GB_KEY_RIGHT: GB_KEY_START, true);
} }
if (pointer_control) { if (pointer_control) {
gb->keys[0][1] = true; // left GB_set_key_state(gb, GB_KEY_LEFT, true);
gb->keys[0][2] = true; // up GB_set_key_state(gb, GB_KEY_UP, true);
} }
break; break;
case 10: case 10:
gb->keys[0][push_right? 0 : 7] = false; // Start (Or right) up GB_set_key_state(gb, push_right? GB_KEY_RIGHT: GB_KEY_START, false);
if (pointer_control) { if (pointer_control) {
gb->keys[0][1] = false; // left GB_set_key_state(gb, GB_KEY_LEFT, false);
gb->keys[0][2] = false; // up GB_set_key_state(gb, GB_KEY_UP, false);
} }
break; break;
case 20: case 20:
gb->keys[0][b_is_confirm? 5: 4] = true; // A down (or B) GB_set_key_state(gb, b_is_confirm? GB_KEY_B: GB_KEY_A, true);
break; break;
case 30: case 30:
gb->keys[0][b_is_confirm? 5: 4] = false; // A up (or B) GB_set_key_state(gb, b_is_confirm? GB_KEY_B: GB_KEY_A, false);
break; break;
case 40: case 40:
if (push_a_twice) { if (push_a_twice) {
gb->keys[0][b_is_confirm? 5: 4] = true; // A down (or B) GB_set_key_state(gb, b_is_confirm? GB_KEY_B: GB_KEY_A, true);
} }
else if (gb->boot_rom_finished) { else if (gb->boot_rom_finished) {
gb->keys[0][3] = true; // D-Pad Down down GB_set_key_state(gb, GB_KEY_DOWN, true);
} }
break; break;
case 50: case 50:
gb->keys[0][b_is_confirm? 5: 4] = false; // A down (or B) GB_set_key_state(gb, b_is_confirm? GB_KEY_B: GB_KEY_A, false);
gb->keys[0][3] = false; // D-Pad Down up GB_set_key_state(gb, GB_KEY_DOWN, false);
break; break;
} }
} }