diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:09:14 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-24 20:09:14 -0500 |
| commit | 6fdeadfe509f37203317a967bf28e57fc75676b2 (patch) | |
| tree | c4d837eca0be726489f24e01fbbe14c6d5d420f4 /runtime/test/gameinput_test.cpp | |
| parent | f2268abeadb9c57f675c43805a622d5e43628739 (diff) | |
| parent | 1d89b20c5f26f1078b50fef7e2c9cd5fbe2372d6 (diff) | |
Merge main with #984 into RT-QUEUE31 (#968)
Merges the local m984-on-main (1d89b20c5f26f1078b50fef7e2c9cd5fbe2372d6), main with #984
merged, into #968's head f2268abea.
Conflicts and their resolutions:
- runtime/shims/xmem.h: both sides appended to the end of rt::xmem. Kept
geometry_aliases and transfer_physical from #984 and appended #968's
CopyPageMappingsFn typedef and the inline copy_page_mappings_fn after them.
- runtime/shims/xmem.cpp: copy_page_mappings and the self-registering
g_copy_page_mappings_set stay right after XMemMapPhysicalPagesScatter,
followed by #984's shadows_write_watch. One-line port: #984's g_mapped stores
the page number itself (HostUnorderedMap<uintptr_t, uint64_t>), so
`it->second.page` becomes `it->second`.
- runtime/shims/d3d12_xs_device.cpp:
- includes: #968's "xmem.h" beside "d3d12_trace.h", then #984's includes;
- constants: #984's block kept, kQueueCopyPageMappingsBatchX = 31 added after
kQueueExecuteCommandListsX and its static_assert;
- the slot-31 section (ConsolePageRange/Batch, copy_console_page_range,
queue_copy_page_mappings) goes after #984's queue_execute_command_lists and
before the "PresentX is at queue slot 30" comment;
- child_slot: #984's queue block kept; the slot-31 dispatch (beyond the PC
table and with xmem's hook set) goes just before the qroutes lookup, ahead
of the presentation routes and the console-only S_OK tail. Newer-layout
PresentX is 32, so 31 does not clash.
- runtime/test/xs_proxy_mock_test.cpp:
- includes: "../shims/xmem.h" beside #984's d3d12_xs_frame_events.h;
- #984's descriptor-heap and later checks kept, check_queue_copy_page_mappings
after them. Without xmem the merged proxy answers slot 31 with the
console-only S_OK, so that check's `== E_NOTIMPL` becomes `== S_OK` (and its
summary line says so);
- main: `|| check_queue_copy_page_mappings()` appended after
check_presentation_wiring().
runtime/test/xmem_test.cpp merged without conflict: test_copy_page_mappings runs
after test_physical_pages.
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, |