mirror of
https://git.triforceproject.com/triforce/source
synced 2026-12-01 05:18:50 -04:00
Triforce v0.9.0
Character tab, faster renderer defaults, HD rumble shipped, and the 11-30 bug pass: ending softlock below 60 fps, adult first-night lock, Intel Arc robust buffers, adult map, randomizer load order.
This commit is contained in:
100
host/hos_main.c
100
host/hos_main.c
@@ -883,6 +883,7 @@ static const unsigned char oot_item_kinds[] = {OOT_CHEAT_ITEMS(OOT_NO_SECTION, O
|
||||
static int oot_gamedata_bool(Ctx *c, uint32_t hash, int *value);
|
||||
static int oot_gamedata_string(Ctx *c, uint32_t hash, char *buf, size_t size);
|
||||
static int oot_first_night_fix(Ctx *c, const char *map); /* (below, after the tools it uses) */
|
||||
static int oot_adult_map_fix(Ctx *c, const char *map); /* (below too) */
|
||||
|
||||
static void oot_inventory_refresh(Ctx *c, int64_t now) {
|
||||
void rx_option_set(int id, int value);
|
||||
@@ -891,9 +892,10 @@ static void oot_inventory_refresh(Ctx *c, int64_t now) {
|
||||
next = now + 500000000LL;
|
||||
/* (a save is loaded once the pouch answers: before that GameData holds a new game's values, shown as unknown) */
|
||||
const int loaded = oot_pouch_count(c, oot_item_names[0]) >= 0;
|
||||
{ /* (the map Link is in, Sequence_CurrentBanc: the first night's time lock is Hyrule Field's alone) */
|
||||
{ /* (the map Link is in, Sequence_CurrentBanc: the first night's time lock is repaired by it) */
|
||||
char map[80] = "";
|
||||
if (loaded && oot_gamedata_string(c, 0x1d6189dau, map, sizeof map) && map[0]) oot_first_night_fix(c, map);
|
||||
if (loaded && oot_gamedata_string(c, 0x1d6189dau, map, sizeof map) && map[0])
|
||||
oot_first_night_fix(c, map), oot_adult_map_fix(c, map); /* ((Triforce, 11-30) and the adult's maps, #1576602300313506086) */
|
||||
/* ((Triforce) the map and Link's age, logged when either changes: the window after a crash says "while you were
|
||||
playing" from these lines (host/hos_crash_dialog.h), and a log's reader sees where a problem happened */
|
||||
static char logged[100];
|
||||
@@ -1286,28 +1288,6 @@ static int oot_gamedata_set_bool(Ctx *c, uint32_t hash, int value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The first adult night's time lock: f_8347c020 holds the clock at 20:00 while the saved Bool
|
||||
HrlField_isFirstNightTime_Adult (0x8592aa82) is 1 and quest 0x4dbca27f is not Ready. The flag belongs to Hyrule
|
||||
Field's first night only. A save in any other map that still holds it cannot leave night (the Sun's Song and the Debug
|
||||
tab's time are overwritten, the clock snaps back): clear it there with the game's own Bool, once, and say so, never
|
||||
while an event (the escape's cutscene) is running. HOS_OOT_FIRST_NIGHT_FIX=0 turns the repair off for a run. Returns 1
|
||||
when it cleared the flag. Asked by oot_inventory_refresh, twice a second while a save is loaded. */
|
||||
static int oot_first_night_fix(Ctx *c, const char *map) {
|
||||
static int on = -1;
|
||||
if (on < 0) {
|
||||
const char *e = getenv("HOS_OOT_FIRST_NIGHT_FIX");
|
||||
on = !(e && *e && atoi(e) == 0);
|
||||
}
|
||||
if (!on || !map[0] || !strncmp(map, "HyruleField", 11)) return 0;
|
||||
const uint64_t events = oot_singleton(c, OOT_EVENTMGR_SLOT);
|
||||
if (events && recomp_load64(c, events + 104)) return 0; /* (the Main sequence's "Event" test: an event is playing) */
|
||||
int set = 0;
|
||||
if (!oot_gamedata_bool(c, 0x8592aa82u, &set) || !set) return 0;
|
||||
if (!oot_gamedata_set_bool(c, 0x8592aa82u, 0)) return 0;
|
||||
hos_log("oot: cleared the first adult night's time lock (the save was in %s, outside Hyrule Field)", map);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---- (Triforce, 11-13) The inventory in GameData ----
|
||||
The items are GameData: struct "Pouch" (0x3da094e3) has a struct for each item, whose member "Stock" (0x22344481) is an
|
||||
Int, the item's count; struct 0xade0ef78 has a Bool for each item, "got it once". The names' hashes are MurmurHash3
|
||||
@@ -1393,6 +1373,78 @@ static int oot_gd_set(Ctx *c, uint64_t mgr, uint32_t hash, uint32_t value, int i
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The first adult night's time lock. f_8347c020, which the clock's update f_803edf70 asks twice a frame, holds the clock
|
||||
(zeroes its step and puts it back at the hour, before a time request is taken: the Sun's Song's 06:00 lasts one frame) while
|
||||
quest Meet_DekuTree (0x4dbca27f) is past its step Ready, the game's first quest, so from the opening on, and either the Bool
|
||||
HyruleField_ArriveEntrance (0x804aec99) is 0, at 06:00 (the child's morning until Goto_HyruleCastle sets it), or
|
||||
HrlField_HasEnteredFirstTime_Adult (0x8592aa82) is 1, at 20:00 (f_8347c450's hours at 0x83ca34e8). ((Triforce, 11-30)
|
||||
0x8592aa82 is HrlField_HasEnteredFirstTime_Adult by its MurmurHash3; this said HrlField_isFirstNightTime_Adult, which is
|
||||
0xf1024b60 and no hold reads.) Two event flows in the whole romfs name it: the first time Link becomes an adult Sheik's
|
||||
cutscene sets it (Dm_TimeTemple_0055, its Event252), and the adult Market's gate into Hyrule Field, whose arrival is
|
||||
Dm_SY_BancChangeArrive's entry Dm_SY_BancChangeArrive_HyruleField_02 (Banc/Market/Market_Adult_Static), clears it as its
|
||||
first event (Event257, Event434). So the night is the adult Temple of Time's and Market's until Link first walks out of
|
||||
the gate, and that is left to the game. What the game never clears is repaired here, once no event plays, through the
|
||||
game's own Bool setter (oot_gd_set: the live value and the save's copy; the live byte alone, as this wrote it before,
|
||||
came back as 1 at the next load, and the gate's clear saw 0 and skipped):
|
||||
- a child holding it (became an adult and went back before the gate: no child's way out clears it, #1064), anywhere;
|
||||
- an adult holding it in Hyrule Field's map (HyruleField_Adult, with Lon Lon Ranch and Lake Hylia): out without the
|
||||
gate's arrival, or a save the earlier live-only clear left with 1 saved, which is held at 20:00 for good there.
|
||||
An adult in any other map (the Market and Temple of Time: the first night itself) keeps it. HOS_OOT_FIRST_NIGHT_FIX=0
|
||||
turns the repair off for a run. Returns 1 when it cleared the flag. Asked by oot_inventory_refresh, twice a second while
|
||||
a save is loaded. */
|
||||
static int oot_first_night_fix(Ctx *c, const char *map) {
|
||||
static int on = -1;
|
||||
if (on < 0) {
|
||||
const char *e = getenv("HOS_OOT_FIRST_NIGHT_FIX");
|
||||
on = !(e && *e && atoi(e) == 0);
|
||||
}
|
||||
if (!on || !map[0]) return 0;
|
||||
const uint64_t events = oot_singleton(c, OOT_EVENTMGR_SLOT);
|
||||
if (events && recomp_load64(c, events + 104)) return 0; /* (the Main sequence's "Event" test: an event is playing) */
|
||||
int set = 0, child = 0;
|
||||
if (!oot_gamedata_bool(c, 0x8592aa82u, &set) || !set) return 0;
|
||||
if (!oot_gamedata_bool(c, 0xcea220d3u, &child)) return 0; /* (Sequence_IsChildhood) */
|
||||
const int field = !strncmp(map, "HyruleField", 11);
|
||||
if (!child && !field) return 0; /* (the adult Market and Temple of Time: the game's first night, its gate clears it) */
|
||||
if (!oot_gd_set(c, oot_singleton(c, OOT_GAMEDATA_SLOT), 0x8592aa82u, 0, 1)) return 0;
|
||||
hos_log("oot: cleared the first adult night's time lock (HrlField_HasEnteredFirstTime_Adult) for %s in %s, where "
|
||||
"the game's own clear at the Market's gate cannot come", child ? "a child" : "an adult", map);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ((Triforce, 11-30) #1576602300313506086) The adult's maps. Both of them ask the same thing of an adult: the pause menu's
|
||||
Map page (f_80b47d70, from UIMapMenuScreen f_834012c0; "Unavailable right now.", MapMessage_01, when it answers no) and
|
||||
the HUD's minimap (f_805a2cf0) say yes for the child (the player's PlayerGameParam IsChild, kept at +0x5c0 of the player's
|
||||
info) and, for the adult, only once HavePlayedEvent.Dm_TimeTemple_0065 (Bool 0xc1b29b0a, saved; struct HavePlayedEvent
|
||||
0x2b05cbb9, member 0xc367dcdc) is 1. Dm_TimeTemple_0065 is the adult's first step out of the Temple of Time into the
|
||||
ruined Market (Navi, the Market's name): Market_Adult_Static places a 2 x 2.5 x 3 m Area at the temple's door, there while
|
||||
the flag is 0, and Market_Adult_Prefab_50e3's logic asks for the event when Link is in it (and challenge AllSage is at its
|
||||
step Step01). Nothing else in the romfs plays it or sets the flag. An adult who leaves the temple any other way (a teleport
|
||||
or the age switch of the Debug tab, the no-clip flight) never has it: no map page and no minimap as an adult, in every
|
||||
area, for good, and a save made from then on keeps it. Repaired here once no event plays, through the game's own Bool
|
||||
setter (oot_gd_set: the live value and the save's copy), for an adult in any map but the Market (the Temple of Time is in
|
||||
it: the game's own first walk out, still to come), the Chamber of Sages (where the first adult wakes) and the dream world
|
||||
(Sequence_IsInDreamWorld hides the maps there by itself). HOS_OOT_ADULT_MAP_FIX=0 turns it off for a run. Returns 1 when
|
||||
it set the flag. Asked by oot_inventory_refresh, twice a second while a save is loaded. */
|
||||
static int oot_adult_map_fix(Ctx *c, const char *map) {
|
||||
static int on = -1;
|
||||
if (on < 0) {
|
||||
const char *e = getenv("HOS_OOT_ADULT_MAP_FIX");
|
||||
on = !(e && *e && atoi(e) == 0);
|
||||
}
|
||||
if (!on || !map[0]) return 0;
|
||||
if (!strncmp(map, "Market", 6) || !strncmp(map, "SageRoom", 8) || !strncmp(map, "DreamWorld", 10)) return 0;
|
||||
const uint64_t events = oot_singleton(c, OOT_EVENTMGR_SLOT);
|
||||
if (events && recomp_load64(c, events + 104)) return 0; /* (the Main sequence's "Event" test: an event is playing) */
|
||||
int child = 1, played = 1;
|
||||
if (!oot_gamedata_bool(c, 0xcea220d3u, &child) || child) return 0; /* (Sequence_IsChildhood) */
|
||||
if (!oot_gamedata_bool(c, 0xc1b29b0au, &played) || played) return 0; /* HavePlayedEvent.Dm_TimeTemple_0065 */
|
||||
if (!oot_gd_set(c, oot_singleton(c, OOT_GAMEDATA_SLOT), 0xc1b29b0au, 1, 1)) return 0;
|
||||
hos_log("oot: the adult's map and minimap: set HavePlayedEvent.Dm_TimeTemple_0065 in %s (the first walk out of the Temple "
|
||||
"of Time, which opens them, was never made)", map);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* A map-hiding area sets the saved flag MapIconDeactivateByAreaActor while Link is in it and shows the minimap again as he
|
||||
walks out. The teleport's map change takes him out without that: the flag stayed set, and no area had a minimap from then
|
||||
on, in that save and every one made from it. oot_teleport clears it once its request is taken; the map he arrives in sets it
|
||||
|
||||
@@ -79,9 +79,18 @@ static void mouse_sens_save(void) {
|
||||
/* The Insert menu keeps the sensitivity (its Mouse sensitivity row, option 7, in percent), read with each read; - and =
|
||||
change it there. HOS_MOUSE_SENS still wins, and then - and = keep it in <user>/mouse_sens.txt as before. A value in
|
||||
mouse_sens.txt from before is moved into the menu once, while the menu's is still its default; the file is renamed
|
||||
mouse_sens.txt.moved then, so the menu's value is not replaced by it again at a later start */
|
||||
mouse_sens.txt.moved then, so the menu's value is not replaced by it again at a later start.
|
||||
((Triforce, 11-30) A key that is a control's (the Controls page's bindings, the walk key) is that control's alone and no
|
||||
sensitivity key: bound to a control (- or Num - on A, say), every press of it took a fifth off the sensitivity, down to
|
||||
its 0.1 floor, faster the more the control was pressed (talking to people). #bug-tracker 11-30, v0.8.5.2. Each change is
|
||||
logged with the key that made it, sens_key_name) */
|
||||
void rx_option_set(int id, int value);
|
||||
static int sens_from_file; /* (mouse_setup: <user>/mouse_sens.txt was there) */
|
||||
static int key_is_a_control(int vk); /* (below, beside bound_down: the binding table's) */
|
||||
static int sens_key(int vk) { return !key_is_a_control(vk) && key(vk); }
|
||||
static const char *sens_key_name(int vk) {
|
||||
return vk == VK_OEM_MINUS ? "-" : vk == VK_SUBTRACT ? "Num -" : vk == VK_OEM_PLUS ? "=" : vk == VK_ADD ? "Num +" : "?";
|
||||
}
|
||||
static void mouse_sens_keys(void) {
|
||||
static int prev_minus, prev_plus, from_env = -1;
|
||||
if (from_env < 0) {
|
||||
@@ -97,11 +106,16 @@ static void mouse_sens_keys(void) {
|
||||
}
|
||||
}
|
||||
if (!from_env) hos_mouse_sens = rx_option(7, 100) / 100.0;
|
||||
const int minus = key(VK_OEM_MINUS) || key(VK_SUBTRACT), plus = key(VK_OEM_PLUS) || key(VK_ADD);
|
||||
const int minus_vk = sens_key(VK_OEM_MINUS) ? VK_OEM_MINUS : sens_key(VK_SUBTRACT) ? VK_SUBTRACT : 0;
|
||||
const int plus_vk = sens_key(VK_OEM_PLUS) ? VK_OEM_PLUS : sens_key(VK_ADD) ? VK_ADD : 0;
|
||||
const int minus = minus_vk != 0, plus = plus_vk != 0;
|
||||
if ((minus && !prev_minus) || (plus && !prev_plus)) {
|
||||
const double was = hos_mouse_sens;
|
||||
hos_mouse_sens *= minus && !prev_minus ? 0.8 : 1.25;
|
||||
if (hos_mouse_sens < 0.1) hos_mouse_sens = 0.1;
|
||||
if (hos_mouse_sens > 5) hos_mouse_sens = 5;
|
||||
hos_log("hid: mouse sensitivity %.2f -> %.2f (the %s key)", was, hos_mouse_sens,
|
||||
sens_key_name(minus && !prev_minus ? minus_vk : plus_vk));
|
||||
if (from_env) mouse_sens_save();
|
||||
else rx_option_set(7, (int)lround(hos_mouse_sens * 100));
|
||||
}
|
||||
@@ -1270,6 +1284,16 @@ static int bound_down(int i, int mouse) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* ((Triforce, 11-30) vk is a key some control has (any row of the binding table: the Switch's buttons, the stick's and the
|
||||
camera's keys, the note rows, Toggle HUD) or the walk key: then no shortcut of the host's own takes it, mouse_sens_keys) */
|
||||
static int key_is_a_control(int vk) {
|
||||
if (vk <= 0) return 0;
|
||||
if (vk == walk_vk) return 1;
|
||||
for (int i = 0; i < HOS_KEY_N; i++)
|
||||
for (int k = 0; k < 2; k++)
|
||||
if ((int)key_bind[i][k] == vk) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ((Triforce) The Controls page's Toggle HUD row: a press of its gamepad input or one of its keys hides the HUD in play, the
|
||||
next shows it again (host/hos_wide_ui.c hos_gameplay_hud_toggle: for the session). readable: the player's input counts at
|
||||
@@ -1455,6 +1479,47 @@ static uint64_t oc_pad_word(uint64_t buttons) {
|
||||
return w;
|
||||
}
|
||||
|
||||
/* ((Triforce, 11-30) The ReShade comparison asked for inside the pause menu's Options (gpu/vk/vk_menu.cpp, option
|
||||
HOS_OPT_COMPARE_PLAY 1): the game is paused there and its scene draws nothing, the preset is laid on the gameplay picture
|
||||
alone, so the comparison over those screens showed the Options and the pause menu and no change ("ReShade Compare not
|
||||
taking you to gameplay screen", #bug-tracker 11-30). The menus are left as Back leaves them: B tapped on the Options
|
||||
screen (as for one of our tabs left with Back, above), then B on the pause menu (its Back prompt's, host/oot_menu.c), each
|
||||
once and once more if its screen still runs 1.5 s later (a press lost in its animation). Neither run for 300 ms: in play,
|
||||
the renderer told 2 and the comparison opened over the game. Not there 4 s after the ask: 3, the comparison where it is */
|
||||
int hos_oot_options_front(void); /* (host/oot_menu.c) */
|
||||
int hos_oot_pause_front(void);
|
||||
static void compare_to_play(int64_t now) {
|
||||
static int64_t asked_ns, menus_ns, tap_ns[2];
|
||||
static int taps[2];
|
||||
if (rx_option(HOS_OPT_COMPARE_PLAY, 0) != 1) {
|
||||
asked_ns = 0;
|
||||
return;
|
||||
}
|
||||
if (!asked_ns) {
|
||||
asked_ns = menus_ns = now, taps[0] = taps[1] = 0;
|
||||
hos_log("hid: the ReShade comparison asked from the Options: leaving the game's menus for play");
|
||||
}
|
||||
const int options = hos_oot_options_front(), pause = !options && hos_oot_pause_front();
|
||||
if (options || pause) {
|
||||
const int i = options ? 0 : 1;
|
||||
menus_ns = now;
|
||||
if (!taps[i] || (taps[i] < 2 && now - tap_ns[i] >= 1500000000LL)) {
|
||||
hos_hid_tap("0:B/80");
|
||||
hos_log("hid: the ReShade comparison: B on the %s (%d)", i ? "pause menu" : "Options", ++taps[i]);
|
||||
tap_ns[i] = now;
|
||||
}
|
||||
} else if (now - menus_ns >= 300000000LL) {
|
||||
rx_option_set(HOS_OPT_COMPARE_PLAY, 2);
|
||||
hos_log("hid: the ReShade comparison: in play after %.1f s", (now - asked_ns) / 1e9);
|
||||
asked_ns = 0;
|
||||
return;
|
||||
}
|
||||
if (now - asked_ns >= 4000000000LL) {
|
||||
rx_option_set(HOS_OPT_COMPARE_PLAY, 3);
|
||||
hos_log("hid: the ReShade comparison: the game's menus still up after 4 s; opened where it is");
|
||||
asked_ns = 0;
|
||||
}
|
||||
}
|
||||
static void read_input(uint64_t *buttons, int32_t stick[4]) {
|
||||
*buttons = 0;
|
||||
memset(stick, 0, 4 * sizeof *stick);
|
||||
@@ -1544,6 +1609,7 @@ static void read_input(uint64_t *buttons, int32_t stick[4]) {
|
||||
}
|
||||
was_open = open;
|
||||
}
|
||||
compare_to_play(hos_now_ns()); /* ((Triforce, 11-30) the ReShade comparison asked from the pause menu's Options) */
|
||||
uint64_t down = 0; /* (the pads' buttons and the bound keys down at this read) */
|
||||
{ /* (hookshot) while the Insert menu is open the pads are its own, as the keyboard is (key()), and after it
|
||||
closed each input it had waits until it is let go (the press that closed it never reaches the game); the
|
||||
|
||||
29
host/nn_vi.c
29
host/nn_vi.c
@@ -502,15 +502,36 @@ static float text_scale(const char *env, int menu) {
|
||||
volatile uint64_t hos_step_probe = 0; /* (f_80706be0's object, set by the lifted code when the frame-time hook is in this build; its
|
||||
+0xd58 is the game clock in 1/60 s: nx2/oot_patches.py) */
|
||||
volatile uint32_t hos_frame_seconds_bits = 0; /* (the frame's seconds as a float's bits for that hook, 0: the game's own step) */
|
||||
/* ((Triforce, 11-30) The rate the game steps by now (the graphics module's +0x2c8, realtime_step's), for hos_movie_frames below
|
||||
60: the rate under 60 (the step 60 / rate), 0 at 60 or when it is not known. Said once in the log when a movie counts by it) */
|
||||
static int movie_game_rate(void) {
|
||||
const uint64_t mod = hos_gfx_module;
|
||||
if (!mod) return 0;
|
||||
const int rate = __atomic_load_n((const int *)GP(mod + 0x2c8), __ATOMIC_RELAXED);
|
||||
if (rate < 15 || rate >= 60) return 0;
|
||||
static volatile LONG said;
|
||||
if (!InterlockedExchange(&said, 1))
|
||||
hos_log("video: a movie's count of 60ths below 60 fps: %.3f an update at the game's rate %d (HOS_FPS_MOVIE=0: 1, as shipped)",
|
||||
60.0 / rate, rate);
|
||||
return rate;
|
||||
}
|
||||
/* A movie's frame count while the frames' time is given (a Frame rate cap above 60): how many 60ths of a second this update of
|
||||
that movie player is worth, the rest carried to its next one, so the count the cutscene's cues are placed by keeps the clock
|
||||
as the movie's picture does (issue 1742: the narration ran ahead above 60 fps). 1, the game's own step, otherwise, and with
|
||||
HOS_FPS_MOVIE=0 (for comparisons). Called by the lifted f_83b7c710 (nx2/oot_patches.py). */
|
||||
as the movie's picture does (issue 1742: the narration ran ahead above 60 fps). 1, the game's own step, at 60 fps, and with
|
||||
HOS_FPS_MOVIE=0 (for comparisons). Called by the lifted f_83b7c710 (nx2/oot_patches.py), once a frame.
|
||||
((Triforce, 11-30) Below 60 fps too, by the game's step (60 / its rate, movie_game_rate): the count grew by 1 a frame, half
|
||||
the movie's 60ths at 30 fps, while the picture keeps the clock (nn_video.c skips the pictures behind it). The ending's second
|
||||
staff roll (Dm_StaffCredit_0005, a timeline of 7343 frames on the movie of 7343 pictures) places its UI by that count: "Presented
|
||||
by Nintendo" in at 3326, out at 3892, the staff roll's end screen opened at 6260. At 30 fps the movie ended with the count near
|
||||
3672: the text stayed, the end screen was never opened, and Dm_StaffCredit_0007's EventWaitInputTheEndNext waits for input on
|
||||
that screen, which it never finds: the game stood on the 3D behind the text for good, the "The End" screen never came (5+
|
||||
players, all of them under 60 fps; the lab: at 30 the same, at 60 the end screen and the title). */
|
||||
uint32_t hos_movie_frames(uint64_t player) {
|
||||
enum { PLACES = 16 };
|
||||
movie_seen(); /* (Triforce: a movie plays, for the frame pacing: pace_handed) */
|
||||
const uint32_t bits = __atomic_load_n(&hos_frame_seconds_bits, __ATOMIC_RELAXED); /* (realtime_step writes it at each present) */
|
||||
if (!bits) return 1;
|
||||
const int rate = bits ? 0 : movie_game_rate(); /* ((Triforce) below 60: the game's step) */
|
||||
if (!bits && !rate) return 1;
|
||||
static SRWLOCK lock = SRWLOCK_INIT;
|
||||
static int timed = -1; /* (these four under the lock) */
|
||||
static struct { uint64_t player, used; double part; } carry[PLACES];
|
||||
@@ -538,7 +559,7 @@ uint32_t hos_movie_frames(uint64_t player) {
|
||||
carry[i].player = player, carry[i].part = x / 4294967296.0;
|
||||
}
|
||||
carry[i].used = ++calls;
|
||||
carry[i].part += (double)secs * 60.0;
|
||||
carry[i].part += bits ? (double)secs * 60.0 : 60.0 / rate;
|
||||
n = (uint32_t)carry[i].part;
|
||||
carry[i].part -= n;
|
||||
}
|
||||
|
||||
30
host/oot_amiibo_uses.c
Normal file
30
host/oot_amiibo_uses.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* (Triforce) The System tab's Unlimited amiibo uses row (its NFC group): On, a figure can be scanned again at once, any
|
||||
number of times, and gives its reward each time.
|
||||
|
||||
What limits a figure's use (read in the game's own code, the supported build; host/amiibo.h has what it asks of the
|
||||
reader): once its amiibo sequence has a figure's TagInfo and ModelInfo, it decides (f_8328bbc0) by asking f_8328cd30
|
||||
whether the figure was used today. That function looks the figure up in the save's amiibo history (a list of figures,
|
||||
each with the date and time of its last use, its serial number's hash and its names: f_8328d110 writes it after each
|
||||
use) and answers 1 when the figure's last use was on today's date (the PC's, through nn::time). Then the game says so
|
||||
and gives nothing until the next day. Nothing is written to the figure (the game opens no data of its own on it), and
|
||||
the runtime counts no uses: a figure chosen again on the Scan amiibo page (host/nn_nfp.c) is another touch.
|
||||
|
||||
The game also refuses a figure while the clock was set by hand, within the day, by more than the time gone by
|
||||
(f_8328c870, nn::time::CalculateStandardUserSystemClockDifferenceByUser). host/nn_applet.c answers 0, "not set by the
|
||||
user", so that never refuses here, row or not.
|
||||
|
||||
nx2/oot_patches.py (patch_amiibo_uses) calls hos_oot_amiibo_used_today at the head of f_8328cd30. With the row Off, the
|
||||
default, it returns 0 before anything is read and the game checks as it always did. With it On it answers 0, "not used
|
||||
today", and the function returns: the game gives the figure's reward and writes its history as for the day's first use
|
||||
(so after the row is turned Off again, a figure used today counts as used today). The player's dump is never written. */
|
||||
#include "hos.h"
|
||||
#include "../gpu/vk/vk_api.h"
|
||||
|
||||
int rx_option(int id, int otherwise);
|
||||
|
||||
int hos_oot_amiibo_used_today(Ctx *c) {
|
||||
if (!rx_option(HOS_OPT_AMIIBO_UNLIMITED, 0)) return 0; /* (the row Off: the game's own check, nothing read) */
|
||||
c->x[0] = 0; /* (not used today) */
|
||||
hos_log("amiibo: the game's once-a-day check of the figure answered \"not used today\" (Unlimited amiibo uses is On)");
|
||||
return 1;
|
||||
}
|
||||
@@ -330,6 +330,13 @@ int hos_oot_options_front(void) {
|
||||
const LONG64 t = InterlockedCompareExchange64(&options_seen_ns, 0, 0);
|
||||
return t && (LONG64)hos_now_ns() - t < 200000000LL;
|
||||
}
|
||||
/* ((Triforce, 11-30) the pause menu's screen updated within 200 ms, as hos_oot_options_front for the Options': it stops while
|
||||
the Options screen is over it (OPTIONS_FROM_PAUSE_NS) and when the pause menu closes. nn_hid.c compare_to_play */
|
||||
static volatile LONG64 pause_seen_ns;
|
||||
int hos_oot_pause_front(void) {
|
||||
const LONG64 t = InterlockedCompareExchange64(&pause_seen_ns, 0, 0);
|
||||
return t && (LONG64)hos_now_ns() - t < 200000000LL;
|
||||
}
|
||||
/* (Triforce) the renderer is told of the Options screen (its tabs over the header): HOS_OPTIONS_TABS=0 keeps it untold */
|
||||
static int options_tabs_on(void) {
|
||||
static int tabs = -1;
|
||||
@@ -1183,7 +1190,7 @@ void hos_oot_menu_tick(Ctx *c, uint64_t screen) {
|
||||
(kept for the run; a run begins after 200 ms with no Options frame, as hos_oot_options_front's) */
|
||||
static int64_t pause_ran_ns; /* (under seen_lock) */
|
||||
static int options_from_pause;
|
||||
if (peek64(screen) == PAUSE_SCREEN_VTABLE) pause_ran_ns = now;
|
||||
if (peek64(screen) == PAUSE_SCREEN_VTABLE) pause_ran_ns = now, InterlockedExchange64(&pause_seen_ns, (LONG64)now);
|
||||
if (me->options) {
|
||||
const LONG64 was = InterlockedCompareExchange64(&options_seen_ns, 0, 0);
|
||||
if (!was || now - was >= 200000000LL) options_from_pause = pause_ran_ns && now - pause_ran_ns < OPTIONS_FROM_PAUSE_NS;
|
||||
@@ -1270,6 +1277,7 @@ void hos_oot_menu_tick(Ctx *c, uint64_t screen) {
|
||||
#include <string.h>
|
||||
#include "../gpu/vk/vk_api.h" /* (HOS_OPT_GAME_OPTIONS) */
|
||||
static int64_t options_seen_ns; /* (the screens' updates run on several of the game's threads: read and written whole) */
|
||||
static int64_t pause_seen_ns; /* ((Triforce, 11-30) the pause menu's last update, hos_oot_pause_front: the same) */
|
||||
void hos_input_clear_toggles(void); /* ((Triforce) 11-24: host/nn_hid.c, hold-to-toggle's latches) */
|
||||
/* (the pause page's focus hook runs here too, without the mouse's menu navigation: a latched button is let go for it) */
|
||||
void hos_oot_menu_focus(Ctx *c, uint64_t screen, uint64_t pane, uint64_t lr) {
|
||||
@@ -1300,7 +1308,7 @@ void hos_oot_menu_tick(Ctx *c, uint64_t screen) {
|
||||
static int64_t pause_ran_ns; /* ((Triforce, 11-20) the pause menu's last update: where the Options were chosen from) */
|
||||
static int options_from_pause;
|
||||
const int64_t now = hos_now_ns();
|
||||
if (vt == PAUSE_SCREEN_VTABLE) __atomic_store_n(&pause_ran_ns, now, __ATOMIC_RELAXED);
|
||||
if (vt == PAUSE_SCREEN_VTABLE) __atomic_store_n(&pause_ran_ns, now, __ATOMIC_RELAXED), __atomic_store_n(&pause_seen_ns, now, __ATOMIC_RELAXED);
|
||||
oot_menu_screen_tick(vt); /* ((Triforce) the screen's class, each frame it runs: oot_title_movie.h) */
|
||||
if (vt != OPTIONS_SCREEN_VTABLE) return;
|
||||
static int tabs = -1;
|
||||
@@ -1318,6 +1326,10 @@ int hos_oot_options_front(void) {
|
||||
const int64_t t = __atomic_load_n(&options_seen_ns, __ATOMIC_RELAXED);
|
||||
return t && hos_now_ns() - t < 200000000LL;
|
||||
}
|
||||
int hos_oot_pause_front(void) { /* ((Triforce, 11-30) the Windows half's, nn_hid.c compare_to_play) */
|
||||
const int64_t t = __atomic_load_n(&pause_seen_ns, __ATOMIC_RELAXED);
|
||||
return t && hos_now_ns() - t < 200000000LL;
|
||||
}
|
||||
/* ((Triforce, 11-18) the Mods entry under the game's lists is the Windows half's (mods_list_tick): here no list's last button
|
||||
has the cursor, so nn_hid.c never keeps a Down from the game. Without it every Linux build of v0.5.0 stopped at the link,
|
||||
"undefined reference to hos_oot_mods_down" (#bug-tracker, 11-18). tests/test_oot_menu_linux_half.py) */
|
||||
|
||||
@@ -447,7 +447,7 @@ int rx_async_replay(void) {
|
||||
on = atoi(e) != 0;
|
||||
} else if (vk && vk->option) {
|
||||
/* ((Triforce) unset: the renderer's answer, resolved once (HOS_OPT_RENDER_THREAD: the Debug tab's Threaded rendering
|
||||
row or RX_VK_THREADED, gpu/vk/threaded_rendering.h; off by default, so 0 as before) */
|
||||
row or RX_VK_THREADED, gpu/vk/threaded_rendering.h; Auto by default, Off 0 as before) */
|
||||
on = vk->option(HOS_OPT_RENDER_THREAD) > 0;
|
||||
} else {
|
||||
/* (asked before the renderer runs: hos_reserved_cpus at its device's pick. RX_VK_THREADED=1 or on says it already;
|
||||
|
||||
Reference in New Issue
Block a user