mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
Triforce v0.8.5
A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
@@ -780,6 +780,24 @@ int hos_oot_stats(int *life, int *max_life, int *rupees, int *tokens, int *piece
|
||||
oot_discord_unlock();
|
||||
return have;
|
||||
}
|
||||
/* ((Triforce, 11-27, a player's report: the status said only "Playing Triforce" with the time) The map and the state for the
|
||||
Discord status, from the copy kept for it here. discord_rpc.c read hos_oot_current_map/hos_oot_state, the control bridge's
|
||||
copy, which only HOS_CONTROL fills: the place, the age and the stats never showed for any player */
|
||||
int hos_oot_discord_map(char *out, size_t cap) {
|
||||
oot_discord_lock();
|
||||
const int have = oot_discord_map[0] != 0;
|
||||
if (have) snprintf(out, cap, "%s", oot_discord_map);
|
||||
oot_discord_unlock();
|
||||
return have;
|
||||
}
|
||||
int hos_oot_discord_state(int *event, int *loading, int *child) {
|
||||
oot_discord_lock();
|
||||
const int f = oot_discord_flags;
|
||||
oot_discord_unlock();
|
||||
if (f < 0) return 0;
|
||||
*event = f & 1, *loading = (f >> 1) & 1, *child = (f >> 2) & 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__) /* (the debug tools: host/posix has what they call) */
|
||||
/* QueryGetPouchContentNumByActorName (f_82a3c260): f_805b63e0(pouch manager, &name, 0, 0) counts one content. */
|
||||
@@ -3070,6 +3088,85 @@ static DWORD WINAPI game_thread(void *p) {
|
||||
hos_crash_clean_end(); /* ((Triforce) ExitProcess is quick_exit here, which runs no atexit: host/hos_crash_record.c */
|
||||
ExitProcess(result);
|
||||
}
|
||||
/* ((Triforce, 11-27) A PC whose NVIDIA shader cache did not keep the game's (triforce_nvidia_cache.own beside the game, left
|
||||
by the renderer's library check: gpu/vk/vk_draw.cpp nv_own_folder_mark_path): the driver's cache in a folder of the game's
|
||||
own, triforce_nvidia_cache, with 10 GB of room, set here before anything loads the driver. v0.8.4 set it in the renderer's
|
||||
create_instance, which Windows' driver still honoured but Linux's did not: SDL had loaded it with the window, and a
|
||||
player's RTX 5090 (Arch) rebuilt every shader at every start, the folder empty and ~/.cache/nvidia growing instead. A path
|
||||
the player set wins; the size too. Nothing is done without the marker */
|
||||
#ifndef _WIN32
|
||||
#include <dirent.h>
|
||||
/* the files under dir, summed into *total (bytes); with drop, removed instead. Two levels of folders, as NVIDIA's are */
|
||||
static void nv_cache_sum(const char *dir, unsigned long long *total, int drop) {
|
||||
DIR *d = opendir(dir);
|
||||
if (!d) return;
|
||||
struct dirent *e;
|
||||
char p[4096];
|
||||
while ((e = readdir(d))) {
|
||||
if (e->d_name[0] == '.') continue;
|
||||
snprintf(p, sizeof p, "%s/%s", dir, e->d_name);
|
||||
struct stat st;
|
||||
if (lstat(p, &st)) continue;
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
nv_cache_sum(p, total, drop);
|
||||
if (drop) rmdir(p);
|
||||
} else if (S_ISREG(st.st_mode)) {
|
||||
if (drop) remove(p);
|
||||
else *total += (unsigned long long)st.st_size;
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
}
|
||||
#endif
|
||||
static void nv_own_cache_folder(void) {
|
||||
char mark[MAX_PATH], dir[MAX_PATH + 32];
|
||||
const DWORD len = hos_game_path_a(mark, MAX_PATH);
|
||||
char *slash = len ? strrchr(mark, '\\') : NULL;
|
||||
if (!slash && len) slash = strrchr(mark, '/');
|
||||
if (!slash) return;
|
||||
const size_t at = (size_t)(slash + 1 - mark);
|
||||
memcpy(dir, mark, at);
|
||||
dir[at] = 0;
|
||||
snprintf(slash + 1, (size_t)(MAX_PATH - at), "triforce_nvidia_cache.own");
|
||||
FILE *f = fopen(mark, "rb");
|
||||
const char *own = getenv("HOS_NV_OWN_CACHE");
|
||||
#ifdef _WIN32
|
||||
if (!f) return;
|
||||
#else
|
||||
/* ((Triforce, 11-27) On Linux for every PC, marker or not: a second player's RTX 3070 (v0.8.3, a start whose check found
|
||||
the caches warm) still had 52 recorded pipelines compiled in play, 40 ms to 2.3 s each, the shared ~/.cache/nvidia
|
||||
having lost them. The variables touch NVIDIA's driver alone (Mesa reads its own). HOS_NV_OWN_CACHE=0: the shared
|
||||
folder, as before; on Windows the marker alone decides, as there the driver keeps what it is given unless its
|
||||
control-panel size is too small */
|
||||
if (!f && own && !strcmp(own, "0")) return;
|
||||
#endif
|
||||
if (f) fclose(f);
|
||||
if (own && !strcmp(own, "0")) return;
|
||||
if (getenv("__GL_SHADER_DISK_CACHE_PATH")) return;
|
||||
snprintf(dir + at, sizeof dir - at, "triforce_nvidia_cache");
|
||||
#ifdef _WIN32
|
||||
CreateDirectoryA(dir, NULL);
|
||||
_putenv_s("__GL_SHADER_DISK_CACHE_PATH", dir);
|
||||
SetEnvironmentVariableA("__GL_SHADER_DISK_CACHE_PATH", dir);
|
||||
if (!getenv("__GL_SHADER_DISK_CACHE_SIZE")) {
|
||||
_putenv_s("__GL_SHADER_DISK_CACHE_SIZE", "10737418240");
|
||||
SetEnvironmentVariableA("__GL_SHADER_DISK_CACHE_SIZE", "10737418240");
|
||||
}
|
||||
#else
|
||||
mkdir(dir, 0700);
|
||||
setenv("__GL_SHADER_DISK_CACHE_PATH", dir, 0);
|
||||
setenv("__GL_SHADER_DISK_CACHE_SIZE", "10737418240", 0);
|
||||
/* ((Triforce, 11-27) and NVIDIA's cleanup pass left out in this folder alone: the same player's shared cache lost its
|
||||
entries between starts with 10 GiB of room (1.7 GB -> 405 MB -> 170 MB). The folder holds the game's shaders only;
|
||||
its size is kept here instead: past 12 GB (stale updates' shaders) it is emptied, and the next start makes them again */
|
||||
setenv("__GL_SHADER_DISK_CACHE_SKIP_CLEANUP", "1", 0);
|
||||
{
|
||||
unsigned long long total = 0;
|
||||
nv_cache_sum(dir, &total, 0);
|
||||
if (total > 12ull << 30) nv_cache_sum(dir, &total, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
int main(int argc, char **argv) {
|
||||
{ /* ((Triforce) the crash window's helper of a run (host/hos_crash_dialog.c): first, so it starts nothing of the game */
|
||||
int hos_crash_helper_main(int argc, char **argv);
|
||||
@@ -3079,6 +3176,7 @@ int main(int argc, char **argv) {
|
||||
int hos_display_init(void);
|
||||
void hos_display_loop(void);
|
||||
load_hookshot_env();
|
||||
nv_own_cache_folder(); /* ((Triforce, 11-27) before the driver loads: see above (and before driver_cache_folder makes it) */
|
||||
#ifdef __linux__
|
||||
driver_env_choose(); /* ((Triforce) after the env file, which may set HOS_HALF_RATE_SHADING; before Vulkan, the builder's run too) */
|
||||
driver_cache_room(); /* ((Triforce, 11-22) the performance audit's PIPE-97: 10 GiB for the driver's shader cache, likewise */
|
||||
|
||||
Reference in New Issue
Block a user