Add PC Port settings to legit start menu (#1217)

* decompiler: support adding new strings to the game_text.txt file

* gsrc: expand the pckernel type and functions to work better with the menu

* gsrc: add new text-ids

* gsrc: add new macros to help with menu code

* gsrc: make a new type to generalize their list menu options

* gsrc: add new menu options and enums

* gsrc: cleanup and refactor the list menu option drawing code

this allows us to easily add a new list menu option...well as easy as the rest is atleast (setting up static lists properly, etc)

* gsrc: add and cleanup handling of new menu options

* scripts: add checks with nice error messages for user facing taskfile recipes

* lint: formatting

* address simple feedback

* gsrc: move modified files to `pc/` folder

* gsrc: revert changes to originally decompiled files

* gsrc: move modified and new files to `goal_src/pc` folder

* gsrc: update paths in `all_files.gc`
This commit is contained in:
Tyler Wilding 2022-03-10 19:25:01 -05:00 committed by GitHub
parent 2a78d0a190
commit b21f0d3397
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 7547 additions and 88 deletions

View file

@ -6,17 +6,29 @@ includes:
tasks:
# GENERAL
extract-jak1:
preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/decompiler{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate decompiler executable -- Have you compiled in release mode?"
cmds:
- '{{.DECOMP_BIN_RELEASE_DIR}}/decompiler "./decompiler/config/jak1_ntsc_black_label.jsonc" "./iso_data" "./decompiler_out" "decompile_code=false"'
boot-game:
preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
cmds:
- "{{.GK_BIN_RELEASE_DIR}}/gk -boot -fakeiso -debug -v"
run-game:
preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/gk{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate runtime executable -- Have you compiled in release mode?"
cmds:
- "{{.GK_BIN_RELEASE_DIR}}/gk -fakeiso -debug -v"
repl:
env:
OPENGOAL_DECOMP_DIR: "jak1/"
preconditions:
- sh: test -f {{.DECOMP_BIN_RELEASE_DIR}}/goalc{{.EXE_FILE_EXTENSION}}
msg: "Couldn't locate compiler executable -- Have you compiled in release mode?"
cmds:
- "{{.GOALC_BIN_RELEASE_DIR}}/goalc"
# DEVELOPMENT

View file

@ -615,7 +615,7 @@ std::string ObjectFileDB::process_tpages(TextureDB& tex_db) {
return result;
}
std::string ObjectFileDB::process_game_text_files(GameTextVersion version) {
std::string ObjectFileDB::process_game_text_files(const Config& cfg) {
lg::info("- Finding game text...");
std::string text_string = "COMMON";
Timer timer;
@ -627,7 +627,7 @@ std::string ObjectFileDB::process_game_text_files(GameTextVersion version) {
for_each_obj([&](ObjectFileData& data) {
if (data.name_in_dgo.substr(1) == text_string) {
file_count++;
auto statistics = process_game_text(data, version);
auto statistics = process_game_text(data, cfg.text_version);
string_count += statistics.total_text;
char_count += statistics.total_chars;
if (text_by_language_by_id.find(statistics.language) != text_by_language_by_id.end()) {
@ -643,7 +643,7 @@ std::string ObjectFileDB::process_game_text_files(GameTextVersion version) {
if (text_by_language_by_id.empty()) {
return {};
}
return write_game_text(text_by_language_by_id);
return write_game_text(cfg, text_by_language_by_id);
}
std::string ObjectFileDB::process_game_count_file() {

View file

@ -99,7 +99,7 @@ class ObjectFileDB {
std::string process_tpages(TextureDB& tex_db);
std::string process_game_count_file();
std::string process_game_text_files(GameTextVersion version);
std::string process_game_text_files(const Config& cfg);
ObjectFileData& lookup_record(const ObjectFileRecord& rec);
DecompilerTypeSystem dts;

View file

@ -224,6 +224,19 @@ Config read_config_file(const std::string& path_to_config_file,
config.levels_to_extract = inputs_json.at("levels_to_extract").get<std::vector<std::string>>();
config.levels_extract = cfg.at("levels_extract").get<bool>();
// get new strings
if (!cfg.contains("new_strings_file")) {
return config;
}
auto new_strings_json = read_json_file_from_config(cfg, "new_strings_file");
config.new_strings_same_across_langs = new_strings_json.at("same_across_languages")
.get<std::unordered_map<std::string, std::string>>();
config.new_strings_different_across_langs =
new_strings_json.at("different_across_languages")
.get<std::unordered_map<std::string, std::vector<std::string>>>();
return config;
}

View file

@ -131,6 +131,9 @@ struct Config {
std::unordered_map<std::string, std::vector<StackStructureHint>>
stack_structure_hints_by_function;
std::unordered_map<std::string, std::string> new_strings_same_across_langs;
std::unordered_map<std::string, std::vector<std::string>> new_strings_different_across_langs;
std::unordered_map<std::string, int> bad_format_strings;
std::vector<std::string> levels_to_extract;

View file

@ -856,10 +856,10 @@
(max 116)
)
;; GAME-TEXT-ID ENUM BEGINS
(defenum game-text-id
:type uint32
:bitfield #f
;; GAME-TEXT-ID ENUM BEGINS
(zero 0)
(one 1)
(confirm #x103)
@ -1300,8 +1300,8 @@
(inc #xf10)
(europe #xf11)
)
;; GAME-TEXT-ID ENUM ENDS
)
;; ----------------------

View file

@ -77,6 +77,7 @@
"stack_structures_file": "decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc",
"hacks_file": "decompiler/config/jak1_ntsc_black_label/hacks.jsonc",
"inputs_file": "decompiler/config/jak1_ntsc_black_label/inputs.jsonc",
"new_strings_file": "decompiler/config/jak1_ntsc_black_label/new_strings.jsonc",
// optional: a predetermined object file name map from a file.
// this will make decompilation naming consistent even if you only run on some objects.

View file

@ -488,7 +488,7 @@
"draw-bones-merc": [1, 3, 5, 7, 8, 10, 11, 12, 13],
"(anon-function 48 lavatube-energy)": [13],
"generic-tie-execute": [4, 9],
"generic-merc-execute-all":[3,7, 12]
"generic-merc-execute-all": [3, 7, 12]
},
// Sometimes the game might use format strings that are fetched dynamically,

View file

@ -2083,18 +2083,14 @@
["L44", "float", true]
],
"ocean-mid": [
["L150", "vu-function"]
],
"ocean-mid": [["L150", "vu-function"]],
"generic-merc": [
["L161", "(inline-array invinitdata)", 8],
["L162", "vu-function"]
],
"generic-vu0": [
["L1", "vu-function"]
],
"generic-vu0": [["L1", "vu-function"]],
"generic-vu1": [
["L8", "vector4w"],
@ -2102,18 +2098,14 @@
["L10", "vu-function"]
],
"generic-effect": [
["L95", "generic-consts"]
],
"generic-effect": [["L95", "generic-consts"]],
"shadow-vu1": [
["L5", "vu-function"],
["L6", "shadow-vu1-gifbuf-template"]
],
"generic-vu0": [
["L1", "vu-function"]
],
"generic-vu0": [["L1", "vu-function"]],
// please do not add things after this entry! git is dumb.
"object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": []

View file

@ -0,0 +1,56 @@
{
"same_across_languages": {
"1008": "UK ENGLISH",
"1009": "PORTUGUÊS",
"1010": "SUOMALAINEN",
"1011": "SVENSKA",
"1012": "DANSK",
"1013": "NORSK",
"1014": "KOREAN",
"1015": "RUSSIAN",
"1022": "4:3",
"1023": "5:4",
"1024": "16:9",
"1025": "21:9",
"1026": "32:9",
"1027": "640X480",
"1028": "800X600",
"1029": "1024X768",
"1030": "1280X960",
"1031": "1600X1200",
"1032": "960X768",
"1033": "1280X1024",
"1034": "1500X1200",
"1035": "854X480",
"1036": "1280X720",
"1037": "1920X1080",
"1038": "2560X1440",
"1039": "2880X1620",
"1040": "3840X2160",
"1041": "5120X2880",
"1042": "2560X1080",
"1043": "3120X1440",
"1044": "3200X1440",
"1045": "3440X1440",
"1046": "3840X1600",
"1047": "5120X2160",
"1048": "5120X1440"
},
// will pad the rest of the array with 'TODO' placeholder
"different_across_languages": {
"1000": ["RESOLUTION"],
"1001": ["DISPLAY MODE"],
"1002": ["LETTERBOX"],
"1003": ["SUBTITLES"],
"1004": ["SUBTITLE SPEAKER"],
"1005": ["DISCORD RPC"],
"1006": ["LANGUAGE OPTIONS"],
"1007": ["SUBTITLE LANGUAGE"],
"1016": ["ON"],
"1017": ["OFF"],
"1018": ["AUTO"],
"1019": ["BORDERLESS"],
"1020": ["FULLSCREEN"],
"1021": ["WINDOWED"]
}
}

View file

@ -3069,9 +3069,7 @@
"(exit target-racing-death)": [[16, "event-message-block"]],
"(anon-function 17 racer-states)": [
[16, "joint-exploder-tuning"]
],
"(anon-function 17 racer-states)": [[16, "joint-exploder-tuning"]],
"(code target-racing-death)": [
[16, "event-message-block"],
@ -5472,9 +5470,7 @@
[48, "eye"]
],
"ocean-near-add-matrices": [
[16, "matrix"]
],
"ocean-near-add-matrices": [[16, "matrix"]],
"placeholder-do-not-add-below!": []
}

View file

@ -4023,9 +4023,7 @@
[251, "a0", "process-drawable"]
],
"(anon-function 46 racer-states)": [
[[4, 32], "v1", "target"]
],
"(anon-function 46 racer-states)": [[[4, 32], "v1", "target"]],
"(anon-function 45 racer-states)": [
[19, "a0", "target"],
@ -7275,9 +7273,7 @@
[47, "v1", "matrix"]
],
"ocean-near-add-constants": [
[3, "a0", "dma-packet"]
],
"ocean-near-add-constants": [[3, "a0", "dma-packet"]],
"draw-ocean-near": [
[2, "a0", "dma-packet"],
@ -7342,7 +7338,7 @@
[24, "a0", "dma-packet"]
],
"draw-bones-generic-merc":[
"draw-bones-generic-merc": [
[11, "v1", "generic-merc-ctrl"],
[198, "v1", "generic-merc-ctrl"],
[274, "a0", "generic-merc-ctrl"],
@ -7356,7 +7352,7 @@
],
"generic-merc-execute-all": [
[[165,170], "v1", "terrain-context"],
[[165, 170], "v1", "terrain-context"],
[92, "a0", "terrain-context"],
[96, "v1", "terrain-context"],
[100, "v1", "terrain-context"],
@ -7374,7 +7370,7 @@
[32, "a0", "terrain-context"]
],
"generic-work-init":[
"generic-work-init": [
[10, "a0", "terrain-context"],
[13, "a0", "terrain-context"],
[16, "a0", "terrain-context"],

View file

@ -134,17 +134,18 @@ GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version)
}
std::string write_game_text(
const Config& cfg,
const std::unordered_map<int, std::unordered_map<int, std::string>>& data) {
// first sort languages:
std::vector<int> langauges;
std::vector<int> languages;
for (const auto& lang : data) {
langauges.push_back(lang.first);
languages.push_back(lang.first);
}
std::sort(langauges.begin(), langauges.end());
std::sort(languages.begin(), languages.end());
// build map
std::map<int, std::vector<std::string>> text_by_id;
for (auto lang : langauges) {
for (auto lang : languages) {
for (auto& text : data.at(lang)) {
text_by_id[text.first].push_back(text.second);
}
@ -152,7 +153,7 @@ std::string write_game_text(
// write!
std::string result; // = "\xEF\xBB\xBF"; // UTF-8 encode (don't need this anymore)
result += fmt::format("(language-count {})\n", langauges.size());
result += fmt::format("(language-count {})\n", languages.size());
result += "(group-name \"common\")\n";
for (auto& x : text_by_id) {
result += fmt::format("(#x{:04x}\n ", x.first);
@ -162,6 +163,28 @@ std::string write_game_text(
result += ")\n\n";
}
// add our own custom text additions from new_strings.jsonc
// - first add the strings that are the same across all languages
for (auto const& [key, val] : cfg.new_strings_same_across_langs) {
result += fmt::format("(#x{}\n ", key);
for (int i = 0; i < languages.size(); i++) {
result += fmt::format("\"{}\"\n ", val);
}
result += ")\n\n";
}
// - now add the ones that are different, if they do not have all languages defined, pad with
// placeholders
for (auto const& [key, val] : cfg.new_strings_different_across_langs) {
result += fmt::format("(#x{}\n ", key);
for (auto const& str : val) {
result += fmt::format("\"{}\"\n ", str);
}
for (int i = 0; i < languages.size() - val.size(); i++) {
result += fmt::format("\"{}\"\n ", "TODO");
}
result += ")\n\n";
}
return result;
}
} // namespace decompiler

View file

@ -5,6 +5,7 @@
namespace decompiler {
struct ObjectFileData;
struct Config;
struct GameTextResult {
int total_text = 0;
@ -15,5 +16,6 @@ struct GameTextResult {
GameTextResult process_game_text(ObjectFileData& data, GameTextVersion version);
std::string write_game_text(
const Config& cfg,
const std::unordered_map<int, std::unordered_map<int, std::string>>& data);
} // namespace decompiler

View file

@ -181,7 +181,7 @@ int main(int argc, char** argv) {
}
if (config.process_game_text) {
auto result = db.process_game_text_files(config.text_version);
auto result = db.process_game_text_files(config);
if (!result.empty()) {
file_util::write_text_file(file_util::get_file_path({"assets", "game_text.txt"}), result);
}

View file

@ -42,7 +42,7 @@
"goal_src/engine/dma/dma-buffer.gc"
"goal_src/engine/dma/dma-bucket.gc"
"goal_src/engine/dma/dma-disasm.gc"
"goal_src/engine/pc/pckernel-h.gc" ;; added
"goal_src/pc/pckernel-h.gc" ;; added
"goal_src/engine/ps2/pad.gc"
"goal_src/engine/gfx/hw/gs.gc"
"goal_src/engine/gfx/hw/display-h.gc"
@ -154,7 +154,7 @@
"goal_src/engine/load/load-dgo.gc"
"goal_src/engine/load/ramdisk.gc"
"goal_src/engine/sound/gsound.gc"
"goal_src/engine/pc/pckernel.gc" ;; added
"goal_src/pc/pckernel.gc" ;; added
"goal_src/engine/math/transformq.gc"
"goal_src/engine/collide/collide-func.gc"
"goal_src/engine/anim/joint.gc"
@ -217,7 +217,7 @@
"goal_src/engine/level/level-info.gc"
"goal_src/engine/level/level.gc"
"goal_src/engine/ui/text.gc"
"goal_src/engine/pc/subtitle.gc" ;; added
"goal_src/pc/subtitle.gc" ;; added
"goal_src/engine/collide/collide-probe.gc"
"goal_src/engine/collide/collide-frag.gc"
"goal_src/engine/collide/collide-mesh.gc"

View file

@ -4356,9 +4356,9 @@
(function "Custom" #f (lambda () (set-aspect! *pc-settings* (-> *pc-settings* aspect-custom-x) (-> *pc-settings* aspect-custom-y))))
)
(menu "Fullscreen"
(function "Windowed" #f (lambda () (set-fullscreen! *pc-settings* #f)))
(function "Fullscreen" #f (lambda () (set-fullscreen! *pc-settings* #t)))
(function "Borderless" #f (lambda () (set-fullscreen! *pc-settings* 'borderless)))
(function "Windowed" #f (lambda () (set-display-mode! *pc-settings* 'windowed)))
(function "Fullscreen" #f (lambda () (set-display-mode! *pc-settings* 'fullscreen)))
(function "Borderless" #f (lambda () (set-display-mode! *pc-settings* 'borderless)))
)
(menu "Sizes"
(function "640 x 480" #f (lambda () (set-size! *pc-settings* 640 480)))

View file

@ -255,4 +255,3 @@

View file

@ -2156,4 +2156,3 @@

View file

@ -1381,4 +1381,3 @@

View file

@ -2518,4 +2518,3 @@
)
)

View file

@ -11,10 +11,10 @@
;; These ID's are shared with short spoken audio clips (daxter hints)
;; most (all?) of the daxter clips don't have text strings.
;; GAME-TEXT-ID ENUM BEGINS
(defenum game-text-id
:type uint32
:bitfield #f
;; GAME-TEXT-ID ENUM BEGINS
(zero 0)
(one 1)
(confirm #x103)
@ -455,8 +455,9 @@
(inc #xf10)
(europe #xf11)
)
;; GAME-TEXT-ID ENUM ENDS
)
;; an individual string.
(deftype game-text (structure)

View file

@ -22,9 +22,9 @@
;; allocate the game text heap if it isn't already allocated.
(when (= 0 (-> *common-text-heap* base))
(let ((heap *common-text-heap*))
(set! (-> heap base) (malloc 'global 34816))
(set! (-> heap base) (malloc 'global 64000))
(set! (-> heap current) (-> heap base))
(set! (-> heap top-base) (&+ (-> heap base) 34816))
(set! (-> heap top-base) (&+ (-> heap base) 64000))
(set! (-> heap top) (-> heap top-base))
)
)

View file

@ -1568,7 +1568,6 @@
"dma/dma-buffer.gc"
"dma/dma-bucket.gc"
"dma/dma-disasm.gc"
"pc/pckernel-h.gc" ;; added
"ps2/pad.gc"
"gfx/hw/gs.gc"
"gfx/hw/display-h.gc"
@ -1583,7 +1582,6 @@
"gfx/decomp-h.gc"
"gfx/hw/display.gc"
"engine/connect.gc"
"ui/text-h.gc"
"game/settings-h.gc"
"gfx/capture.gc"
"debug/memory-usage-h.gc"
@ -1673,14 +1671,12 @@
"camera/cam-update-h.gc"
"debug/assert-h.gc"
"ui/hud-h.gc"
"ui/progress-h.gc"
"ps2/rpc-h.gc"
"nav/path-h.gc"
"nav/navigate-h.gc"
"load/load-dgo.gc"
"load/ramdisk.gc"
"sound/gsound.gc"
"pc/pckernel.gc" ;; added
"math/transformq.gc"
"collide/collide-func.gc"
"anim/joint.gc"
@ -1743,7 +1739,6 @@
"level/level-info.gc"
"level/level.gc"
"ui/text.gc"
"pc/subtitle.gc" ;; added
"collide/collide-probe.gc"
"collide/collide-frag.gc"
"collide/collide-mesh.gc"
@ -1809,10 +1804,7 @@
"game/crates.gc"
"ui/hud.gc"
"ui/hud-classes.gc"
"ui/progress/progress-static.gc"
"ui/progress/progress-part.gc"
"ui/progress/progress-draw.gc"
"ui/progress/progress.gc"
"ui/credits.gc"
"game/projectiles.gc"
"gfx/ocean/ocean.gc"
@ -1880,3 +1872,16 @@
"out/iso/0SUBTIT.TXT"
)
)
;; Custom or Modified Code
(goal-src "pc/pckernel-h.gc" "dma-disasm")
(goal-src "pc/pckernel.gc" "gsound")
(goal-src "pc/subtitle.gc" "text")
(goal-src "pc/engine/ui/text-h.gc" "connect")
(goal-src "pc/engine/ui/progress-h.gc" "hud-h")
(goal-src "pc/engine/ui/progress/progress-static.gc" "hud-classes")
(goal-src "pc/engine/ui/progress/progress-draw.gc" "progress-part")
(goal-src "pc/engine/ui/progress/progress.gc" "progress-draw")

View file

@ -510,6 +510,10 @@
`(+ ,var 1)
)
(defmacro inc (val)
"Increments a value"
`(1+ ,val))
(defmacro +! (place amount)
`(set! ,place (+ ,place ,amount))
)
@ -522,6 +526,10 @@
`(- ,var 1)
)
(defmacro dec (val)
"Decrements a value"
`(1- ,val))
(defmacro -! (place amount)
`(set! ,place (- ,place ,amount))
)
@ -552,14 +560,17 @@
(defmacro not! (var)
`(set! ,var (not ,var)))
(defmacro true! (var)
`(set! ,var #t))
(defmacro false! (var)
`(set! ,var #f))
(defmacro minmax (val minval maxval)
`(max (min ,val ,maxval) ,minval)
)
(defmacro fminmax (val minval maxval)
`(fmax (fmin ,val ,maxval) ,minval)
)
@ -573,6 +584,7 @@
(defmacro maxmin (val minval maxval)
`(min (max ,val ,maxval) ,minval)
)
(defmacro fmaxmin (val minval maxval)
`(fmin (fmax ,val ,maxval) ,minval)
)
@ -756,6 +768,30 @@
`(new 'debug 'pair ,a ,b)
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ARRAYS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro first-arr (coll)
"Returns the first element in an array"
`(-> ,coll 0))
(defmacro last-arr (coll)
"Returns the last element in an array"
`(-> ,coll (dec (length ,coll))))
(defmacro last-idx-arr (coll)
"Returns the index of the last element in an array"
`(dec (length ,coll)))
(defmacro arr-idx-of (coll val def)
"Returns the index of an item in an array, returns <def> if is nothing is found."
`(block find-element
(dotimes (i (length ,coll))
(if (= ,val (-> ,coll i))
(return-from find-element i)))
,def))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; METHOD STUFF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

3
goal_src/pc/README.md Normal file
View file

@ -0,0 +1,3 @@
This directory contains either completely new source code files OR files we've significantly modified from the original
Please try to preserve the original file path (with the addition of `pc/`) to make regression testing easy if it falls into the category of the latter.

View file

@ -0,0 +1,271 @@
;;-*-Lisp-*-
(in-package goal)
;; name: progress-h.gc
;; name in dgo: progress-h
;; dgos: GAME, ENGINE
(defenum progress-screen
:type int64
(invalid -1)
(fuel-cell 0)
(money 1)
(buzzer 2)
(settings 3)
(game-settings 4)
(graphic-settings 5)
(sound-settings 6)
(memcard-no-space 7)
(memcard-not-inserted 8)
(memcard-not-formatted 9)
(memcard-format 10)
(memcard-data-exists 11)
(memcard-loading 12)
(memcard-saving 13)
(memcard-formatting 14)
(memcard-creating 15)
(load-game 16)
(save-game 17)
(save-game-title 18)
(memcard-insert 19)
(memcard-error-loading 20)
(memcard-error-saving 21)
(memcard-removed 22)
(memcard-no-data 23)
(memcard-error-formatting 24)
(memcard-error-creating 25)
(memcard-auto-save-error 26)
(title 27)
(settings-title 28)
(auto-save 29)
(pal-change-to-60hz 30)
(pal-now-60hz 31)
(no-disc 32)
(bad-disc 33)
(quit 34)
;; custom
(language-options 35)
)
(defun-extern activate-progress process progress-screen none)
(defun-extern hide-progress-screen none)
(defun-extern hide-progress-icons none)
(declare-type level-tasks-info basic)
(define-extern *level-task-data* (array level-tasks-info))
(define-extern *level-task-data-remap* (array int32))
(declare-type count-info structure)
(defun-extern get-game-count int count-info)
(defun-extern progress-allowed? symbol)
(defun-extern pause-allowed? symbol)
(declare-type progress process)
(defun-extern deactivate-progress none)
(defun-extern calculate-completion progress float)
(defun-extern make-current-level-available-to-progress none)
;; DECOMP BEGINS
(deftype count-info (structure)
((money-count int32 :offset-assert 0)
(buzzer-count int32 :offset-assert 4)
)
:pack-me
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
(deftype game-count-info (basic)
((length int32 :offset-assert 4)
(data count-info :inline :dynamic :offset-assert 8)
)
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
(deftype task-info-data (basic)
((task-id game-task :offset-assert 4)
(task-name game-text-id 4 :offset-assert 8)
(text-index-when-resolved int32 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x1c
:flag-assert #x90000001c
)
(deftype level-tasks-info (basic)
((level-name-id game-text-id :offset-assert 4)
(text-group-index int32 :offset-assert 8)
(nb-of-tasks int32 :offset-assert 12)
(buzzer-task-index int32 :offset-assert 16)
(task-info task-info-data 8 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x34
:flag-assert #x900000034
)
(deftype game-option (basic)
((option-type uint64 :offset-assert 8)
(name game-text-id :offset-assert 16)
(scale basic :offset-assert 20)
(param1 float :offset-assert 24)
(param2 float :offset-assert 28)
(param3 int32 :offset-assert 32)
(value-to-modify pointer :offset-assert 36)
)
:method-count-assert 9
:size-assert #x28
:flag-assert #x900000028
)
;; new custom type to extend the very limited progress-menu system
;; the user can only interact with one element at a time, so a single global is sufficient
(deftype progress-menu-list-tracker (basic)
((direction symbol :offset-assert 4) ; 'left | 'right
(transition? symbol :offset-assert 8) ; '??
(x-offset int32 :offset-assert 12)
(selected-index int32 :offset-assert 16)))
;; why a new global? because i dont want to modify the type below....but that would get me what i want as well!
(define *progress-menu-list-tracker* (new 'static 'progress-menu-list-tracker))
(deftype progress (process)
((current-debug-string int32 :offset-assert 112)
(current-debug-language int32 :offset-assert 116)
(current-debug-group int32 :offset-assert 120)
(in-out-position int32 :offset-assert 124)
(display-state progress-screen :offset-assert 128)
(next-display-state progress-screen :offset-assert 136)
(option-index int32 :offset-assert 144)
(selected-option basic :offset-assert 148)
(completion-percentage float :offset-assert 152)
(ready-to-run basic :offset-assert 156)
(display-level-index int32 :offset-assert 160)
(next-level-index int32 :offset-assert 164)
(task-index int32 :offset-assert 168)
(in-transition basic :offset-assert 172)
(last-in-transition basic :offset-assert 176)
(force-transition basic :offset-assert 180)
(stat-transition basic :offset-assert 184)
(level-transition int32 :offset-assert 188)
(language-selection uint64 :offset-assert 192)
; true = left | false = right
(language-direction symbol :offset-assert 200)
(language-transition symbol :offset-assert 204)
(language-x-offset int32 :offset-assert 208)
(sides-x-scale float :offset-assert 212)
(sides-y-scale float :offset-assert 216)
(left-x-offset int32 :offset-assert 220)
(right-x-offset int32 :offset-assert 224)
(button-scale float :offset-assert 228)
(slot-scale float :offset-assert 232)
(left-side-x-scale float :offset-assert 236)
(left-side-y-scale float :offset-assert 240)
(right-side-x-scale float :offset-assert 244)
(right-side-y-scale float :offset-assert 248)
(small-orb-y-offset int32 :offset-assert 252)
(big-orb-y-offset int32 :offset-assert 256)
(transition-offset int32 :offset-assert 260)
(transition-offset-invert int32 :offset-assert 264)
(transition-percentage float :offset-assert 268)
(transition-percentage-invert float :offset-assert 272)
(transition-speed float :offset-assert 276)
(total-nb-of-power-cells int32 :offset-assert 280)
(total-nb-of-orbs int32 :offset-assert 284)
(total-nb-of-buzzers int32 :offset-assert 288)
(card-info mc-slot-info :offset-assert 292)
(last-option-index-change time-frame :offset-assert 296)
(video-mode-timeout time-frame :offset-assert 304)
(display-state-stack progress-screen 5 :offset-assert 312)
(option-index-stack int32 5 :offset-assert 352)
(display-state-pos int32 :offset-assert 372)
(nb-of-icons int32 :offset-assert 376)
(icons hud-icon 6 :offset-assert 380)
(max-nb-of-particles int32 :offset-assert 404)
(nb-of-particles int32 :offset-assert 408)
(particles hud-particle 40 :offset-assert 412)
(particle-state int32 40 :offset-assert 572)
)
:heap-base #x270
:method-count-assert 59
:size-assert #x2dc
:flag-assert #x3b027002dc
(:methods
(dummy-14 (_type_) none 14)
(dummy-15 (_type_) none 15)
(dummy-16 (_type_) none 16)
(draw-progress (_type_) none 17)
(dummy-18 () none 18)
(dummy-19 (_type_) symbol 19)
(hidden? (_type_) symbol 20)
(adjust-sprites (_type_) none 21)
(adjust-icons (_type_) none 22)
(adjust-ratios (_type_ symbol symbol) none 23)
(draw-fuel-cell-screen (_type_ int) none 24)
(draw-money-screen (_type_ int) none 25)
(draw-buzzer-screen (_type_ int) none 26)
(draw-notice-screen (_type_) none 27)
(draw-options (_type_ int int float) none 28)
(dummy-29 (_type_) none 29)
(respond-progress (_type_) none 30)
(dummy-31 (_type_) none 31)
(dummy-32 (_type_) symbol 32)
(initialize-icons (_type_) none 33)
(initialize-particles (_type_) none 34)
(draw-memcard-storage-error (_type_ font-context) none 35)
(draw-memcard-data-exists (_type_ font-context) none 36)
(draw-memcard-no-data (_type_ font-context) none 37)
(draw-memcard-accessing (_type_ font-context) none 38)
(draw-memcard-insert (_type_ font-context) none 39)
(draw-memcard-file-select (_type_ font-context) none 40)
(draw-memcard-auto-save-error (_type_ font-context) none 41)
(draw-memcard-removed (_type_ font-context) none 42)
(draw-memcard-error (_type_ font-context) none 43)
(dummy-44 (_type_) none 44)
(push! (_type_) none 45)
(pop! (_type_) none 46)
(dummy-47 (_type_) none 47)
(enter! (_type_ progress-screen int) none 48)
(draw-memcard-format (_type_ font-context) none 49)
(draw-auto-save (_type_ font-context) none 50)
(set-transition-progress! (_type_ int) none 51)
(set-transition-speed! (_type_) none 52)
(dummy-53 (_type_ progress-screen) progress-screen 53)
(draw-pal-change-to-60hz (_type_ font-context) none 54)
(draw-pal-now-60hz (_type_ font-context) none 55)
(draw-no-disc (_type_ font-context) none 56)
(draw-bad-disc (_type_ font-context) none 57)
(draw-quit (_type_ font-context) none 58)
)
(:states
progress-coming-in
progress-debug
progress-going-out
progress-gone
progress-normal
progress-waiting
)
)
(define *progress-process* (the-as (pointer progress) #f))
(define *progress-last-task-index* 0)
0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,560 @@
;;-*-Lisp-*-
(in-package goal)
;; name: text-h.gc
;; name in dgo: text-h
;; dgos: GAME, ENGINE
;; This file contains types related to game text.
;; Each game string is assigned an ID number.
;; This ID is used to lookup the string for the currently selected language.
;; These ID's are shared with short spoken audio clips (daxter hints)
;; most (all?) of the daxter clips don't have text strings.
(defenum game-text-id
:type uint32
:bitfield #f
;; GAME-TEXT-ID ENUM BEGINS
(zero 0)
(one 1)
(confirm #x103)
(press-to-talk #x104)
(press-to-use #x105)
(confirm-play #x106)
(play-again? #x107)
(quit #x108)
(pause #x109)
(sfx-volume #x10a)
(music-volume #x10b)
(speech-volume #x10c)
(language #x10d)
(vibrations #x10e)
(play-hints #x10f)
(center-screen #x110)
(on #x111)
(off #x112)
(move-dpad #x113)
(english #x114)
(french #x115)
(german #x116)
(spanish #x117)
(italian #x118)
(japanese #x119)
(press-to-trade-money #x11a)
(press-to-trade-money-oracle #x11b)
(press-to-warp #x11c)
(press-to-exit #x11d)
(press-to-talk-to-sage #x123)
(press-to-talk-to-assistant #x124)
(aspect-ratio #x125)
(video-mode #x126)
(game-options #x127)
(graphic-options #x128)
(sound-options #x129)
(4x3 #x12a)
(16x9 #x12b)
(60hz #x12c)
(50hz #x12d)
(game-title #x12e)
(hidden-power-cell #x12f) ;; why is this here??
(memcard-no-space #x130)
(memcard-not-inserted #x131)
(card-not-formatted-title #x132)
(memcard-space-requirement1 #x133)
(memcard-space-requirement2 #x134)
(card-not-formatted-msg #x135)
(saving-data #x136)
(loading-data #x137)
(do-not-remove-mem-card #x138)
(overwrite? #x139)
(format? #x13a)
(yes #x13c)
(no #x13d)
(back #x13e)
(continue-without-saving #x13f)
(select-file-to-save #x140)
(select-file-to-load #x141)
(save-data-already-exists #x142)
(insert-memcard #x143)
(continue? #x144)
(load-game #x14b)
(save-game #x14c)
(formatting #x14d)
(creating-save-data #x14e)
(empty #x14f)
(options #x150)
(error-loading #x151)
(error-saving #x152)
(error-formatting #x153)
(error-creating-data #x154)
(memcard-removed #x156)
(autosave-disabled-title #x157)
(autosave-disabled-msg #x158)
(no-save-data #x159)
(create-save-data? #x15a)
(check-memcard #x15b)
(new-game #x15c)
(back? #x15d)
(ok #x15e)
(exit-demo #x15f)
(autosave-warn-title #x160)
(autosave-warn-msg #x161)
(task-completed #x162)
(check-memcard-and-retry #x163)
(screen-change-to-60hz #x164)
(screen-60hz-warn-support #x165)
(screen-60hz-warn-timer #x166)
(screen-now-60hz #x167)
(screen-60hz-keep? #x168)
(warp-gate-use-dpad #x169)
(no-disc-title #x16a)
(no-disc-msg #x16b)
(bad-disc-title #x16c)
(bad-disc-msg #x16d)
(press-start #x16e)
(quit-game #x16f)
(quit? #x170)
(total-collected #x171)
(village1-mayor-money #x200)
(vollage1-uncle-money #x201)
(village1-yakow-herd #x202)
(village1-yakow-return #x203)
(village1-oracle #x204)
(beach-ecorocks #x205)
(beach-flutflut-push #x206)
(beach-flutflut-meet #x207)
(beach-pelican #x208)
(beach-seagull #x209)
(beach-cannon #x20a)
(beach-buzzer #x20b)
(jungle-lurkerm-connect #x20c)
(jungle-tower #x20d)
(jungle-eggtop #x20e)
(jungle-plant #x20f)
(jungle-fishgame #x210)
(misty-muse-catch #x211)
(misty-muse-return #x212)
(misty-boat #x213)
(misty-cannon #x214)
(misty-return-to-pool #x215) ;; task name??
(misty-find-transpad #x216) ;; task name?
(misty-balloon-lurkers #x217)
(village1-level-name #x220)
(beach-level-name #x221)
(jungle-level-name #x222)
(misty-level-name #x223)
(beach-seagull-get #x22e)
(jungle-lurkerm-unblock #x22f)
(jungle-lurkerm-return #x230)
(MISSING-orb-hint #x233)
(beach-eco-rock-increment #x239)
(jungle-maindoor-hint #x23c)
(firecanyon-not-enough-cells #x24f)
(sidekick-hint-orb-cache-top #x251)
(jungle-precursorbridge-hint #x25b)
(daxter-launcher-no-eco #x25c)
(jungle-mirrors-completion-talk-to-mayor #x25e)
(beach-gimmie #x262)
(beach-sentinel #x263)
(jungle-canyon-end #x264)
(jungle-temple-door #x265)
(misty-bike-jump #x266)
(misty-eco-challenge #x267)
(beach-seagull-chased-one #x268)
(beach-seagull-chased-two #x26a)
(beach-seagull-chased-three #x26b)
(beach-seagull-chased-four #x26c)
(misty-daxter-scared #x26f)
(beach-seagulls-avalanche #x273)
(beach-pelican-quick-get-cell #x274)
(beach-flutflutegg-hint #x275)
(sidekick-hint-fish-powerup #x278)
(misty-racer-hit-the-ballon-lurkers #x27e)
(misty-daxter-hit-lurkers-not-mines #x27f)
(sidekick-speech-hint-crate-darkeco1 #x281)
(sidekick-speech-crate-steel-break1 #x283)
(sidekick-speech-hint-crate-iron #x284)
(sidekick-speech-hint-crate-steel #x285)
(beach-collectors-unblocked #x288)
(misty-stopped-lurkers-at-silo #x28a)
(misty-stopped-balloon-lurkers #x28b)
(jungleb-eco-vents-opened #x289)
(sidekick-speech-crate-steel-break2 #x28e)
(sidekick-speech-hint-crate-darkeco2 #x28f)
(daxter-screaming-jump #x290)
(daxter-wahoo-jump #x291)
(daxter-get-some #x292)
(collectables-scout-flies-red-boxes #x295)
(found-all-scout-flies #x296)
(yakow-owed-powercell #x297)
(jungle-mirrors-tutorial #x29c)
(jungle-mirrors-break-the-mirror-jak #x29d)
(jungle-mirrors-go-to-the-next-tower #x29f)
(jungle-mirrors-follow-the-beam #x2a0)
(misty-teetertotter-bonk-dax-tutorial #x2a4)
(sidekick-hint-misty-get-red-eco #x2a5)
(red-eco-tutorial #x2a6)
(daxter-blue-eco-plat-tutorial #x2a7)
(fish? #x2a9)
(misty-bone-bridge-hint #x2aa)
(beach-grottopole-increment #x2af)
(firecanyon-collect-cells-collected #x2b1)
(firecanyon-collect-cells-collected-reminder #x2b2)
(firecanyon-collect-cells-text #x2b3)
(caught #x2b4)
(missed #x2b5)
(lose! #x2b6)
(village2-gambler-money #x300)
(village2-geologist-money #x301)
(village2-warrior-money #x302)
(village2-oracle-money #x303)
(swamp-tether #x304)
(swamp-flutflut #x307)
(swamp-billy #x309)
(sunken-elevator-raise #x30a)
(sunken-elevator-get-to-roof #x30b)
(sunken-pipe #x30c)
(sunken-climb-tube #x30d) ;; task name?
(sunken-pool #x30e) ;; task name?
(sunken-platforms #x30f)
(rolling-moles #x310)
(rolling-moles-return #x311)
(rolling-robbers #x312)
(rolling-race #x313)
(rolling-race-return #x314)
(rolling-lake #x315)
(rolling-plants #x316)
(unknown-buzzers #x317)
(village2-level-name #x319)
(rolling-level-name #x31b)
(swamp-level-name #x31c)
(sunken-level-name #x31d)
(ogre-level-name #x31e)
(swamp-battle #x321)
(sunken-bottom #x322) ;; task name?
(reach-center #x323) ;; task name?
(rolling-ring-chase-1 #x324)
(rolling-ring-chase-2 #x325)
(sunken-kiera-you-raised-a-piece-of-lpc #x326)
(rolling-beat-lurkers #x327)
(swamp-finished-with-flutflut #x328)
(rolling-race-beat-record #x335)
(sidekick-speech-hint-rolling-crate-darkeco #x336)
(rolling-lightning-moles-completion #x338)
(rolling-dark-plants-location-hint #x339)
(rolling-dark-plants-hint #x33a)
(rolling-flying-lurker-intro #x33c)
(rolling-ring-hint-one-ring-down #x33f)
(rolling-ring-hint-be-quick-to-next #x340)
(rolling-ring-hint-be-quick-all #x341)
(sunken-pipegame-follow-it #x343)
(sunken-helix-daxter-bad-feeling #x344)
(sunken-blue-eco-charger-hint #x345)
(sunken-double-lurker-hint #x347)
(sunken-helix-daxter-eco-rising #x348)
(sunken-qbert-plat-hint #x34a)
(sunken-bully-dive-hint #x34b)
(sunken-take-it-easy-hot-pipes #x34e)
(sunken-blue-eco-charger-all-hint #x34d)
(swamp-tethers-advice-hint #x352)
(kermit-break-tongue #x357)
(swamp-rats-nest-hint #x358)
(daxter-you-can-shoot-with-yellow-eco #x359)
(kermit-run-away-jak #x35f)
(swamp-bats-hint #x364) ;; maybe we can duck the bats
(swamp-tethers-three-to-go #x365)
(swamp-tethers-two-to-go #x366)
(swamp-tethers-lefts-find-the-last #x367)
(flutflut-reminder #x368)
(sage-golfclap-i-have-low-expectations #x36a) ;; where was this said?
(swamp-tethers-completion-sage-precursor-arm #x36b)
(village2-warp-gate-reminder #x36f)
(village2-warp-gate-reminder-annoyed #x370)
(village2-warp-gate-reminder-very-annoyed #x371)
(village2-not-enough-cells-levitator #x36c)
(villlage2-levitator-cell-req-text #x372)
(rolling-race-time-string-prefix #x373)
(rolling-race-record-string-prefix #x374)
(rolling-race-new-record-string-prefix #x375)
(rolling-race-try-again-string #x376)
(rolling-race-start-race-aborted #x377) ;; double check this
(village3-miner-money #x400)
(village3-oracle-money #x401)
(snow-ram-3-left #x402)
(snow-ram-2-left #x403)
(snow-ram-1-left #x404)
(snow-fort #x405)
(snow-bunnies #x406)
(snow-open-door #x408) ;; task name?
(cave-robot-climb #x40e)
(cave-dark-climb #x40f) ;; destroy crystals
(cave-gnawers #x410)
(cave-dark-crystals #x411)
(village3-buzzer #x413)
(village3-level-name #x415)
(snowy-level-name #x417)
(cave-level-name #x419)
(lavatube-level-name #x41b)
(snow-eggtop #x421)
(cave-spider-tunnel #x423)
(cave-platforms #x424)
(cave-swing-poles #x426)
(assistant-lavatube-powercell-hint #x428)
(village3-gondola-malfunctioning #x429)
(village3-gondola-reactivated #x42a)
(snow-frozen-crate #x42b) ;; task name?
(snow-bumpers #x42c)
(dark-crystal-last-one #x432)
(daxter-maybe-you-can-shoot-better-goggles #x433)
(darkcave-light-crystal-low-light-hint #x437)
(darkcave-light-crystal-hint #x438)
(dark-crystal-run-away #x439)
(cave-trap-nest-hint #x440)
(snow-fort-reminder #x443)
(ram-boss-red-eco-hint #x444)
(ice-cube-hint #x448)
(snowy-turned-on-yellow-vents #x44c)
(village3-warp-gate-reminder #x452)
(village3-warp-gate-reminder=annoyed #x453)
(village3-warp-gate-reminder-very-annoyed #x454)
(lavatube-powercell-req-text #x455)
(fire-canyon-end #x500)
(fire-canyon-buzzer #x501)
(daxter-maybe-i-should-drive #x506)
(daxter-you-are-trying-to-avoid-dark-eco #x507)
(fire-canyon-level-name #x50c)
(fire-canyon-we-made-it #x515)
(collectables-theres-scout-flys-here-too #x516)
(ogre-end #x600)
(ogre-buzzer #x601)
(ogre-boss #x603)
(ogre-boss-killed #x604)
(assistant-voicebox-intro-ogre-race #x605)
(sidekick-speech-hint-ogre-race #x61c)
(assistant-finished-mountain-pass-race #x61d)
(lavatube-end #x700)
(lavatube-buzzer #x701)
(lavatube-shoot-the-spheres #x70d)
(lavatube-spheres-door-open #x710)
(citadel-buzzer #x800)
(citadel-level-name #x801)
(citadel-sage-blue #x802)
(citadel-sage-red #x803)
(citadel-sage-yellow #x804)
(citadel-sage-green #x805)
(citadel-break-generator-hint #x806)
(citadel-lurker-bunny-alert #x808)
(citadel-break-generators-reminder #x809)
(citadel-climb-plat-hint #x80c)
(daxter-dont-miss-the-next-launcher #x80d)
(daxter-land-on-the-next-launcher #x812)
(misty-battle-finished #x813)
(training-precursor-orbs #x901)
(training-power-cells #x902)
(training-assistant-found-scout-fly #x903)
(training-assistant-found-scout-fly-cell #x904)
(training-blue-eco-vent #x907)
(training-eco-green #x908)
(training-eco-blue #x909)
(training-more-eco-more-time #x90a)
(training-precursor-door #x90b)
(training-eco-opened-door #x90c)
(training-double-jump #x90e)
(sage-voicebox-hint-crate-iron #x917)
(training-warp-gate-blocked #x919)
(training-warp-gate-reminder #x91a)
(training-gimmie-task-name #x91b)
(training-buzzer-task-name #x91c)
(training-door-task-name #x91d)
(training-climb-task-name #x91e)
(training-level-name #x91f)
(inc #xf10)
(europe #xf11)
;; GAME-TEXT-ID ENUM ENDS
; PC Port TEXT
(progress-resolution #x1000)
(progress-display-mode #x1001)
(progress-letterbox #x1002)
(progress-subtitles #x1003)
(progress-subtitles-label-speaker #x1004)
(progress-discord-rpc #x1005)
(progress-language-options #x1006)
;; subtitle languages
(progress-subtitles-language #x1007)
(progress-subtitle-language-uk-english #x1008)
(progress-subtitle-language-portuguese #x1009)
(progress-subtitle-language-finnish #x1010)
(progress-subtitle-language-swedish #x1011)
(progress-subtitle-language-danish #x1012)
(progress-subtitle-language-norwegian #x1013)
(progress-subtitle-language-korean #x1014)
(progress-subtitle-language-russian #x1015)
(progress-subtitles-label-speaker-on #x1016)
(progress-subtitles-label-speaker-off #x1017)
(progress-subtitles-label-speaker-auto #x1018)
;; display modes
(progress-display-mode-borderless #x1019)
(progress-display-mode-fullscreen #x1020)
(progress-display-mode-windowed #x1021)
;; aspect ratios
(process-aspect-ratio-4x3 #x1022)
(process-aspect-ratio-5x4 #x1023)
(process-aspect-ratio-16x9 #x1024)
(process-aspect-ratio-21x9 #x1025)
(process-aspect-ratio-32x9 #x1026)
;; 4:3 resolutions
(process-res-4x3-640x480 #x1027)
(process-res-4x3-800x600 #x1028)
(process-res-4x3-1024x768 #x1029)
(process-res-4x3-1280x960 #x1030)
(process-res-4x3-1600x1200 #x1031)
;; 5:4 resolutions
(process-res-5x4-960x768 #x1032)
(process-res-5x4-1280x1024 #x1033)
(process-res-5x4-1500x1200 #x1034)
;; 16:9 resolutions
(process-res-16x9-854x480 #x1035)
(process-res-16x9-1280x720 #x1036)
(process-res-16x9-1920x1080 #x1037)
(process-res-16x9-2560x1440 #x1038)
(process-res-16x9-2880x1620 #x1039)
(process-res-16x9-3840x2160 #x1040)
(process-res-16x9-5120x2880 #x1041)
;; 21:9 resolutions
(process-res-21x9-2560x1080 #x1042)
(process-res-21x9-3120x1440 #x1043)
(process-res-21x9-3200x1440 #x1044)
(process-res-21x9-3440x1440 #x1045)
(process-res-21x9-3840x1600 #x1046)
(process-res-21x9-5120x2160 #x1047)
;; 32:9 resolutions
(process-res-32x9-5120x1440 #x1048)
)
;; an individual string.
(deftype game-text (structure)
((id game-text-id :offset-assert 0)
(text string :offset-assert 4)
)
:pack-me
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
;; A table of all strings.
(deftype game-text-info (basic)
((length int32 :offset-assert 4)
(language-id int32 :offset-assert 8)
(group-name string :offset-assert 12)
(data game-text :inline :dynamic :offset-assert 16)
)
:method-count-assert 10
:size-assert #x10
:flag-assert #xa00000010
(:methods
(lookup-text! (_type_ game-text-id symbol) string 9)
)
)
;; all text is stored in the COMMON text files (one file per language).
;; in theory, you could have multiple text files that are only loaded when needed, but they didn't do this.
(define *text-group-names* (new 'static 'boxed-array :type string :length 1 "common"))
;; The heap for storing text
(define *common-text-heap* (new 'global 'kheap))
;; will store the COMMON text when it is loaded.
(define *common-text* (the-as game-text-info #f))
(defun-extern print-game-text string font-context symbol int int float)

View file

@ -207,7 +207,9 @@
(aspect-ratio float) ;; the desired aspect ratio. set auto to off and then this to 4/3 to force 4x3 aspect.
(aspect-ratio-scale float) ;; aspect ratio compared to 4x3
(aspect-ratio-reciprocal float) ;; aspect ratio compared to 3x4
(fullscreen? symbol) ;; fullscreen status. can be #f, #t or borderless
(resolution symbol) ;; selected resolution
(display-mode symbol) ;; display mode. can be windowed, fullscreen or borderless
(aspect-ratio-mode symbol) ;; explicit vetted aspect ratios - 4:3 | 5:4 | 16:9 | 21:9 | 32:9
(letterbox? symbol) ;; letterbox. #f = stretched
(vsync? symbol) ;; vsync.
(font-scale float) ;; font scaling.
@ -304,10 +306,12 @@
(reset-fixes (_type_) none)
(reset-extra (_type_) none)
(draw (_type_ dma-buffer) none)
(set-fullscreen! (_type_ symbol) int)
(set-size! (_type_ int int) int)
(set-aspect! (_type_ int int) int)
(set-aspect-ratio! (_type_ float) int)
(set-display-mode! (_type_ symbol) none)
(set-aspect-ratio-mode! (_type_ symbol) none)
(set-resolution! (_type_ symbol) none)
(set-size! (_type_ int int) none)
(set-aspect! (_type_ int int) none)
(set-aspect-ratio! (_type_ float) none)
(read-from-file (_type_ string) symbol)
(write-to-file (_type_ string) symbol)
(actor-force-visible? (_type_) symbol)
@ -388,10 +392,13 @@
(set! (-> obj height) PC_BASE_HEIGHT)
(set! (-> obj use-vis?) #t)
(set! (-> obj aspect-ratio-auto?) #f)
(set! (-> obj fullscreen?) #f)
(set! (-> obj vsync?) #t)
(set! (-> obj letterbox?) #t)
(set-aspect-ratio-mode! obj 'pc-aspect-4x3)
(set-resolution! obj '640x480)
(set-display-mode! obj 'windowed)
(none))
(defmethod reset-audio pc-settings ((obj pc-settings))

View file

@ -32,26 +32,29 @@
(defmethod set-fullscreen! pc-settings ((obj pc-settings) (mode symbol))
"toggles fullscreen mode"
(defmethod set-display-mode! pc-settings ((obj pc-settings) (mode symbol))
"sets the game's display mode"
(if (= (-> obj fullscreen?) mode) ;; already fullscreen
;; changing to same mode, no-op
(if (= (-> obj display-mode) mode)
(return 0))
(set! (-> obj fullscreen?) mode)
(pc-set-fullscreen
(cond ((= mode 'borderless) 2)
(mode 1)
(else 0)
)
0)
0)
;; else change it and update it
(set! (-> obj display-mode) mode)
(cond
((= mode 'borderless)
(pc-set-fullscreen 2 0))
((= mode 'fullscreen)
(pc-set-fullscreen 1 0))
(else ;; default to windowed
(pc-set-fullscreen 0 0)))
(none))
(defmethod set-size! pc-settings ((obj pc-settings) (width int) (height int))
"sets window size"
"sets the size of the display window"
(pc-set-window-size width height)
0)
(none))
(defmethod set-aspect! pc-settings ((obj pc-settings) (aw int) (ah int))
@ -61,7 +64,7 @@
(set! (-> obj aspect-ratio-auto?) #f)
(set! (-> obj use-vis?) #f)
)
0)
(none))
(defmethod set-aspect-ratio! pc-settings ((obj pc-settings) (aspect float))
@ -69,9 +72,64 @@
(set! (-> obj aspect-ratio) aspect)
(set! (-> obj aspect-ratio-scale) (/ aspect ASPECT_4X3))
(set! (-> obj aspect-ratio-reciprocal) (/ ASPECT_4X3 aspect))
0)
(none))
(defmethod set-aspect-ratio-mode! pc-settings ((obj pc-settings) (mode symbol))
"sets the game's aspect ratio mode"
;; changing to same mode, no-op
(if (= (-> obj aspect-ratio-mode) mode)
(return 0))
;; else change it and update it
(set! (-> obj aspect-ratio-mode) mode)
(cond
((= mode 'pc-aspect-5x4)
(set-aspect! obj 5 4))
((= mode 'pc-aspect-16x9)
(set-aspect! obj 16 9))
((= mode 'pc-aspect-21x9)
(set-aspect! obj 21 9))
((= mode 'pc-aspect-32x9)
(set-aspect! obj 32 9))
(else ;; default to 4x3
(set-aspect! obj 4 3)))
(none))
(defmethod set-resolution! pc-settings ((obj pc-settings) (mode symbol))
"sets the game's resolution"
;; changing to same mode, no-op
(if (= (-> obj resolution) mode)
(none))
;; else change it and update it
(set! (-> obj resolution) mode)
;; give me string splitting!
(case mode
(('640x480) (set-size! obj 640 480))
(('800x600) (set-size! obj 800 600))
(('1024x768) (set-size! obj 1024 768))
(('1280x960) (set-size! obj 1280 960))
(('1600x1200) (set-size! obj 1600 1200))
(('960x768) (set-size! obj 960 768))
(('1280x1024) (set-size! obj 1280 1024))
(('1500x1200) (set-size! obj 1500 1200))
(('854x480) (set-size! obj 854 480))
(('1280x720) (set-size! obj 1280 720))
(('1920x1080) (set-size! obj 1920 1080))
(('2560x1440) (set-size! obj 2560 1440))
(('2880x1620) (set-size! obj 2880 1620))
(('3840x2160) (set-size! obj 3840 2160))
(('5120x2880) (set-size! obj 5120 2880))
(('2560x1080) (set-size! obj 2560 1080))
(('3120x1440) (set-size! obj 3120 1440))
(('3200x1440) (set-size! obj 3200 1440))
(('3440x1440) (set-size! obj 3440 1440))
(('3840x1600) (set-size! obj 3840 1600))
(('5120x2160) (set-size! obj 5120 2160))
(('5120x1440) (set-size! obj 5120 1440)))
(none))
(defmethod update-from-os pc-settings ((obj pc-settings))
"Update settings from the PC kernel to GOAL."
@ -292,7 +350,7 @@
(format *pc-temp-string* "game resolution: ~D x ~D~%" (-> obj width) (-> obj height))
(format *pc-temp-string* "window size: ~D x ~D (~,,1f x ~,,1f)~%" (-> obj win-width) (-> obj win-height) (-> obj dpi-x) (-> obj dpi-y))
(format *pc-temp-string* "target aspect: ~,,3f/~,,3f A: ~A/~A L: ~A~%" (-> obj aspect-ratio) (/ (the float (-> obj win-width)) (the float (-> obj win-height))) (-> obj aspect-ratio-auto?) (-> obj use-vis?) (-> obj letterbox?))
(format *pc-temp-string* "fullscreen: ~A ~A~%" (-> obj fullscreen?) (-> obj vsync?))
(format *pc-temp-string* "display-type: ~A ~A~%" (-> obj display-mode) (-> obj vsync?))
(draw-string-xy *pc-temp-string* buf 0 (- 224 (* 8 4)) (font-color default) (font-flags shadow kerning))
@ -473,7 +531,9 @@
)
(("aspect-auto") (set! (-> obj aspect-ratio-auto?) (file-stream-read-symbol file)))
(("aspect-game") (set! (-> obj aspect-setting) (file-stream-read-symbol file)))
(("fullscreen") (set-fullscreen! obj (file-stream-read-symbol file)))
(("display-mode") (set-display-mode! obj (file-stream-read-symbol file)))
(("aspect-ratio-mode") (set-aspect-ratio-mode! obj (file-stream-read-symbol file)))
(("resolution") (set-resolution! obj (file-stream-read-symbol file)))
(("letterbox") (set! (-> obj letterbox?) (file-stream-read-symbol file)))
(("vsync") (set! (-> obj vsync?) (file-stream-read-symbol file)))
(("font-scale") (set! (-> obj font-scale) (file-stream-read-float file)))
@ -555,7 +615,7 @@
(file-stream-close file)
(reset obj)
(write-to-file obj filename)
(set-fullscreen! obj #f)
(set-display-mode! obj #f)
(return #f)
)
)
@ -605,7 +665,9 @@
(format file " (aspect ~D ~D)~%" (-> obj aspect-custom-x) (-> obj aspect-custom-y))
(format file " (aspect-auto ~A)~%" (-> obj aspect-ratio-auto?))
(format file " (aspect-game ~A)~%" (-> *setting-control* default aspect-ratio))
(format file " (fullscreen ~A)~%" (-> obj fullscreen?))
(format file " (display-mode ~A)~%" (-> obj display-mode))
(format file " (aspect-ratio-mode ~A)~%" (-> obj aspect-ratio-mode))
(format file " (resolution ~A)~%" (-> obj resolution))
(format file " (letterbox ~A)~%" (-> obj letterbox?))
(format file " (vsync ~A)~%" (-> obj vsync?))
(format file " (font-scale ~f)~%" (-> obj font-scale))

View file

@ -7,3 +7,4 @@ vars:
MEMDUMP_BIN_RELEASE_DIR: './build/tools'
OFFLINETEST_BIN_RELEASE_DIR: './build'
GOALCTEST_BIN_RELEASE_DIR: './build'
EXE_FILE_EXTENSION: ''

View file

@ -7,3 +7,4 @@ vars:
MEMDUMP_BIN_RELEASE_DIR: './build/tools'
OFFLINETEST_BIN_RELEASE_DIR: './build'
GOALCTEST_BIN_RELEASE_DIR: './build'
EXE_FILE_EXTENSION: ''

View file

@ -7,3 +7,4 @@ vars:
MEMDUMP_BIN_RELEASE_DIR: './out/build/Release/bin'
OFFLINETEST_BIN_RELEASE_DIR: './out/build/Release/bin'
GOALCTEST_BIN_RELEASE_DIR: './out/build/Release/bin'
EXE_FILE_EXTENSION: '.exe'

View file

@ -38,5 +38,24 @@ with open('goal_src/engine/ui/text-h.gc') as f:
os.remove('goal_src/engine/ui/text-h.gc')
with open('goal_src/engine/ui/text-h.gc', "w") as f:
f.writelines(new_texth_lines)
with open('goal_src/engine/pc/ui/text-h.gc') as f:
lines = f.readlines()
found_enum = False
for line in lines:
if begin_str in line:
found_enum = True
new_texth_lines.append(begin_str + "\n")
new_texth_lines += enum_lines
new_texth_lines.append(end_str + "\n")
continue
if end_str in line:
found_enum = False
continue
if found_enum:
continue
new_texth_lines.append(line)
os.remove('goal_src/engine/pc/ui/text-h.gc')
with open('goal_src/engine/pc/ui/text-h.gc', "w") as f:
f.writelines(new_texth_lines)
print("game-text-id enum updated!")