/* (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; }