log
This commit is contained in:
@@ -543,6 +543,7 @@ struct System::Impl {
|
||||
|
||||
ExecuteProgramCallback execute_program_callback;
|
||||
ExitCallback exit_callback;
|
||||
GameLogCallback game_log_callback;
|
||||
|
||||
std::array<u64, Core::Hardware::NUM_CPU_CORES> dynarmic_ticks{};
|
||||
std::array<MicroProfileToken, Core::Hardware::NUM_CPU_CORES> microprofile_cpu{};
|
||||
@@ -1011,6 +1012,18 @@ void System::RegisterExitCallback(ExitCallback&& callback) {
|
||||
impl->exit_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void System::RegisterGameLogCallback(GameLogCallback&& callback) {
|
||||
impl->game_log_callback = std::move(callback);
|
||||
}
|
||||
|
||||
void System::AppendGameMessage(std::string& text) {
|
||||
if (impl->game_log_callback) {
|
||||
impl->game_log_callback(text);
|
||||
} else {
|
||||
LOG_CRITICAL(Core, "game_log_callback must be initialized by the frontend");
|
||||
}
|
||||
}
|
||||
|
||||
void System::Exit() {
|
||||
if (impl->exit_callback) {
|
||||
impl->exit_callback();
|
||||
|
@@ -462,6 +462,18 @@ public:
|
||||
*/
|
||||
void RegisterExitCallback(ExitCallback&& callback);
|
||||
|
||||
/// Type used for the frontend to designate a callback for System to display log output.
|
||||
using GameLogCallback = std::function<void(std::string)>;
|
||||
|
||||
/**
|
||||
* Registers a callback from the frontend for System to display log output.
|
||||
* @param callback Callback from the frontend to display log output.
|
||||
*/
|
||||
void RegisterGameLogCallback(GameLogCallback&& callback);
|
||||
|
||||
/// Inserts a new entry on the game log ouput window
|
||||
void AppendGameMessage(std::string& text);
|
||||
|
||||
/// Instructs the frontend to exit the application.
|
||||
void Exit();
|
||||
|
||||
|
@@ -276,6 +276,7 @@ private:
|
||||
|
||||
if (text_log) {
|
||||
output_log += fmt::format("Log Text: {}\n", *text_log);
|
||||
system.AppendGameMessage(*text_log);
|
||||
}
|
||||
LOG_DEBUG(Service_LM, "LogManager {} ({}):\n{}", NameOf(entry.severity),
|
||||
DestinationToString(destination), output_log);
|
||||
|
Reference in New Issue
Block a user