Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/cheats-and-assists.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ game is shipped with Savage Wind.
| Free sprint out of combat | Sprinting on the ground takes no stamina while no enemy is fighting you. Once enemies start the battle music, sprinting costs stamina again until the music fades. Climbing, swimming, gliding and attacks cost stamina as usual. |
| Item pickup multiplier | Multiplies the stackable items you pick up (materials, monster parts, arrows) by 2, 4 or 8, up to 999. |
| Sure-footed horse | A running horse no longer stops dead and rears when it runs into something, even a small rock. It no longer stops at cliff edges either: mind where you ride. |
| Show shrines and towers | Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is. |

## Teleport and console cheats

Expand Down
2 changes: 1 addition & 1 deletion runtime/control_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static const Setting settings[] = {
{"color_lut", g_settings.color_lut, TEXT, 0, 0, NULL},
I(color_lut_strength, 0, 100, NULL), B(color_lut_set), B(no_weapon_wear),
I(weapon_wear, WEAPON_WEAR_MIN, WEAPON_WEAR_MAX, NULL), B(infinite_arrows),
B(infinite_stamina), B(infinite_rupees), I(item_multiplier, 1, 8, NULL), B(free_sprint), B(sure_footed), I(weather, 0, WEATHER_COUNT - 1,
B(infinite_stamina), B(infinite_rupees), I(item_multiplier, 1, 8, NULL), B(free_sprint), B(sure_footed), B(show_all_places), I(weather, 0, WEATHER_COUNT - 1,
"game|no_rain|no_storms|clear|cloudy|rain|heavy_rain|snow|heavy_snow|thunderstorm|thunder_rain|sun_shower"),
B(god_mode), B(one_hit_kill), I(damage_taken, 25, 400, NULL), I(damage_dealt, 25, 400, NULL),
I(text_language, 0, 0, NULL), I(voice_language, 0, 0, NULL), B(save_backups), B(stick_cam_on), I(stick_cam_x, STICK_CAM_MIN, STICK_CAM_MAX, NULL),
Expand Down
5 changes: 4 additions & 1 deletion runtime/game_sites.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Addresses in the game's main module that the runtime reads or writes. They differ between game versions:
// Addresses in the game's main module that the runtime reads or writes. They differ between game versions:
// tools/game_sites.py finds them for the version the game code was generated from, and the game library carries them
// (runtime/gamelib.h, the generated layout.c). g_site holds them once the library is loaded (gamelib_load).
#pragma once
Expand Down Expand Up @@ -29,6 +29,9 @@
X(title_version_format) /* "Ver.%s": the title screen's version line */ \
X(player_info) /* uking::act::PlayerInfo * (test tools) */ \
X(world_mgr) /* ksys::world::Manager * (test tools, weather.c)*/ \
X(place_count_read) /* the map marker update's count read (Cheats > Map, patches.py) */ \
X(place_travel) /* the marker's travel bit (Cheats > Map, patches.py) */ \
X(place_icon) /* the tower marker's colour decision (Cheats > Map, patches.py) */ \
X(main_data) /* main's .data (then .bss, up to main_end) */ \
X(main_end)

Expand Down
75 changes: 75 additions & 0 deletions runtime/place_display.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Cheats > Map (runtime/place_display.h): shows every shrine, tower, stable and lab on the map, and makes the places it
// shows travel destinations. No game data is written: nothing is saved and no tower is activated, so the map fog stays
// as it is.
//
// Three decisions of the game's own marker logic are hooked:
// - the visit count a marker is drawn from (record +0x1c): a place that was never visited reads as 1
// (patches.py _place_count_read), so the game marks and draws it itself. Only that read changes - the record in
// memory keeps its 0, so what the game records elsewhere (completion and the like) is untouched;
// - the travel bit of a marker's flags (marker +0x3c, bit 0x200): kept on for the places above (patches.py
// _place_travel), so they can be travelled to without being activated. Stables are left out: the game itself
// never travels to one;
// - the draw's colour decision (patches.py _place_icon): it tests that same travel bit, which is what makes a tower
// look activated. For a place whose record still has count 0 - travelable only because of this option - the bit is
// hidden from that read, so the marker keeps the look it has for a place that was never visited.
#include <stdbool.h>
#include <stdint.h>
#include <string.h>

#include "place_display.h"
#include "rt.h" // GUEST_LO/GUEST_HI (guest addresses are the process's own addresses)
#include "settings.h"

#define RECORD_NAME_OFF 0x10
#define RECORD_COUNT_OFF 0x1c
#define MARKER_RECORD_OFF 0x58
#define MARKER_TRAVEL_BIT 0x200u

// The groups the option covers, by the place record's name (the record's name is a plain char * at +0x10).
static bool is_named(const char *name, const char *prefix, size_t len) { return strncmp(name, prefix, len) == 0; }
static bool is_shrine(const char *name) { return is_named(name, "Location_Dungeon", 16); }
static bool is_tower(const char *name) { return is_named(name, "Location_MapTower", 17); }
static bool is_stable(const char *name) { return is_named(name, "Location_", 9) && strstr(name, "Hatago") != NULL; }
static bool is_lab(const char *name) { return is_named(name, "Location_", 9) && strstr(name, "Labo") != NULL; }
// Shown: shrines, towers, stables and the ancient labs. Travelled to: the same except the stables.
static bool shown(const char *name) {
return name && (is_shrine(name) || is_tower(name) || is_stable(name) || is_lab(name));
}
static bool travels(const char *name) { return shown(name) && !is_stable(name); }

// The place record a marker belongs to, and its name; 0/NULL when this is not one of the map's markers.
static uint64_t marker_record(uint64_t marker) {
if (marker < GUEST_LO || marker >= GUEST_HI || (marker & 3)) return 0;
uint64_t record = *(volatile uint64_t *)(uintptr_t)(marker + MARKER_RECORD_OFF);
return record >= GUEST_LO && record < GUEST_HI ? record : 0;
}

static const char *record_name(uint64_t record) {
if (record < GUEST_LO || record >= GUEST_HI) return NULL;
const char *name = *(const char *const volatile *)(uintptr_t)(record + RECORD_NAME_OFF);
return (uint64_t)(uintptr_t)name >= GUEST_LO && (uint64_t)(uintptr_t)name < GUEST_HI ? name : NULL;
}

// The visit count the marker update reads for a place: never-visited places of the groups above read as visited.
uint32_t rt_place_count(uint64_t record, uint32_t count) {
if (!g_settings.show_all_places || count != 0 || record < GUEST_LO || record >= GUEST_HI) return count;
const char *name = record_name(record);
return shown(name) ? 1 : count;
}

// The travel bit of a marker's flags, as the marker update computes it: kept on while the option is on.
uint32_t rt_place_travel(uint64_t marker, uint32_t bit) {
if (!g_settings.show_all_places) return bit;
const char *name = record_name(marker_record(marker));
return travels(name) ? MARKER_TRAVEL_BIT : bit;
}

// The draw's view of a marker's flags: the travel bit is hidden for places that are only travelable because of this
// option (their record still has count 0), so they keep the normal icon instead of the activated-looking one.
uint32_t rt_place_icon(uint64_t marker, uint32_t flags) {
if (!g_settings.show_all_places || !(flags & MARKER_TRAVEL_BIT)) return flags;
uint64_t record = marker_record(marker);
const char *name = record_name(record);
if (!travels(name)) return flags;
return *(volatile uint32_t *)(uintptr_t)(record + RECORD_COUNT_OFF) == 0 ? (flags & ~MARKER_TRAVEL_BIT) : flags;
}
16 changes: 16 additions & 0 deletions runtime/place_display.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif
// Cheats > Map (runtime/place_display.c): shows every shrine, tower, stable and lab on the map, and makes the places it
// shows travel destinations, by hooking three decisions of the game's own marker logic. No game data is written:
// nothing is saved and no tower is activated, so the map fog stays as it is.
uint32_t rt_place_count(uint64_t record, uint32_t count); // the visit count a marker is drawn from
uint32_t rt_place_travel(uint64_t marker, uint32_t bit); // the travel bit (0x200) of a marker's flags
uint32_t rt_place_icon(uint64_t marker, uint32_t flags); // the draw's view of those flags (the icon's colour)
#ifdef __cplusplus
}
#endif
2 changes: 2 additions & 0 deletions runtime/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ void settings_load(void) {
else if (!strcmp(key, "infinite_rupees")) g_settings.infinite_rupees = atoi(val) != 0;
else if (!strcmp(key, "item_multiplier")) g_settings.item_multiplier = atoi(val);
else if (!strcmp(key, "free_sprint")) g_settings.free_sprint = atoi(val) != 0;
else if (!strcmp(key, "show_all_places")) g_settings.show_all_places = atoi(val) != 0;
else if (!strcmp(key, "sure_footed")) g_settings.sure_footed = atoi(val) != 0;
else if (!strcmp(key, "weather")) {
g_settings.weather = 0;
Expand Down Expand Up @@ -910,6 +911,7 @@ bool settings_save_to(const char *path) {
fprintf(f, "infinite_rupees = %d\n", g_settings.infinite_rupees);
fprintf(f, "item_multiplier = %d\n", g_settings.item_multiplier);
fprintf(f, "free_sprint = %d\n", g_settings.free_sprint);
fprintf(f, "show_all_places = %d\n", g_settings.show_all_places);
fprintf(f, "sure_footed = %d\n", g_settings.sure_footed);
int wx = g_settings.weather;
fprintf(f, "weather = %s\n", g_weather_keys[wx >= 0 && wx < WEATHER_COUNT ? wx : 0]);
Expand Down
1 change: 1 addition & 0 deletions runtime/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ typedef struct {
int item_multiplier; // 1, 2, 4 or 8: multiply stackable item pickups (runtime/items.c)
bool free_sprint; // sprinting takes no stamina while no enemy is fighting Link (runtime/free_sprint.c)
bool sure_footed; // a running horse doesn't stop dead and rear when it hits something (runtime/sure_footed.c)
bool show_all_places; // every shrine, tower, lab and stable on the map (runtime/place_display.c)
int weather; // WEATHER_COUNT: the game's, rain or thunderstorms kept out, or one weather held (weather.c)
bool god_mode; // Link takes no damage
bool one_hit_kill; // whatever else takes damage loses all its life at once
Expand Down
2 changes: 2 additions & 0 deletions runtime/ui/i18n/de.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,5 @@ T("Downloading Intel XeSS", "Intel XeSS wird heruntergeladen")
T("Dynamic: renders the 3D scene smaller when frames are slow, sharper when they aren't; stays full size where that gains nothing.", "Dynamisch: rendert die 3D-Szene kleiner, wenn Frames langsam sind, und wieder schärfer, wenn nicht; bleibt in voller Größe, wo das nichts bringt.")
T("About mods", "Über Mods")
T("Mods are made by other people, not by Savage Wind. We don't check, test or support them, and we aren't responsible for what they do, including if they break the game or your saves. Back up your saves before trying one, and turn mods off before reporting a bug: a report of a bug a mod causes is closed right away. Savage Wind releases never include mods; in the future we may suggest some we've found to play well with Savage Wind.", "Mods stammen von anderen Leuten, nicht von Savage Wind. Wir prüfen, testen und unterstützen sie nicht und sind nicht verantwortlich für das, was sie tun, auch wenn sie das Spiel oder deine Spielstände beschädigen. Sichere deine Spielstände, bevor du einen ausprobierst, und schalte Mods aus, bevor du einen Fehler meldest: Eine Meldung zu einem Fehler, den ein Mod verursacht, wird sofort geschlossen. Savage-Wind-Versionen enthalten nie Mods; künftig empfehlen wir vielleicht einige, die gut mit Savage Wind laufen.")
T("Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is.", "Zeigt alle Schreine, Türme, Ställe und antiken Labore auf der Karte und macht Schreine, Türme und Labore zu Reisezielen (ein Stall wird nur angezeigt). Nichts wird gespeichert und kein Turm aktiviert, der Nebel der Karte bleibt.")
T("Show shrines and towers", "Schreine und Türme anzeigen")
2 changes: 2 additions & 0 deletions runtime/ui/i18n/es.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1260,3 +1260,5 @@ T("Downloading Intel XeSS", "Descargando Intel XeSS")
T("Dynamic: renders the 3D scene smaller when frames are slow, sharper when they aren't; stays full size where that gains nothing.", "Dinámico: renderiza la escena 3D más pequeña cuando los fotogramas van lentos y más nítida cuando no; se queda a tamaño completo donde eso no gana nada.")
T("About mods", "Sobre los mods")
T("Mods are made by other people, not by Savage Wind. We don't check, test or support them, and we aren't responsible for what they do, including if they break the game or your saves. Back up your saves before trying one, and turn mods off before reporting a bug: a report of a bug a mod causes is closed right away. Savage Wind releases never include mods; in the future we may suggest some we've found to play well with Savage Wind.", "Los mods los hacen otras personas, no Savage Wind. No los revisamos, probamos ni damos soporte, y no nos hacemos responsables de lo que hagan, incluso si rompen el juego o tus partidas. Haz una copia de tus partidas antes de probar uno y desactiva los mods antes de reportar un error: un reporte de un error causado por un mod se cierra de inmediato. Las versiones de Savage Wind nunca incluyen mods; en el futuro quizá recomendemos algunos que funcionen bien con Savage Wind.")
T("Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is.", "Muestra todos los santuarios, torres, establos y laboratorios antiguos en el mapa y permite viajar a santuarios, torres y laboratorios (un establo se muestra pero no es destino). No se guarda nada ni se activa ninguna torre: la niebla del mapa no cambia.")
T("Show shrines and towers", "Mostrar santuarios y torres")
2 changes: 2 additions & 0 deletions runtime/ui/i18n/fr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,5 @@ T("Downloading Intel XeSS", "Téléchargement de Intel XeSS")
T("Dynamic: renders the 3D scene smaller when frames are slow, sharper when they aren't; stays full size where that gains nothing.", "Dynamique : rend la scène 3D plus petite quand les images sont lentes, plus nette quand elles ne le sont pas ; reste en pleine taille là où ça n'apporte rien.")
T("About mods", "À propos des mods")
T("Mods are made by other people, not by Savage Wind. We don't check, test or support them, and we aren't responsible for what they do, including if they break the game or your saves. Back up your saves before trying one, and turn mods off before reporting a bug: a report of a bug a mod causes is closed right away. Savage Wind releases never include mods; in the future we may suggest some we've found to play well with Savage Wind.", "Les mods sont faits par d'autres personnes, pas par Savage Wind. Nous ne les vérifions pas, ne les testons pas et ne les prenons pas en charge, et nous ne sommes pas responsables de ce qu'ils font, y compris s'ils cassent le jeu ou vos sauvegardes. Sauvegardez vos parties avant d'en essayer un, et désactivez les mods avant de signaler un bug : le signalement d'un bug causé par un mod est fermé immédiatement. Les versions de Savage Wind n'incluent jamais de mods ; à l'avenir, nous pourrons en recommander certains qui fonctionnent bien avec Savage Wind.")
T("Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is.", "Affiche tous les sanctuaires, tours, relais et laboratoires antiques sur la carte et rend les sanctuaires, tours et laboratoires accessibles en voyage (un relais est affiché mais pas desservi). Rien n'est sauvegardé et aucune tour n'est activée : la brume de la carte reste.")
T("Show shrines and towers", "Afficher sanctuaires et tours")
2 changes: 2 additions & 0 deletions runtime/ui/i18n/he.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1260,3 +1260,5 @@ T("Downloading Intel XeSS", "מוריד את Intel XeSS")
T("Dynamic: renders the 3D scene smaller when frames are slow, sharper when they aren't; stays full size where that gains nothing.", "דינמי: מרנדר את סצנת ה-3D קטנה יותר כשהפריימים איטיים וחדה יותר כשלא; נשארת בגודל מלא כשאין בכך תועלת.")
T("About mods", "על מודים")
T("Mods are made by other people, not by Savage Wind. We don't check, test or support them, and we aren't responsible for what they do, including if they break the game or your saves. Back up your saves before trying one, and turn mods off before reporting a bug: a report of a bug a mod causes is closed right away. Savage Wind releases never include mods; in the future we may suggest some we've found to play well with Savage Wind.", "המודים נוצרים על ידי אנשים אחרים, לא על ידי Savage Wind. איננו בודקים, מנסים או תומכים בהם, ואיננו אחראים למה שהם עושים, כולל אם הם שוברים את המשחק או את השמירות שלך. גבה את השמירות לפני שאתה מנסה מוד, וכבה את המודים לפני דיווח על באג: דיווח על באג שנגרם על ידי מוד ייסגר מיד. גרסאות Savage Wind לעולם אינן כוללות מודים; בעתיד אולי נמליץ על כמה שעובדים טוב עם Savage Wind.")
T("Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is.", "מציג במפה את כל המקדשים, המגדלים, האורוות והמעבדות העתיקות ומאפשר מעבר אל מקדשים, מגדלים ומעבדות (אורווה רק מוצגת). שום דבר לא נשמר ואף מגדל לא מופעל, ולכן ערף המפה נשאר כפי שהוא.")
T("Show shrines and towers", "הצג מקדשים ומגדלים")
2 changes: 2 additions & 0 deletions runtime/ui/i18n/it.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1261,3 +1261,5 @@ T("Downloading Intel XeSS", "Download di Intel XeSS")
T("Dynamic: renders the 3D scene smaller when frames are slow, sharper when they aren't; stays full size where that gains nothing.", "Dinamico: rende la scena 3D più piccola quando i frame sono lenti, più nitida quando non lo sono; resta a piena dimensione dove non serve.")
T("About mods", "Informazioni sulle mod")
T("Mods are made by other people, not by Savage Wind. We don't check, test or support them, and we aren't responsible for what they do, including if they break the game or your saves. Back up your saves before trying one, and turn mods off before reporting a bug: a report of a bug a mod causes is closed right away. Savage Wind releases never include mods; in the future we may suggest some we've found to play well with Savage Wind.", "Le mod sono fatte da altre persone, non da Savage Wind. Non le controlliamo, non le testiamo e non le supportiamo, e non siamo responsabili di ciò che fanno, anche se rompono il gioco o i tuoi salvataggi. Fai una copia dei salvataggi prima di provarne una e disattiva le mod prima di segnalare un bug: la segnalazione di un bug causato da una mod viene chiusa subito. Le versioni di Savage Wind non includono mai mod; in futuro potremmo consigliarne alcune che funzionano bene con Savage Wind.")
T("Shows every shrine, tower, stable and ancient lab on the map, and makes the shrines, towers and labs travel destinations (a stable is shown but never travelled to). Nothing is saved and no tower is activated, so the map fog stays as it is.", "Mostra tutti i santuari, le torri, le stalle e i laboratori antichi sulla mappa e rende santuari, torri e laboratori mete di viaggio (una stalla è solo mostrata). Nulla viene salvato e nessuna torre viene attivata: la nebbia della mappa resta com'è.")
T("Show shrines and towers", "Mostra santuari e torri")
Loading