void search_jap(void) //JAP { static u16 result; u16 *id; char id_str[5]; int i; if (is_pressed(BUTTON_L + BUTTON_DU)) { id = (u16 *)0x16FE3C60; for (i = 0; i < 4; i++) id_str[i] = (char)READU8(id + i); result = (u16)strtoul(id_str, NULL, 16); reset_search(); add_search_replace(result, 0x9999); find_and_replace_multiple((void *)0x1609D158, 0x5000); find_and_replace_multiple((void *)0x160B9B28, 0x1000); } if (is_pressed(BUTTON_L + BUTTON_DD)) { id = (u16 *)0x16FE3C60; for (i = 0; i < 4; i++) id_str[i] = (char)READU8(id + i); result = (u16)strtoul(id_str, NULL, 16); reset_search(); add_search_replace(0x9999, result); find_and_replace_multiple((void *)0x1609D158, 0x5000); find_and_replace_multiple((void *)0x160B9B28, 0x1000); } }
void timeTravel(void) { if(is_pressed(BUTTON_B + BUTTON_DR)) { ADD64(g_savetime, 0x34630B8A000); ADD64(g_realtime, 0x34630B8A000); wait_keys_released(DR); } if(is_pressed(BUTTON_B + BUTTON_DL)) { SUB64(g_savetime, 0x34630B8A000); SUB64(g_realtime, 0x34630B8A000); wait_keys_released(DL); } if(is_pressed(BUTTON_B + BUTTON_DD)) { WRITES64(g_savetime, 0x0000000000000000); WRITES64(g_realtime, 0x0000000000000000); } if(is_pressed(BUTTON_R + BUTTON_DR)) { ADD64(g_savetime, 0xdf8475800); ADD64(g_realtime, 0xdf8475800); } if(is_pressed(BUTTON_R + BUTTON_DL)) { SUB64(g_savetime, 0xdf8475800); SUB64(g_realtime, 0xdf8475800); } }
Response AbstractButton::PerformMouseRelease (AbstractWindow* context) { if (context->GetMouseButton() == MouseButtonLeft) { int fire_event = 0; // 0: no event, 1: click event, 2: toggled event if (is_checkable()) { if (is_pressed()) { fire_event = 2; } } else { if (is_pressed() && is_down()) { fire_event = 1; } } RequestRedraw(); switch (fire_event) { case 0: break; case 1: { if (group_) { group_->Click(this); } else { clicked_.Invoke(); } break; } case 2: { if (is_checked() != is_last_checked()) { if (group_) { group_->Toggle(this, is_checked()); } else { toggled_.Invoke(is_checked()); } } break; } default: break; } set_pressed(false); set_down(false); released_.Invoke(); return Finish; } return Ignore; }
int poll_button(uint32_t tick) { static int pressed_button = -1; static int press_start_tick = 0; static int action_ok = 0; static int poll_limit_ts = 0; int ret, i; /* Cases : * 1. Button pressed, but was not previously * Start waiting for the detect time * 2. Button pressed, and was previously * Check detect time. If expired, wait for release * 3. Button not pressed, but was previously * If waiting for release, reset and return 1 * otherwise do nothing. */ if ( pressed_button >= 0 ) { // Button was held previously if ( is_pressed(pressed_button) ) { // Button is still held // Has it been held enough time? if ( tick - press_start_tick > BUTTON_SENSITIVITY_TICKS ) { // action_ok = 1; } return -1; // Wait for release } // Button was pressed but now released. Time for action ret = pressed_button; pressed_button = -1; press_start_tick = 0; if (action_ok) { action_ok = 0; return ret; } // If we switched button it will be detected next polling time return -1; } // If we end up here no button was held previously // So find out if one is pressed now /* Rate limit polling on the EVK1104 because is_pressed() * takes a huge amount of time. */ #if BOARD != EVK1104 poll_limit_ts = 0; #endif if ( poll_limit_ts == 0 || tick - poll_limit_ts > 100 ) { for (i = 0; i < NUM_BUTTONS; i++) { // Check buttons if ( is_pressed(i) ) { pressed_button = i; press_start_tick = tick; break; } } poll_limit_ts = tick; } return -1; }
void coord(void) { static int loc = 0; if (!is_pressed(BUTTON_A)) return; loc = READU32(g_location); if (loc == -1) //FFFFFFFF=outdoors { if (is_pressed(BUTTON_A + BUTTON_DD)) ADDTOFLOAT(g_outdoor_pos_x, 1.0); if (is_pressed(BUTTON_A + BUTTON_DU)) SUBTOFLOAT(g_outdoor_pos_x, 1.0); if (is_pressed(BUTTON_A + BUTTON_DL)) SUBTOFLOAT(g_outdoor_pos_z, 1.0); if (is_pressed(BUTTON_A + BUTTON_DR)) ADDTOFLOAT(g_outdoor_pos_z, 1.0); } else //if it's anything but FFFFFFFF then you're indoors { if (is_pressed(BUTTON_A + BUTTON_DD)) ADDTOFLOAT(g_indoor_pos_x, 1.0); if (is_pressed(BUTTON_A + BUTTON_DU)) SUBTOFLOAT(g_indoor_pos_x, 1.0); if (is_pressed(BUTTON_A + BUTTON_DL)) SUBTOFLOAT(g_indoor_pos_z, 1.0); if (is_pressed(BUTTON_A + BUTTON_DR)) ADDTOFLOAT(g_indoor_pos_z, 1.0); } }
void coord_jap(void)//JAP { static int loc = 0; if (is_pressed(BUTTON_A)) { loc = READU32(0x173B8CC4); //JP } if (loc == -1) //FFFFFFFF=outdoors { if (is_pressed(BUTTON_A + BUTTON_DD)) ADDTOFLOAT(0x173B8B98, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DU)) SUBTOFLOAT(0x173B8B98, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DL)) SUBTOFLOAT(0x173B8B90, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DR)) ADDTOFLOAT(0x173B8B90, 0x00000002); //JP } else //if it's anything but FFFFFFFF then you're indoors { if (is_pressed(BUTTON_A + BUTTON_DD)) ADDTOFLOAT(0x173B8CC4, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DU)) SUBTOFLOAT(0x173B8CC4, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DL)) SUBTOFLOAT(0x173B8CBC, 0x00000002); //JP if (is_pressed(BUTTON_A + BUTTON_DR)) ADDTOFLOAT(0x173B8CBC, 0x00000002); //JP } }
void collisions(void) { if (is_pressed(BUTTON_R + BUTTON_DU)) { WRITEU8(g_collisions, 0x01); } if (is_pressed(BUTTON_R + BUTTON_DD)) { WRITEU8(g_collisions, 0x00); } }
pqrs::karabiner_virtual_hid_device::hid_report::modifiers make_hid_report_modifiers(void) const { pqrs::karabiner_virtual_hid_device::hid_report::modifiers modifiers; if (is_pressed(modifier_flag::left_control)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::left_control); } if (is_pressed(modifier_flag::left_shift)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::left_shift); } if (is_pressed(modifier_flag::left_option)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::left_option); } if (is_pressed(modifier_flag::left_command)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::left_command); } if (is_pressed(modifier_flag::right_control)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::right_control); } if (is_pressed(modifier_flag::right_shift)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::right_shift); } if (is_pressed(modifier_flag::right_option)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::right_option); } if (is_pressed(modifier_flag::right_command)) { modifiers.insert(pqrs::karabiner_virtual_hid_device::hid_report::modifier::right_command); } return modifiers; }
void teleport(void) { static u32 indoor_X[3] = { 0 }; static u32 indoor_Y[3] = { 0 }; static u32 outdoor_X[3] = { 0 }; static u32 outdoor_Y[3] = { 0 }; int loc; int slot; if (!is_pressed(BUTTON_B) && !g_text_activated) return; //Pointer to define whether player is indoors or not loc = READU32(g_location); if (is_pressed(BUTTON_L)) //If L is pressed then use slot3 slot = 2; else if (is_pressed(BUTTON_R)) //If R is pressed then use slot2 slot = 1; else //If noting is pressed then use slot0 slot = 0; if (is_pressed(BUTTON_B + BUTTON_DU) || (g_teleport_save && g_text_activated)) { if (loc == -1) { outdoor_X[slot] = READU32(g_outdoor_pos_x); outdoor_Y[slot] = READU32(g_outdoor_pos_z); } else { indoor_X[slot] = READU32(g_indoor_pos_x); indoor_Y[slot] = READU32(g_indoor_pos_z); } } else if (is_pressed(BUTTON_B + BUTTON_DD) || (!g_teleport_save && g_text_activated)) { if (loc == -1) { WRITEU32(g_outdoor_pos_x, outdoor_X[slot]); WRITEU32(g_outdoor_pos_z, outdoor_Y[slot]); } else { WRITEU32(g_indoor_pos_x, indoor_X[slot]); WRITEU32(g_indoor_pos_z, indoor_Y[slot]); } } }
void BaseButton::_unhandled_input(InputEvent p_event) { if (!is_disabled() && is_visible() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) return; //ignore because of modal window if (is_toggle_mode()) { set_pressed(!is_pressed()); emit_signal("toggled",is_pressed()); } emit_signal("pressed"); } }
void tree(void) { if (is_pressed(BUTTON_X)) { reset_search(); add_search_replace(0x003A, 0x003E); add_search_replace(0x003F, 0x0043); add_search_replace(0x0044, 0x0048); add_search_replace(0x0049, 0x004D); add_search_replace(0x004E, 0x0052); add_search_replace(0x0022, 0x0026); add_search_replace(0x0027, 0x002B); add_search_replace(0x002C, 0x0030); add_search_replace(0x0031, 0x0035); add_search_replace(0x0036, 0x0039); add_search_replace(0x0053, 0x0057); add_search_replace(0x0058, 0x005C); add_search_replace(0x005D, 0x0061); add_search_replace(0x0062, 0x0066); add_search_replace(0x0067, 0x006B); add_search_replace(0x006C, 0x0043); find_and_replace_multiple((void *)g_town_items, 0x5000); find_and_replace_multiple((void *)g_island_items, 0x1000); } }
void CheckButton::_notification(int p_what) { if (p_what == NOTIFICATION_THEME_CHANGED) { _set_internal_margin(MARGIN_RIGHT, get_icon_size().width); } else if (p_what == NOTIFICATION_DRAW) { RID ci = get_canvas_item(); Ref<Texture> on = Control::get_icon("on"); Ref<Texture> off = Control::get_icon("off"); Ref<StyleBox> sb = get_stylebox("normal"); Vector2 ofs; Size2 tex_size = get_icon_size(); ofs.x = get_size().width - (tex_size.width + sb->get_margin(MARGIN_RIGHT)); ofs.y = (get_size().height - tex_size.height) / 2; if (is_pressed()) on->draw(ci, ofs); else off->draw(ci, ofs); } }
void duplicate4_jap(void)//JAP { u32 dupe = 0; u32 dupe0 = 0; u32 dupe1 = 0; u32 dupe2 = 0; u32 dupe3 = 0; u32 dupe4 = 0; if (is_pressed(BUTTON_R)) { dupe = READU32(0x16074000); dupe0 = READU32(0xAEEC28); //online pointer0 dupe1 = READU32(0xAF8B38); //online pointer1 dupe2 = READU32(0xB02A48); //online pointer2 dupe3 = READU32(0xB0C958); dupe4 = READU32(0xB0BA58); WRITEU32(0x16074004, dupe); WRITEU32(0xAEEC2C, dupe0); WRITEU32(0xAF8B3C, dupe1); WRITEU32(0xB02A4C, dupe2); WRITEU32(0xB0C96C, dupe3); WRITEU32(0xB0BA6C, dupe4); } }
void moonjump_jap(void) { int loc; u32 Z; if (!(any_is_pressed(R)) && is_pressed(BUTTON_L)) //it's better to test the negation first { loc = READU32(0x17321644); Z = READU32(0x17321514); if (Z >= 0x440F0000) { if (loc == -1) { WRITEU32(0x17321514, 0x440F0000); } else { WRITEU32(0x17321640, 0x440F0000); } } else { if (loc == -1) { ADDTOFLOAT(0x17321514, 0x00000006); } else { ADDTOFLOAT(0x17321640, 0x00000006); } } } }
void moonjump(void) { int loc; u32 height; if (!(any_is_pressed(R)) && is_pressed(BUTTON_L)) //it's better to test the negation first { loc = READU32(g_location); height = READU32(g_outdoor_pos_y); if (height >= 0x440F0000) { if (loc == -1) { WRITEU32(g_outdoor_pos_y, 0x440F0000); } else { WRITEU32(g_indoor_pos_y, 0x440F0000); } } else { if (loc == -1) { ADDTOFLOAT(g_outdoor_pos_y, 6.0); } else { ADDTOFLOAT(g_indoor_pos_y, 6.0); } } } }
void sleep_until_switch_press() { // This routine takes up a lot of program memory :( // Turn the WDT off so it doesn't wake us from sleep // Will also ensure interrupts are on or we will never wake up WDT_off(); // Need to reset press duration since a button release wasn't recorded press_duration = 0; // Enable a pin change interrupt to wake us up // However, we have to make sure the switch is released otherwise we will wake when the user releases the switch while (is_pressed()) { _delay_ms(16); } PCINT_on(); // Enable sleep mode set to Power Down that will be triggered by the sleep_mode() command. //set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Now go to sleep sleep_mode(); // Hey, someone must have pressed the switch!! // Disable pin change interrupt because it's only used to wake us up PCINT_off(); // Turn the WDT back on to check for switch presses WDT_on(); // Go back to main program }
void bumper_action() { int i; int pressed[BUMPER_NUM]; for (i = 0; i < BUMPER_NUM; i++) { pressed[bumpers[i].id] = is_pressed(bumpers[i].data); } if (pressed[BUMPER_REAR_R]) { set_car_velocity(-400, -100, deg2rad(-120)); sleep(1); } else if (pressed[BUMPER_REAR_L]) { set_car_velocity(-400, 100, deg2rad(120)); sleep(1); } else if (pressed[BUMPER_LEFT_R]) { set_car_velocity(400, -100, deg2rad(-120)); sleep(1); } else if (pressed[BUMPER_RIGHT_L]) { set_car_velocity(400, 100, deg2rad(120)); sleep(1); } else if (pressed[BUMPER_RIGHT_R]) { set_car_velocity(0, -400, 0); sleep(1); } else if (pressed[BUMPER_LEFT_L]) { set_car_velocity(0, 400, 0); sleep(1); } else { set_car_velocity(-200, 0, 0); } }
void sleep_until_switch_press() { // This routine takes up a lot of program memory :( // Turn the WDT off so it doesn't wake us from sleep // Will also ensure interrupts are on or we will never wake up WDT_off(); // Need to reset press duration since a button release wasn't recorded press_duration = 0; // Enable a pin change interrupt to wake us up // However, we have to make sure the switch is released otherwise we will wake when the user releases the switch while (is_pressed()) { _delay_ms(16); } PCINT_on(); // turn red+green LEDs off DDRB = (1 << PWM_PIN); // note the lack of red/green pins here // with this commented out, the LEDs dim instead of turning off entirely //PORTB &= 0xff ^ ((1 << RED_PIN) | (1 << GREEN_PIN)); // red+green off // Enable sleep mode set to Power Down that will be triggered by the sleep_mode() command. //set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Now go to sleep sleep_mode(); // Hey, someone must have pressed the switch!! // Disable pin change interrupt because it's only used to wake us up PCINT_off(); // Turn the WDT back on to check for switch presses WDT_on(); // Go back to main program }
void real(void) { u32 x; u32 y; u32 reg0; u32 reg1; u32 offset; int input; if (is_pressed(BUTTON_R + BUTTON_DD)) { x = READU32(g_world_x); y = READU32(g_world_y); if (x >= 0x10 && y >= 0x10) { x -= 0x10; y -= 0x10; reg0 = x % 0x10; x /= 0x10; reg1 = y % 0x10; y /= 0x10; reg0 *= 0x4; reg1 *= 0x40; x *= 0x400; y *= 0x1400; offset = reg0 + reg1 + x + y; get_input_id(&input, NULL); WRITEU16(g_town_items + offset, input); } } }
void seeder(void) { int input; if (!is_pressed(BUTTON_L)) return; get_input_id(&input, NULL); if (is_pressed(BUTTON_L + A)) { WRITEU32(g_seed, 0x80000000 + input); } else { WRITEU16(g_seed, input); } }
void seed_jap(void) //JAP { u16 result; if (is_pressed(BUTTON_R + BUTTON_DD)) { u16 *id = (u16 *)0x16FE3C60; char id_str[5] = { 0 }; int i; for (i = 0; i < 4; i++) id_str[i] = (char)READU16(id + i); result = (u16)strtoul(id_str, NULL, 16); reset_search(); add_search_replace(0x20A7, result); find_and_replace_multiple((void *)0x1609D158, 0x5000); find_and_replace_multiple((void *)0x160B9B28, 0x1000); wait_all_released(); } if (is_pressed(BUTTON_R + BUTTON_DU)) { u16 *id = (u16 *)0x16FE3C60; char id_str[5] = { 0 }; int i; for (i = 0; i < 4; i++) id_str[i] = (char)READU16(id + i); result = (u16)strtoul(id_str, NULL, 16); reset_search(); add_search_replace(result, 0x7FFE); find_and_replace_multiple((void *)0x1609D158, 0x5000); find_and_replace_multiple((void *)0x160B9B28, 0x1000); wait_all_released(); } if (is_pressed(BUTTON_R + BUTTON_DL)) { u16 *id = (u16 *)0x16FE3C60; char id_str[5] = { 0 }; int i; for (i = 0; i < 4; i++) id_str[i] = (char)READU16(id + i); result = (u16)strtoul(id_str, NULL, 16); reset_search(); add_search_replace(result, 0x20A7); find_and_replace_multiple((void *)0x1609D158, 0x5000); find_and_replace_multiple((void *)0x160B9B28, 0x1000); wait_all_released(); } }
void get_movement(int player, int &x, int &y, int &b1, int &b2, int &b3, int &b4) { if( player < key_players ) { /* if( key_map[player].joy ) { joy_status( b1,b2,b3,x,y ); b3 = ( b1 && b2 ); b4 = 0; } else if( !wm ) { x = y = b1 = b2 = b3 = b4 = 0; } else*/ { if( is_pressed( key_map[player].left ) ) x = -1; else if( is_pressed( key_map[player].right ) ) x=1; else x = 0; if( is_pressed( key_map[player].up ) ) y = -1; else if( is_pressed( key_map[player].down ) ) y = 1; else y = 0; if( is_pressed( key_map[player].b1 ) ) b1 = 1; else b1 = 0; if( is_pressed( key_map[player].b2 ) ) b2 = 1; else b2 = 0; if( is_pressed( key_map[player].b3 ) ) b3 = 1; else b3 = 0; if( is_pressed( key_map[player].b4 ) ) b4 = 1; else b4 = 0; } } else { x = y = b1 = b2 = b3 = 0; } }
static inline void query_hotkeys() { uint32_t modifiers = 0; if (is_pressed(OBS_KEY_SHIFT)) modifiers |= INTERACT_SHIFT_KEY; if (is_pressed(OBS_KEY_CONTROL)) modifiers |= INTERACT_CONTROL_KEY; if (is_pressed(OBS_KEY_ALT)) modifiers |= INTERACT_ALT_KEY; if (is_pressed(OBS_KEY_META)) modifiers |= INTERACT_COMMAND_KEY; struct obs_query_hotkeys_helper param = { modifiers, obs->hotkeys.thread_disable_press, obs->hotkeys.strict_modifiers, }; enum_bindings(query_hotkey, ¶m); }
void edibleItems(void) { int input; if (is_pressed(BUTTON_L)) { get_input_id(&input, NULL); WRITEU16(g_edible, input); } }
void desert(void) { if (is_pressed(BUTTON_R + BUTTON_A)) { int i; for (i = g_grass_start; i < g_grass_end; i++) *(u32 *)i = 0x00000000; wait_all_released(); } }
void grass_jap(void) { disableCheat(8); if (is_pressed(BUTTON_R + BUTTON_A)) { int i; for (i = 0x160A3580; i < 0x160a5d7c; i++) *(u32 *)i = 0xFFFFFFFF; wait_all_released(); } }
void AbstractButton::PerformHoverIn (AbstractWindow* context) { if (is_pressed()) { set_down(true); if (is_checkable()) { set_checked(!is_checked()); } RequestRedraw(); } }
void desert_jap(void) { disableCheat(7); if (is_pressed(BUTTON_R + BUTTON_A)) { int i; for (i = 0x160A3580; i < 0x160a5d7c; i++) *(u32 *)i = 0x00000000; wait_all_released(); } }
void occur2(int button, int event) { int current_state = get_current_state2(button); set_current_state2(button, current_state+1); if (event == EV_WAKE_UP) { if (is_pressed(button)) set_current_state2(button, ST_BUTTON_PRESSED); else set_current_state2(button, ST_BUTTON_RELEASED); } }
void search(void) { int search; int replace; if (is_pressed(BUTTON_L + BUTTON_DL)) { get_input_id(&search, &replace); reset_search(); add_search_replace(search, replace); find_and_replace_multiple((void *)g_town_items, 0x5000); find_and_replace_multiple((void *)g_island_items, 0x1000); } }