repl: add gameVersionFolder to repl-config for running the non-default version (#2463)

Adds a decent way to customize the folders the project file expects the
iso data and decompiler data to be in. When you run any version other
than the default, for example Jak 1 PAL, it uses the `gameName`
decompiler config to consume and output it's results.

However the project file will assume `jak1` unless you hard-code it
differently -- basically, it needs to be explicitly told just the
decompiler is told what version to use.

We now have a per-user REPL Config json file, so that can be used to
override the default `jak1` behaviour.

Fixes #1993
This commit is contained in:
Tyler Wilding
2023-04-11 16:57:20 -05:00
committed by GitHub
parent fb62a1fb87
commit 10ac78200b
12 changed files with 73 additions and 19 deletions
+21 -1
View File
@@ -38,7 +38,8 @@ std::string MakeStep::print() const {
return result;
}
MakeSystem::MakeSystem(const std::string& username) : m_goos(username) {
MakeSystem::MakeSystem(const std::optional<REPL::Config> repl_config, const std::string& username)
: m_goos(username), m_repl_config(repl_config) {
m_goos.register_form("defstep", [=](const goos::Object& obj, goos::Arguments& args,
const std::shared_ptr<goos::EnvironmentObject>& env) {
return handle_defstep(obj, args, env);
@@ -81,6 +82,12 @@ MakeSystem::MakeSystem(const std::string& username) : m_goos(username) {
return handle_get_gsrc_folder(obj, args, env);
});
m_goos.register_form("get-game-version-folder",
[=](const goos::Object& obj, goos::Arguments& args,
const std::shared_ptr<goos::EnvironmentObject>& env) {
return handle_get_game_version_folder(obj, args, env);
});
m_goos.set_global_variable_to_symbol("ASSETS", "#t");
set_constant("*iso-data*", file_util::get_file_path({"iso_data"}));
@@ -296,6 +303,19 @@ goos::Object MakeSystem::handle_get_gsrc_folder(
return goos::StringObject::make_new(out);
}
goos::Object MakeSystem::handle_get_game_version_folder(
const goos::Object& form,
goos::Arguments& args,
const std::shared_ptr<goos::EnvironmentObject>& env) {
m_goos.eval_args(&args, env);
va_check(form, args, {}, {});
if (m_repl_config) {
return goos::StringObject::make_new(m_repl_config->game_version_folder);
} else {
return goos::StringObject::make_new("");
}
}
void MakeSystem::get_dependencies(const std::string& master_target,
const std::string& output,
std::vector<std::string>* result,