upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/gameinput.cpp
diff options
context:
space:
mode:
authorJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 19:38:04 -0500
committerJan Trencansky <jan.trencansky@protonmail.com>2026-11-24 19:38:04 -0500
commit39879ce0fdcaea23ce3919c1e845dd360b17b0f8 (patch)
tree894ddf50be120cdfbd80b28e895876c518cc2199 /runtime/shims/gameinput.cpp
parent273b3bdf9d6e736442ad584ad464df6e86ee928b (diff)
parent1154976d49acca28ad436b90861e9f9aea28eba9 (diff)
Merge main into RT-PROTON-STORY-LOAD (#984)
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted; this commit is the resolution only. Build and test repairs follow in their own commits. Rule of resolution: where both sides added different things, both stay; where both made the same change in two forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two changed the same code for different purposes, both purposes are kept. Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h, d3d12_xs_desc_clean.h, registry.cpp): - d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and list slot 139 (#396). - Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider pc_resource_desc, S_OK for queue slots past the PC table. - Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base list proxy, its null-view slot 70 and its refusing slot 133. Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp): - Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra cases added; main's --env-slots-74 and #984's --env-slots-70. - Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy, the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases. D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h, frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp, d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp, vk_pipeline_check.cpp, vk_test_device.h): - Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's origin, so both pools run on disjoint sets of textures. - frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter. - main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4 stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980). - shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it. - Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it. Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp, runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp): - ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file. - gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries. - Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped. Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1, make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py, runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md, runtime/README.md): - Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake. - rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped. - shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags. - shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants. One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/gameinput.cpp')
-rw-r--r--runtime/shims/gameinput.cpp43
1 files changed, 28 insertions, 15 deletions
diff --git a/runtime/shims/gameinput.cpp b/runtime/shims/gameinput.cpp
index 4dd0e34a6..db685e71f 100644
--- a/runtime/shims/gameinput.cpp
+++ b/runtime/shims/gameinput.cpp
@@ -47,6 +47,7 @@
47#include <mutex> 47#include <mutex>
48#include <string> 48#include <string>
49#include <thread> 49#include <thread>
50#include <utility>
50#include <vector> 51#include <vector>
51 52
52#include "gameinput.h" 53#include "gameinput.h"
@@ -1865,8 +1866,8 @@ void update_keyboard_pad() {
1865 bool down[SDL_GAMEPAD_BUTTON_COUNT] = {}; 1866 bool down[SDL_GAMEPAD_BUTTON_COUNT] = {};
1866 int lx = 0, ly = 0; 1867 int lx = 0, ly = 0;
1867 bool aim = false, fire = false; 1868 bool aim = false, fire = false;
1868 // Out of focus every button, stick and trigger is released, so a key held while switching windows does not stay 1869 // Focus gates physical keyboard and mouse input. Read the cursor afresh on return to avoid a jump.
1869 // pressed, and the cursor is read afresh on return, so moving it in another window does not swing the stick. 1870 // Scripted presses still run while the window is unfocused.
1870 const bool active = mode == rt::gameinput::KeyboardPadMode::Always || g_has_focus.load()(); 1871 const bool active = mode == rt::gameinput::KeyboardPadMode::Always || g_has_focus.load()();
1871 if (active) { 1872 if (active) {
1872 const rt::gameinput::KeyDownFn key_down = g_key_down.load(); 1873 const rt::gameinput::KeyDownFn key_down = g_key_down.load();
@@ -1914,23 +1915,35 @@ void update_keyboard_pad() {
1914 {"up", SDL_GAMEPAD_BUTTON_DPAD_UP}, {"down", SDL_GAMEPAD_BUTTON_DPAD_DOWN}, 1915 {"up", SDL_GAMEPAD_BUTTON_DPAD_UP}, {"down", SDL_GAMEPAD_BUTTON_DPAD_DOWN},
1915 {"left", SDL_GAMEPAD_BUTTON_DPAD_LEFT}, {"right", SDL_GAMEPAD_BUTTON_DPAD_RIGHT}}; 1916 {"left", SDL_GAMEPAD_BUTTON_DPAD_LEFT}, {"right", SDL_GAMEPAD_BUTTON_DPAD_RIGHT}};
1916 const std::string text = env("LEONIDA_INPUT_SCRIPT"); 1917 const std::string text = env("LEONIDA_INPUT_SCRIPT");
1917 for (size_t at = 0; at < text.size();) { 1918 if (text.empty()) return out;
1918 const size_t end = std::min(text.find(',', at), text.size()); 1919 constexpr char whitespace[] = " \t\r\n\f\v";
1920 size_t items = 0;
1921 for (size_t at = 0, end; at <= text.size(); at = end + 1) {
1922 ++items;
1923 end = std::min(text.find(',', at), text.size());
1919 const std::string item = text.substr(at, end - at); 1924 const std::string item = text.substr(at, end - at);
1925 const size_t first = item.find_first_not_of(whitespace);
1920 const size_t sep = item.find('@'); 1926 const size_t sep = item.find('@');
1921 if (sep != std::string::npos) { 1927 if (sep == std::string::npos || first >= sep) continue;
1922 const double when = std::atof(item.c_str() + sep + 1); 1928 const char* time = item.c_str() + sep + 1;
1923 const auto name = item.substr(0, sep); 1929 char* tail;
1924 if (name == "rsup" || name == "rsdown") 1930 const double seconds = std::strtod(time, &tail);
1925 out.push_back({SDL_GAMEPAD_BUTTON_INVALID, when, name == "rsup" ? -kStickFull : kStickFull}); 1931 if (tail == time || !std::isfinite(seconds) || seconds < 0 ||
1926 else 1932 item.find_first_not_of(whitespace, tail - item.c_str()) != std::string::npos) continue;
1927 for (const auto& n : names) 1933 if (item.compare(first, sep - first, "rsup") == 0 || item.compare(first, sep - first, "rsdown") == 0) {
1928 if (name == n.first) out.push_back({n.second, when}); 1934 const bool up = item.compare(first, sep - first, "rsup") == 0;
1935 out.push_back({SDL_GAMEPAD_BUTTON_INVALID, seconds, up ? -kStickFull : kStickFull});
1936 continue;
1937 }
1938 for (const auto& [name, button] : names) {
1939 if (item.compare(first, sep - first, name) == 0) {
1940 out.push_back({button, seconds});
1941 break;
1942 }
1929 } 1943 }
1930 at = end + 1;
1931 } 1944 }
1932 if (!out.empty()) 1945 std::fprintf(stderr, "[rt] gameinput: LEONIDA_INPUT_SCRIPT: %zu scripted press(es), %zu rejected\n",
1933 std::fprintf(stderr, "[rt] gameinput: LEONIDA_INPUT_SCRIPT: %zu scripted press(es)\n", out.size()); 1946 out.size(), items - out.size());
1934 return out; 1947 return out;
1935 }(); 1948 }();
1936 if (!script.empty()) { 1949 if (!script.empty()) {