diff options
| author | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-26 13:17:55 -0500 |
|---|---|---|
| committer | Jan Trencansky <jan.trencansky@protonmail.com> | 2026-11-26 13:17:55 -0500 |
| commit | bbf861fbb4ea51ca18cd6f372797111984b6f8aa (patch) | |
| tree | 81ac99a1a6d61841cca3562fab529cf38348c73f /runtime/test/gameinput_test.cpp | |
| parent | 4645a3f62a7655ce69b930da70bdc1a858d1d0a1 (diff) | |
| parent | bdbc7e9236465c5d6a1305de6edd3fc09c2d6fd9 (diff) | |
Merge main into fix/depth16-quantise-fallback
runtime/CMakeLists.txt: main added the heavy_pipeline_cache, pipeline_cache_journal and compile_helper tests where this branch adds depth24_fragment; both sides are kept.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/gameinput_test.cpp')
| -rw-r--r-- | runtime/test/gameinput_test.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/runtime/test/gameinput_test.cpp b/runtime/test/gameinput_test.cpp index b6658f51c..09d959f34 100644 --- a/runtime/test/gameinput_test.cpp +++ b/runtime/test/gameinput_test.cpp | |||
| @@ -1718,10 +1718,12 @@ int main(int argc, char** argv) { | |||
| 1718 | 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) { | 1719 | if (argc == 2 && std::strcmp(argv[1], "--input-script") == 0) { |
| 1720 | if (!input) return 1; | 1720 | if (!input) return 1; |
| 1721 | // Only the X after byte 63 is due now. Its later entry must not cancel it. | 1721 | // Only the X after byte 63 and the Y held 0.6 s are due now. X's later entry must not cancel it; the |
| 1722 | // malformed holds at the end hold nothing. | ||
| 1722 | set_env("LEONIDA_INPUT_SCRIPT", | 1723 | set_env("LEONIDA_INPUT_SCRIPT", |
| 1723 | "start@3600,start@3600,start@3600,start@3600,start@3600,start@3600, X@0 \t,x@3600," | 1724 | "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 | "unknown@0,a@,a@x,,a@-0.1,a@nan,a@inf,a@1e999,a@0tail, ,y@0:0.6," |
| 1726 | "a@0:0,a@0:-1,a@0:,a@0:x,a@0:inf,a@0:601,a@0:1tail"); | ||
| 1725 | set_env("LEONIDA_KEYBOARD_PAD", "1"); | 1727 | set_env("LEONIDA_KEYBOARD_PAD", "1"); |
| 1726 | rt::gameinput::set_keyboard_source(fake_key_down, fake_focus); | 1728 | rt::gameinput::set_keyboard_source(fake_key_down, fake_focus); |
| 1727 | rt::gameinput::set_cursor_source(fake_cursor); | 1729 | rt::gameinput::set_cursor_source(fake_cursor); |
| @@ -1730,20 +1732,32 @@ int main(int argc, char** argv) { | |||
| 1730 | rt::gameinput::reload_config(); | 1732 | rt::gameinput::reload_config(); |
| 1731 | rt::gameinput::poll(); | 1733 | rt::gameinput::poll(); |
| 1732 | const auto buttons = pad_state(input, nullptr).buttons; | 1734 | const auto buttons = pad_state(input, nullptr).buttons; |
| 1733 | const auto expected = GameInputGamepadX | GameInputGamepadB; | 1735 | const auto expected = GameInputGamepadX | GameInputGamepadB | GameInputGamepadY; |
| 1734 | check((buttons & expected) == expected, "long script: the spaced X after byte 63 and the physical B are held"); | 1736 | check((buttons & expected) == expected, |
| 1737 | "long script: the spaced X after byte 63, the held Y and the physical B are held"); | ||
| 1735 | check((buttons & ~expected) == 0, "malformed script entries hold no extra buttons"); | 1738 | check((buttons & ~expected) == 0, "malformed script entries hold no extra buttons"); |
| 1736 | g_focus = false; | 1739 | g_focus = false; |
| 1737 | set_env("LEONIDA_INPUT_SCRIPT", "y@0"); | 1740 | set_env("LEONIDA_INPUT_SCRIPT", "y@0"); |
| 1738 | rt::gameinput::reload_config(); | 1741 | rt::gameinput::reload_config(); |
| 1739 | rt::gameinput::poll(); | 1742 | rt::gameinput::poll(); |
| 1740 | check(pad_state(input, nullptr).buttons == GameInputGamepadX, | 1743 | check(pad_state(input, nullptr).buttons == (GameInputGamepadX | GameInputGamepadY), |
| 1741 | "scripted X survives focus loss; reload does not replace it with Y"); | 1744 | "scripted X and Y survive focus loss; reload does not replace the script with y@0"); |
| 1742 | Sleep(350); | 1745 | Sleep(350); |
| 1743 | g_focus = true; | 1746 | g_focus = true; |
| 1744 | rt::gameinput::poll(); | 1747 | rt::gameinput::poll(); |
| 1748 | // A scripted press lasts its hold (300 ms, or button@seconds:hold) and then until the title has read the pads | ||
| 1749 | // six times since it began (update_keyboard_pad: kReads), so a title that polls slowly still sees it. Each | ||
| 1750 | // pad_state() is one GetCurrentReading, and this is the third since X and Y began. | ||
| 1751 | check(pad_state(input, nullptr).buttons == (GameInputGamepadX | GameInputGamepadB | GameInputGamepadY), | ||
| 1752 | "long script: past its 300 ms X is still held while the title has read the pads fewer than six times"); | ||
| 1753 | for (int i = 0; i < 6; ++i) pad_state(input, nullptr); | ||
| 1754 | rt::gameinput::poll(); | ||
| 1755 | check(pad_state(input, nullptr).buttons == (GameInputGamepadB | GameInputGamepadY), | ||
| 1756 | "long script: X ends once the title has read it, y@0:0.6 is still held for its time, the key stays held"); | ||
| 1757 | Sleep(400); | ||
| 1758 | rt::gameinput::poll(); | ||
| 1745 | check(pad_state(input, nullptr).buttons == GameInputGamepadB, | 1759 | check(pad_state(input, nullptr).buttons == GameInputGamepadB, |
| 1746 | "long script: the timed press ends while the physical key stays held"); | 1760 | "long script: Y is released after its 0.6 s hold, the title having read it six times"); |
| 1747 | input->Release(); | 1761 | input->Release(); |
| 1748 | std::printf("%d checks, %d failures\n", g_checks, g_failures); | 1762 | std::printf("%d checks, %d failures\n", g_checks, g_failures); |
| 1749 | return g_failures ? 1 : 0; | 1763 | return g_failures ? 1 : 0; |