mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
eb703ee96e
Motivated by - https://github.com/open-goal/opengoal-vscode/pull/358 This addresses the following: - Fixes #2939 spam edge-case - Stop picking a different nREPL port based on the game mode by default, this causes friction for tools in the average usecase (having a REPL open for a single game, and wanting to connect to it). `goalc` spins up fine even if the port is already bound to. - For people that need/want this behaviour, adding per-game configuration to the `repl-config.json` is on my todo list. - Allows `goalc` to permit redefining symbols, including functions. This is defaulted to off via the `repl-config.json` but it allows you to for example, change the definition of a function without having to restart and rebuild the entire game. ![Screenshot 2024-06-02 124558](https://github.com/open-goal/jak-project/assets/13153231/28f81f6e-b7b8-4172-9787-f96e4ab1305b) - Updates the welcome message to include a bunch of useful metadata up-front. Cleaned up all the startup logs that appear when starting goalc, many of whom's information is now included in the welcome message. - Before: ![image](https://github.com/open-goal/jak-project/assets/13153231/814c2374-4808-408e-9ed6-67114902a1d9) - After: ![Screenshot 2024-06-01 235954](https://github.com/open-goal/jak-project/assets/13153231/f3f459fb-2cbb-46ba-a90f-318243d4b3b3)
64 lines
1.9 KiB
C++
64 lines
1.9 KiB
C++
#pragma once
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <vector>
|
|
|
|
#include "common/versions/versions.h"
|
|
|
|
#include "third-party/json.hpp"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
namespace REPL {
|
|
struct KeyBind {
|
|
// NOTE - in my experience, meta doesn't work on windows and shift is probably a bad idea when
|
|
// typing text! but I leave it up to the user.
|
|
enum class Modifier { CTRL, SHIFT, META };
|
|
Modifier modifier;
|
|
std::string key;
|
|
std::string description;
|
|
std::string command;
|
|
|
|
std::string string() const;
|
|
};
|
|
void to_json(json& j, const KeyBind& obj);
|
|
void from_json(const json& j, KeyBind& obj);
|
|
|
|
// TODO - per-game config
|
|
struct Config {
|
|
GameVersion game_version;
|
|
Config(GameVersion _game_version) : game_version(_game_version){};
|
|
|
|
// this is the default REPL configuration
|
|
int nrepl_port = 8181;
|
|
int temp_nrepl_port = -1;
|
|
std::string game_version_folder;
|
|
int target_connect_attempts = 30;
|
|
std::vector<std::string> asm_file_search_dirs = {};
|
|
bool append_keybinds = true;
|
|
std::vector<KeyBind> keybinds = {
|
|
{KeyBind::Modifier::CTRL, "T", "Starts up the game runtime", "(test-play)"},
|
|
{KeyBind::Modifier::CTRL, "Q", "Exit the REPL", "(e)"},
|
|
{KeyBind::Modifier::CTRL, "L", "Listen to an available game process", "(lt)"},
|
|
{KeyBind::Modifier::CTRL, "W",
|
|
"Halt the attached process so you can re-launch a crashed game", "(:stop)"},
|
|
{KeyBind::Modifier::CTRL, "G", "Attach the debugger to the process", "(dbgc)"},
|
|
{KeyBind::Modifier::CTRL, "B", "Displays the most recently caught backtrace", "(:di)"},
|
|
{KeyBind::Modifier::CTRL, "N", "Full build of the game", "(mi)"}};
|
|
bool per_game_history = true;
|
|
bool permissive_redefinitions = false;
|
|
|
|
int get_nrepl_port() {
|
|
if (temp_nrepl_port != -1) {
|
|
return temp_nrepl_port;
|
|
}
|
|
return nrepl_port;
|
|
}
|
|
};
|
|
void to_json(json& j, const Config& obj);
|
|
void from_json(const json& j, Config& obj);
|
|
|
|
} // namespace REPL
|