Remove legacy GENERAL log channel

Add some more log channels instead.
This commit is contained in:
Nekotekina 2020-02-01 07:15:50 +03:00
parent efafda2650
commit d9a0619ddd
26 changed files with 269 additions and 221 deletions

View File

@ -6,6 +6,8 @@
#include <typeinfo>
#include <charconv>
LOG_CHANNEL(cfg_log);
namespace cfg
{
_base::_base(type _type)
@ -72,13 +74,13 @@ bool cfg::try_to_int64(s64* out, const std::string& value, s64 min, s64 max)
if (ret.ec != std::errc() || ret.ptr != end)
{
if (out) LOG_ERROR(GENERAL, "cfg::try_to_int('%s'): invalid integer", value);
if (out) cfg_log.error("cfg::try_to_int('%s'): invalid integer", value);
return false;
}
if (result < min || result > max)
{
if (out) LOG_ERROR(GENERAL, "cfg::try_to_int('%s'): out of bounds (%lld..%lld)", value, min, max);
if (out) cfg_log.error("cfg::try_to_int('%s'): out of bounds (%lld..%lld)", value, min, max);
return false;
}
@ -127,13 +129,13 @@ bool cfg::try_to_enum_value(u64* out, decltype(&fmt_class_string<int>::format) f
if (ret.ec != std::errc() || ret.ptr != end)
{
if (out) LOG_ERROR(GENERAL, "cfg::try_to_enum_value('%s'): invalid enum or integer", value);
if (out) cfg_log.error("cfg::try_to_enum_value('%s'): invalid enum or integer", value);
return false;
}
if (result > max)
{
if (out) LOG_ERROR(GENERAL, "cfg::try_to_enum_value('%s'): out of bounds(0..%u)", value, max);
if (out) cfg_log.error("cfg::try_to_enum_value('%s'): out of bounds(0..%u)", value, max);
return false;
}
@ -307,7 +309,7 @@ bool cfg::node::from_string(const std::string& value, bool dynamic) try
}
catch (const std::exception& e)
{
LOG_FATAL(GENERAL, "%s thrown: %s", typeid(e).name(), e.what());
cfg_log.fatal("%s thrown: %s", typeid(e).name(), e.what());
return false;
}

View File

@ -14,6 +14,8 @@
#define CAN_OVERCOMMIT
#endif
LOG_CHANNEL(jit_log);
static u8* get_jit_memory()
{
// Reserve 2G memory (magic static)
@ -80,7 +82,7 @@ static u8* add_jit_memory(std::size_t size, uint align)
if (UNLIKELY(pos == -1))
{
LOG_WARNING(GENERAL, "JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off);
jit_log.warning("JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off);
return nullptr;
}
@ -532,7 +534,7 @@ extern void jit_finalize()
{
if (!RtlDeleteFunctionTable(unwind.data()))
{
LOG_FATAL(GENERAL, "RtlDeleteFunctionTable() failed! Error %u", GetLastError());
jit_log.fatal("RtlDeleteFunctionTable() failed! Error %u", GetLastError());
}
}
@ -579,11 +581,11 @@ struct MemoryManager : llvm::RTDyldMemoryManager
if (addr)
{
LOG_WARNING(GENERAL, "LLVM: Symbol requested: %s -> 0x%016llx", name, addr);
jit_log.warning("LLVM: Symbol requested: %s -> 0x%016llx", name, addr);
}
else
{
LOG_ERROR(GENERAL, "LLVM: Linkage failed: %s", name);
jit_log.error("LLVM: Linkage failed: %s", name);
addr = reinterpret_cast<u64>(null);
}
}
@ -661,13 +663,13 @@ struct MemoryManager : llvm::RTDyldMemoryManager
if (ptr == nullptr)
{
LOG_FATAL(GENERAL, "LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
jit_log.fatal("LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
return nullptr;
}
utils::memory_commit(ptr, size, utils::protection::wx);
m_code_addr = static_cast<u8*>(ptr);
LOG_NOTICE(GENERAL, "LLVM: Code section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x)", sec_id, sec_name.data(), ptr, size, align);
jit_log.notice("LLVM: Code section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x)", sec_id, sec_name.data(), ptr, size, align);
return static_cast<u8*>(ptr);
}
@ -685,7 +687,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
if (ptr == nullptr)
{
LOG_FATAL(GENERAL, "LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
jit_log.fatal("LLVM: Out of memory (size=0x%llx, aligned 0x%x)", size, align);
return nullptr;
}
@ -695,7 +697,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
utils::memory_commit(ptr, size);
LOG_NOTICE(GENERAL, "LLVM: Data section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x, %s)", sec_id, sec_name.data(), ptr, size, align, is_ro ? "ro" : "rw");
jit_log.notice("LLVM: Data section %u '%s' allocated -> %p (size=0x%llx, aligned 0x%x, %s)", sec_id, sec_name.data(), ptr, size, align, is_ro ? "ro" : "rw");
return static_cast<u8*>(ptr);
}
@ -738,7 +740,7 @@ struct MemoryManager : llvm::RTDyldMemoryManager
// Register .xdata UNWIND_INFO structs
if (!RtlAddFunctionTable(pdata.data(), (DWORD)pdata.size(), segment_start))
{
LOG_ERROR(GENERAL, "RtlAddFunctionTable() failed! Error %u", GetLastError());
jit_log.error("RtlAddFunctionTable() failed! Error %u", GetLastError());
}
else
{
@ -942,14 +944,14 @@ public:
}
default:
{
LOG_ERROR(GENERAL, "LLVM: Failed to compress module: %s", module->getName().data());
jit_log.error("LLVM: Failed to compress module: %s", module->getName().data());
deflateEnd(&zs);
return;
}
}
fs::file(name, fs::rewrite).write(zbuf.get(), zsz - zs.avail_out);
LOG_NOTICE(GENERAL, "LLVM: Created module: %s", module->getName().data());
jit_log.notice("LLVM: Created module: %s", module->getName().data());
}
static std::unique_ptr<llvm::MemoryBuffer> load(const std::string& path)
@ -1020,7 +1022,7 @@ public:
if (auto buf = load(path))
{
LOG_NOTICE(GENERAL, "LLVM: Loaded module: %s", module->getName().data());
jit_log.notice("LLVM: Loaded module: %s", module->getName().data());
return buf;
}
@ -1186,7 +1188,7 @@ void jit_compiler::add(const std::string& path)
}
else
{
LOG_ERROR(GENERAL, "ObjectCache: Adding failed: %s", path);
jit_log.error("ObjectCache: Adding failed: %s", path);
}
}

View File

@ -110,8 +110,6 @@ namespace logs
namespace logs
{
/* Small set of predefined channels */
inline channel GENERAL("");
inline channel LOADER("LDR");
LOG_CHANNEL(RSX);
LOG_CHANNEL(HLE);

View File

@ -3,6 +3,8 @@
#include "File.h"
#include "Config.h"
LOG_CHANNEL(patch_log);
template <>
void fmt_class_string<patch_type>::format(std::string& out, u64 arg)
{
@ -40,7 +42,7 @@ void patch_engine::append(const std::string& patch)
}
catch (const std::exception& e)
{
LOG_FATAL(GENERAL, "Failed to load patch file %s\n%s thrown: %s", patch, typeid(e).name(), e.what());
patch_log.fatal("Failed to load patch file %s\n%s thrown: %s", patch, typeid(e).name(), e.what());
return;
}

View File

@ -9,6 +9,8 @@
#include "windows.h"
#endif
LOG_CHANNEL(input_log);
void basic_keyboard_handler::Init(const u32 max_connect)
{
for (u32 i = 0; i < max_connect; i++)
@ -45,7 +47,7 @@ void basic_keyboard_handler::SetTargetWindow(QWindow* target)
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
QApplication::instance()->installEventFilter(this);
LOG_ERROR(GENERAL, "Trying to set keyboard handler to a null target window.");
input_log.error("Trying to set keyboard handler to a null target window.");
}
}

View File

@ -3,6 +3,8 @@
#include <QApplication>
#include <QCursor>
LOG_CHANNEL(input_log);
void basic_mouse_handler::Init(const u32 max_connect)
{
m_mice.emplace_back(Mouse());
@ -37,7 +39,7 @@ void basic_mouse_handler::SetTargetWindow(QWindow* target)
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
QApplication::instance()->installEventFilter(this);
LOG_ERROR(GENERAL, "Trying to set mouse handler to a null target window.");
input_log.error("Trying to set mouse handler to a null target window.");
}
}

View File

@ -17,6 +17,8 @@
#include <cstdio>
#include <cmath>
LOG_CHANNEL(evdev_log);
evdev_joystick_handler::evdev_joystick_handler() : PadHandlerBase(pad_handler::evdev)
{
init_configs();
@ -150,7 +152,7 @@ bool evdev_joystick_handler::update_device(const std::shared_ptr<PadDevice>& dev
dev = nullptr;
}
LOG_ERROR(GENERAL, "Joystick %s is not present or accessible [previous status: %d]", path.c_str(), was_connected ? 1 : 0);
evdev_log.error("Joystick %s is not present or accessible [previous status: %d]", path.c_str(), was_connected ? 1 : 0);
return false;
}
@ -161,18 +163,18 @@ bool evdev_joystick_handler::update_device(const std::shared_ptr<PadDevice>& dev
if (fd == -1)
{
int err = errno;
LOG_ERROR(GENERAL, "Failed to open joystick: %s [errno %d]", strerror(err), err);
evdev_log.error("Failed to open joystick: %s [errno %d]", strerror(err), err);
return false;
}
int ret = libevdev_new_from_fd(fd, &dev);
if (ret < 0)
{
LOG_ERROR(GENERAL, "Failed to initialize libevdev for joystick: %s [errno %d]", strerror(-ret), -ret);
evdev_log.error("Failed to initialize libevdev for joystick: %s [errno %d]", strerror(-ret), -ret);
return false;
}
LOG_NOTICE(GENERAL, "Opened joystick: '%s' at %s (fd %d)", get_device_name(dev), path, fd);
evdev_log.notice("Opened joystick: '%s' at %s (fd %d)", get_device_name(dev), path, fd);
return true;
}
@ -526,7 +528,7 @@ int evdev_joystick_handler::GetButtonInfo(const input_event& evt, const std::sha
// get the button value and return its code
if (button_list.find(code) == button_list.end())
{
LOG_ERROR(GENERAL, "Evdev button %s (%d) is unknown. Please add it to the button list.", libevdev_event_code_get_name(EV_KEY, code), code);
evdev_log.error("Evdev button %s (%d) is unknown. Please add it to the button list.", libevdev_event_code_get_name(EV_KEY, code), code);
return -1;
}
@ -583,7 +585,7 @@ std::vector<std::string> evdev_joystick_handler::ListDevices()
{
// If it's just a bad file descriptor, don't bother logging, but otherwise, log it.
if (rc != -9)
LOG_WARNING(GENERAL, "Failed to connect to device at %s, the error was: %s", "/dev/input/" + et.name, strerror(-rc));
evdev_log.warning("Failed to connect to device at %s, the error was: %s", "/dev/input/" + et.name, strerror(-rc));
libevdev_free(dev);
close(fd);
continue;
@ -631,7 +633,7 @@ int evdev_joystick_handler::add_device(const std::string& device, const std::sha
{
// If it's just a bad file descriptor, don't bother logging, but otherwise, log it.
if (rc != -9)
LOG_WARNING(GENERAL, "Failed to connect to device at %s, the error was: %s", path, strerror(-rc));
evdev_log.warning("Failed to connect to device at %s, the error was: %s", path, strerror(-rc));
libevdev_free(dev);
close(fd);
continue;
@ -712,7 +714,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
// Grab any pending sync event.
if (ret == LIBEVDEV_READ_STATUS_SYNC)
{
LOG_NOTICE(GENERAL, "Captured sync event");
evdev_log.notice("Captured sync event");
ret = libevdev_next_event(dev, LIBEVDEV_READ_FLAG_NORMAL | LIBEVDEV_READ_FLAG_SYNC, &evt);
}
@ -720,7 +722,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
{
// -EAGAIN signifies no available events, not an actual *error*.
if (ret != -EAGAIN)
LOG_ERROR(GENERAL, "Failed to read latest event from joystick: %s [errno %d]", strerror(-ret), -ret);
evdev_log.error("Failed to read latest event from joystick: %s [errno %d]", strerror(-ret), -ret);
return;
}

View File

@ -3,6 +3,8 @@
#include <QApplication>
#include <QThread>
LOG_CHANNEL(input_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString;
@ -179,7 +181,7 @@ void keyboard_pad_handler::SetTargetWindow(QWindow* target)
QApplication::instance()->installEventFilter(this);
// If this is hit, it probably means that some refactoring occurs because currently a gsframe is created in Load.
// We still want events so filter from application instead since target is null.
LOG_ERROR(GENERAL, "Trying to set pad handler to a null target window.");
input_log.error("Trying to set pad handler to a null target window.");
}
}
@ -250,42 +252,42 @@ void keyboard_pad_handler::keyPressEvent(QKeyEvent* event)
{
case Qt::Key_I:
m_deadzone_y = std::min(m_deadzone_y + 1, 255);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone y = %d", m_deadzone_y);
input_log.success("mouse move adjustment: deadzone y = %d", m_deadzone_y);
event->ignore();
return;
case Qt::Key_U:
m_deadzone_y = std::max(0, m_deadzone_y - 1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone y = %d", m_deadzone_y);
input_log.success("mouse move adjustment: deadzone y = %d", m_deadzone_y);
event->ignore();
return;
case Qt::Key_Y:
m_deadzone_x = std::min(m_deadzone_x + 1, 255);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone x = %d", m_deadzone_x);
input_log.success("mouse move adjustment: deadzone x = %d", m_deadzone_x);
event->ignore();
return;
case Qt::Key_T:
m_deadzone_x = std::max(0, m_deadzone_x - 1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: deadzone x = %d", m_deadzone_x);
input_log.success("mouse move adjustment: deadzone x = %d", m_deadzone_x);
event->ignore();
return;
case Qt::Key_K:
m_multi_y = std::min(m_multi_y + 0.1, 5.0);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
input_log.success("mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
event->ignore();
return;
case Qt::Key_J:
m_multi_y = std::max(0.0, m_multi_y - 0.1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
input_log.success("mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
event->ignore();
return;
case Qt::Key_H:
m_multi_x = std::min(m_multi_x + 0.1, 5.0);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
input_log.success("mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
event->ignore();
return;
case Qt::Key_G:
m_multi_x = std::max(0.0, m_multi_x - 0.1);
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
input_log.success("mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
event->ignore();
return;
default:
@ -550,7 +552,7 @@ u32 keyboard_pad_handler::GetKeyCode(const QString& keyName)
if (seq.count() == 1)
keyCode = seq[0];
else
LOG_NOTICE(GENERAL, "GetKeyCode(%s): seq.count() = %d", sstr(keyName), seq.count());
input_log.notice("GetKeyCode(%s): seq.count() = %d", sstr(keyName), seq.count());
return keyCode;
}

View File

@ -1,6 +1,8 @@
#ifdef _WIN32
#include "mm_joystick_handler.h"
LOG_CHANNEL(input_log);
mm_joystick_handler::mm_joystick_handler() : PadHandlerBase(pad_handler::mm)
{
init_configs();
@ -81,11 +83,11 @@ bool mm_joystick_handler::Init()
if (supported_joysticks <= 0)
{
LOG_ERROR(GENERAL, "mmjoy: Driver doesn't support Joysticks");
input_log.error("mmjoy: Driver doesn't support Joysticks");
return false;
}
LOG_NOTICE(GENERAL, "mmjoy: Driver supports %u joysticks", supported_joysticks);
input_log.notice("mmjoy: Driver supports %u joysticks", supported_joysticks);
for (u32 i = 0; i < supported_joysticks; i++)
{
@ -191,7 +193,7 @@ void mm_joystick_handler::get_next_button_press(const std::string& padId, const
id = GetIDByName(padId);
if (id < 0)
{
LOG_ERROR(GENERAL, "MMJOY get_next_button_press for device [%s] failed with id = %d", padId, id);
input_log.error("MMJOY get_next_button_press for device [%s] failed with id = %d", padId, id);
return fail_callback(padId);
}
}
@ -447,7 +449,7 @@ bool mm_joystick_handler::GetMMJOYDevice(int index, MMJOYDevice* dev)
char drv[32];
wcstombs(drv, js_caps.szPname, 31);
LOG_NOTICE(GENERAL, "Joystick nr.%d found. Driver: %s", index, drv);
input_log.notice("Joystick nr.%d found. Driver: %s", index, drv);
dev->device_id = index;
dev->device_name = m_name_string + std::to_string(index + 1); // Controllers 1-n in GUI

View File

@ -10,6 +10,8 @@
#include "keyboard_pad_handler.h"
#include "Emu/Io/Null/NullPadHandler.h"
LOG_CHANNEL(input_log);
namespace pad
{
atomic_t<pad_thread*> g_current = nullptr;
@ -123,7 +125,7 @@ void pad_thread::Init()
if (cur_pad_handler->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string()) == false)
{
// Failed to bind the device to cur_pad_handler so binds to NullPadHandler
LOG_ERROR(GENERAL, "Failed to bind device %s to handler %s", g_cfg_input.player[i]->device.to_string(), handler_type.to_string());
input_log.error("Failed to bind device %s to handler %s", g_cfg_input.player[i]->device.to_string(), handler_type.to_string());
nullpad->bindPadToDevice(m_pads[i], g_cfg_input.player[i]->device.to_string());
}
}

View File

@ -5,6 +5,8 @@
#include <cmath>
#include <cstdlib>
LOG_CHANNEL(tar_log);
tar_object::tar_object(const fs::file& file, size_t offset)
: m_file(file)
, initial_offset(static_cast<int>(offset))
@ -124,7 +126,7 @@ bool tar_object::extract(std::string path, std::string ignore)
}
default:
LOG_ERROR(GENERAL, "TAR Loader: unknown file type: 0x%x", header.filetype);
tar_log.error("TAR Loader: unknown file type: 0x%x", header.filetype);
return false;
}
}

View File

@ -19,6 +19,8 @@
#include "3rdparty/OpenAL/include/alext.h"
LOG_CHANNEL(cfg_log);
extern std::string g_cfg_defaults; //! Default settings grabbed from Utilities/Config.h
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
@ -164,7 +166,7 @@ emu_settings::Render_Creator::Render_Creator()
if (thread_running)
{
LOG_ERROR(GENERAL, "Vulkan device enumeration timed out");
cfg_log.error("Vulkan device enumeration timed out");
auto button = QMessageBox::critical(nullptr, tr("Vulkan Check Timeout"),
tr("Querying for Vulkan-compatible devices is taking too long. This is usually caused by malfunctioning "
"graphics drivers, reinstalling them could fix the issue.\n\n"
@ -333,7 +335,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool
{
if (!combobox)
{
LOG_FATAL(GENERAL, "EnhanceComboBox '%s' was used with an invalid object", GetSettingName(type));
cfg_log.fatal("EnhanceComboBox '%s' was used with an invalid object", GetSettingName(type));
return;
}
@ -341,7 +343,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool
{
if (sorted)
{
LOG_WARNING(GENERAL, "EnhanceCombobox '%s': ignoring sorting request on ranged combo box", GetSettingName(type));
cfg_log.warning("EnhanceCombobox '%s': ignoring sorting request on ranged combo box", GetSettingName(type));
}
QStringList range = GetSettingOptions(type);
@ -374,7 +376,7 @@ void emu_settings::EnhanceComboBox(QComboBox* combobox, SettingsType type, bool
if (index == -1)
{
std::string def = GetSettingDefault(type);
LOG_ERROR(GENERAL, "EnhanceComboBox '%s' tried to set an invalid value: %s. Setting to default: %s", GetSettingName(type), selected, def);
cfg_log.fatal("EnhanceComboBox '%s' tried to set an invalid value: %s. Setting to default: %s", GetSettingName(type), selected, def);
combobox->setCurrentIndex(combobox->findData(qstr(def)));
m_broken_types.insert(type);
}
@ -393,7 +395,7 @@ void emu_settings::EnhanceCheckBox(QCheckBox* checkbox, SettingsType type)
{
if (!checkbox)
{
LOG_FATAL(GENERAL, "EnhanceCheckBox '%s' was used with an invalid object", GetSettingName(type));
cfg_log.fatal("EnhanceCheckBox '%s' was used with an invalid object", GetSettingName(type));
return;
}
@ -402,7 +404,7 @@ void emu_settings::EnhanceCheckBox(QCheckBox* checkbox, SettingsType type)
if (def != "true" && def != "false")
{
LOG_FATAL(GENERAL, "EnhanceCheckBox '%s' was used with an invalid SettingsType", GetSettingName(type));
cfg_log.fatal("EnhanceCheckBox '%s' was used with an invalid SettingsType", GetSettingName(type));
return;
}
@ -415,7 +417,7 @@ void emu_settings::EnhanceCheckBox(QCheckBox* checkbox, SettingsType type)
}
else if (selected != "false")
{
LOG_ERROR(GENERAL, "EnhanceCheckBox '%s' tried to set an invalid value: %s. Setting to default: %s", GetSettingName(type), selected, def);
cfg_log.fatal("EnhanceCheckBox '%s' tried to set an invalid value: %s. Setting to default: %s", GetSettingName(type), selected, def);
checkbox->setChecked(def == "true");
m_broken_types.insert(type);
}
@ -431,7 +433,7 @@ void emu_settings::EnhanceSlider(QSlider* slider, SettingsType type)
{
if (!slider)
{
LOG_FATAL(GENERAL, "EnhanceSlider '%s' was used with an invalid object", GetSettingName(type));
cfg_log.fatal("EnhanceSlider '%s' was used with an invalid object", GetSettingName(type));
return;
}
@ -444,7 +446,7 @@ void emu_settings::EnhanceSlider(QSlider* slider, SettingsType type)
if (!ok_def || !ok_min || !ok_max)
{
LOG_FATAL(GENERAL, "EnhanceSlider '%s' was used with an invalid SettingsType", GetSettingName(type));
cfg_log.fatal("EnhanceSlider '%s' was used with an invalid SettingsType", GetSettingName(type));
return;
}
@ -453,7 +455,7 @@ void emu_settings::EnhanceSlider(QSlider* slider, SettingsType type)
if (!ok_sel || val < min || val > max)
{
LOG_ERROR(GENERAL, "EnhanceSlider '%s' tried to set an invalid value: %d. Setting to default: %d. Allowed range: [%d, %d]", GetSettingName(type), val, def, min, max);
cfg_log.fatal("EnhanceSlider '%s' tried to set an invalid value: %d. Setting to default: %d. Allowed range: [%d, %d]", GetSettingName(type), val, def, min, max);
val = def;
m_broken_types.insert(type);
}
@ -471,7 +473,7 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, SettingsType type, const QS
{
if (!spinbox)
{
LOG_FATAL(GENERAL, "EnhanceSpinBox '%s' was used with an invalid object", GetSettingName(type));
cfg_log.fatal("EnhanceSpinBox '%s' was used with an invalid object", GetSettingName(type));
return;
}
@ -484,7 +486,7 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, SettingsType type, const QS
if (!ok_def || !ok_min || !ok_max)
{
LOG_FATAL(GENERAL, "EnhanceSpinBox '%s' was used with an invalid type", GetSettingName(type));
cfg_log.fatal("EnhanceSpinBox '%s' was used with an invalid type", GetSettingName(type));
return;
}
@ -493,7 +495,7 @@ void emu_settings::EnhanceSpinBox(QSpinBox* spinbox, SettingsType type, const QS
if (!ok_sel || val < min || val > max)
{
LOG_ERROR(GENERAL, "EnhanceSpinBox '%s' tried to set an invalid value: %d. Setting to default: %d. Allowed range: [%d, %d]", GetSettingName(type), selected, def, min, max);
cfg_log.fatal("EnhanceSpinBox '%s' tried to set an invalid value: %d. Setting to default: %d. Allowed range: [%d, %d]", GetSettingName(type), selected, def, min, max);
val = def;
m_broken_types.insert(type);
}
@ -517,7 +519,7 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, SettingsType ty
{
if (!spinbox)
{
LOG_FATAL(GENERAL, "EnhanceDoubleSpinBox '%s' was used with an invalid object", GetSettingName(type));
cfg_log.fatal("EnhanceDoubleSpinBox '%s' was used with an invalid object", GetSettingName(type));
return;
}
@ -530,7 +532,7 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, SettingsType ty
if (!ok_def || !ok_min || !ok_max)
{
LOG_FATAL(GENERAL, "EnhanceDoubleSpinBox '%s' was used with an invalid type", GetSettingName(type));
cfg_log.fatal("EnhanceDoubleSpinBox '%s' was used with an invalid type", GetSettingName(type));
return;
}
@ -539,7 +541,7 @@ void emu_settings::EnhanceDoubleSpinBox(QDoubleSpinBox* spinbox, SettingsType ty
if (!ok_sel || val < min || val > max)
{
LOG_ERROR(GENERAL, "EnhanceDoubleSpinBox '%s' tried to set an invalid value: %f. Setting to default: %f. Allowed range: [%f, %f]", GetSettingName(type), val, def, min, max);
cfg_log.fatal("EnhanceDoubleSpinBox '%s' tried to set an invalid value: %f. Setting to default: %f. Allowed range: [%f, %f]", GetSettingName(type), val, def, min, max);
val = def;
m_broken_types.insert(type);
}
@ -613,10 +615,10 @@ void emu_settings::OpenCorrectionDialog(QWidget* parent)
std::string def = GetSettingDefault(type);
std::string old = GetSetting(type);
SetSetting(type, def);
LOG_SUCCESS(GENERAL, "The config entry '%s' was corrected from '%s' to '%s'", GetSettingName(type), old, def);
cfg_log.success("The config entry '%s' was corrected from '%s' to '%s'", GetSettingName(type), old, def);
}
m_broken_types.clear();
LOG_SUCCESS(GENERAL, "You need to save the settings in order to make these changes permanent!");
cfg_log.success("You need to save the settings in order to make these changes permanent!");
}
}

View File

@ -3,6 +3,8 @@
#include <QLabel>
#include <QMessageBox>
LOG_CHANNEL(compat_log);
constexpr auto qstr = QString::fromStdString;
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
@ -36,19 +38,19 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl
error_message = "Server Error - Unknown Error";
break;
}
LOG_ERROR(GENERAL, "Compatibility error: { %s: return code %d }", error_message, return_code);
compat_log.error("Compatibility error: { %s: return code %d }", error_message, return_code);
Q_EMIT DownloadError(qstr(error_message) + " " + QString::number(return_code));
}
else
{
LOG_ERROR(GENERAL, "Compatibility error: { Database Error - Invalid: return code %d }", return_code);
compat_log.error("Compatibility error: { Database Error - Invalid: return code %d }", return_code);
}
return false;
}
if (!json_data["results"].isObject())
{
LOG_ERROR(GENERAL, "Compatibility error: { Database Error - No Results found }");
compat_log.error("Compatibility error: { Database Error - No Results found }");
return false;
}
@ -61,7 +63,7 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl
{
if (!json_results[key].isObject())
{
LOG_ERROR(GENERAL, "Compatibility error: { Database Error - Unusable object %s }", sstr(key));
compat_log.error("Compatibility error: { Database Error - Unusable object %s }", sstr(key));
continue;
}
@ -92,20 +94,20 @@ void game_compatibility::RequestCompatibility(bool online)
if (!file.exists())
{
LOG_NOTICE(GENERAL, "Compatibility notice: { Database file not found: %s }", sstr(m_filepath));
compat_log.notice("Compatibility notice: { Database file not found: %s }", sstr(m_filepath));
return;
}
if (!file.open(QIODevice::ReadOnly))
{
LOG_ERROR(GENERAL, "Compatibility error: { Database Error - Could not read database from file: %s }", sstr(m_filepath));
compat_log.error("Compatibility error: { Database Error - Could not read database from file: %s }", sstr(m_filepath));
return;
}
QByteArray data = file.readAll();
file.close();
LOG_NOTICE(GENERAL, "Compatibility notice: { Finished reading database from file: %s }", sstr(m_filepath));
compat_log.notice("Compatibility notice: { Finished reading database from file: %s }", sstr(m_filepath));
// Create new map from database
ReadJSON(QJsonDocument::fromJson(data).object(), online);
@ -115,7 +117,7 @@ void game_compatibility::RequestCompatibility(bool online)
if (QSslSocket::supportsSsl() == false)
{
LOG_ERROR(GENERAL, "Can not retrieve the online database! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
compat_log.error("Can not retrieve the online database! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
const QString message = tr("Can not retrieve the online database!<br>Please make sure your system supports SSL.<br>Visit our <a href='https://rpcs3.net/quickstart'>quickstart guide</a> for more information.");
QMessageBox box(QMessageBox::Icon::Warning, tr("Warning!"), message, QMessageBox::StandardButton::Ok, nullptr);
box.setTextFormat(Qt::RichText);
@ -123,7 +125,7 @@ void game_compatibility::RequestCompatibility(bool online)
return;
}
LOG_NOTICE(GENERAL, "SSL supported! Beginning compatibility database download from: %s", sstr(m_url));
compat_log.notice("SSL supported! Beginning compatibility database download from: %s", sstr(m_url));
// Send request and wait for response
m_network_access_manager.reset(new QNetworkAccessManager());
@ -177,7 +179,7 @@ void game_compatibility::RequestCompatibility(bool online)
// We failed to retrieve a new database, therefore refresh gamelist to old state
const QString error = network_reply->errorString();
Q_EMIT DownloadError(error);
LOG_ERROR(GENERAL, "Compatibility error: { Network Error - %s }", sstr(error));
compat_log.error("Compatibility error: { Network Error - %s }", sstr(error));
}
// Clean up Progress Dialog
@ -211,7 +213,7 @@ void game_compatibility::RequestCompatibility(bool online)
m_progress_timer->stop();
}
LOG_NOTICE(GENERAL, "Compatibility notice: { Database download finished }");
compat_log.notice("Compatibility notice: { Database download finished }");
// Read data from network reply
QByteArray data = network_reply->readAll();
@ -228,19 +230,19 @@ void game_compatibility::RequestCompatibility(bool online)
if (file.exists())
{
LOG_NOTICE(GENERAL, "Compatibility notice: { Database file found: %s }", sstr(m_filepath));
compat_log.notice("Compatibility notice: { Database file found: %s }", sstr(m_filepath));
}
if (!file.open(QIODevice::WriteOnly))
{
LOG_ERROR(GENERAL, "Compatibility error: { Database Error - Could not write database to file: %s }", sstr(m_filepath));
compat_log.error("Compatibility error: { Database Error - Could not write database to file: %s }", sstr(m_filepath));
return;
}
file.write(data);
file.close();
LOG_SUCCESS(GENERAL, "Compatibility success: { Write database to file: %s }", sstr(m_filepath));
compat_log.success("Compatibility success: { Write database to file: %s }", sstr(m_filepath));
}
});

View File

@ -29,6 +29,8 @@
#include <QApplication>
#include <QClipboard>
LOG_CHANNEL(game_list_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
game_list_frame::game_list_frame(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, std::shared_ptr<persistent_settings> persistent_settings, QWidget *parent)
@ -648,7 +650,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
if (game.icon_path.empty() || !icon.load(qstr(game.icon_path)))
{
LOG_WARNING(GENERAL, "Could not load image from path %s", sstr(QDir(qstr(game.icon_path)).absolutePath()));
game_list_log.warning("Could not load image from path %s", sstr(QDir(qstr(game.icon_path)).absolutePath()));
}
const auto compat = m_game_compat->GetCompatibility(game.serial);
@ -663,7 +665,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
}
catch (const std::exception& e)
{
LOG_FATAL(GENERAL, "Failed to update game list at %s\n%s thrown: %s", dir, typeid(e).name(), e.what());
game_list_log.fatal("Failed to update game list at %s\n%s thrown: %s", dir, typeid(e).name(), e.what());
return;
}
});
@ -703,7 +705,7 @@ void game_list_frame::Refresh(const bool fromDrive, const bool scrollAfter)
}
catch (const std::exception& e)
{
LOG_ERROR(GENERAL, "Failed to update the displayed version numbers for title ID %s\n%s thrown: %s", entry->info.serial, typeid(e).name(), e.what());
game_list_log.error("Failed to update the displayed version numbers for title ID %s\n%s thrown: %s", entry->info.serial, typeid(e).name(), e.what());
}
const std::string key = "GD" + other->info.name;
@ -1063,7 +1065,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
{
if (currGame.path.empty())
{
LOG_FATAL(GENERAL, "Cannot remove game. Path is empty");
game_list_log.fatal("Cannot remove game. Path is empty");
return;
}
@ -1084,12 +1086,12 @@ void game_list_frame::ShowContextMenu(const QPoint &pos)
RemoveCustomPadConfiguration(currGame.serial);
}
m_game_data.erase(std::remove(m_game_data.begin(), m_game_data.end(), gameinfo), m_game_data.end());
LOG_SUCCESS(GENERAL, "Removed %s %s in %s", currGame.category, currGame.name, currGame.path);
game_list_log.success("Removed %s %s in %s", currGame.category, currGame.name, currGame.path);
Refresh(true);
}
else
{
LOG_ERROR(GENERAL, "Failed to remove %s %s in %s (%s)", currGame.category, currGame.name, currGame.path, fs::g_tls_error);
game_list_log.error("Failed to remove %s %s in %s (%s)", currGame.category, currGame.name, currGame.path, fs::g_tls_error);
QMessageBox::critical(this, tr("Failure!"), tr(remove_caches ? "Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact." : "Failed to remove %0 from drive!\nPath: %1").arg(name).arg(qstr(currGame.path)));
}
}
@ -1193,11 +1195,11 @@ bool game_list_frame::CreatePPUCache(const game_info& game)
if (success)
{
LOG_WARNING(GENERAL, "Creating PPU Cache for %s", game->info.path);
game_list_log.warning("Creating PPU Cache for %s", game->info.path);
}
else
{
LOG_ERROR(GENERAL, "Could not create PPU Cache for %s", game->info.path);
game_list_log.error("Could not create PPU Cache for %s", game->info.path);
}
return success;
}
@ -1227,11 +1229,11 @@ bool game_list_frame::RemoveCustomConfiguration(const std::string& title_id, gam
{
game->hasCustomConfig = false;
}
LOG_SUCCESS(GENERAL, "Removed configuration file: %s", path);
game_list_log.success("Removed configuration file: %s", path);
}
else
{
LOG_FATAL(GENERAL, "Failed to remove configuration file: %s\nError: %s", path, fs::g_tls_error);
game_list_log.fatal("Failed to remove configuration file: %s\nError: %s", path, fs::g_tls_error);
result = false;
}
}
@ -1268,13 +1270,13 @@ bool game_list_frame::RemoveCustomPadConfiguration(const std::string& title_id,
Emu.GetCallbacks().reset_pads(title_id);
Emu.GetCallbacks().enable_pads(true);
}
LOG_NOTICE(GENERAL, "Removed pad configuration directory: %s", config_dir);
game_list_log.notice("Removed pad configuration directory: %s", config_dir);
return true;
}
else if (is_interactive)
{
QMessageBox::warning(this, tr("Warning!"), tr("Failed to completely remove pad configuration directory!"));
LOG_FATAL(GENERAL, "Failed to completely remove pad configuration directory: %s\nError: %s", config_dir, fs::g_tls_error);
game_list_log.fatal("Failed to completely remove pad configuration directory: %s\nError: %s", config_dir, fs::g_tls_error);
}
return false;
}
@ -1301,11 +1303,11 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
if (QDir(filepath).removeRecursively())
{
++caches_removed;
LOG_NOTICE(GENERAL, "Removed shaders cache dir: %s", sstr(filepath));
game_list_log.notice("Removed shaders cache dir: %s", sstr(filepath));
}
else
{
LOG_WARNING(GENERAL, "Could not completely remove shaders cache dir: %s", sstr(filepath));
game_list_log.warning("Could not completely remove shaders cache dir: %s", sstr(filepath));
}
++caches_total;
@ -1314,9 +1316,9 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in
const bool success = caches_total == caches_removed;
if (success)
LOG_SUCCESS(GENERAL, "Removed shaders cache in %s", base_dir);
game_list_log.success("Removed shaders cache in %s", base_dir);
else
LOG_FATAL(GENERAL, "Only %d/%d shaders cache dirs could be removed in %s", caches_removed, caches_total, base_dir);
game_list_log.fatal("Only %d/%d shaders cache dirs could be removed in %s", caches_removed, caches_total, base_dir);
return success;
}
@ -1343,11 +1345,11 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
if (QFile::remove(filepath))
{
++files_removed;
LOG_NOTICE(GENERAL, "Removed PPU cache file: %s", sstr(filepath));
game_list_log.notice("Removed PPU cache file: %s", sstr(filepath));
}
else
{
LOG_WARNING(GENERAL, "Could not remove PPU cache file: %s", sstr(filepath));
game_list_log.warning("Could not remove PPU cache file: %s", sstr(filepath));
}
++files_total;
@ -1356,9 +1358,9 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera
const bool success = files_total == files_removed;
if (success)
LOG_SUCCESS(GENERAL, "Removed PPU cache in %s", base_dir);
game_list_log.success("Removed PPU cache in %s", base_dir);
else
LOG_FATAL(GENERAL, "Only %d/%d PPU cache files could be removed in %s", files_removed, files_total, base_dir);
game_list_log.fatal("Only %d/%d PPU cache files could be removed in %s", files_removed, files_total, base_dir);
return success;
}
@ -1385,11 +1387,11 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
if (QFile::remove(filepath))
{
++files_removed;
LOG_NOTICE(GENERAL, "Removed SPU cache file: %s", sstr(filepath));
game_list_log.notice("Removed SPU cache file: %s", sstr(filepath));
}
else
{
LOG_WARNING(GENERAL, "Could not remove SPU cache file: %s", sstr(filepath));
game_list_log.warning("Could not remove SPU cache file: %s", sstr(filepath));
}
++files_total;
@ -1398,9 +1400,9 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera
const bool success = files_total == files_removed;
if (success)
LOG_SUCCESS(GENERAL, "Removed SPU cache in %s", base_dir);
game_list_log.success("Removed SPU cache in %s", base_dir);
else
LOG_FATAL(GENERAL, "Only %d/%d SPU cache files could be removed in %s", files_removed, files_total, base_dir);
game_list_log.fatal("Only %d/%d SPU cache files could be removed in %s", files_removed, files_total, base_dir);
return success;
}
@ -1425,7 +1427,7 @@ void game_list_frame::BatchCreatePPUCaches()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "PPU Cache Batch Creation was canceled");
game_list_log.notice("PPU Cache Batch Creation was canceled");
break;
}
QApplication::processEvents();
@ -1470,7 +1472,7 @@ void game_list_frame::BatchRemovePPUCaches()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "PPU Cache Batch Removal was canceled");
game_list_log.notice("PPU Cache Batch Removal was canceled");
break;
}
QApplication::processEvents();
@ -1511,7 +1513,7 @@ void game_list_frame::BatchRemoveSPUCaches()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "SPU Cache Batch Removal was canceled. %d/%d folders cleared", removed, total);
game_list_log.notice("SPU Cache Batch Removal was canceled. %d/%d folders cleared", removed, total);
break;
}
QApplication::processEvents();
@ -1555,7 +1557,7 @@ void game_list_frame::BatchRemoveCustomConfigurations()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "Custom Configuration Batch Removal was canceled. %d/%d custom configurations cleared", removed, total);
game_list_log.notice("Custom Configuration Batch Removal was canceled. %d/%d custom configurations cleared", removed, total);
break;
}
QApplication::processEvents();
@ -1600,7 +1602,7 @@ void game_list_frame::BatchRemoveCustomPadConfigurations()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "Custom Pad Configuration Batch Removal was canceled. %d/%d custom pad configurations cleared", removed, total);
game_list_log.notice("Custom Pad Configuration Batch Removal was canceled. %d/%d custom pad configurations cleared", removed, total);
break;
}
QApplication::processEvents();
@ -1642,7 +1644,7 @@ void game_list_frame::BatchRemoveShaderCaches()
{
if (pdlg->wasCanceled())
{
LOG_NOTICE(GENERAL, "Shader Cache Batch Removal was canceled");
game_list_log.notice("Shader Cache Batch Removal was canceled");
break;
}
QApplication::processEvents();

View File

@ -31,6 +31,8 @@
#endif
#endif
LOG_CHANNEL(screenshot);
constexpr auto qstr = QString::fromStdString;
gs_frame::gs_frame(const QString& title, const QRect& geometry, const QIcon& appIcon, const std::shared_ptr<gui_settings>& gui_settings)
@ -131,7 +133,7 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
switch (keyEvent->key())
{
case Qt::Key_L:
if (keyEvent->modifiers() == Qt::AltModifier) { static int count = 0; LOG_SUCCESS(GENERAL, "Made forced mark %d in log", ++count); }
if (keyEvent->modifiers() == Qt::AltModifier) { static int count = 0; screenshot.success("Made forced mark %d in log", ++count); }
break;
case Qt::Key_Return:
if (keyEvent->modifiers() == Qt::AltModifier) { toggle_fullscreen(); return; }
@ -330,7 +332,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
if (!fs::create_dir(screen_path) && fs::g_tls_error != fs::error::exist)
{
LOG_ERROR(GENERAL, "Failed to create screenshot path \"%s\" : %s", screen_path, fs::g_tls_error);
screenshot.error("Failed to create screenshot path \"%s\" : %s", screen_path, fs::g_tls_error);
return;
}
@ -339,7 +341,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
fs::file sshot_file(filename, fs::open_mode::create + fs::open_mode::write + fs::open_mode::excl);
if (!sshot_file)
{
LOG_ERROR(GENERAL, "[Screenshot] Failed to save screenshot \"%s\" : %s", filename, fs::g_tls_error);
screenshot.error("[Screenshot] Failed to save screenshot \"%s\" : %s", filename, fs::g_tls_error);
return;
}
@ -378,7 +380,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
sshot_file.write(encoded_png.data(), encoded_png.size());
LOG_SUCCESS(GENERAL, "[Screenshot] Successfully saved screenshot to %s", filename);
screenshot.success("[Screenshot] Successfully saved screenshot to %s", filename);
const auto fxo = g_fxo->get<screenshot_manager>();
@ -387,25 +389,25 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
const std::string cell_sshot_filename = fxo->get_screenshot_path();
const std::string cell_sshot_dir = fs::get_parent_dir(cell_sshot_filename);
LOG_NOTICE(GENERAL, "[Screenshot] Saving cell screenshot to %s", cell_sshot_filename);
screenshot.notice("[Screenshot] Saving cell screenshot to %s", cell_sshot_filename);
if (!fs::create_path(cell_sshot_dir) && fs::g_tls_error != fs::error::exist)
{
LOG_ERROR(GENERAL, "Failed to create cell screenshot dir \"%s\" : %s", cell_sshot_dir, fs::g_tls_error);
screenshot.error("Failed to create cell screenshot dir \"%s\" : %s", cell_sshot_dir, fs::g_tls_error);
return;
}
fs::file cell_sshot_file(cell_sshot_filename, fs::open_mode::create + fs::open_mode::write + fs::open_mode::excl);
if (!cell_sshot_file)
{
LOG_ERROR(GENERAL, "[Screenshot] Failed to save cell screenshot \"%s\" : %s", cell_sshot_filename, fs::g_tls_error);
screenshot.error("[Screenshot] Failed to save cell screenshot \"%s\" : %s", cell_sshot_filename, fs::g_tls_error);
return;
}
const std::string cell_sshot_overlay_path = fxo->get_overlay_path();
if (fs::is_file(cell_sshot_overlay_path))
{
LOG_NOTICE(GENERAL, "[Screenshot] Adding overlay to cell screenshot from %s", cell_sshot_overlay_path);
screenshot.notice("[Screenshot] Adding overlay to cell screenshot from %s", cell_sshot_overlay_path);
// TODO: add overlay to screenshot
}
@ -414,7 +416,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
cell_sshot_file.write(encoded_png.data(), encoded_png.size());
LOG_SUCCESS(GENERAL, "[Screenshot] Successfully saved cell screenshot to %s", cell_sshot_filename);
screenshot.success("[Screenshot] Successfully saved cell screenshot to %s", cell_sshot_filename);
}
return;

View File

@ -18,6 +18,8 @@
#include <clocale>
LOG_CHANNEL(gui_log);
gui_application::gui_application(int& argc, char** argv) : QApplication(argc, argv)
{
}
@ -201,7 +203,7 @@ void gui_application::InitializeCallbacks()
case 0: static_cast<gs_frame*>(m_game_window)->progress_reset(value); break;
case 1: static_cast<gs_frame*>(m_game_window)->progress_increment(value); break;
case 2: static_cast<gs_frame*>(m_game_window)->progress_set_limit(value); break;
default: LOG_FATAL(GENERAL, "Unknown type in handle_taskbar_progress(type=%d, value=%d)", type, value); break;
default: gui_log.fatal("Unknown type in handle_taskbar_progress(type=%d, value=%d)", type, value); break;
}
}
};

