Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit 125bfdd

Browse files
authored
Merge main into sdl_input
* fix Y axis overflow * adhere to mupen plugin naming convention
1 parent d708eff commit 125bfdd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/JoystickControl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ BOOL JoystickControl::get_position(HWND hwnd, int* x, int* y)
327327
}
328328
if (y)
329329
{
330-
*y = (int)std::round(remap(ctx->y, 1.0, -1.0, -127, 128));
330+
*y = (int)std::round(remap(ctx->y, 1.0, -1.0, -128, 127));
331331
}
332332

333333
return TRUE;
@@ -338,7 +338,7 @@ BOOL JoystickControl::set_position(HWND hwnd, int x, int y)
338338
WITH_VALID_CTX()
339339

340340
ctx->x = remap(x, -128, 127, -1.0, 1.0);
341-
ctx->y = -remap(y, -127, 128, -1.0, 1.0);
341+
ctx->y = -remap(y, -128, 127, -1.0, 1.0);
342342

343343
RedrawWindow(hwnd, nullptr, nullptr, RDW_INVALIDATE);
344344
SendMessage(GetParent(hwnd), WM_JOYSTICK_POSITION_CHANGED, 1, 0);

src/Main.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ extern core_plugin_extended_funcs* g_ef;
1414
#ifdef _M_X64
1515
#define PLUGIN_ARCH L" x64"
1616
#else
17-
#define PLUGIN_ARCH L" x86"
17+
#define PLUGIN_ARCH L" "
1818
#endif
1919

2020
#ifdef _DEBUG
2121
#define PLUGIN_TARGET L" Debug"
2222
#else
23-
#define PLUGIN_TARGET L" Release"
23+
#define PLUGIN_TARGET L" "
2424
#endif
2525

2626
#define PLUGIN_NAME L"TASInput " PLUGIN_VERSION PLUGIN_ARCH PLUGIN_TARGET

src/TASInput.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -575,9 +575,9 @@ INT_PTR CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
575575
int x{}, y{};
576576
JoystickControl::get_position(ctx->joy_hwnd, &x, &y);
577577

578-
ctx->current_input.x = x;
579-
ctx->current_input.y = y;
580-
578+
ctx->current_input.x = (int8_t)x;
579+
ctx->current_input.y = (int8_t)y;
580+
581581
if (!wparam)
582582
{
583583
ctx->set_visuals(ctx->current_input);
@@ -878,7 +878,7 @@ INT_PTR CALLBACK wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
878878
case IDC_Y_UP:
879879
{
880880
int increment = get_joystick_increment(LOWORD(wparam) == IDC_Y_UP);
881-
ctx->current_input.y = wrapping_clamp(ctx->current_input.y + increment, -127, 128);
881+
ctx->current_input.y = wrapping_clamp(ctx->current_input.y + increment, -128, 127);
882882
ctx->set_visuals(ctx->current_input);
883883
}
884884
break;

0 commit comments

Comments
 (0)