diff --git a/.github/workflows/compiler-output-check.yaml b/.github/workflows/compiler-output-check.yaml index 7daab005d..969ed247c 100644 --- a/.github/workflows/compiler-output-check.yaml +++ b/.github/workflows/compiler-output-check.yaml @@ -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 diff --git a/common/repl/config.h b/common/repl/config.h index ff1857be7..c0a5334ff 100644 --- a/common/repl/config.h +++ b/common/repl/config.h @@ -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) { diff --git a/common/repl/repl_wrapper.cpp b/common/repl/repl_wrapper.cpp index fd2b517de..d85be66fd 100644 --- a/common/repl/repl_wrapper.cpp +++ b/common/repl/repl_wrapper.cpp @@ -43,6 +43,15 @@ void Wrapper::print_welcome_message(const std::vector& 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& 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); } diff --git a/goalc/main.cpp b/goalc/main.cpp index c5ec7c8d3..77fe79bfb 100644 --- a/goalc/main.cpp +++ b/goalc/main.cpp @@ -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; std::mutex compiler_mutex; diff --git a/goalc/make/MakeSystem.cpp b/goalc/make/MakeSystem.cpp index 982e8e3dd..dfa29b7d0 100644 --- a/goalc/make/MakeSystem.cpp +++ b/goalc/make/MakeSystem.cpp @@ -91,8 +91,14 @@ MakeSystem::MakeSystem(const std::optional 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(); add_tool(); diff --git a/goalc/make/MakeSystem.h b/goalc/make/MakeSystem.h index cba37ebf7..1eef3174b 100644 --- a/goalc/make/MakeSystem.h +++ b/goalc/make/MakeSystem.h @@ -1,6 +1,7 @@ #pragma once #include "common/goos/Interpreter.h" +#include "common/util/FileUtil.h" #include "goalc/make/Tool.h"