mirror of
https://github.com/open-goal/jak-project
synced 2026-05-31 09:22:14 -04:00
4b8b2abbed
Adds the `pckernel` system to Jak 2, allowing you to do the PC-specific things that Jak 1 lets you do like change game resolution, etc. In other to reduce the amount of code duplication for something that we're gonna be changing a lot over time, I split it into a few more code files. In this new system, `pckernel-h.gc`, `pckernel-common.gc` (previously `pckernel.gc`) and `pc-debug-common.gc` are the files that should be shared across all games (I hacked the Jak 2 project to pull these files from the Jak 1 folder), while `pckernel-impl.gc`, `pckernel.gc` and `pc-debug-methods.gc` are their respective game-specific counterparts that should be loaded after. I'm not fully happy with this, I think it's slightly messy, but it cleanly separates code that should be game-specific and not accidentally copied around and code that should be the same for all games anyway.
94 lines
3.5 KiB
C++
94 lines
3.5 KiB
C++
#pragma once
|
|
|
|
#include "common/goos/Interpreter.h"
|
|
|
|
#include "goalc/make/Tool.h"
|
|
|
|
struct MakeStep {
|
|
std::vector<std::string> input;
|
|
std::vector<std::string> deps, outputs;
|
|
goos::Object arg;
|
|
std::string tool;
|
|
|
|
std::string print() const;
|
|
};
|
|
|
|
class MakeSystem {
|
|
public:
|
|
MakeSystem(const std::string& username = "#f");
|
|
void load_project_file(const std::string& file_path);
|
|
|
|
goos::Object handle_defstep(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_basename(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_stem(const goos::Object& obj,
|
|
goos::Arguments&,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_get_gsrc_path(const goos::Object& obj,
|
|
goos::Arguments&,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_map_path(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_set_output_prefix(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_set_gsrc_folder(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
goos::Object handle_get_gsrc_folder(const goos::Object& obj,
|
|
goos::Arguments& args,
|
|
const std::shared_ptr<goos::EnvironmentObject>& env);
|
|
|
|
std::vector<std::string> get_dependencies(const std::string& target) const;
|
|
std::vector<std::string> filter_dependencies(const std::vector<std::string>& all_deps);
|
|
|
|
bool make(const std::string& target, bool force, bool verbose);
|
|
|
|
void add_tool(std::shared_ptr<Tool> tool);
|
|
void set_constant(const std::string& name, const std::string& value);
|
|
void set_constant(const std::string& name, bool value);
|
|
|
|
template <typename T>
|
|
void add_tool() {
|
|
add_tool(std::make_shared<T>());
|
|
}
|
|
|
|
void clear_project();
|
|
|
|
/*!
|
|
* Get the prefix that the project has requested for all compiler outputs
|
|
*/
|
|
const std::string& compiler_output_prefix() const { return m_path_map.output_prefix; }
|
|
|
|
private:
|
|
void va_check(const goos::Object& form,
|
|
const goos::Arguments& args,
|
|
const std::vector<std::optional<goos::ObjectType>>& unnamed,
|
|
const std::unordered_map<std::string,
|
|
std::pair<bool, std::optional<goos::ObjectType>>>& named);
|
|
|
|
void get_dependencies(const std::string& master_target,
|
|
const std::string& output,
|
|
std::vector<std::string>* result_order,
|
|
std::unordered_set<std::string>* result_set) const;
|
|
|
|
goos::Interpreter m_goos;
|
|
|
|
std::unordered_map<std::string, std::shared_ptr<MakeStep>> m_output_to_step;
|
|
std::unordered_map<std::string, std::shared_ptr<Tool>> m_tools;
|
|
PathMap m_path_map;
|
|
std::vector<std::string> m_gsrc_folder;
|
|
std::map<std::string, std::string> m_gsrc_files = {};
|
|
};
|