mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-03 21:45:32 +02:00
Remove haptics code
It never worked anyway, as far as anyone knew, and is probably not a feature anyone particularly needs.
This commit is contained in:
parent
cd2c375e2d
commit
d565650975
6 changed files with 4 additions and 97 deletions
|
@ -217,21 +217,6 @@ RB_METHOD(inputJoystickInfo) {
|
|||
#undef POWERCASE
|
||||
#undef M_SYMBOL
|
||||
|
||||
RB_METHOD(inputRumble) {
|
||||
RB_UNUSED_PARAM;
|
||||
VALUE duration, strength, attack, fade;
|
||||
rb_scan_args(argc, argv, "13", &duration, &strength, &attack, &fade);
|
||||
|
||||
int dur = NUM2INT(duration);
|
||||
int str = (NIL_P(strength)) ? 1 : NUM2INT(strength);
|
||||
int att = (NIL_P(attack)) ? 0 : NUM2INT(attack);
|
||||
int fad = (NIL_P(fade)) ? 0 : NUM2INT(fade);
|
||||
|
||||
shState->input().rumble(dur, str, att, fad);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
RB_METHOD(inputGetMode) {
|
||||
RB_UNUSED_PARAM;
|
||||
|
||||
|
@ -332,7 +317,6 @@ void inputBindingInit() {
|
|||
_rb_define_module_function(module, "mouse_y", inputMouseY);
|
||||
|
||||
_rb_define_module_function(module, "joystick", inputJoystickInfo);
|
||||
_rb_define_module_function(module, "rumble", inputRumble);
|
||||
|
||||
_rb_define_module_function(module, "text_input", inputGetMode);
|
||||
_rb_define_module_function(module, "text_input=", inputSetMode);
|
||||
|
|
|
@ -91,8 +91,6 @@ enum
|
|||
REQUEST_TEXTMODE,
|
||||
|
||||
REQUEST_SETTINGS,
|
||||
|
||||
REQUEST_RUMBLE,
|
||||
|
||||
UPDATE_FPS,
|
||||
UPDATE_SCREEN_RECT,
|
||||
|
@ -114,11 +112,9 @@ bool EventThread::allocUserEvents()
|
|||
|
||||
EventThread::EventThread()
|
||||
: js(0),
|
||||
hapt(0),
|
||||
fullscreen(false),
|
||||
showCursor(true),
|
||||
joystickConnected(false),
|
||||
hapticEffectId(0)
|
||||
joystickConnected(false)
|
||||
{}
|
||||
|
||||
void EventThread::process(RGSSThreadData &rtData)
|
||||
|
@ -172,9 +168,7 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
SDL_DisplayMode dm = {0};
|
||||
|
||||
SDL_GetWindowSize(win, &winW, &winH);
|
||||
|
||||
SDL_Haptic *hap;
|
||||
memset(&hapticEffect, 0, sizeof(SDL_HapticEffect));
|
||||
|
||||
textInputBuffer.clear();
|
||||
|
||||
SettingsMenu *sMenu = 0;
|
||||
|
@ -387,25 +381,12 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
|
||||
js = SDL_JoystickOpen(0);
|
||||
joystickConnected = true;
|
||||
|
||||
hap = SDL_HapticOpenFromJoystick(js);
|
||||
Debug() << (hap ? "true" : "false");
|
||||
if (hap && (SDL_HapticQuery(hap) & SDL_HAPTIC_SINE))
|
||||
{
|
||||
hapt = hap;
|
||||
Debug() << "Haptic device initialized";
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug() << "No haptic support found";
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case SDL_JOYDEVICEREMOVED :
|
||||
resetInputStates();
|
||||
joystickConnected = false;
|
||||
hapt = 0;
|
||||
break;
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN :
|
||||
|
@ -500,25 +481,6 @@ void EventThread::process(RGSSThreadData &rtData)
|
|||
}
|
||||
|
||||
sMenu->raise();
|
||||
break;
|
||||
|
||||
case REQUEST_RUMBLE :
|
||||
if (!hapt) break;
|
||||
if (!hapticEffect.type)
|
||||
{
|
||||
hapticEffect.type = SDL_HAPTIC_SINE;
|
||||
hapticEffect.constant.attack_level = 0;
|
||||
hapticEffect.constant.fade_level = 0;
|
||||
hapticEffectId = SDL_HapticNewEffect(hapt, &hapticEffect);
|
||||
}
|
||||
if (hapticEffect.constant.length == 0 && SDL_HapticGetEffectStatus(hapt, hapticEffectId) > 0)
|
||||
{
|
||||
SDL_HapticStopEffect(hapt, hapticEffectId);
|
||||
break;
|
||||
}
|
||||
SDL_HapticUpdateEffect(hapt, hapticEffectId, &hapticEffect);
|
||||
|
||||
SDL_HapticRunEffect(hapt, hapticEffectId, 1);
|
||||
break;
|
||||
|
||||
case UPDATE_FPS :
|
||||
|
@ -732,19 +694,6 @@ void EventThread::requestSettingsMenu()
|
|||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::requestRumble(int duration, short strength, int attack, int fade)
|
||||
{
|
||||
SDL_Event event;
|
||||
event.type = usrIdStart + REQUEST_RUMBLE;
|
||||
|
||||
hapticEffect.constant.length = duration;
|
||||
hapticEffect.constant.level = strength;
|
||||
hapticEffect.constant.attack_length = attack;
|
||||
hapticEffect.constant.fade_length = fade;
|
||||
|
||||
SDL_PushEvent(&event);
|
||||
}
|
||||
|
||||
void EventThread::showMessageBox(const char *body, int flags)
|
||||
{
|
||||
msgBoxDone.clear();
|
||||
|
@ -781,11 +730,6 @@ SDL_Joystick *EventThread::joystick() const
|
|||
return (joystickConnected) ? js : 0;
|
||||
}
|
||||
|
||||
SDL_Haptic *EventThread::haptic() const
|
||||
{
|
||||
return hapt;
|
||||
}
|
||||
|
||||
void EventThread::notifyFrame()
|
||||
{
|
||||
if (!fps.sendUpdates)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <SDL_scancode.h>
|
||||
#include <SDL_joystick.h>
|
||||
#include <SDL_haptic.h>
|
||||
#include <SDL_mouse.h>
|
||||
#include <SDL_mutex.h>
|
||||
|
||||
|
@ -97,8 +96,6 @@ public:
|
|||
void requestTextInputMode(bool mode);
|
||||
|
||||
void requestSettingsMenu();
|
||||
|
||||
void requestRumble(int duration, short strength, int attack, int fade);
|
||||
|
||||
void requestTerminate();
|
||||
|
||||
|
@ -107,7 +104,6 @@ public:
|
|||
bool getJoystickConnected() const;
|
||||
|
||||
SDL_Joystick *joystick() const;
|
||||
SDL_Haptic *haptic() const;
|
||||
|
||||
void showMessageBox(const char *body, int flags = 0);
|
||||
|
||||
|
@ -130,9 +126,6 @@ private:
|
|||
bool showCursor;
|
||||
|
||||
SDL_Joystick *js;
|
||||
SDL_Haptic *hapt;
|
||||
SDL_HapticEffect hapticEffect;
|
||||
int hapticEffectId;
|
||||
|
||||
AtomicFlag msgBoxDone;
|
||||
|
||||
|
|
|
@ -1198,18 +1198,6 @@ int Input::getJoystickPowerLevel()
|
|||
SDL_JOYSTICK_POWER_UNKNOWN;
|
||||
}
|
||||
|
||||
void Input::rumble(int duration, int strength, int attack, int fade)
|
||||
{
|
||||
duration = clamp(duration, 0, 10000);
|
||||
strength = clamp(strength, 1, 100);
|
||||
attack = clamp(attack, 0, 10000);
|
||||
fade = clamp(fade, 0, 10000);
|
||||
shState->eThread().requestRumble(duration,
|
||||
(short)((double)strength / 100 * 32767),
|
||||
attack,
|
||||
fade);
|
||||
}
|
||||
|
||||
bool Input::getTextInputMode()
|
||||
{
|
||||
return (SDL_IsTextInputActive() == SDL_TRUE);
|
||||
|
|
|
@ -71,9 +71,7 @@ public:
|
|||
bool getJoystickConnected();
|
||||
const char *getJoystickName();
|
||||
int getJoystickPowerLevel();
|
||||
|
||||
void rumble(int duration, int strength, int attack, int fade);
|
||||
|
||||
|
||||
bool getTextInputMode();
|
||||
void setTextInputMode(bool mode);
|
||||
const char *getText();
|
||||
|
|
|
@ -171,7 +171,7 @@ int main(int argc, char *argv[]) {
|
|||
#endif
|
||||
|
||||
/* initialize SDL first */
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
|
||||
showInitError(std::string("Error initializing SDL: ") + SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue