core: Replace remaining old non-generic logger usages with fmt-capable equivalents

LOG_GENERIC usages will be amended in a follow-up to keep API changes separate from
interface changes, as it will require removing a parameter from the relevant function
in the VMManager class.
This commit is contained in:
Lioncash 2018-04-26 14:46:54 -04:00
parent 3dd3cdeafd
commit c33755e2b9
No known key found for this signature in database
GPG Key ID: 4E3C3CC1031BA9C7
6 changed files with 28 additions and 28 deletions

View File

@ -55,8 +55,8 @@ public:
} }
void InterpreterFallback(u64 pc, size_t num_instructions) override { void InterpreterFallback(u64 pc, size_t num_instructions) override {
LOG_INFO(Core_ARM, "Unicorn fallback @ 0x%" PRIx64 " for %zu instructions (instr = %08x)", NGLOG_INFO(Core_ARM, "Unicorn fallback @ {:#X} for {} instructions (instr = {:08X})", pc,
pc, num_instructions, MemoryReadCode(pc)); num_instructions, MemoryReadCode(pc));
ARM_Interface::ThreadContext ctx; ARM_Interface::ThreadContext ctx;
parent.SaveContext(ctx); parent.SaveContext(ctx);

View File

@ -55,7 +55,7 @@ System::ResultStatus System::RunLoop(bool tight_loop) {
// If we don't have a currently active thread then don't execute instructions, // If we don't have a currently active thread then don't execute instructions,
// instead advance to the next event and try to yield to the next thread // instead advance to the next event and try to yield to the next thread
if (Kernel::GetCurrentThread() == nullptr) { if (Kernel::GetCurrentThread() == nullptr) {
LOG_TRACE(Core_ARM, "Idling"); NGLOG_TRACE(Core_ARM, "Idling");
CoreTiming::Idle(); CoreTiming::Idle();
CoreTiming::Advance(); CoreTiming::Advance();
PrepareReschedule(); PrepareReschedule();
@ -82,15 +82,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
app_loader = Loader::GetLoader(filepath); app_loader = Loader::GetLoader(filepath);
if (!app_loader) { if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); NGLOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
return ResultStatus::ErrorGetLoader; return ResultStatus::ErrorGetLoader;
} }
std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode = std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode =
app_loader->LoadKernelSystemMode(); app_loader->LoadKernelSystemMode();
if (system_mode.second != Loader::ResultStatus::Success) { if (system_mode.second != Loader::ResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", NGLOG_CRITICAL(Core, "Failed to determine system mode (Error {})!",
static_cast<int>(system_mode.second)); static_cast<int>(system_mode.second));
switch (system_mode.second) { switch (system_mode.second) {
case Loader::ResultStatus::ErrorEncrypted: case Loader::ResultStatus::ErrorEncrypted:
@ -106,15 +106,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
ResultStatus init_result{Init(emu_window, system_mode.first.get())}; ResultStatus init_result{Init(emu_window, system_mode.first.get())};
if (init_result != ResultStatus::Success) { if (init_result != ResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", NGLOG_CRITICAL(Core, "Failed to initialize system (Error {})!",
static_cast<int>(init_result)); static_cast<int>(init_result));
System::Shutdown(); System::Shutdown();
return init_result; return init_result;
} }
const Loader::ResultStatus load_result{app_loader->Load(current_process)}; const Loader::ResultStatus load_result{app_loader->Load(current_process)};
if (Loader::ResultStatus::Success != load_result) { if (Loader::ResultStatus::Success != load_result) {
LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", static_cast<int>(load_result)); NGLOG_CRITICAL(Core, "Failed to load ROM (Error {})!", static_cast<int>(load_result));
System::Shutdown(); System::Shutdown();
switch (load_result) { switch (load_result) {
@ -151,7 +151,7 @@ void System::Reschedule() {
} }
System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK"); NGLOG_DEBUG(HW_Memory, "initialized OK");
CoreTiming::Init(); CoreTiming::Init();
@ -162,7 +162,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
cpu_core = std::make_shared<ARM_Dynarmic>(); cpu_core = std::make_shared<ARM_Dynarmic>();
#else #else
cpu_core = std::make_shared<ARM_Unicorn>(); cpu_core = std::make_shared<ARM_Unicorn>();
LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); NGLOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
#endif #endif
} else { } else {
cpu_core = std::make_shared<ARM_Unicorn>(); cpu_core = std::make_shared<ARM_Unicorn>();
@ -184,7 +184,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
return ResultStatus::ErrorVideoCore; return ResultStatus::ErrorVideoCore;
} }
LOG_DEBUG(Core, "Initialized OK"); NGLOG_DEBUG(Core, "Initialized OK");
// Reset counters and set time origin to current frame // Reset counters and set time origin to current frame
GetAndResetPerfStats(); GetAndResetPerfStats();
@ -218,7 +218,7 @@ void System::Shutdown() {
app_loader.reset(); app_loader.reset();
LOG_DEBUG(Core, "Shutdown OK"); NGLOG_DEBUG(Core, "Shutdown OK");
} }
Service::SM::ServiceManager& System::ServiceManager() { Service::SM::ServiceManager& System::ServiceManager() {

View File

@ -51,11 +51,11 @@ inline s64 usToCycles(int us) {
inline s64 usToCycles(s64 us) { inline s64 usToCycles(s64 us) {
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) { if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
LOG_ERROR(Core_Timing, "Integer overflow, use max value"); NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (us > MAX_VALUE_TO_MULTIPLY) { if (us > MAX_VALUE_TO_MULTIPLY) {
LOG_DEBUG(Core_Timing, "Time very big, do rounding"); NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (us / 1000000); return BASE_CLOCK_RATE * (us / 1000000);
} }
return (BASE_CLOCK_RATE * us) / 1000000; return (BASE_CLOCK_RATE * us) / 1000000;
@ -63,11 +63,11 @@ inline s64 usToCycles(s64 us) {
inline s64 usToCycles(u64 us) { inline s64 usToCycles(u64 us) {
if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) { if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) {
LOG_ERROR(Core_Timing, "Integer overflow, use max value"); NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (us > MAX_VALUE_TO_MULTIPLY) { if (us > MAX_VALUE_TO_MULTIPLY) {
LOG_DEBUG(Core_Timing, "Time very big, do rounding"); NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000); return BASE_CLOCK_RATE * static_cast<s64>(us / 1000000);
} }
return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000; return (BASE_CLOCK_RATE * static_cast<s64>(us)) / 1000000;
@ -83,11 +83,11 @@ inline s64 nsToCycles(int ns) {
inline s64 nsToCycles(s64 ns) { inline s64 nsToCycles(s64 ns) {
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) { if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
LOG_ERROR(Core_Timing, "Integer overflow, use max value"); NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (ns > MAX_VALUE_TO_MULTIPLY) { if (ns > MAX_VALUE_TO_MULTIPLY) {
LOG_DEBUG(Core_Timing, "Time very big, do rounding"); NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (ns / 1000000000); return BASE_CLOCK_RATE * (ns / 1000000000);
} }
return (BASE_CLOCK_RATE * ns) / 1000000000; return (BASE_CLOCK_RATE * ns) / 1000000000;
@ -95,11 +95,11 @@ inline s64 nsToCycles(s64 ns) {
inline s64 nsToCycles(u64 ns) { inline s64 nsToCycles(u64 ns) {
if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) { if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) {
LOG_ERROR(Core_Timing, "Integer overflow, use max value"); NGLOG_ERROR(Core_Timing, "Integer overflow, use max value");
return std::numeric_limits<s64>::max(); return std::numeric_limits<s64>::max();
} }
if (ns > MAX_VALUE_TO_MULTIPLY) { if (ns > MAX_VALUE_TO_MULTIPLY) {
LOG_DEBUG(Core_Timing, "Time very big, do rounding"); NGLOG_DEBUG(Core_Timing, "Time very big, do rounding");
return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000); return BASE_CLOCK_RATE * (static_cast<s64>(ns) / 1000000000);
} }
return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000; return (BASE_CLOCK_RATE * static_cast<s64>(ns)) / 1000000000;

View File

@ -59,7 +59,7 @@ template <typename InputDeviceType>
void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) { void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDeviceType>> factory) {
auto pair = std::make_pair(name, std::move(factory)); auto pair = std::make_pair(name, std::move(factory));
if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) { if (!Impl::FactoryList<InputDeviceType>::list.insert(std::move(pair)).second) {
LOG_ERROR(Input, "Factory %s already registered", name.c_str()); NGLOG_ERROR(Input, "Factory '{}' already registered", name);
} }
} }
@ -71,7 +71,7 @@ void RegisterFactory(const std::string& name, std::shared_ptr<Factory<InputDevic
template <typename InputDeviceType> template <typename InputDeviceType>
void UnregisterFactory(const std::string& name) { void UnregisterFactory(const std::string& name) {
if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) { if (Impl::FactoryList<InputDeviceType>::list.erase(name) == 0) {
LOG_ERROR(Input, "Factory %s not registered", name.c_str()); NGLOG_ERROR(Input, "Factory '{}' not registered", name);
} }
} }
@ -88,7 +88,7 @@ std::unique_ptr<InputDeviceType> CreateDevice(const std::string& params) {
const auto pair = factory_list.find(engine); const auto pair = factory_list.find(engine);
if (pair == factory_list.end()) { if (pair == factory_list.end()) {
if (engine != "null") { if (engine != "null") {
LOG_ERROR(Input, "Unknown engine name: %s", engine.c_str()); NGLOG_ERROR(Input, "Unknown engine name: {}", engine);
} }
return std::make_unique<InputDeviceType>(); return std::make_unique<InputDeviceType>();
} }

View File

@ -42,14 +42,14 @@ u64 GetTelemetryId() {
if (FileUtil::Exists(filename)) { if (FileUtil::Exists(filename)) {
FileUtil::IOFile file(filename, "rb"); FileUtil::IOFile file(filename, "rb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: %s", filename.c_str()); NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
file.ReadBytes(&telemetry_id, sizeof(u64)); file.ReadBytes(&telemetry_id, sizeof(u64));
} else { } else {
FileUtil::IOFile file(filename, "wb"); FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: %s", filename.c_str()); NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
telemetry_id = GenerateTelemetryId(); telemetry_id = GenerateTelemetryId();
@ -65,7 +65,7 @@ u64 RegenerateTelemetryId() {
FileUtil::IOFile file(filename, "wb"); FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) { if (!file.IsOpen()) {
LOG_ERROR(Core, "failed to open telemetry_id: %s", filename.c_str()); NGLOG_ERROR(Core, "failed to open telemetry_id: {}", filename);
return {}; return {};
} }
file.WriteBytes(&new_telemetry_id, sizeof(u64)); file.WriteBytes(&new_telemetry_id, sizeof(u64));

View File

@ -159,7 +159,7 @@ void Recorder::Finish(const std::string& filename) {
throw "Failed to write stream element"; throw "Failed to write stream element";
} }
} catch (const char* str) { } catch (const char* str) {
LOG_ERROR(HW_GPU, "Writing CiTrace file failed: %s", str); NGLOG_ERROR(HW_GPU, "Writing CiTrace file failed: {}", str);
} }
} }