sm64pc/src/pc/controller/controller_entry_point.c

38 lines
1010 B
C
Raw Normal View History

2020-05-05 12:15:53 +00:00
#include "lib/src/libultra_internal.h"
#include "lib/src/osContInternal.h"
#include "controller_recorded_tas.h"
#include "controller_keyboard.h"
#include "controller_sdl.h"
2020-05-08 10:48:52 +00:00
#include "controller_tas_recorder.h"
2020-05-05 12:15:53 +00:00
static struct ControllerAPI *controller_implementations[] = {
&controller_recorded_tas,
2020-05-08 12:47:25 +00:00
&controller_sdl,
&controller_keyboard,
&controller_tas_recorder,
2020-05-05 12:15:53 +00:00
};
s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
for (size_t i = 0; i < sizeof(controller_implementations) / sizeof(struct ControllerAPI *); i++) {
controller_implementations[i]->init();
}
*controllerBits = 1;
return 0;
}
s32 osContStartReadData(OSMesgQueue *mesg) {
return 0;
}
void osContGetReadData(OSContPad *pad) {
pad->button = 0;
pad->stick_x = 0;
pad->stick_y = 0;
pad->errnum = 0;
for (size_t i = 0; i < sizeof(controller_implementations) / sizeof(struct ControllerAPI *); i++) {
controller_implementations[i]->read(pad);
}
}