feat: add opt-in native Nintendo rumble backend
This commit is contained in:
parent
71fcf5bb94
commit
3fc28b1fa4
44 changed files with 4834 additions and 240 deletions
31
tests/switch_native_output_native_stubs/btstack.h
Normal file
31
tests/switch_native_output_native_stubs/btstack.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum btstack_data_source_callback_type_t {
|
||||
DATA_SOURCE_CALLBACK_POLL = 4,
|
||||
};
|
||||
|
||||
struct btstack_data_source_t {
|
||||
void (*handler)(btstack_data_source_t*, btstack_data_source_callback_type_t) = nullptr;
|
||||
uint16_t callbacks = 0;
|
||||
};
|
||||
|
||||
struct btstack_timer_source_t {
|
||||
void (*handler)(btstack_timer_source_t*) = nullptr;
|
||||
uint64_t due_us = 0;
|
||||
};
|
||||
|
||||
void btstack_run_loop_set_data_source_handler(
|
||||
btstack_data_source_t* source,
|
||||
void (*handler)(btstack_data_source_t*, btstack_data_source_callback_type_t));
|
||||
void btstack_run_loop_enable_data_source_callbacks(btstack_data_source_t* source,
|
||||
uint16_t callbacks);
|
||||
void btstack_run_loop_add_data_source(btstack_data_source_t* source);
|
||||
void btstack_run_loop_poll_data_sources_from_irq();
|
||||
void btstack_run_loop_set_timer_handler(btstack_timer_source_t* timer,
|
||||
void (*handler)(btstack_timer_source_t*));
|
||||
void btstack_run_loop_set_timer(btstack_timer_source_t* timer, uint32_t timeout_ms);
|
||||
void btstack_run_loop_add_timer(btstack_timer_source_t* timer);
|
||||
bool btstack_run_loop_remove_timer(btstack_timer_source_t* timer);
|
||||
uint8_t l2cap_request_can_send_now_event(uint16_t cid);
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
#include <uni.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
bool uni_hid_parser_switch_native_info(uni_hid_device_t* device, uint8_t* type,
|
||||
uint8_t* firmware_hi, uint8_t* firmware_lo);
|
||||
bool uni_hid_parser_switch_native_acquire(uni_hid_device_t* device);
|
||||
bool uni_hid_parser_switch_native_send(uni_hid_device_t* device,
|
||||
const uint8_t rumble[8]);
|
||||
void uni_hid_parser_switch_native_release(uni_hid_device_t* device);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
27
tests/switch_native_output_native_stubs/uni.h
Normal file
27
tests/switch_native_output_native_stubs/uni.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct uni_hid_device_s;
|
||||
using uni_hid_device_t = uni_hid_device_s;
|
||||
using uni_play_dual_rumble_t = void (*)(uni_hid_device_t*, uint16_t, uint16_t,
|
||||
uint8_t, uint8_t);
|
||||
|
||||
struct uni_report_parser_t {
|
||||
uni_play_dual_rumble_t play_dual_rumble = nullptr;
|
||||
};
|
||||
|
||||
// Only the parser boundary is faked. Native sends either enter the byte sink
|
||||
// synchronously or fail without retaining a packet; no hidden transmit queue.
|
||||
struct uni_hid_device_s {
|
||||
uni_report_parser_t report_parser{};
|
||||
struct { uint16_t interrupt_cid = 0; } conn;
|
||||
bool connected = true;
|
||||
bool info_ready = true;
|
||||
bool acquire_allowed = true;
|
||||
bool native_owned = false;
|
||||
uint8_t controller_type = 3;
|
||||
unsigned acquisitions = 0;
|
||||
unsigned releases = 0;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue