Skip to content

Commit

Permalink
Emu: try to make "Silence All Logs" dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Mar 28, 2020
1 parent 7a8fa57 commit 4529cd0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
21 changes: 16 additions & 5 deletions rpcs3/Emu/System.cpp
Expand Up @@ -31,6 +31,7 @@
#include "../Crypto/unself.h"
#include "../Crypto/unpkg.h"
#include "util/yaml.hpp"
#include "util/logs.hpp"

#include "cereal/archives/binary.hpp"

Expand Down Expand Up @@ -1528,11 +1529,7 @@ void Emulator::Run(bool start_playtime)
m_pause_amend_time = 0;
m_state = system_state::running;

if (g_cfg.misc.silence_all_logs)
{
sys_log.notice("Now disabling logging...");
logs::silence();
}
ResetLogs();

auto on_select = [](u32, cpu_thread& cpu)
{
Expand Down Expand Up @@ -1822,6 +1819,20 @@ s32 error_code::error_report(const fmt_type_info* sup, u64 arg, const fmt_type_i
return static_cast<s32>(arg);
}

void Emulator::ResetLogs() const
{
if (g_cfg.misc.silence_all_logs)
{
sys_log.notice("Disabling logging...");
logs::silence();
}
else
{
sys_log.notice("Enabling Logging...");
logs::reset();
}
}

template <>
void stx::manual_fixed_typemap<void>::init_reporter(const char* name, unsigned long long created) const noexcept
{
Expand Down
9 changes: 5 additions & 4 deletions rpcs3/Emu/System.h
Expand Up @@ -175,10 +175,6 @@ class Emulator final
bool BootRsxCapture(const std::string& path);
bool InstallPkg(const std::string& path);

private:
void LimitCacheSize();

public:
#ifdef _WIN32
static std::string GetExeDir();
#endif
Expand Down Expand Up @@ -214,6 +210,11 @@ class Emulator final
std::string GetFormattedTitle(double fps) const;

u32 GetMaxThreads() const;

void ResetLogs() const;

private:
void LimitCacheSize();
};

extern Emulator Emu;
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/system_config.h
Expand Up @@ -263,7 +263,7 @@ struct cfg_root : cfg::node
cfg::_bool show_shader_compilation_hint{ this, "Show shader compilation hint", true, true };
cfg::_bool use_native_interface{ this, "Use native user interface", true };
cfg::string gdb_server{ this, "GDB Server", "127.0.0.1:2345" };
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, false };
cfg::_bool silence_all_logs{ this, "Silence All Logs", false, true };
cfg::string title_format{ this, "Window Title Format", "FPS: %F | %R | %V | %T [%t]", true };

} misc{ this };
Expand Down
1 change: 1 addition & 0 deletions rpcs3/rpcs3qt/gui_application.cpp
Expand Up @@ -427,6 +427,7 @@ void gui_application::OnChangeStyleSheetRequest(const QString& path)

void gui_application::OnEmuSettingsChange()
{
Emu.ResetLogs();
rsx::overlays::reset_performance_overlay();
}

Expand Down

0 comments on commit 4529cd0

Please sign in to comment.