[jak2] fully implement *user* (#3046)

Fixes #1918
This commit is contained in:
ManDude 2023-10-01 04:28:30 +01:00 committed by GitHub
parent d149838485
commit dfeb88b35d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 13 deletions

View File

@ -35,7 +35,6 @@ Interpreter::Interpreter(const std::string& username) {
// set user profile name
auto user = SymbolObject::make_new(reader.symbolTable, username);
define_var_in_env(global_environment, user, "*user*");
define_var_in_env(goal_env, user, "*user*");
// setup maps
special_forms = {

View File

@ -207,7 +207,7 @@ std::string find_repl_username() {
}
}
return "#f";
return "unknown";
}
fs::path get_startup_file_path(const std::string& username, const GameVersion game_version) {

View File

@ -5,6 +5,7 @@
#include <cstring>
#include "common/goal_constants.h"
#include "common/repl/util.h"
#include "common/util/Timer.h"
#include "game/common/game_common_types.h"
@ -26,7 +27,11 @@ char DebugBootArtGroup[64];
void kboot_init_globals() {
memset(DebugBootUser, 0, sizeof(DebugBootUser));
memset(DebugBootArtGroup, 0, sizeof(DebugBootArtGroup));
strcpy(DebugBootUser, "unknown");
// strcpy(DebugBootUser, "unknown");
// CHANGED : let's just try to find the username automatically by default!
// the default is still "unknown"
auto username = REPL::find_repl_username();
strcpy(DebugBootUser, username.c_str());
}
void KernelCheckAndDispatch();

View File

@ -70,11 +70,12 @@ std::string game_arg_documentation() {
output += " -level [name] Used to inform the game to boot a specific level the default level is `#f`\n";
// Jak 1 Related
output += fmt::format(fmt::emphasis::bold | fmt::fg(fmt::color::orange), "Jak 1:\n");
output += " -demo Used to pass the message `demo` to the gkernel in the DebugBootMessage (instead of play)\n";
output += " -demo Boot the game in demo mode\n";
// Jak 2 only
output += fmt::format(fmt::emphasis::bold | fmt::fg(fmt::color::purple), "Jak 2:\n");
output += " -kiosk A demo mode, TODO on specifics\n";
output += " -preview A demo mode, TODO on specifics\n";
output += " -demo Boot the game in demo mode\n";
output += " -kiosk Boot the game in kiosk demo mode\n";
output += " -preview Boot the game in preview demo mode\n";
output += " -debug-boot Used to boot the game in retail mode, but with debug segments\n";
output += " -user [name] Specify the debugging username, the default is `unknown`\n";
output += " -art [name] Specify the art-group name to set `DebugBootArtGroup`, there is no default\n";

View File

@ -116,7 +116,7 @@ void deci2_runner(SystemThreadInterface& iface) {
// then allow the server to accept connections
bool server_ok = server.init_server();
if (!server_ok) {
lg::error("[DECI2] failed to initialize, REPL will not work.\n");
lg::error("[DECI2] failed to initialize, REPL will not work.");
}
lg::debug("[DECI2] Waiting for listener...");
@ -434,8 +434,8 @@ RuntimeExitStatus exec_runtime(GameLaunchOptions game_options, int argc, const c
try {
Gfx::Loop([]() { return MasterExit == RuntimeExitStatus::RUNNING; });
} catch (std::exception& e) {
lg::error("Exception thrown from graphics loop: {}\n", e.what());
lg::error("Everything will crash now. good luck\n");
lg::error("Exception thrown from graphics loop: {}", e.what());
lg::error("Everything will crash now. good luck");
throw;
}
}

View File

@ -110,6 +110,7 @@ s32 sceOpen(const char* filename, s32 flag) {
default: {
// either append or truncate
file_util::create_dir_if_needed_for_file(name);
if (flag & SCE_TRUNC) {
fp = file_util::open_file(name.c_str(), "w");
} else {

View File

@ -1020,10 +1020,6 @@
;;;; user stuf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmacro get-user ()
`(quote ,*user*)
)
(defmacro user? (&rest users)
(cond
((null? users) #f)

View File

@ -401,6 +401,9 @@
(define-extern pc-prof (function string pc-prof-event none))
(defmacro get-user ()
`(quote ,*user*)
)
(defconstant *user* (get-user))
(define-extern pc-filter-debug-string? (function string float symbol))