mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-28 23:13:02 +00:00
unfuck keyboard API; actually use seconds for rumble time
This commit is contained in:
parent
3954f7d1d3
commit
aff081080b
5 changed files with 13 additions and 9 deletions
|
@ -15,5 +15,6 @@ extern void func_sh_8024CA04(void);
|
|||
extern void cancel_rumble(void);
|
||||
extern void create_thread_6(void);
|
||||
extern void rumble_thread_update_vi(void);
|
||||
extern void thread6_rumble_loop(void *a0);
|
||||
|
||||
#endif // _THREAD_6_H
|
|
@ -1,5 +1,6 @@
|
|||
#include "lib/src/libultra_internal.h"
|
||||
#include "lib/src/osContInternal.h"
|
||||
#include "macros.h"
|
||||
|
||||
#include "../configfile.h"
|
||||
|
||||
|
@ -21,7 +22,7 @@ static struct ControllerAPI *controller_implementations[] = {
|
|||
&controller_keyboard,
|
||||
};
|
||||
|
||||
s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
|
||||
s32 osContInit(UNUSED OSMesgQueue *mq, u8 *controllerBits, UNUSED OSContStatus *status) {
|
||||
for (size_t i = 0; i < sizeof(controller_implementations) / sizeof(struct ControllerAPI *); i++) {
|
||||
controller_implementations[i]->init();
|
||||
}
|
||||
|
@ -29,23 +30,23 @@ s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
s32 osMotorStart(void *pfs) {
|
||||
s32 osMotorStart(UNUSED void *pfs) {
|
||||
// Since rumble stops by osMotorStop, its duration is not nessecary.
|
||||
// Set it to 5 seconds and hope osMotorStop() is called in time.
|
||||
controller_rumble_play(configRumbleStrength / 100.0f, 5.0f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 osMotorStop(void *pfs) {
|
||||
s32 osMotorStop(UNUSED void *pfs) {
|
||||
controller_rumble_stop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 osMotorInit(OSMesgQueue *mq, void *pfs, s32 port) {
|
||||
u32 osMotorInit(UNUSED OSMesgQueue *mq, UNUSED void *pfs, UNUSED s32 port) {
|
||||
return 0; // rumble is initialized in the specific backend's init function
|
||||
}
|
||||
|
||||
s32 osContStartReadData(OSMesgQueue *mesg) {
|
||||
s32 osContStartReadData(UNUSED OSMesgQueue *mesg) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,8 @@ struct ControllerAPI controller_keyboard = {
|
|||
keyboard_init,
|
||||
keyboard_read,
|
||||
keyboard_rawkey,
|
||||
NULL,
|
||||
NULL,
|
||||
keyboard_bindkeys,
|
||||
keyboard_shutdown
|
||||
};
|
||||
|
|
|
@ -241,9 +241,9 @@ static void controller_sdl_read(OSContPad *pad) {
|
|||
}
|
||||
}
|
||||
|
||||
static void controller_sdl_rumble_play(f32 strength, u32 length) {
|
||||
static void controller_sdl_rumble_play(f32 strength, f32 length) {
|
||||
if (sdl_haptic)
|
||||
SDL_HapticRumblePlay(sdl_haptic, strength, length);
|
||||
SDL_HapticRumblePlay(sdl_haptic, strength, (u32)(length * 1000.0f));
|
||||
}
|
||||
|
||||
static void controller_sdl_rumble_stop(void) {
|
||||
|
|
|
@ -67,7 +67,7 @@ void send_display_list(struct SPTask *spTask) {
|
|||
void produce_one_frame(void) {
|
||||
gfx_start_frame();
|
||||
game_loop_one_iteration();
|
||||
thread6_rumble_loop();
|
||||
thread6_rumble_loop(NULL);
|
||||
|
||||
int samples_left = audio_api->buffered();
|
||||
u32 num_audio_samples = samples_left < audio_api->get_desired_buffered() ? 544 : 528;
|
||||
|
|
Loading…
Reference in a new issue