mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-04 15:05:02 -06:00
Swap LOG macros for std::cerr and std::cout use.
This commit is contained in:
parent
4fbd9608f2
commit
a14d46d383
@ -89,12 +89,11 @@ std::optional<T> get_optional(const toml::value& v, const std::string& key) {
|
||||
|
||||
void EmulatorSettingsImpl::PrintChangedSummary(const std::vector<std::string>& changed) {
|
||||
if (changed.empty()) {
|
||||
LOG_DEBUG(Config, "No game-specific overrides applied");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG(Config, "Game-specific overrides applied:");
|
||||
std::cout << "Game-specific overrides applied:" << std::endl;
|
||||
for (const auto& k : changed)
|
||||
LOG_DEBUG(Config, " * {}", k);
|
||||
std::cout << " * " << k << std::endl;
|
||||
}
|
||||
|
||||
// ── Singleton ────────────────────────────────────────────────────────
|
||||
@ -232,7 +231,6 @@ void EmulatorSettingsImpl::ClearGameSpecificOverrides() {
|
||||
ClearGroupOverrides(m_audio);
|
||||
ClearGroupOverrides(m_gpu);
|
||||
ClearGroupOverrides(m_vulkan);
|
||||
LOG_DEBUG(Config, "All game-specific overrides cleared");
|
||||
}
|
||||
|
||||
void EmulatorSettingsImpl::ResetGameSpecificValue(const std::string& key) {
|
||||
@ -260,7 +258,7 @@ void EmulatorSettingsImpl::ResetGameSpecificValue(const std::string& key) {
|
||||
return;
|
||||
if (tryGroup(m_vulkan))
|
||||
return;
|
||||
LOG_WARNING(Config, "ResetGameSpecificValue: key '{}' not found", key);
|
||||
std::cerr << "ResetGameSpecificValue: key '" << key << "' not found" << std::endl;
|
||||
}
|
||||
|
||||
bool EmulatorSettingsImpl::Save(const std::string& serial) {
|
||||
@ -302,7 +300,8 @@ bool EmulatorSettingsImpl::Save(const std::string& serial) {
|
||||
|
||||
std::ofstream out(path);
|
||||
if (!out) {
|
||||
LOG_ERROR(Config, "Failed to open game config for writing: {}", path.string());
|
||||
std::cerr << "Failed to open game config for writing: " << path.string()
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
out << std::setw(2) << j;
|
||||
@ -344,14 +343,14 @@ bool EmulatorSettingsImpl::Save(const std::string& serial) {
|
||||
|
||||
std::ofstream out(path);
|
||||
if (!out) {
|
||||
LOG_ERROR(Config, "Failed to open config for writing: {}", path.string());
|
||||
std::cerr << "Failed to open config for writing: " << path.string() << std::endl;
|
||||
return false;
|
||||
}
|
||||
out << std::setw(2) << existing;
|
||||
return !out.fail();
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Config, "Error saving settings: {}", e.what());
|
||||
std::cerr << "Error saving settings: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -364,7 +363,6 @@ bool EmulatorSettingsImpl::Load(const std::string& serial) {
|
||||
// ── Global config ──────────────────────────────────────────
|
||||
const auto userDir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||
const auto configPath = userDir / "config.json";
|
||||
LOG_DEBUG(Config, "Loading global config from: {}", configPath.string());
|
||||
|
||||
if (std::ifstream in{configPath}; in.good()) {
|
||||
json gj;
|
||||
@ -385,8 +383,6 @@ bool EmulatorSettingsImpl::Load(const std::string& serial) {
|
||||
mergeGroup(m_audio, "Audio");
|
||||
mergeGroup(m_gpu, "GPU");
|
||||
mergeGroup(m_vulkan, "Vulkan");
|
||||
|
||||
LOG_DEBUG(Config, "Global config loaded successfully");
|
||||
} else {
|
||||
if (std::filesystem::exists(Common::FS::GetUserPath(Common::FS::PathType::UserDir) /
|
||||
"config.toml")) {
|
||||
@ -420,7 +416,6 @@ bool EmulatorSettingsImpl::Load(const std::string& serial) {
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_DEBUG(Config, "Global config not found - using defaults");
|
||||
SetDefaultValues();
|
||||
Save();
|
||||
}
|
||||
@ -436,16 +431,14 @@ bool EmulatorSettingsImpl::Load(const std::string& serial) {
|
||||
// base configuration.
|
||||
const auto gamePath =
|
||||
Common::FS::GetUserPath(Common::FS::PathType::CustomConfigs) / (serial + ".json");
|
||||
LOG_DEBUG(Config, "Applying game config: {}", gamePath.string());
|
||||
|
||||
if (!std::filesystem::exists(gamePath)) {
|
||||
LOG_DEBUG(Config, "No game-specific config found for {}", serial);
|
||||
return false;
|
||||
}
|
||||
|
||||
std::ifstream in(gamePath);
|
||||
if (!in) {
|
||||
LOG_ERROR(Config, "Failed to open game config: {}", gamePath.string());
|
||||
std::cerr << "Failed to open game config: " << gamePath.string() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -478,7 +471,7 @@ bool EmulatorSettingsImpl::Load(const std::string& serial) {
|
||||
return true;
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Config, "Error loading settings: {}", e.what());
|
||||
std::cerr << "Error loading settings: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -678,7 +671,7 @@ bool EmulatorSettingsImpl::TransferSettings() {
|
||||
}
|
||||
s.install_dirs.value = settings_install_dirs;
|
||||
} catch (const std::exception& e) {
|
||||
LOG_WARNING(Config, "Failed to transfer install directories: {}", e.what());
|
||||
std::cerr << "Failed to transfer install directories: " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
// Transfer addon install directory
|
||||
@ -694,7 +687,7 @@ bool EmulatorSettingsImpl::TransferSettings() {
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_WARNING(Config, "Failed to transfer addon install directory: {}", e.what());
|
||||
std::cerr << "Failed to transfer addon install directory: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
if (og_data.contains("General")) {
|
||||
@ -713,7 +706,8 @@ bool EmulatorSettingsImpl::TransferSettings() {
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_WARNING(Config, "Failed to transfer sysmodules install directory: {}", e.what());
|
||||
std::cerr << "Failed to transfer sysmodules install directory: " << e.what()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
// Transfer font install directory
|
||||
@ -729,7 +723,7 @@ bool EmulatorSettingsImpl::TransferSettings() {
|
||||
}
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
LOG_WARNING(Config, "Failed to transfer font install directory: {}", e.what());
|
||||
std::cerr << "Failed to transfer font install directory: " << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include <filesystem>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <sstream>
|
||||
@ -116,26 +117,19 @@ inline OverrideItem make_override(const char* key, Setting<T> Struct::* member)
|
||||
return OverrideItem{
|
||||
key,
|
||||
[member, key](void* base, const nlohmann::json& entry, std::vector<std::string>& changed) {
|
||||
LOG_DEBUG(Config, "[make_override] Processing key: {}", key);
|
||||
LOG_DEBUG(Config, "[make_override] Entry JSON: {}", entry.dump());
|
||||
Struct* obj = reinterpret_cast<Struct*>(base);
|
||||
Setting<T>& dst = obj->*member;
|
||||
try {
|
||||
T newValue = entry.get<T>();
|
||||
LOG_DEBUG(Config, "[make_override] Parsed value: {}", newValue);
|
||||
LOG_DEBUG(Config, "[make_override] Current value: {}", dst.value);
|
||||
if (dst.value != newValue) {
|
||||
std::ostringstream oss;
|
||||
oss << key << " ( " << dst.value << " → " << newValue << " )";
|
||||
oss << key << " ( " << dst.value << " -> " << newValue << " )";
|
||||
changed.push_back(oss.str());
|
||||
LOG_DEBUG(Config, "[make_override] Recorded change: {}", oss.str());
|
||||
}
|
||||
dst.game_specific_value = newValue;
|
||||
LOG_DEBUG(Config, "[make_override] Successfully updated {}", key);
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Config, "[make_override] ERROR parsing {}: {}", key, e.what());
|
||||
LOG_ERROR(Config, "[make_override] Entry was: {}", entry.dump());
|
||||
LOG_ERROR(Config, "[make_override] Type name: {}", entry.type_name());
|
||||
std::cerr << "make_override: failed to parse " << key << ": " << e.what()
|
||||
<< std::endl;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <common/path_util.h>
|
||||
#include <common/scm_rev.h>
|
||||
@ -59,13 +60,13 @@ bool UserSettingsImpl::Save() const {
|
||||
|
||||
std::ofstream out(path);
|
||||
if (!out) {
|
||||
LOG_ERROR(Config, "Failed to open user settings for writing: {}", path.string());
|
||||
std::cerr << "Failed to open user settings for writing: " << path.string() << std::endl;
|
||||
return false;
|
||||
}
|
||||
out << std::setw(2) << existing;
|
||||
return !out.fail();
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Config, "Error saving user settings: {}", e.what());
|
||||
std::cerr << "Error saving user settings: " << e.what() << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -74,7 +75,6 @@ bool UserSettingsImpl::Load() {
|
||||
const auto path = Common::FS::GetUserPath(Common::FS::PathType::UserDir) / "users.json";
|
||||
try {
|
||||
if (!std::filesystem::exists(path)) {
|
||||
LOG_DEBUG(Config, "User settings file not found: {}", path.string());
|
||||
if (m_userManager.GetUsers().user.empty())
|
||||
m_userManager.GetUsers() = m_userManager.CreateDefaultUsers();
|
||||
m_loaded = true;
|
||||
@ -84,7 +84,7 @@ bool UserSettingsImpl::Load() {
|
||||
|
||||
std::ifstream in(path);
|
||||
if (!in) {
|
||||
LOG_ERROR(Config, "Failed to open user settings: {}", path.string());
|
||||
std::cerr << "Failed to open user settings: " << path.string() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -103,15 +103,13 @@ bool UserSettingsImpl::Load() {
|
||||
m_userManager.GetUsers() = default_users;
|
||||
}
|
||||
|
||||
LOG_DEBUG(Config, "User settings loaded successfully");
|
||||
|
||||
m_loaded = true;
|
||||
if (m_userManager.GetUsers().commit_hash != Common::g_scm_rev)
|
||||
Save();
|
||||
|
||||
return true;
|
||||
} catch (const std::exception& e) {
|
||||
LOG_ERROR(Config, "Error loading user settings: {}", e.what());
|
||||
std::cerr << "Error loading user settings: " << e.what() << std::endl;
|
||||
if (m_userManager.GetUsers().user.empty())
|
||||
m_userManager.GetUsers() = m_userManager.CreateDefaultUsers();
|
||||
return false;
|
||||
|
||||
@ -190,13 +190,14 @@ void GetGameIconInfo(std::vector<IconInfo>& icons) {
|
||||
|
||||
void Launch(char* executableName) {
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
LOG_ERROR(ImGui, "SDL_INIT_VIDEO Error: {}", SDL_GetError());
|
||||
std::cout << "BigPictureMode Launch: SDL_INIT_VIDEO Error: " << SDL_GetError() << std::endl;
|
||||
SDL_Quit();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SDL_Init(SDL_INIT_GAMEPAD)) {
|
||||
LOG_ERROR(ImGui, "SDL_INIT_GAMEPAD Error: {}", SDL_GetError());
|
||||
std::cout << "BigPictureMode Launch: SDL_INIT_GAMEPAD Error: " << SDL_GetError()
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
SDL_Window* window =
|
||||
@ -204,7 +205,8 @@ void Launch(char* executableName) {
|
||||
renderer = SDL_CreateRenderer(window, nullptr);
|
||||
|
||||
if (window == nullptr) {
|
||||
LOG_ERROR(ImGui, "SDL Window Creation Error: {}", SDL_GetError());
|
||||
std::cout << "BigPictureMode Launch: SDL Window Creation Error: " << SDL_GetError()
|
||||
<< std::endl;
|
||||
SDL_DestroyRenderer(renderer);
|
||||
SDL_Quit();
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user