2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-14 13:26:09 +00:00

TexturedQuad fixes, Better controller input handling (needs custom mapping)

This commit is contained in:
2022-02-08 11:18:12 -08:00
parent 5add26b42e
commit acd861754c
14 changed files with 240 additions and 59 deletions

View File

@@ -2,7 +2,7 @@
#include "Runtime/CArchitectureMessage.hpp"
#include "Runtime/CArchitectureQueue.hpp"
#include "imgui/magic_enum.hpp"
namespace metaforce {
void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
@@ -14,7 +14,7 @@ void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
const CFinalInput& kbInput = getFinalInput(0, dt);
queue.Push(MakeMsg::CreateUserInput(EArchMsgTarget::Game, kbInput));
/* Dolphin controllers next */
/* Dolphin controllers next */
// for (int i = 0; i < 4; ++i) {
// bool connected;
// EStatusChange change = m_dolphinCb.getStatusChange(i, connected);
@@ -38,4 +38,40 @@ void CInputGenerator::Update(float dt, CArchitectureQueue& queue) {
// }
}
void CInputGenerator::controllerAxis(uint32_t which, aurora::ControllerAxis axis, int16_t value) noexcept {
s32 idx = aurora::get_controller_player_index(which);
if (idx < 0) {
return;
}
switch (axis) {
case aurora::ControllerAxis::LeftY:
case aurora::ControllerAxis::RightY:
/* Value is inverted compared to what we expect on the Y axis */
value = -value;
[[fallthrough]];
case aurora::ControllerAxis::LeftX:
case aurora::ControllerAxis::RightX:
value /= 256;
if (value < -127)
value = -127;
else if (value > 127)
value = 127;
break;
case aurora::ControllerAxis::TriggerLeft:
case aurora::ControllerAxis::TriggerRight:
printf("Axis before clamp %i", value);
value /= 128;
if (value < 0)
value = 0;
printf(" after clamp %i\n", value);
break;
default:
break;
}
m_state[idx].m_axes[size_t(axis)] = value;
}
} // namespace metaforce