Skip to content

Commit

Permalink
fix gamepad axis not hitting zero on 3ds
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtleP committed Jul 21, 2024
1 parent 40ff82f commit 6163a4b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions platform/ctr/source/driver/EventQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ namespace love
float value = joystick->getAxis(Joystick::GamepadAxis(input));
this->sendGamepadAxisEvent(0, input, value);
}

Joystick::HidAxisType value;
Joystick::getConstant(Joystick::GamepadAxis(input), value);

if (hidKeysUp() & value)
this->sendGamepadAxisEvent(0, input, 0.0f);
}

for (int input = 0; input < Sensor::SENSOR_MAX_ENUM; input++)
Expand Down
2 changes: 1 addition & 1 deletion source/modules/audio/Source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ namespace love

if (decoded > 0)
{
DigitalSound::getInstance().setLooping(buffer, this->looping);
// DigitalSound::getInstance().setLooping(buffer, this->looping);

const int samples = int((decoded / this->channels) / (this->bitDepth / 8));
DigitalSound::getInstance().prepare(buffer, decoder->getBuffer(), decoded, samples);
Expand Down
17 changes: 17 additions & 0 deletions source/modules/love/love.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ static int love_atpanic(lua_State* L)
return 0;
}

static void love_atcpanic()
{
try
{
throw;
}
catch (const std::exception& e)
{
std::printf("Uncaught exception: %s", e.what());
std::exit(EXIT_FAILURE);
}
}

static void luax_addcompatibilityalias(lua_State* L, const char* module, const char* name, const char* alias)
{
lua_getglobal(L, module);
Expand Down Expand Up @@ -247,6 +260,10 @@ int love_initialize(lua_State* L)

lua_atpanic(L, love_atpanic);

#if __DEBUG__
std::set_terminate(love_atcpanic);
#endif

return 1;
}

Expand Down

0 comments on commit 6163a4b

Please sign in to comment.