MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / handle_input_event2

Function handle_input_event2

src/inputdevice.cpp:5422–5887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5420}
5421
5422static int handle_input_event2(int nr, int state, int max, int flags, int extra)
5423{
5424 struct vidbuf_description *vidinfo = &adisplays[0].gfxvidinfo;
5425 const struct inputevent *ie;
5426 int joy;
5427 bool isaks = false;
5428 bool allowoppositestick = false;
5429 int autofire = (flags & HANDLE_IE_FLAG_AUTOFIRE) ? 1 : 0;
5430
5431 if (nr <= 0 || nr == INPUTEVENT_SPC_CUSTOM_EVENT)
5432 return 0;
5433
5434#if defined(_WIN32) && !defined(AMIBERRY)
5435 // ignore normal GUI event if forced gui key is in use
5436 if (nr == INPUTEVENT_SPC_ENTERGUI) {
5437 if (currprefs.win32_guikey > 0)
5438 return 0;
5439 }
5440#endif
5441
5442 ie = &events[nr];
5443 if (isqual (nr))
5444 return 0; // qualifiers do nothing
5445 if (ie->unit == 0 && ie->data >= AKS_FIRST) {
5446 isaks = true;
5447 }
5448
5449#ifdef DEBUGGER
5450 if (isaks) {
5451 if (debug_trainer_event(ie->data, state))
5452 {
5453 return 0;
5454 }
5455 } else {
5456 if (debug_trainer_event(nr, state))
5457 {
5458 return 0;
5459 }
5460 }
5461#endif
5462 if (!isaks) {
5463 if (input_record && input_record != INPREC_RECORD_PLAYING)
5464 inprec_recordevent (nr, state, max, autofire);
5465 if (input_play && state && (flags & HANDLE_IE_FLAG_CANSTOPPLAYBACK)) {
5466 if (inprec_realtime ()) {
5467 if (input_record && input_record != INPREC_RECORD_PLAYING)
5468 inprec_recordevent (nr, state, max, autofire);
5469 }
5470 }
5471 if (!(flags & HANDLE_IE_FLAG_PLAYBACKEVENT) && input_play)
5472 return 0;
5473 }
5474
5475 if (flags & HANDLE_IE_FLAG_ALLOWOPPOSITE) {
5476 if (ie->unit >= 1 && ie->unit <= 4) {
5477 if ((ie->data & (DIR_LEFT | DIR_RIGHT)) != (DIR_LEFT | DIR_RIGHT) && (ie->data & (DIR_UP | DIR_DOWN)) != (DIR_UP | DIR_DOWN))
5478 allowoppositestick = true;
5479 }

Callers 2

handle_input_event_extraFunction · 0.85
handle_input_eventFunction · 0.85

Calls 13

isqualFunction · 0.85
debug_trainer_eventFunction · 0.85
inprec_recordeventFunction · 0.85
inprec_realtimeFunction · 0.85
queue_input_eventFunction · 0.85
tablet_lightpenFunction · 0.85
vkbd_allowedFunction · 0.85
osk_controlFunction · 0.85
get_cyclesFunction · 0.85
joymousecounterFunction · 0.85
inputdevice_do_keyboardFunction · 0.85
write_logFunction · 0.70

Tested by

no test coverage detected