Check if controller can rumble to insert rumble pak
This commit is contained in:
parent
038757a9b6
commit
21e4e5a140
|
@ -19,6 +19,7 @@ namespace Ship {
|
|||
void Read(OSContPad* pad);
|
||||
virtual void ReadFromSource() = 0;
|
||||
virtual void WriteToSource(ControllerCallback* controller) = 0;
|
||||
virtual bool CanRumble() const = 0;
|
||||
bool isRumbling;
|
||||
|
||||
void SetButtonMapping(const std::string& szButtonName, int32_t dwScancode);
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace Ship {
|
|||
|
||||
void ReadFromSource();
|
||||
void WriteToSource(ControllerCallback* controller);
|
||||
bool CanRumble() const { return false; }
|
||||
|
||||
bool PressButton(int32_t dwScancode);
|
||||
bool ReleaseButton(int32_t dwScancode);
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace Ship {
|
|||
|
||||
void ReadFromSource();
|
||||
void WriteToSource(ControllerCallback* controller);
|
||||
bool CanRumble() const { return SDL_GameControllerHasRumble(Cont); }
|
||||
|
||||
std::string GetGuid() { return guid; };
|
||||
|
||||
|
|
|
@ -814,3 +814,13 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) {
|
|||
OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Play(buf, len);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" int Controller_CanRumble(void) {
|
||||
for (const auto& controller : Ship::Window::Controllers.at(0)) {
|
||||
if (controller->CanRumble()) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -64,4 +64,5 @@ int AudioPlayer_Buffered(void);
|
|||
int AudioPlayer_GetDesiredBuffered(void);
|
||||
void AudioPlayer_Play(const uint8_t* buf, uint32_t len);
|
||||
void AudioMgr_CreateNextAudioBuffer(s16* samples, u32 num_samples);
|
||||
int Controller_CanRumble(void);
|
||||
#endif
|
||||
|
|
|
@ -304,11 +304,7 @@ void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
|
|||
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
|
||||
osContGetReadData(padMgr->pads);
|
||||
|
||||
if (CVar_GetS32("gRumbleEnabled", 0) != 0) {
|
||||
padMgr->padStatus[0].status = 1;
|
||||
} else {
|
||||
padMgr->padStatus[0].status = 0;
|
||||
}
|
||||
padMgr->padStatus[0].status = (CVar_GetS32("gRumbleEnabled", 0) != 0) && Controller_CanRumble();
|
||||
|
||||
if (padMgr->preNMIShutdown) {
|
||||
memset(padMgr->pads, 0, sizeof(padMgr->pads));
|
||||
|
|
Loading…
Reference in New Issue