View File

@ -6,6 +6,8 @@
#include <QCoreApplication>
#include <QMessageBox>
LOG_CHANNEL(cfg_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
gui_settings::gui_settings(QObject* parent) : settings(parent)
@ -34,7 +36,7 @@ QString gui_settings::GetCurrentUser()
return user;
}
LOG_FATAL(GENERAL, "Could not parse user setting: '%s' = '%d'.", user.toStdString(), user_id);
cfg_log.fatal("Could not parse user setting: '%s' = '%d'.", user.toStdString(), user_id);
return QString();
}
@ -137,7 +139,7 @@ bool gui_settings::GetCategoryVisibility(int cat)
case Category::Others:
value = gui::cat_other; break;
default:
LOG_WARNING(GENERAL, "GetCategoryVisibility: wrong cat <%d>", cat);
cfg_log.warning("GetCategoryVisibility: wrong cat <%d>", cat);
break;
}
@ -171,7 +173,7 @@ void gui_settings::SetCategoryVisibility(int cat, const bool& val)
case Category::Others:
value = gui::cat_other; break;
default:
LOG_WARNING(GENERAL, "SetCategoryVisibility: wrong cat <%d>", cat);
cfg_log.warning("SetCategoryVisibility: wrong cat <%d>", cat);
break;
}
@ -204,13 +206,13 @@ void gui_settings::ShowBox(bool confirm, const QString& title, const QString& te
if (!entry.name.isEmpty() && mb->checkBox()->isChecked())
{
SetValue(entry, false);
LOG_NOTICE(GENERAL, "%s Dialog for Entry %s is now disabled", dialog_type, sstr(entry.name));
cfg_log.notice("%s Dialog for Entry %s is now disabled", dialog_type, sstr(entry.name));
}
});
mb->exec();
}
else LOG_NOTICE(GENERAL, "%s Dialog for Entry %s was ignored", dialog_type, sstr(entry.name));
else cfg_log.notice("%s Dialog for Entry %s was ignored", dialog_type, sstr(entry.name));
}
void gui_settings::ShowConfirmationBox(const QString& title, const QString& text, const gui_save& entry, int* result = nullptr, QWidget* parent = nullptr)

