mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-19 16:20:01 -04:00
Triforce v0.3.4
The slowdown in fights and the controller whose buttons stopped arriving are fixed; the checks' file names; groundwork for Linux. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -236,14 +236,14 @@ static int latest_tag(char *tag, size_t cap) {
|
||||
"https://github.com/ruckus7382sfgsgdf/CBeta0.2/releases/latest/download/triforce-linux.txt 2>/dev/null", tag, cap);
|
||||
}
|
||||
|
||||
/* the builder an update installed (builder/linux/linux_update.py): <data>/hookshot/builder/versions/<current>/AppRun. The
|
||||
/* the builder an update installed (builder/linux/linux_update.py): <data>/triforce/builder/versions/<current>/AppRun. The
|
||||
builder= line names the AppImage that built the folder, which the player may have deleted since */
|
||||
static int installed_builder(char *out, size_t cap) {
|
||||
const char *home = getenv("HOOKSHOT_BUILDER_HOME"), *data = getenv("XDG_DATA_HOME"), *user = getenv("HOME");
|
||||
char root[MAX_PATH * 2], path[MAX_PATH * 2 + 64], tag[128];
|
||||
if (home && *home) snprintf(root, sizeof root, "%s/hookshot/builder", home);
|
||||
else if (data && *data) snprintf(root, sizeof root, "%s/hookshot/builder", data);
|
||||
else if (user && *user) snprintf(root, sizeof root, "%s/.local/share/hookshot/builder", user);
|
||||
if (home && *home) snprintf(root, sizeof root, "%s/triforce/builder", home);
|
||||
else if (data && *data) snprintf(root, sizeof root, "%s/triforce/builder", data);
|
||||
else if (user && *user) snprintf(root, sizeof root, "%s/.local/share/triforce/builder", user);
|
||||
else return 0;
|
||||
snprintf(path, sizeof path, "%s/current", root);
|
||||
FILE *f = fopen(path, "rb");
|
||||
|
||||
@@ -692,6 +692,37 @@ static void pads_read(uint64_t *buttons, int32_t stick[4]) {
|
||||
if (rx_option(17, 0)) v[3] = -v[3];
|
||||
stick_max(s, v);
|
||||
}
|
||||
} else if (xinput_get) {
|
||||
/* (Triforce, 11-12) SDL has the pads: XInput is only looked at, ten times a second, for the pads it had before
|
||||
SDL opened its own. A pad whose buttons XInput shows down while SDL shows none, 20 looks with no look between
|
||||
where SDL showed one: SDL's button input is not arriving (pad_sdl.c's SDL_JOYSTICK_THREAD), said once */
|
||||
static int64_t next_look;
|
||||
static int silent, said;
|
||||
if (!said && now >= next_look) {
|
||||
next_look = now + 100000000LL;
|
||||
const uint64_t triggers = 1ULL << HOS_PAD_LTRIGGER | 1ULL << HOS_PAD_RTRIGGER;
|
||||
for (int p = 0; p < XUSER_MAX_COUNT; p++) {
|
||||
if (!was_connected[p]) continue;
|
||||
XINPUT_STATE xs;
|
||||
if (xinput_get((DWORD)p, &xs) != ERROR_SUCCESS) {
|
||||
hos_log("hid: controller %d disconnected", p);
|
||||
was_connected[p] = 0;
|
||||
continue;
|
||||
}
|
||||
if (!xs.Gamepad.wButtons) continue;
|
||||
if (raw & ~triggers) {
|
||||
silent = 0;
|
||||
continue;
|
||||
}
|
||||
if (++silent >= 20) {
|
||||
said = 1;
|
||||
hos_log("hid: XInput shows controller %d's buttons down and SDL shows none, 20 times running: SDL's "
|
||||
"button and stick input is not arriving (HOS_NO_SDL=1 in triforce_env.txt reads the "
|
||||
"controllers through XInput alone)", p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
InterlockedExchange(&pad_raw_now, (LONG)raw);
|
||||
/* Back and Start together open the Insert menu (gpu/vk/vk_menu.cpp, for pads whose Home button the system
|
||||
|
||||
@@ -85,6 +85,17 @@ static int32_t stick_value(int16_t v, int flip, int zone) {
|
||||
static int pads_start(void) {
|
||||
/* poll in the background, whatever window is in front (nn_hid.c decides when input counts) */
|
||||
hos_sdl_hint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1");
|
||||
#ifdef _WIN32
|
||||
/* (Triforce, 11-12) SDL's own thread for its controller window's messages. On Windows SDL reads an Xbox pad through
|
||||
raw input: the buttons and sticks arrive as WM_INPUT messages to a window SDL makes on the thread that starts its
|
||||
controllers, and only the triggers and Guide come from XInput. SDL handles those messages in its video event loop,
|
||||
or on a thread of its own with this hint; this thread has neither a window loop nor SDL's video, so the messages
|
||||
were never handled: once SDL had opened the pad only the triggers worked, until the game was started again with
|
||||
the pad turned on later (SDL never saw that pad, its arrival being such a message too, and XInput read it). A
|
||||
player's Xbox Series X pad on the Xbox Wireless Adapter, SDL 2.32.10, the same calls in a probe: XInput 694 state
|
||||
changes in 8 s of pressing, SDL 0 button or stick changes with the triggers moving; with the hint 579 for 700. */
|
||||
hos_sdl_hint("SDL_JOYSTICK_THREAD", "1");
|
||||
#endif
|
||||
/* (SDL2: PlayStation pads' rumble asked for; SDL3 turns it on when a rumble is first sent) */
|
||||
hos_sdl_hint("SDL_JOYSTICK_HIDAPI_PS5_RUMBLE", "1");
|
||||
hos_sdl_hint("SDL_JOYSTICK_HIDAPI_PS4_RUMBLE", "1");
|
||||
|
||||
Reference in New Issue
Block a user