2023-11-24 22:10:21 +00:00
|
|
|
#ifndef __RECOMP_INPUT_H__
|
|
|
|
#define __RECOMP_INPUT_H__
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
#include <variant>
|
|
|
|
#include <vector>
|
|
|
|
#include <type_traits>
|
2023-12-13 07:06:56 +00:00
|
|
|
#include <span>
|
2023-11-24 22:10:21 +00:00
|
|
|
|
|
|
|
namespace recomp {
|
2023-12-13 07:06:56 +00:00
|
|
|
struct InputField {
|
|
|
|
uint32_t device_type;
|
|
|
|
int32_t input_id;
|
2023-11-24 22:10:21 +00:00
|
|
|
};
|
|
|
|
|
2023-12-13 07:06:56 +00:00
|
|
|
void poll_inputs();
|
|
|
|
float get_input_analog(const InputField& field);
|
|
|
|
float get_input_analog(const std::span<const recomp::InputField> fields);
|
|
|
|
bool get_input_digital(const InputField& field);
|
|
|
|
bool get_input_digital(const std::span<const recomp::InputField> fields);
|
|
|
|
|
|
|
|
struct DefaultN64Mappings {
|
|
|
|
std::vector<InputField> a;
|
|
|
|
std::vector<InputField> b;
|
|
|
|
std::vector<InputField> l;
|
|
|
|
std::vector<InputField> r;
|
|
|
|
std::vector<InputField> z;
|
|
|
|
std::vector<InputField> start;
|
|
|
|
|
|
|
|
std::vector<InputField> c_left;
|
|
|
|
std::vector<InputField> c_right;
|
|
|
|
std::vector<InputField> c_up;
|
|
|
|
std::vector<InputField> c_down;
|
|
|
|
|
|
|
|
std::vector<InputField> dpad_left;
|
|
|
|
std::vector<InputField> dpad_right;
|
|
|
|
std::vector<InputField> dpad_up;
|
|
|
|
std::vector<InputField> dpad_down;
|
|
|
|
|
|
|
|
std::vector<InputField> analog_left;
|
|
|
|
std::vector<InputField> analog_right;
|
|
|
|
std::vector<InputField> analog_up;
|
|
|
|
std::vector<InputField> analog_down;
|
2023-11-24 22:10:21 +00:00
|
|
|
};
|
|
|
|
|
2024-01-08 08:38:05 +00:00
|
|
|
extern const DefaultN64Mappings default_n64_keyboard_mappings;
|
|
|
|
extern const DefaultN64Mappings default_n64_controller_mappings;
|
2023-11-24 22:10:21 +00:00
|
|
|
|
|
|
|
void get_n64_input(uint16_t* buttons_out, float* x_out, float* y_out);
|
|
|
|
void handle_events();
|
2024-01-08 08:38:05 +00:00
|
|
|
|
|
|
|
bool game_input_disabled();
|
2023-11-24 22:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|