View File

@ -55,6 +55,8 @@
#include "ui_main_window.h"
LOG_CHANNEL(gui_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
main_window::main_window(std::shared_ptr<gui_settings> guiSettings, std::shared_ptr<emu_settings> emuSettings, std::shared_ptr<persistent_settings> persistent_settings, QWidget *parent)
@ -105,7 +107,7 @@ void main_window::Init()
if (false)
#endif
{
LOG_WARNING(GENERAL, "Experimental Build Warning! Build origin: " STRINGIZE(BRANCH));
gui_log.warning("Experimental Build Warning! Build origin: " STRINGIZE(BRANCH));
QMessageBox msg;
msg.setWindowTitle(tr("Experimental Build Warning"));
@ -269,7 +271,7 @@ void main_window::Boot(const std::string& path, const std::string& title_id, boo
}
else
{
LOG_ERROR(GENERAL, "Boot failed: %s", path);
gui_log.error("Boot failed: %s", path);
}
m_gameListFrame->Refresh(true);
@ -367,7 +369,7 @@ void main_window::BootRsxCapture(std::string path)
if (!Emu.BootRsxCapture(path))
{
LOG_ERROR(GENERAL, "Capture Boot Failed. path: %s", path);
gui_log.error("Capture Boot Failed. path: %s", path);
}
else
{
@ -477,7 +479,7 @@ void main_window::HandlePackageInstallation(QStringList file_paths)
if (worker())
{
m_gameListFrame->Refresh(true);
LOG_SUCCESS(GENERAL, "Successfully installed %s.", file_name);
gui_log.success("Successfully installed %s.", file_name);
if (i == (count - 1))
{
@ -488,13 +490,13 @@ void main_window::HandlePackageInstallation(QStringList file_paths)
{
if (!cancelled)
{
LOG_ERROR(GENERAL, "Failed to install %s.", file_name);
gui_log.error("Failed to install %s.", file_name);
QMessageBox::critical(this, tr("Failure!"), tr("Failed to install software from package %1!").arg(file_path));
}
return;
}
// return if the thread was still running after cancel
// return if the thread was still running after cancel
if (cancelled)
{
return;
@ -545,14 +547,14 @@ void main_window::HandlePupInstallation(QString file_path)
fs::file pup_f(path);
if (!pup_f)
{
LOG_ERROR(GENERAL, "Error opening PUP file %s", path);
gui_log.error("Error opening PUP file %s", path);
QMessageBox::critical(this, tr("Failure!"), tr("The selected firmware file couldn't be opened."));
return;
}
if (pup_f.size() < sizeof(PUPHeader))
{
LOG_ERROR(GENERAL, "Too small PUP file: %llu", pup_f.size());
gui_log.error("Too small PUP file: %llu", pup_f.size());
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP file size is invalid."));
return;
}
@ -563,7 +565,7 @@ void main_window::HandlePupInstallation(QString file_path)
if (header.header_length + header.data_length != pup_f.size())
{
LOG_ERROR(GENERAL, "Firmware size mismatch, expected: %llu, actual: %llu + %llu", pup_f.size(), header.header_length, header.data_length);
gui_log.error("Firmware size mismatch, expected: %llu, actual: %llu + %llu", pup_f.size(), header.header_length, header.data_length);
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP file is corrupted."));
return;
}
@ -571,14 +573,14 @@ void main_window::HandlePupInstallation(QString file_path)
pup_object pup(pup_f);
if (!pup)
{
LOG_ERROR(GENERAL, "Error while installing firmware: PUP file is invalid.");
gui_log.error("Error while installing firmware: PUP file is invalid.");
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP file is invalid."));
return;
}
if (!pup.validate_hashes())
{
LOG_ERROR(GENERAL, "Error while installing firmware: Hash check failed. ");
gui_log.error("Error while installing firmware: Hash check failed. ");
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP file contents are invalid."));
return;
}
@ -630,7 +632,7 @@ void main_window::HandlePupInstallation(QString file_path)
auto dev_flash_tar_f = self_dec.MakeFile();
if (dev_flash_tar_f.size() < 3)
{
LOG_ERROR(GENERAL, "Error while installing firmware: PUP contents are invalid.");
gui_log.error("Error while installing firmware: PUP contents are invalid.");
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: PUP contents are invalid."));
progress = -1;
}
@ -638,7 +640,7 @@ void main_window::HandlePupInstallation(QString file_path)
tar_object dev_flash_tar(dev_flash_tar_f[2]);
if (!dev_flash_tar.extract(g_cfg.vfs.get_dev_flash(), "dev_flash/"))
{
LOG_ERROR(GENERAL, "Error while installing firmware: TAR contents are invalid.");
gui_log.error("Error while installing firmware: TAR contents are invalid.");
QMessageBox::critical(this, tr("Failure!"), tr("Error while installing firmware: TAR contents are invalid."));
progress = -1;
}
@ -673,7 +675,7 @@ void main_window::HandlePupInstallation(QString file_path)
if (progress > 0)
{
LOG_SUCCESS(GENERAL, "Successfully installed PS3 firmware version %s.", version_string);
gui_log.success("Successfully installed PS3 firmware version %s.", version_string);
guiSettings->ShowInfoBox(tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), gui::ib_pup_success, this);
Emu.SetForceBoot(true);
@ -699,7 +701,7 @@ void main_window::DecryptSPRXLibraries()
guiSettings->SetValue(gui::fd_decrypt_sprx, QFileInfo(modules.first()).path());
LOG_NOTICE(GENERAL, "Decrypting binaries...");
gui_log.notice("Decrypting binaries...");
for (const QString& module : modules)
{
@ -719,21 +721,21 @@ void main_window::DecryptSPRXLibraries()
if (fs::file new_file{new_path, fs::rewrite})
{
new_file.write(elf_file.to_string());
LOG_SUCCESS(GENERAL, "Decrypted %s", old_path);
gui_log.success("Decrypted %s", old_path);
}
else
{
LOG_ERROR(GENERAL, "Failed to create %s", new_path);
gui_log.error("Failed to create %s", new_path);
}
}
else
{
LOG_ERROR(GENERAL, "Failed to decrypt %s", old_path);
gui_log.error("Failed to decrypt %s", old_path);
}
}
}
LOG_NOTICE(GENERAL, "Finished decrypting all binaries.");
gui_log.notice("Finished decrypting all binaries.");
}
/** Needed so that when a backup occurs of window state in guisettings, the state is current.
@ -1021,7 +1023,7 @@ void main_window::BootRecentAction(const QAction* act)
guiSettings->SetValue(gui::rg_entries, guiSettings->List2Var(m_rg_entries));
LOG_ERROR(GENERAL, "Recent Game not valid, removed from Boot Recent list: %s", path);
gui_log.error("Recent Game not valid, removed from Boot Recent list: %s", path);
// refill menu with actions
for (int i = 0; i < m_recentGameActs.count(); i++)
@ -1031,11 +1033,11 @@ void main_window::BootRecentAction(const QAction* act)
ui->bootRecentMenu->addAction(m_recentGameActs[i]);
}
LOG_WARNING(GENERAL, "Boot Recent list refreshed");
gui_log.warning("Boot Recent list refreshed");
return;
}
LOG_ERROR(GENERAL, "Path invalid and not in m_rg_paths: %s", path);
gui_log.error("Path invalid and not in m_rg_paths: %s", path);
return;
}
@ -1050,7 +1052,7 @@ QAction* main_window::CreateRecentAction(const q_string_pair& entry, const uint&
{
if (m_rg_entries.contains(entry))
{
LOG_WARNING(GENERAL, "Recent Game not valid, removing from Boot Recent list: %s", sstr(entry.first));
gui_log.warning("Recent Game not valid, removing from Boot Recent list: %s", sstr(entry.first));
int idx = m_rg_entries.indexOf(entry);
m_rg_entries.removeAt(idx);
@ -1359,7 +1361,7 @@ void main_window::CreateConnects()
skylander_dialog* sky_diag = skylander_dialog::get_dlg(this);
sky_diag->show();
});
connect(ui->actionManage_Cheats, &QAction::triggered, [=]
{
cheat_manager_dialog* cheat_manager = cheat_manager_dialog::get_dlg(this);
@ -1465,7 +1467,7 @@ void main_window::CreateConnects()
else if (act == ui->showCatGameDataAct) categories += category::data, id = Category::Data;
else if (act == ui->showCatUnknownAct) categories += category::unknown, id = Category::Unknown_Cat;
else if (act == ui->showCatOtherAct) categories += category::others, id = Category::Others;
else LOG_WARNING(GENERAL, "categoryVisibleActGroup: category action not found");
else gui_log.warning("categoryVisibleActGroup: category action not found");
if (!categories.isEmpty())
{
@ -1841,7 +1843,7 @@ void main_window::AddGamesFromDir(const QString& path)
// search dropped path first or else the direct parent to an elf is wrongly skipped
if (Emu.BootGame(s_path, "", false, true))
{
LOG_NOTICE(GENERAL, "Returned from game addition by drag and drop: %s", s_path);
gui_log.notice("Returned from game addition by drag and drop: %s", s_path);
}
// search direct subdirectories, that way we can drop one folder containing all games
@ -1852,7 +1854,7 @@ void main_window::AddGamesFromDir(const QString& path)
if (Emu.BootGame(pth, "", false, true))
{
LOG_NOTICE(GENERAL, "Returned from game addition by drag and drop: %s", pth);
gui_log.notice("Returned from game addition by drag and drop: %s", pth);
}
}
}
@ -1974,11 +1976,11 @@ void main_window::dropEvent(QDropEvent* event)
if (!fs::copy_file(sstr(rap), Emulator::GetHddDir() + "/home/" + Emu.GetUsr() + "/exdata/" + rapname, false))
{
LOG_WARNING(GENERAL, "Could not copy rap file by drop: %s", rapname);
gui_log.warning("Could not copy rap file by drop: %s", rapname);
}
else
{
LOG_SUCCESS(GENERAL, "Successfully copied rap file by drop: %s", rapname);
gui_log.success("Successfully copied rap file by drop: %s", rapname);
}
}
@ -1995,14 +1997,14 @@ void main_window::dropEvent(QDropEvent* event)
case drop_type::drop_game: // import valid games to gamelist (games.yaml)
if (Emu.BootGame(sstr(dropPaths.first()), "", true))
{
LOG_SUCCESS(GENERAL, "Elf Boot from drag and drop done: %s", sstr(dropPaths.first()));
gui_log.success("Elf Boot from drag and drop done: %s", sstr(dropPaths.first()));
}
m_gameListFrame->Refresh(true);
break;
case drop_type::drop_rrc: // replay a rsx capture file
BootRsxCapture(sstr(dropPaths.first()));
default:
LOG_WARNING(GENERAL, "Invalid dropType in gamelist dropEvent");
gui_log.warning("Invalid dropType in gamelist dropEvent");
break;
}
}

View File

@ -1,8 +1,9 @@
#include "memory_string_searcher.h"
#include <QLabel>
LOG_CHANNEL(gui_log);
memory_string_searcher::memory_string_searcher(QWidget* parent)
: QDialog(parent)
{
@ -33,7 +34,7 @@ void memory_string_searcher::OnSearch()
const char *str = wstr.toStdString().c_str();
const u32 len = wstr.length();
LOG_NOTICE(GENERAL, "Searching for string %s", str);
gui_log.notice("Searching for string %s", str);
// Search the address space for the string
u32 strIndex = 0;
@ -53,7 +54,7 @@ void memory_string_searcher::OnSearch()
if (strIndex == len)
{
// Found it
LOG_NOTICE(GENERAL, "Found @ %04x", addr - len);
gui_log.notice("Found @ %04x", addr - len);
numFound++;
strIndex = 0;
continue;
@ -68,9 +69,9 @@ void memory_string_searcher::OnSearch()
if (addr % (1024 * 1024 * 64) == 0) // Log every 64mb
{
LOG_NOTICE(GENERAL, "Searching %04x ...", addr);
gui_log.notice("Searching %04x ...", addr);
}
}
LOG_NOTICE(GENERAL, "Search completed (found %d matches)", numFound);
gui_log.notice("Search completed (found %d matches)", numFound);
}

View File

@ -24,6 +24,8 @@
#include "Input/evdev_joystick_handler.h"
#endif
LOG_CHANNEL(cfg_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
constexpr auto qstr = QString::fromStdString;
@ -31,7 +33,7 @@ inline bool CreateConfigFile(const QString& dir, const QString& name)
{
if (!QDir().mkpath(dir))
{
LOG_ERROR(GENERAL, "Failed to create dir %s", sstr(dir));
cfg_log.error("Failed to create dir %s", sstr(dir));
return false;
}
@ -40,7 +42,7 @@ inline bool CreateConfigFile(const QString& dir, const QString& name)
if (!new_file.open(QIODevice::WriteOnly))
{
LOG_ERROR(GENERAL, "Failed to create file %s", sstr(filename));
cfg_log.error("Failed to create file %s", sstr(filename));
return false;
}
@ -114,7 +116,7 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent, const GameInfo *game)
if (!g_cfg_input.player[m_tabs->currentIndex()]->device.from_string(m_device_name))
{
// Something went wrong
LOG_ERROR(GENERAL, "Failed to convert device string: %s", m_device_name);
cfg_log.error("Failed to convert device string: %s", m_device_name);
return;
}
});
@ -130,7 +132,7 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent, const GameInfo *game)
if (!g_cfg_input.player[m_tabs->currentIndex()]->profile.from_string(m_profile))
{
// Something went wrong
LOG_ERROR(GENERAL, "Failed to convert profile string: %s", m_profile);
cfg_log.error("Failed to convert profile string: %s", m_profile);
return;
}
ChangeProfile();
@ -424,7 +426,7 @@ void pad_settings_dialog::InitButtons()
{
if (!ui->chooseDevice->itemData(i).canConvert<pad_device_info>())
{
LOG_FATAL(GENERAL, "Cannot convert itemData for index %d and itemText %s", i, sstr(ui->chooseDevice->itemText(i)));
cfg_log.fatal("Cannot convert itemData for index %d and itemText %s", i, sstr(ui->chooseDevice->itemText(i)));
continue;
}
const pad_device_info info = ui->chooseDevice->itemData(i).value<pad_device_info>();
@ -981,7 +983,7 @@ void pad_settings_dialog::ChangeInputType()
if (!g_cfg_input.player[player]->handler.from_string(handler))
{
// Something went wrong
LOG_ERROR(GENERAL, "Failed to convert input string: %s", handler);
cfg_log.error("Failed to convert input string: %s", handler);
return;
}
@ -1072,7 +1074,7 @@ void pad_settings_dialog::ChangeInputType()
{
if (!ui->chooseDevice->itemData(i).canConvert<pad_device_info>())
{
LOG_FATAL(GENERAL, "Cannot convert itemData for index %d and itemText %s", i, sstr(ui->chooseDevice->itemText(i)));
cfg_log.fatal("Cannot convert itemData for index %d and itemText %s", i, sstr(ui->chooseDevice->itemText(i)));
continue;
}
const pad_device_info info = ui->chooseDevice->itemData(i).value<pad_device_info>();

View File

@ -22,6 +22,8 @@
#include <QPainter>
#include <QScreen>
LOG_CHANNEL(gui_log);
namespace
{
// Helper converters
@ -254,7 +256,7 @@ void save_manager_dialog::UpdateList()
QPixmap icon = QPixmap(320, 176);
if (!icon.loadFromData(entry.iconBuf.data(), static_cast<uint>(entry.iconBuf.size())))
{
LOG_WARNING(GENERAL, "Loading icon for save %s failed", entry.dirName);
gui_log.warning("Loading icon for save %s failed", entry.dirName);
icon = QPixmap(320, 176);
icon.fill(m_icon_color);
}

View File

@ -32,6 +32,8 @@
#include "_discord_utils.h"
#endif
LOG_CHANNEL(cfg_log);
inline std::string sstr(const QString& _in) { return _in.toStdString(); }
inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); }
@ -1685,7 +1687,7 @@ void settings_dialog::AddConfigs()
}
else
{
LOG_WARNING(GENERAL, "Trying to set an invalid config index %d", index);
cfg_log.warning("Trying to set an invalid config index %d", index);
}
}
@ -1713,7 +1715,7 @@ void settings_dialog::AddStylesheets()
}
else
{
LOG_WARNING(GENERAL, "Trying to set an invalid stylesheets index: %d (%s)", index, sstr(m_currentStylesheet));
cfg_log.warning("Trying to set an invalid stylesheets index: %d (%s)", index, sstr(m_currentStylesheet));
}
}

View File

@ -35,6 +35,8 @@
#include <QGuiApplication>
#include <QScreen>
LOG_CHANNEL(gui_log);
namespace
{
constexpr auto qstr = QString::fromStdString;
@ -363,7 +365,7 @@ bool trophy_manager_dialog::LoadTrophyFolderToDB(const std::string& trop_name)
if (!success || !config)
{
LOG_ERROR(GENERAL, "Failed to load trophy database for %s", trop_name);
gui_log.error("Failed to load trophy database for %s", trop_name);
return false;
}
@ -371,7 +373,7 @@ bool trophy_manager_dialog::LoadTrophyFolderToDB(const std::string& trop_name)
if (trophy_count == 0)
{
LOG_ERROR(GENERAL, "Warning game %s in trophy folder %s usr file reports zero trophies. Cannot load in trophy manager.", game_trophy_data->game_name, game_trophy_data->path);
gui_log.error("Warning game %s in trophy folder %s usr file reports zero trophies. Cannot load in trophy manager.", game_trophy_data->game_name, game_trophy_data->path);
return false;
}
@ -392,7 +394,7 @@ bool trophy_manager_dialog::LoadTrophyFolderToDB(const std::string& trop_name)
const QString path = qstr(game_trophy_data->path) + "TROP" + padding + QString::number(trophy_id) + ".PNG";
if (!trophy_icon.load(path))
{
LOG_ERROR(GENERAL, "Failed to load trophy icon for trophy %d %s", trophy_id, game_trophy_data->path);
gui_log.error("Failed to load trophy icon for trophy %d %s", trophy_id, game_trophy_data->path);
}
game_trophy_data->trophy_images.emplace_back(std::move(trophy_icon));
}
@ -708,7 +710,7 @@ void trophy_manager_dialog::StartTrophyLoadThreads()
futureWatcher.setFuture(QtConcurrent::map(indices, [this, folder_list, &progressDialog](const int& i)
{
const std::string dir_name = sstr(folder_list.value(i));
LOG_TRACE(GENERAL, "Loading trophy dir: %s", dir_name);
gui_log.trace("Loading trophy dir: %s", dir_name);
try
{
LoadTrophyFolderToDB(dir_name);
@ -717,7 +719,7 @@ void trophy_manager_dialog::StartTrophyLoadThreads()
{
// TODO: Add error checks & throws to LoadTrophyFolderToDB so that they can be caught here.
// Also add a way of showing the number of corrupted/invalid folders in UI somewhere.
LOG_ERROR(GENERAL, "Exception occurred while parsing folder %s for trophies: %s", dir_name, e.what());
gui_log.error("Exception occurred while parsing folder %s for trophies: %s", dir_name, e.what());
}
}));
@ -746,7 +748,7 @@ void trophy_manager_dialog::PopulateGameTable()
const std::string icon_path = m_trophies_db[i]->path + "ICON0.PNG";
if (!icon.load(qstr(icon_path)))
{
LOG_WARNING(GENERAL, "Could not load trophy game icon from path %s", icon_path);
gui_log.warning("Could not load trophy game icon from path %s", icon_path);
}
return icon;
};
@ -785,7 +787,7 @@ void trophy_manager_dialog::PopulateTrophyTable()
return;
auto& data = m_trophies_db[m_game_combo->currentData().toInt()];
LOG_TRACE(GENERAL, "Populating Trophy Manager UI with %s %s", data->game_name, data->path);
gui_log.trace("Populating Trophy Manager UI with %s %s", data->game_name, data->path);
const int all_trophies = data->trop_usr->GetTrophiesCount();
const int unlocked_trophies = data->trop_usr->GetUnlockedTrophiesCount();
@ -804,7 +806,7 @@ void trophy_manager_dialog::PopulateTrophyTable()
}
else
{
LOG_ERROR(GENERAL, "Root name does not match trophyconf in trophy. Name received: %s", trophy_base->GetChildren()->GetName());
gui_log.error("Root name does not match trophyconf in trophy. Name received: %s", trophy_base->GetChildren()->GetName());
return;
}

View File

@ -26,6 +26,8 @@
#include <sys/stat.h>
#endif
LOG_CHANNEL(update_log);
update_manager::update_manager()
{
m_manager.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
@ -43,7 +45,7 @@ void update_manager::check_for_updates(bool automatic, QWidget* parent)
if (QSslSocket::supportsSsl() == false)
{
LOG_ERROR(GENERAL, "Unable to update RPCS3! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
update_log.error("Unable to update RPCS3! Please make sure your system supports SSL. Visit our quickstart guide for more information: https://rpcs3.net/quickstart");
if (!automatic)
{
const QString message = tr("Unable to update RPCS3!<br>Please make sure your system supports SSL.<br>Visit our <a href='https://rpcs3.net/quickstart'>Quickstart</a> guide for more information.");
@ -96,7 +98,7 @@ void update_manager::handle_error(QNetworkReply::NetworkError error)
if (error != QNetworkReply::OperationCanceledError)
{
QString error = reply->errorString();
LOG_ERROR(GENERAL, "[Auto-updater] Network Error: %s", error.toStdString());
update_log.error("[Auto-updater] Network Error: %s", error.toStdString());
}
}
}
@ -110,7 +112,7 @@ bool update_manager::handle_reply(QNetworkReply* reply, std::function<bool(updat
const QByteArray data = reply->readAll();
reply->deleteLater();
LOG_NOTICE(GENERAL, "[Auto-updater] %s", message);
update_log.notice("[Auto-updater] %s", message);
if (!func(*this, data, automatic))
{
m_progress_dialog->close();
@ -142,9 +144,9 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
}
if (return_code != -1)
LOG_ERROR(GENERAL, "[Auto-updater] error: %s return code: %d", error_message, return_code);
update_log.error("[Auto-updater] error: %s return code: %d", error_message, return_code);
else
LOG_WARNING(GENERAL, "[Auto-updater] error: %s return code: %d", error_message, return_code);
update_log.warning("[Auto-updater] error: %s return code: %d", error_message, return_code);
// If a user clicks "Check for Updates" with a custom build ask him if he's sure he wants to update to latest version
if (!automatic && return_code == -1)
@ -167,7 +169,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
const auto& latest = json_data["latest_build"];
if (!latest.isObject())
{
LOG_ERROR(GENERAL, "[Auto-updater] JSON doesn't contain latest_build section");
update_log.error("[Auto-updater] JSON doesn't contain latest_build section");
return false;
}
@ -178,7 +180,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
#elif defined(__linux__)
os = "linux";
#else
LOG_ERROR(GENERAL, "[Auto-updater] Your OS isn't currently supported by the auto-updater");
update_log.error("[Auto-updater] Your OS isn't currently supported by the auto-updater");
return false;
#endif
@ -187,13 +189,13 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
!latest["datetime"].isString() ||
(hash_found && (!json_data["current_build"].isObject() || !json_data["current_build"]["version"].isString() || !json_data["current_build"]["datetime"].isString())))
{
LOG_ERROR(GENERAL, "[Auto-updater] Some information seems unavailable");
update_log.error("[Auto-updater] Some information seems unavailable");
return false;
}
if (hash_found && return_code == 0)
{
LOG_SUCCESS(GENERAL, "[Auto-updater] RPCS3 is up to date!");
update_log.success("[Auto-updater] RPCS3 is up to date!");
m_progress_dialog->close();
if (!automatic)
@ -274,7 +276,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
{
if (m_expected_size != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size);
update_log.error("[Auto-updater] Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size);
return false;
}
@ -295,7 +297,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (m_expected_hash != res_hash_string)
{
LOG_ERROR(GENERAL, "[Auto-updater] Hash mismatch: %s expected: %s", res_hash_string, m_expected_hash);
update_log.error("[Auto-updater] Hash mismatch: %s expected: %s", res_hash_string, m_expected_hash);
return false;
}
@ -307,22 +309,22 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (appimage_path != nullptr)
{
replace_path = appimage_path;
LOG_NOTICE(GENERAL, "[Auto-updater] Found AppImage path: %s", appimage_path);
update_log.notice("[Auto-updater] Found AppImage path: %s", appimage_path);
}
else
{
LOG_WARNING(GENERAL, "[Auto-updater] Failed to find AppImage path");
update_log.warning("[Auto-updater] Failed to find AppImage path");
char exe_path[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1);
if (len == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to find executable path");
update_log.error("[Auto-updater] Failed to find executable path");
return false;
}
exe_path[len] = '\0';
LOG_TRACE(GENERAL, "[Auto-updater] Found exec path: %s", exe_path);
update_log.trace("[Auto-updater] Found exec path: %s", exe_path);
replace_path = exe_path;
}
@ -335,22 +337,22 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
fs::file new_appimage(replace_path, fs::read + fs::write + fs::create + fs::trunc);
if (!new_appimage)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to create new AppImage file: %s", replace_path);
update_log.error("[Auto-updater] Failed to create new AppImage file: %s", replace_path);
return false;
}
if (new_appimage.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to write new AppImage file: %s", replace_path);
update_log.error("[Auto-updater] Failed to write new AppImage file: %s", replace_path);
return false;
}
if (fchmod(new_appimage.get_handle(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to chmod rwxrxrx %s", replace_path);
update_log.error("[Auto-updater] Failed to chmod rwxrxrx %s", replace_path);
return false;
}
new_appimage.close();
LOG_SUCCESS(GENERAL, "[Auto-updater] Successfully updated %s!", replace_path);
update_log.success("[Auto-updater] Successfully updated %s!", replace_path);
#elif defined(_WIN32)
@ -365,12 +367,12 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
fs::file tmpfile(tmpfile_path, fs::read + fs::write + fs::create + fs::trunc);
if (!tmpfile)
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to create temporary file: %s", tmpfile_path);
update_log.error("[Auto-updater] Failed to create temporary file: %s", tmpfile_path);
return false;
}
if (tmpfile.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size())
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to write temporary file: %s", tmpfile_path);
update_log.error("[Auto-updater] Failed to write temporary file: %s", tmpfile_path);
return false;
}
tmpfile.close();
@ -396,7 +398,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (InFile_Open(&archiveStream.file, tmpfile_path.c_str()))
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to open temporary storage file: %s", tmpfile_path);
update_log.error("[Auto-updater] Failed to open temporary storage file: %s", tmpfile_path);
return false;
}
@ -429,10 +431,10 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
switch (res)
{
case SZ_OK: break;
case SZ_ERROR_UNSUPPORTED: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder doesn't support this archive"); break;
case SZ_ERROR_MEM: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder failed to allocate memory"); break;
case SZ_ERROR_CRC: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder CRC error"); break;
default: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: %d", static_cast<u64>(res)); break;
case SZ_ERROR_UNSUPPORTED: update_log.error("[Auto-updater] 7z decoder doesn't support this archive"); break;
case SZ_ERROR_MEM: update_log.error("[Auto-updater] 7z decoder failed to allocate memory"); break;
case SZ_ERROR_CRC: update_log.error("[Auto-updater] 7z decoder CRC error"); break;
default: update_log.error("[Auto-updater] 7z decoder error: %d", static_cast<u64>(res)); break;
}
};
@ -467,7 +469,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (len >= PATH_MAX)
{
LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: filename longer or equal to PATH_MAX");
update_log.error("[Auto-updater] 7z decoder error: filename longer or equal to PATH_MAX");
error_free7z();
return false;
}
@ -479,7 +481,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
{
if (temp_u16[index] > 0xFF)
{
LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: Failed to convert UTF-16 to UTF-8");
update_log.error("[Auto-updater] 7z decoder error: Failed to convert UTF-16 to UTF-8");
error_free7z();
return false;
}
@ -500,13 +502,13 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (size_t pos = name.find_last_of('/'); pos != std::string::npos)
{
LOG_TRACE(GENERAL, "[Auto-updater] Creating path: %s", name.substr(0, pos));
update_log.trace("[Auto-updater] Creating path: %s", name.substr(0, pos));
fs::create_path(name.substr(0, pos));
}
if (isDir)
{
LOG_TRACE(GENERAL, "[Auto-updater] Creating dir: %s", name);
update_log.trace("[Auto-updater] Creating dir: %s", name);
fs::create_dir(name);
continue;
}
@ -525,10 +527,10 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
// Moving to temp is not an option on windows as it will fail if the disk is different
// So we create a folder in config dir and move stuff there
const std::string rename_target = tmp_folder + filename;
LOG_TRACE(GENERAL, "[Auto-updater] Renaming %s to %s", name, rename_target);
update_log.trace("[Auto-updater] Renaming %s to %s", name, rename_target);
if (!fs::rename(name, rename_target, true))
{
LOG_ERROR(GENERAL, "[Auto-updater] Failed to rename %s to %s", name, rename_target);
update_log.error("[Auto-updater] Failed to rename %s to %s", name, rename_target);
res = SZ_ERROR_FAIL;
break;
}
@ -536,7 +538,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
outfile.open(name, fs::read + fs::write + fs::create + fs::trunc);
if (!outfile)
{
LOG_ERROR(GENERAL, "[Auto-updater] can not open output file %s", name);
update_log.error("[Auto-updater] can not open output file %s", name);
res = SZ_ERROR_FAIL;
break;
}
@ -544,7 +546,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
if (outfile.write(outBuffer + offset, outSizeProcessed) != outSizeProcessed)
{
LOG_ERROR(GENERAL, "[Auto-updater] can not write output file: %s", name);
update_log.error("[Auto-updater] can not write output file: %s", name);
res = SZ_ERROR_FAIL;
break;
}
@ -573,7 +575,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
#endif
if (ret == -1)
{
LOG_ERROR(GENERAL, "[Auto-updater] Relaunching failed with result: %d(%s)", ret, strerror(errno));
update_log.error("[Auto-updater] Relaunching failed with result: %d(%s)", ret, strerror(errno));
return false;
}

View File

@ -1,5 +1,7 @@
#include "user_account.h"
LOG_CHANNEL(gui_log);
UserAccount::UserAccount(const std::string& user_id)
{
// Setting userId.
@ -18,12 +20,12 @@ UserAccount::UserAccount(const std::string& user_id)
if (m_username.length() > 16) // max of 16 chars on real PS3
{
m_username = m_username.substr(0, 16);
LOG_WARNING(GENERAL, "UserAccount: localusername of userId=%s was too long, cropped to: %s", m_user_id, m_username);
gui_log.warning("UserAccount: localusername of userId=%s was too long, cropped to: %s", m_user_id, m_username);
}
}
else
{
LOG_ERROR(GENERAL, "UserAccount: localusername file read error (userId=%s, userDir=%s).", m_user_id, m_user_dir);
gui_log.error("UserAccount: localusername file read error (userId=%s, userDir=%s).", m_user_id, m_user_dir);
}
}

View File

@ -8,12 +8,15 @@
#include "main_application.h"
#include "Utilities/StrUtil.h"
#include "Utilities/Log.h"
#include <QRegExpValidator>
#include <QInputDialog>
#include <QScreen>
#include <QKeyEvent>
LOG_CHANNEL(gui_log);
namespace
{
std::map<u32, UserAccount> GetUserAccounts(const std::string& base_dir)
@ -237,7 +240,7 @@ void user_manager_dialog::OnUserRemove()
if (QMessageBox::question(this, tr("Delete Confirmation"), tr("Are you sure you want to delete the following user?\n\nUser ID: %0\nUsername: %1\n\n"
"This will remove all files in:\n%2").arg(user_id).arg(username).arg(qstr(user_dir)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
LOG_WARNING(GENERAL, "Deleting user: %s", user_dir);
gui_log.warning("Deleting user: %s", user_dir);
fs::remove_all(user_dir);
UpdateTable();
}
@ -301,11 +304,11 @@ void user_manager_dialog::OnUserRename()
if (fs::write_file(username_file, fs::rewrite, new_username))
{
LOG_SUCCESS(GENERAL, "Renamed user %s with id %s to %s", username, user_id, new_username);
gui_log.success("Renamed user %s with id %s to %s", username, user_id, new_username);
}
else
{
LOG_FATAL(GENERAL, "Could not rename user %s with id %s to %s", username, user_id, new_username);
gui_log.fatal("Could not rename user %s with id %s to %s", username, user_id, new_username);
}
UpdateTable();
@ -370,7 +373,7 @@ void user_manager_dialog::OnUserLogin()
if (!main_application::InitializeEmulator(new_user, false, Emu.HasGui()))
{
LOG_FATAL(GENERAL, "Failed to login user! username=%s key=%d", new_user, key);
gui_log.fatal("Failed to login user! username=%s key=%d", new_user, key);
return;
}
@ -389,7 +392,7 @@ void user_manager_dialog::OnSort(int logicalIndex)
else if (logicalIndex == m_sort_column)
{
m_sort_ascending ^= true;
}
}
else
{
m_sort_ascending = true;