mirror of
https://github.com/open-goal/jak-project.git
synced 2025-02-17 04:27:57 +00:00
Parameterize the iso_data folder for goalc (#3692)
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
Some checks are pending
Build / 🖥️ Windows (push) Waiting to run
Build / 🐧 Linux (push) Waiting to run
Build / 🍎 MacOS (push) Waiting to run
Lint / 📝 Formatting (push) Waiting to run
Lint / 📝 Required Checks (push) Waiting to run
Lint / 📝 Optional Checks (push) Waiting to run
I hope this is everything I needed, and nothing I didn't. ## What's Changed This update adds a command-line parameter to goalc, `--iso-path`. Providing a path to a directory like `D:\Files\Repositories\ArchipelaGOAL\iso_data\jak1` will inform the compiler to use that directory instead. ## Why is this useful? When combined with `--proj-path`, the compiler can be pointed to a completely different project folder, given the `(mi)` command, and immediately begin building from that directory, with everything it needs. This eliminates the need to copy `iso_data` to multiple `data` directories. If a subsequent change to the Launcher is made, each mod could be passed an --iso-path pointing to a single shared folder, allowing mods to each run their own REPL _without_ requiring a copy of `iso_data` in a subfolder. ## Independent testing required! My local repositories are a little suspect, with a mod, a fork of mod-base, and a fork of jak-project, all on the same drive. My decompiler_out and iso_data folders are in the mod repo, not mod-base nor jak-project. So what I did was make the change in the mod-base fork, point `--proj-path and --iso-path` to the mod folders, and then ran `(mi)`. The output showed a build starting with no errors. Then I had to create this PR, which my fork of mod-base is unable to do, so I created a patch file, forked jak-project, then applied the patch there. All this is to say that it would be preferable if someone could apply this code to their own installation and see if it works. Even I wouldn't take my own word for this. --------- Co-authored-by: Tyler Wilding <xtvaser@gmail.com>
This commit is contained in:
parent
b50652ce54
commit
7dbacc72d3
8
.github/workflows/compiler-output-check.yaml
vendored
8
.github/workflows/compiler-output-check.yaml
vendored
@ -29,8 +29,8 @@ jobs:
|
||||
uses: hendrikmuhs/ccache-action@v1.2.14
|
||||
with:
|
||||
variant: sccache
|
||||
key: linux-ubuntu-20.04--Release-linux-clang-asan-${{ github.sha }}
|
||||
restore-keys: linux-ubuntu-20.04--Release-linux-clang-asan
|
||||
key: linux-ubuntu-20.04--Release-linux-clang-static-${{ github.sha }}
|
||||
restore-keys: linux-ubuntu-20.04--Release-linux-clang-static
|
||||
max-size: 1000M
|
||||
|
||||
- name: CMake Generation (master)
|
||||
@ -38,7 +38,7 @@ jobs:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
run: |
|
||||
cmake -B build --preset=Release-linux-clang-asan \
|
||||
cmake -B build --preset=Release-linux-clang-static \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
|
||||
@ -57,7 +57,7 @@ jobs:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
run: |
|
||||
cmake -B build --preset=Release-linux-clang-asan \
|
||||
cmake -B build --preset=Release-linux-clang-static \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
|
||||
|
@ -49,6 +49,7 @@ struct Config {
|
||||
{KeyBind::Modifier::CTRL, "N", "Full build of the game", "(mi)"}};
|
||||
bool per_game_history = true;
|
||||
bool permissive_redefinitions = false;
|
||||
std::string iso_path;
|
||||
|
||||
int get_nrepl_port() {
|
||||
if (temp_nrepl_port != -1) {
|
||||
|
@ -43,6 +43,15 @@ void Wrapper::print_welcome_message(const std::vector<std::string>& loaded_proje
|
||||
fmt::format(" Project Path: {}\n",
|
||||
fmt::format(fg(fmt::color::gray), file_util::get_jak_project_dir().string()));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " - :===: -");
|
||||
std::string effective_iso_path;
|
||||
if (repl_config.iso_path.empty()) {
|
||||
effective_iso_path = file_util::get_file_path({"iso_data"});
|
||||
} else {
|
||||
effective_iso_path = repl_config.iso_path;
|
||||
}
|
||||
message +=
|
||||
fmt::format(" ISO Data Path: {}\n", fmt::format(fg(fmt::color::gray), effective_iso_path));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " --. .--: :--. .--");
|
||||
message += " nREPL:";
|
||||
if (!nrepl_alive) {
|
||||
message += fmt::format(fg(fmt::color::red), "DISABLED\n");
|
||||
@ -50,22 +59,21 @@ void Wrapper::print_welcome_message(const std::vector<std::string>& loaded_proje
|
||||
message += fmt::format(fg(fmt::color::light_green), " Listening on {}\n",
|
||||
repl_config.get_nrepl_port());
|
||||
}
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " --. .--: :--. .--");
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .=======. =======.");
|
||||
message += " Source File Search Dirs: ";
|
||||
const auto search_dir_string =
|
||||
fmt::format("{}", fmt::join(repl_config.asm_file_search_dirs, ","));
|
||||
message += fmt::format("[{}]\n", fmt::format(fg(fmt::color::gray), search_dir_string));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .=======. =======.");
|
||||
message += fmt::format(" {} or {} for basic help and usage\n",
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-=====-. .-=====-");
|
||||
message += fmt::format(" {} or {} for basic help and usage\n",
|
||||
fmt::format(fg(fmt::color::cyan), "(repl-help)"),
|
||||
fmt::format(fg(fmt::color::cyan), "(repl-keybinds)"));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-=====-. .-=====-");
|
||||
message +=
|
||||
fmt::format(" {} to connect to the game\n", fmt::format(fg(fmt::color::cyan), "(lt)"));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-===========-.");
|
||||
message += fmt::format(" {} to recompile the active project.\n",
|
||||
message +=
|
||||
fmt::format(" {} to connect to the game\n", fmt::format(fg(fmt::color::cyan), "(lt)"));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-===-.");
|
||||
message += fmt::format(" {} to recompile the active project.\n",
|
||||
fmt::format(fg(fmt::color::cyan), "(mi)"));
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .-===-.\n");
|
||||
message += fmt::format(fmt::emphasis::bold | fg(fmt::color::orange), " .\n");
|
||||
fmt::print("{}", message);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ int main(int argc, char** argv) {
|
||||
std::string game = "jak1";
|
||||
int nrepl_port = -1;
|
||||
fs::path project_path_override;
|
||||
fs::path iso_path_override;
|
||||
|
||||
// TODO - a lot of these flags could be deprecated and moved into `repl-config.json`
|
||||
CLI::App app{"OpenGOAL Compiler / REPL"};
|
||||
@ -49,6 +50,7 @@ int main(int argc, char** argv) {
|
||||
app.add_option("-g,--game", game, "The game name: 'jak1' or 'jak2'");
|
||||
app.add_option("--proj-path", project_path_override,
|
||||
"Specify the location of the 'data/' folder");
|
||||
app.add_option("--iso-path", iso_path_override, "Specify the location of the 'iso_data/' folder");
|
||||
define_common_cli_arguments(app);
|
||||
app.validate_positionals();
|
||||
CLI11_PARSE(app, argc, argv);
|
||||
@ -84,6 +86,16 @@ int main(int argc, char** argv) {
|
||||
// Load the user's REPL config
|
||||
auto repl_config = REPL::load_repl_config(username, game_version, nrepl_port);
|
||||
|
||||
// Check for a custom ISO path before we instantiate the compiler.
|
||||
if (!iso_path_override.empty()) {
|
||||
if (!fs::exists(iso_path_override)) {
|
||||
lg::error("Error: iso path override '{}' does not exist", iso_path_override.string());
|
||||
return 1;
|
||||
}
|
||||
file_util::set_iso_data_dir(iso_path_override);
|
||||
repl_config.iso_path = iso_path_override.string();
|
||||
}
|
||||
|
||||
// Init Compiler
|
||||
std::unique_ptr<Compiler> compiler;
|
||||
std::mutex compiler_mutex;
|
||||
|
@ -91,8 +91,14 @@ MakeSystem::MakeSystem(const std::optional<REPL::Config> repl_config, const std:
|
||||
|
||||
m_goos.set_global_variable_to_symbol("ASSETS", "#t");
|
||||
|
||||
set_constant("*iso-data*", file_util::get_file_path({"iso_data"}));
|
||||
set_constant("*use-iso-data-path*", false);
|
||||
if (m_repl_config && !m_repl_config->iso_path.empty()) {
|
||||
set_constant("*iso-data*",
|
||||
file_util::get_iso_dir_for_game(m_repl_config->game_version).string());
|
||||
set_constant("*use-iso-data-path*", true);
|
||||
} else {
|
||||
set_constant("*iso-data*", file_util::get_file_path({"iso_data"}));
|
||||
set_constant("*use-iso-data-path*", false);
|
||||
}
|
||||
|
||||
add_tool<DgoTool>();
|
||||
add_tool<TpageDirTool>();
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/goos/Interpreter.h"
|
||||
#include "common/util/FileUtil.h"
|
||||
|
||||
#include "goalc/make/Tool.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user