diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:35:34 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 22:35:34 -0500 |
| commit | 6ed716a99a7416f1e8a60c2e38e128876ab752ec (patch) | |
| tree | 3c35526aa8b96594252c82c278ab19b9aa3a98ba /runtime/test/gameinput_test.cpp | |
| parent | 028a414fade7058a96e5933d1325f374a0026588 (diff) | |
| parent | bfef489cb6307fa4e1dc6ed2c40bfc0ce120d066 (diff) | |
Merge main into RT-QUEUE-SIGNAL (#430)
Everything below this rung (#414, #416, #427) and the rung's own routing are in
main already, through #984 and #939, in main's form; what is left of #430 is
its test of queue slot 17, ported onto main's layout detection.
Conflicts, all resolved to main's form:
- runtime/shims/d3d12_xs_device.cpp: main's queue slot 16/17 rule (a fence
there is the newer layout's Signal/Wait, for any caller) replaces the
rung's caller-gated rule; main's PresentX routing (slot 30, or 32 once the
newer layout is detected, LEONIDA_XS_PRESENT_X_SLOT) and lazily built
presenter replace the fixed slot 32 of #414; main's list proxy already
translates the CPU handles of console list slots 50 to 54 (#416) and
drops unordered access from a depth-stencil texture at slot 76 (#427).
- runtime/shims/d3d12_xs_device.h, runtime/shims/xbox_present.cpp,
runtime/shims/xbox_present.h, runtime/src/frame_pacer.h: main's shared
FrameTokenSource (Logan's piece of #414, as #984 carried it).
- runtime/shims/d3d12_xs_desc_clean.h, runtime/test/device_proxy_test.cpp:
main's without_depth_stencil_uav and its slot 25/76 test (#427).
- runtime/test/xs_proxy_mock_test.cpp: main's file, which already has
check_list_cpu_handles (#416's cases and more); the rung's slot 16/17 case
is ported to main's form at the end of check_xbox_queue_slots: slot 16 and
17 with a fence reach PC Signal and Wait with the real fence, not the PC
getters, and the fence proxy's vtable pointer is unchanged. The rung's
host-caller and no-fence expectations are dropped: under main's rule a
fence at 16 proves the newer layout, after which those calls answer S_OK.
Auto-merged, then set to main's content:
- runtime/test/queue_proxy_test.cpp: #414's call of queue slot 32 as an
overridden slot; on main slot 32 is routed only on the newer layout and the
sweep of the console tail already calls it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/gameinput_test.cpp')
| -rw-r--r-- | runtime/test/gameinput_test.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/runtime/test/gameinput_test.cpp b/runtime/test/gameinput_test.cpp index 93c48518b..b6658f51c 100644 --- a/runtime/test/gameinput_test.cpp +++ b/runtime/test/gameinput_test.cpp | |||
| @@ -1693,12 +1693,14 @@ void test_haptic_motors(IGameInput* input) { | |||
| 1693 | 1693 | ||
| 1694 | } // namespace | 1694 | } // namespace |
| 1695 | 1695 | ||
| 1696 | int main() { | 1696 | int main(int argc, char** argv) { |
| 1697 | // Only virtual pads: no real controller on the test machine may show up. | 1697 | // Only virtual pads: no real controller on the test machine may show up. |
| 1698 | for (const char* hint : {SDL_HINT_JOYSTICK_HIDAPI, SDL_HINT_JOYSTICK_RAWINPUT, SDL_HINT_JOYSTICK_WGI, | 1698 | for (const char* hint : {SDL_HINT_JOYSTICK_HIDAPI, SDL_HINT_JOYSTICK_RAWINPUT, SDL_HINT_JOYSTICK_WGI, |
| 1699 | SDL_HINT_JOYSTICK_GAMEINPUT, SDL_HINT_XINPUT_ENABLED, SDL_HINT_JOYSTICK_DIRECTINPUT}) | 1699 | SDL_HINT_JOYSTICK_GAMEINPUT, SDL_HINT_XINPUT_ENABLED, SDL_HINT_JOYSTICK_DIRECTINPUT}) |
| 1700 | SDL_SetHintWithPriority(hint, "0", SDL_HINT_OVERRIDE); | 1700 | SDL_SetHintWithPriority(hint, "0", SDL_HINT_OVERRIDE); |
| 1701 | set_env("LEONIDA_GAMEINPUT_THREAD", "0"); | 1701 | set_env("LEONIDA_GAMEINPUT_THREAD", "0"); |
| 1702 | set_env("LEONIDA_KEYBOARD_PAD", nullptr); | ||
| 1703 | set_env("LEONIDA_INPUT_SCRIPT", nullptr); | ||
| 1702 | set_env("LEONIDA_DS_TRIGGERS", nullptr); | 1704 | set_env("LEONIDA_DS_TRIGGERS", nullptr); |
| 1703 | set_env("LEONIDA_DS_LIGHTBAR", nullptr); | 1705 | set_env("LEONIDA_DS_LIGHTBAR", nullptr); |
| 1704 | set_env("LEONIDA_RUMBLE", nullptr); | 1706 | set_env("LEONIDA_RUMBLE", nullptr); |
| @@ -1714,6 +1716,38 @@ int main() { | |||
| 1714 | 1716 | ||
| 1715 | IGameInput* input = nullptr; | 1717 | IGameInput* input = nullptr; |
| 1716 | check(create(&input) == S_OK && input, "GameInputCreate returns an instance"); | 1718 | check(create(&input) == S_OK && input, "GameInputCreate returns an instance"); |
| 1719 | if (argc == 2 && std::strcmp(argv[1], "--input-script") == 0) { | ||
| 1720 | if (!input) return 1; | ||
| 1721 | // Only the X after byte 63 is due now. Its later entry must not cancel it. | ||
| 1722 | set_env("LEONIDA_INPUT_SCRIPT", | ||
| 1723 | "start@3600,start@3600,start@3600,start@3600,start@3600,start@3600, X@0 \t,x@3600," | ||
| 1724 | "unknown@0,a@,a@x,,a@-0.1,a@nan,a@inf,a@1e999,a@0tail, ,"); | ||
| 1725 | set_env("LEONIDA_KEYBOARD_PAD", "1"); | ||
| 1726 | rt::gameinput::set_keyboard_source(fake_key_down, fake_focus); | ||
| 1727 | rt::gameinput::set_cursor_source(fake_cursor); | ||
| 1728 | g_focus = true; | ||
| 1729 | g_keys[VK_BACK] = true; | ||
| 1730 | rt::gameinput::reload_config(); | ||
| 1731 | rt::gameinput::poll(); | ||
| 1732 | const auto buttons = pad_state(input, nullptr).buttons; | ||
| 1733 | const auto expected = GameInputGamepadX | GameInputGamepadB; | ||
| 1734 | check((buttons & expected) == expected, "long script: the spaced X after byte 63 and the physical B are held"); | ||
| 1735 | check((buttons & ~expected) == 0, "malformed script entries hold no extra buttons"); | ||
| 1736 | g_focus = false; | ||
| 1737 | set_env("LEONIDA_INPUT_SCRIPT", "y@0"); | ||
| 1738 | rt::gameinput::reload_config(); | ||
| 1739 | rt::gameinput::poll(); | ||
| 1740 | check(pad_state(input, nullptr).buttons == GameInputGamepadX, | ||
| 1741 | "scripted X survives focus loss; reload does not replace it with Y"); | ||
| 1742 | Sleep(350); | ||
| 1743 | g_focus = true; | ||
| 1744 | rt::gameinput::poll(); | ||
| 1745 | check(pad_state(input, nullptr).buttons == GameInputGamepadB, | ||
| 1746 | "long script: the timed press ends while the physical key stays held"); | ||
| 1747 | input->Release(); | ||
| 1748 | std::printf("%d checks, %d failures\n", g_checks, g_failures); | ||
| 1749 | return g_failures ? 1 : 0; | ||
| 1750 | } | ||
| 1717 | check(create(nullptr) == E_POINTER, "GameInputCreate(nullptr) is E_POINTER"); | 1751 | check(create(nullptr) == E_POINTER, "GameInputCreate(nullptr) is E_POINTER"); |
| 1718 | IUnknown* unk = nullptr; | 1752 | IUnknown* unk = nullptr; |
| 1719 | check(input->QueryInterface(IID_IGameInput, reinterpret_cast<void**>(&unk)) == S_OK && unk == input, | 1753 | check(input->QueryInterface(IID_IGameInput, reinterpret_cast<void**>(&unk)) == S_OK && unk == input, |