Merge pull request #9187 from lioncash/commonlog
Common: Migrate logging to fmt
This commit is contained in:
commit
07e6d008bd
|
@ -1092,8 +1092,6 @@ void ARM64XEmitter::QuickCallFunction(ARM64Reg scratchreg, const void* func)
|
|||
distance >>= 2; // Can only branch to opcode-aligned (4) addresses
|
||||
if (!IsInRangeImm26(distance))
|
||||
{
|
||||
// WARN_LOG(DYNA_REC, "Distance too far in function call (%p to %p)! Using scratch.", m_code,
|
||||
// func);
|
||||
MOVI2R(scratchreg, (uintptr_t)func);
|
||||
BLR(scratchreg);
|
||||
}
|
||||
|
|
|
@ -135,14 +135,14 @@ bool IsFile(const std::string& path)
|
|||
// Doesn't supports deleting a directory
|
||||
bool Delete(const std::string& filename)
|
||||
{
|
||||
INFO_LOG(COMMON, "Delete: file %s", filename.c_str());
|
||||
INFO_LOG_FMT(COMMON, "Delete: file {}", filename);
|
||||
|
||||
#ifdef ANDROID
|
||||
if (StringBeginsWith(filename, "content://"))
|
||||
{
|
||||
const bool success = DeleteAndroidContent(filename);
|
||||
if (!success)
|
||||
WARN_LOG(COMMON, "Delete failed on %s", filename.c_str());
|
||||
WARN_LOG_FMT(COMMON, "Delete failed on {}", filename);
|
||||
return success;
|
||||
}
|
||||
#endif
|
||||
|
@ -152,29 +152,27 @@ bool Delete(const std::string& filename)
|
|||
// Return true because we care about the file not being there, not the actual delete.
|
||||
if (!file_info.Exists())
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str());
|
||||
WARN_LOG_FMT(COMMON, "Delete: {} does not exist", filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
// We can't delete a directory
|
||||
if (file_info.IsDirectory())
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str());
|
||||
WARN_LOG_FMT(COMMON, "Delete failed: {} is a directory", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!DeleteFile(UTF8ToTStr(filename).c_str()))
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(),
|
||||
GetLastErrorString().c_str());
|
||||
WARN_LOG_FMT(COMMON, "Delete: DeleteFile failed on {}: {}", filename, GetLastErrorString());
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (unlink(filename.c_str()) == -1)
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", filename.c_str(),
|
||||
LastStrerrorString().c_str());
|
||||
WARN_LOG_FMT(COMMON, "Delete: unlink failed on {}: {}", filename, LastStrerrorString());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -185,31 +183,31 @@ bool Delete(const std::string& filename)
|
|||
// Returns true if successful, or path already exists.
|
||||
bool CreateDir(const std::string& path)
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateDir: directory %s", path.c_str());
|
||||
INFO_LOG_FMT(COMMON, "CreateDir: directory {}", path);
|
||||
#ifdef _WIN32
|
||||
if (::CreateDirectory(UTF8ToTStr(path).c_str(), nullptr))
|
||||
return true;
|
||||
DWORD error = GetLastError();
|
||||
const DWORD error = GetLastError();
|
||||
if (error == ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str());
|
||||
WARN_LOG_FMT(COMMON, "CreateDir: CreateDirectory failed on {}: already exists", path);
|
||||
return true;
|
||||
}
|
||||
ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %i", path.c_str(), error);
|
||||
ERROR_LOG_FMT(COMMON, "CreateDir: CreateDirectory failed on {}: {}", path, error);
|
||||
return false;
|
||||
#else
|
||||
if (mkdir(path.c_str(), 0755) == 0)
|
||||
return true;
|
||||
|
||||
int err = errno;
|
||||
const int err = errno;
|
||||
|
||||
if (err == EEXIST)
|
||||
{
|
||||
WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str());
|
||||
WARN_LOG_FMT(COMMON, "CreateDir: mkdir failed on {}: already exists", path);
|
||||
return true;
|
||||
}
|
||||
|
||||
ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err));
|
||||
ERROR_LOG_FMT(COMMON, "CreateDir: mkdir failed on {}: {}", path, strerror(err));
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
@ -218,11 +216,11 @@ bool CreateDir(const std::string& path)
|
|||
bool CreateFullPath(const std::string& fullPath)
|
||||
{
|
||||
int panicCounter = 100;
|
||||
INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str());
|
||||
INFO_LOG_FMT(COMMON, "CreateFullPath: path {}", fullPath);
|
||||
|
||||
if (Exists(fullPath))
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
|
||||
INFO_LOG_FMT(COMMON, "CreateFullPath: path exists {}", fullPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -245,7 +243,7 @@ bool CreateFullPath(const std::string& fullPath)
|
|||
panicCounter--;
|
||||
if (panicCounter <= 0)
|
||||
{
|
||||
ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep");
|
||||
ERROR_LOG_FMT(COMMON, "CreateFullPath: directory structure is too deep");
|
||||
return false;
|
||||
}
|
||||
position++;
|
||||
|
@ -255,25 +253,24 @@ bool CreateFullPath(const std::string& fullPath)
|
|||
// Deletes a directory filename, returns true on success
|
||||
bool DeleteDir(const std::string& filename)
|
||||
{
|
||||
INFO_LOG(COMMON, "DeleteDir: directory %s", filename.c_str());
|
||||
INFO_LOG_FMT(COMMON, "DeleteDir: directory {}", filename);
|
||||
|
||||
// check if a directory
|
||||
if (!IsDirectory(filename))
|
||||
{
|
||||
ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", filename.c_str());
|
||||
ERROR_LOG_FMT(COMMON, "DeleteDir: Not a directory {}", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (::RemoveDirectory(UTF8ToTStr(filename).c_str()))
|
||||
return true;
|
||||
ERROR_LOG(COMMON, "DeleteDir: RemoveDirectory failed on %s: %s", filename.c_str(),
|
||||
GetLastErrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "DeleteDir: RemoveDirectory failed on {}: {}", filename,
|
||||
GetLastErrorString());
|
||||
#else
|
||||
if (rmdir(filename.c_str()) == 0)
|
||||
return true;
|
||||
ERROR_LOG(COMMON, "DeleteDir: rmdir failed on %s: %s", filename.c_str(),
|
||||
LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "DeleteDir: rmdir failed on {}: {}", filename, LastStrerrorString());
|
||||
#endif
|
||||
|
||||
return false;
|
||||
|
@ -282,7 +279,7 @@ bool DeleteDir(const std::string& filename)
|
|||
// renames file srcFilename to destFilename, returns true on success
|
||||
bool Rename(const std::string& srcFilename, const std::string& destFilename)
|
||||
{
|
||||
INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
|
||||
INFO_LOG_FMT(COMMON, "Rename: {} --> {}", srcFilename, destFilename);
|
||||
#ifdef _WIN32
|
||||
auto sf = UTF8ToTStr(srcFilename);
|
||||
auto df = UTF8ToTStr(destFilename);
|
||||
|
@ -297,13 +294,13 @@ bool Rename(const std::string& srcFilename, const std::string& destFilename)
|
|||
if (MoveFile(sf.c_str(), df.c_str()))
|
||||
return true;
|
||||
}
|
||||
ERROR_LOG(COMMON, "Rename: MoveFile failed on %s --> %s: %s", srcFilename.c_str(),
|
||||
destFilename.c_str(), GetLastErrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Rename: MoveFile failed on {} --> {}: {}", srcFilename, destFilename,
|
||||
GetLastErrorString());
|
||||
#else
|
||||
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
|
||||
return true;
|
||||
ERROR_LOG(COMMON, "Rename: rename failed on %s --> %s: %s", srcFilename.c_str(),
|
||||
destFilename.c_str(), LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Rename: rename failed on {} --> {}: {}", srcFilename, destFilename,
|
||||
LastStrerrorString());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -346,13 +343,13 @@ bool RenameSync(const std::string& srcFilename, const std::string& destFilename)
|
|||
// copies file source_path to destination_path, returns true on success
|
||||
bool Copy(const std::string& source_path, const std::string& destination_path)
|
||||
{
|
||||
INFO_LOG(COMMON, "Copy: %s --> %s", source_path.c_str(), destination_path.c_str());
|
||||
INFO_LOG_FMT(COMMON, "Copy: {} --> {}", source_path, destination_path);
|
||||
#ifdef _WIN32
|
||||
if (CopyFile(UTF8ToTStr(source_path).c_str(), UTF8ToTStr(destination_path).c_str(), FALSE))
|
||||
return true;
|
||||
|
||||
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", source_path.c_str(), destination_path.c_str(),
|
||||
GetLastErrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Copy: failed %s --> %s: %s", source_path, destination_path,
|
||||
GetLastErrorString());
|
||||
return false;
|
||||
#else
|
||||
std::ifstream source{source_path, std::ios::binary};
|
||||
|
@ -378,17 +375,17 @@ u64 GetSize(const int fd)
|
|||
u64 GetSize(FILE* f)
|
||||
{
|
||||
// can't use off_t here because it can be 32-bit
|
||||
u64 pos = ftello(f);
|
||||
const u64 pos = ftello(f);
|
||||
if (fseeko(f, 0, SEEK_END) != 0)
|
||||
{
|
||||
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "GetSize: seek failed {}: {}", fmt::ptr(f), LastStrerrorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
u64 size = ftello(f);
|
||||
const u64 size = ftello(f);
|
||||
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0))
|
||||
{
|
||||
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "GetSize: seek failed {}: {}", fmt::ptr(f), LastStrerrorString());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -398,12 +395,11 @@ u64 GetSize(FILE* f)
|
|||
// creates an empty file filename, returns true on success
|
||||
bool CreateEmptyFile(const std::string& filename)
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str());
|
||||
INFO_LOG_FMT(COMMON, "CreateEmptyFile: {}", filename);
|
||||
|
||||
if (!File::IOFile(filename, "wb"))
|
||||
{
|
||||
ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", filename.c_str(),
|
||||
LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "CreateEmptyFile: failed {}: {}", filename, LastStrerrorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -413,7 +409,7 @@ bool CreateEmptyFile(const std::string& filename)
|
|||
// Recursive or non-recursive list of files and directories under directory.
|
||||
FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
|
||||
{
|
||||
INFO_LOG(COMMON, "ScanDirectoryTree: directory %s", directory.c_str());
|
||||
INFO_LOG_FMT(COMMON, "ScanDirectoryTree: directory {}", directory);
|
||||
FSTEntry parent_entry;
|
||||
parent_entry.physicalName = directory;
|
||||
parent_entry.isDirectory = true;
|
||||
|
@ -480,7 +476,7 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
|
|||
// Deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const std::string& directory)
|
||||
{
|
||||
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
|
||||
INFO_LOG_FMT(COMMON, "DeleteDirRecursively: {}", directory);
|
||||
bool success = true;
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -613,7 +609,7 @@ std::string GetCurrentDir()
|
|||
char* dir = __getcwd(nullptr, 0);
|
||||
if (!dir)
|
||||
{
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "GetCurrentDirectory failed: {}", LastStrerrorString());
|
||||
return "";
|
||||
}
|
||||
std::string strDir = dir;
|
||||
|
@ -766,14 +762,14 @@ std::string GetSysDirectory()
|
|||
#endif
|
||||
sysDir += DIR_SEP;
|
||||
|
||||
INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str());
|
||||
INFO_LOG_FMT(COMMON, "GetSysDirectory: Setting to {}:", sysDir);
|
||||
return sysDir;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
void SetSysDirectory(const std::string& path)
|
||||
{
|
||||
INFO_LOG(COMMON, "Setting Sys directory to %s", path.c_str());
|
||||
INFO_LOG_FMT(COMMON, "Setting Sys directory to {}", path);
|
||||
s_android_sys_directory = path;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2439,7 +2439,7 @@ static void* GetFuncAddress(GLContext* context, const std::string& name, void**
|
|||
*func = dlsym(RTLD_NEXT, name.c_str());
|
||||
#endif
|
||||
if (*func == nullptr)
|
||||
ERROR_LOG(VIDEO, "Couldn't load function %s", name.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "Couldn't load function {}", name);
|
||||
}
|
||||
return *func;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ static bool AttachContextToView(NSOpenGLContext* context, NSView* view, u32* wid
|
|||
NSWindow* window = [view window];
|
||||
if (window == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to get NSWindow");
|
||||
ERROR_LOG_FMT(VIDEO, "failed to get NSWindow");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,14 +83,14 @@ bool GLContextAGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
m_pixel_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||
if (m_pixel_format == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create pixel format");
|
||||
ERROR_LOG_FMT(VIDEO, "failed to create pixel format");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_context = [[NSOpenGLContext alloc] initWithFormat:m_pixel_format shareContext:nil];
|
||||
if (m_context == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create context");
|
||||
ERROR_LOG_FMT(VIDEO, "failed to create context");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ std::unique_ptr<GLContext> GLContextAGL::CreateSharedContext()
|
|||
shareContext:m_context];
|
||||
if (new_agl_context == nil)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "failed to create shared context");
|
||||
ERROR_LOG_FMT(VIDEO, "failed to create shared context");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void GLContextEGL::DetectMode()
|
|||
// Get how many configs there are
|
||||
if (!eglChooseConfig(m_egl_display, attribs, nullptr, 0, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ void GLContextEGL::DetectMode()
|
|||
// Get all the configurations
|
||||
if (!eglChooseConfig(m_egl_display, attribs, config, num_configs, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
delete[] config;
|
||||
continue;
|
||||
}
|
||||
|
@ -110,18 +110,18 @@ void GLContextEGL::DetectMode()
|
|||
|
||||
if (supportsGL)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Using OpenGL");
|
||||
INFO_LOG_FMT(VIDEO, "Using OpenGL");
|
||||
m_opengl_mode = Mode::OpenGL;
|
||||
}
|
||||
else if (supportsGLES3)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Using OpenGL|ES");
|
||||
INFO_LOG_FMT(VIDEO, "Using OpenGL|ES");
|
||||
m_opengl_mode = Mode::OpenGLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Errored before we found a mode
|
||||
ERROR_LOG(VIDEO, "Error: Failed to detect OpenGL flavour, falling back to OpenGL");
|
||||
ERROR_LOG_FMT(VIDEO, "Error: Failed to detect OpenGL flavour, falling back to OpenGL");
|
||||
// This will fail to create a context, as it'll try to use the same attribs we just failed to
|
||||
// find a matching config with
|
||||
m_opengl_mode = Mode::OpenGL;
|
||||
|
@ -149,13 +149,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
m_egl_display = OpenEGLDisplay();
|
||||
if (!m_egl_display)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed");
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglGetDisplay() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglInitialize(m_egl_display, &egl_major, &egl_minor))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglInitialize() failed");
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglInitialize() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -191,13 +191,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
ctx_attribs = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG(VIDEO, "Unknown opengl mode set");
|
||||
ERROR_LOG_FMT(VIDEO, "Unknown opengl mode set");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!eglChooseConfig(m_egl_display, attribs, &m_config, 1, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
INFO_LOG_FMT(VIDEO, "Error: couldn't get an EGL visual config");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -247,13 +247,13 @@ bool GLContextEGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
|
||||
if (!m_egl_context)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreateContext failed");
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglCreateContext failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CreateWindowSurface())
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed 0x%04x", eglGetError());
|
||||
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed {:#06x}", eglGetError());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ std::unique_ptr<GLContext> GLContextEGL::CreateSharedContext()
|
|||
eglCreateContext(m_egl_display, m_config, m_egl_context, m_attribs.data());
|
||||
if (!new_egl_context)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreateContext failed 0x%04x", eglGetError());
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglCreateContext failed {:#06x}", eglGetError());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ std::unique_ptr<GLContext> GLContextEGL::CreateSharedContext()
|
|||
new_context->m_is_shared = true;
|
||||
if (!new_context->CreateWindowSurface())
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed 0x%04x", eglGetError());
|
||||
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed {:#06x}", eglGetError());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ bool GLContextEGL::CreateWindowSurface()
|
|||
m_egl_surface = eglCreateWindowSurface(m_egl_display, m_config, native_window, nullptr);
|
||||
if (!m_egl_surface)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed");
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglCreateWindowSurface failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ bool GLContextEGL::CreateWindowSurface()
|
|||
if (!eglQuerySurface(m_egl_display, m_egl_surface, EGL_WIDTH, &surface_width) ||
|
||||
!eglQuerySurface(m_egl_display, m_egl_surface, EGL_HEIGHT, &surface_height))
|
||||
{
|
||||
WARN_LOG(VIDEO,
|
||||
WARN_LOG_FMT(VIDEO,
|
||||
"Failed to get surface dimensions via eglQuerySurface. Size may be incorrect.");
|
||||
}
|
||||
m_backbuffer_width = static_cast<int>(surface_width);
|
||||
|
@ -319,7 +319,7 @@ bool GLContextEGL::CreateWindowSurface()
|
|||
m_egl_surface = eglCreatePbufferSurface(m_egl_display, m_config, attrib_list);
|
||||
if (!m_egl_surface)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreatePbufferSurface failed");
|
||||
INFO_LOG_FMT(VIDEO, "Error: eglCreatePbufferSurface failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ void GLContextEGL::DestroyWindowSurface()
|
|||
if (eglGetCurrentSurface(EGL_DRAW) == m_egl_surface)
|
||||
eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglDestroySurface(m_egl_display, m_egl_surface))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
|
||||
NOTICE_LOG_FMT(VIDEO, "Could not destroy window surface.");
|
||||
m_egl_surface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
|
@ -370,9 +370,9 @@ void GLContextEGL::DestroyContext()
|
|||
if (eglGetCurrentContext() == m_egl_context)
|
||||
eglMakeCurrent(m_egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglDestroyContext(m_egl_display, m_egl_context))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
|
||||
NOTICE_LOG_FMT(VIDEO, "Could not destroy drawing context.");
|
||||
if (!m_is_shared && !eglTerminate(m_egl_display))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
|
||||
NOTICE_LOG_FMT(VIDEO, "Could not destroy display connection.");
|
||||
m_egl_context = EGL_NO_CONTEXT;
|
||||
m_egl_display = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,18 @@ void GLContextGLX::SwapInterval(int Interval)
|
|||
|
||||
// Try EXT_swap_control, then MESA_swap_control.
|
||||
if (glXSwapIntervalEXTPtr)
|
||||
{
|
||||
glXSwapIntervalEXTPtr(m_display, m_drawable, Interval);
|
||||
}
|
||||
else if (glXSwapIntervalMESAPtr)
|
||||
{
|
||||
glXSwapIntervalMESAPtr(static_cast<unsigned int>(Interval));
|
||||
}
|
||||
else
|
||||
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO,
|
||||
"No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||
}
|
||||
}
|
||||
|
||||
void* GLContextGLX::GetFuncAddress(const std::string& name)
|
||||
|
@ -83,7 +90,7 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
glXQueryVersion(m_display, &glxMajorVersion, &glxMinorVersion);
|
||||
if (glxMajorVersion < 1 || (glxMajorVersion == 1 && glxMinorVersion < 4))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "glX-Version %d.%d detected, but need at least 1.4", glxMajorVersion,
|
||||
ERROR_LOG_FMT(VIDEO, "glX-Version {}.{} detected, but need at least 1.4", glxMajorVersion,
|
||||
glxMinorVersion);
|
||||
return false;
|
||||
}
|
||||
|
@ -93,7 +100,7 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
(PFNGLXCREATECONTEXTATTRIBSPROC)GetFuncAddress("glXCreateContextAttribsARB");
|
||||
if (!glXCreateContextAttribs)
|
||||
{
|
||||
ERROR_LOG(VIDEO,
|
||||
ERROR_LOG_FMT(VIDEO,
|
||||
"glXCreateContextAttribsARB not found, do you support GLX_ARB_create_context?");
|
||||
return false;
|
||||
}
|
||||
|
@ -124,7 +131,7 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
GLXFBConfig* fbc = glXChooseFBConfig(m_display, screen, visual_attribs, &fbcount);
|
||||
if (!fbc || !fbcount)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to retrieve a framebuffer config");
|
||||
ERROR_LOG_FMT(VIDEO, "Failed to retrieve a framebuffer config");
|
||||
return false;
|
||||
}
|
||||
m_fbconfig = *fbc;
|
||||
|
@ -150,7 +157,8 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
continue;
|
||||
|
||||
// Got a context.
|
||||
INFO_LOG(VIDEO, "Created a GLX context with version %d.%d", version.first, version.second);
|
||||
INFO_LOG_FMT(VIDEO, "Created a GLX context with version {}.{}", version.first,
|
||||
version.second);
|
||||
m_attribs.insert(m_attribs.end(), context_attribs.begin(), context_attribs.end());
|
||||
break;
|
||||
}
|
||||
|
@ -169,7 +177,7 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
}
|
||||
if (!m_context || s_glxError)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Unable to create GL context.");
|
||||
ERROR_LOG_FMT(VIDEO, "Unable to create GL context.");
|
||||
XSetErrorHandler(oldHandler);
|
||||
return false;
|
||||
}
|
||||
|
@ -206,7 +214,7 @@ bool GLContextGLX::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
|
||||
if (!CreateWindowSurface(reinterpret_cast<Window>(wsi.render_surface)))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed\n");
|
||||
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed\n");
|
||||
XSetErrorHandler(oldHandler);
|
||||
return false;
|
||||
}
|
||||
|
@ -227,7 +235,7 @@ std::unique_ptr<GLContext> GLContextGLX::CreateSharedContext()
|
|||
|
||||
if (!new_glx_context || s_glxError)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Unable to create GL context.");
|
||||
ERROR_LOG_FMT(VIDEO, "Unable to create GL context.");
|
||||
XSetErrorHandler(oldHandler);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -242,7 +250,7 @@ std::unique_ptr<GLContext> GLContextGLX::CreateSharedContext()
|
|||
|
||||
if (m_supports_pbuffer && !new_context->CreateWindowSurface(None))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Error: CreateWindowSurface failed");
|
||||
ERROR_LOG_FMT(VIDEO, "Error: CreateWindowSurface failed");
|
||||
XSetErrorHandler(oldHandler);
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -162,10 +162,10 @@ GLContextWGL::~GLContextWGL()
|
|||
if (m_rc)
|
||||
{
|
||||
if (wglGetCurrentContext() == m_rc && !wglMakeCurrent(m_dc, nullptr))
|
||||
NOTICE_LOG(VIDEO, "Could not release drawing context.");
|
||||
NOTICE_LOG_FMT(VIDEO, "Could not release drawing context.");
|
||||
|
||||
if (!wglDeleteContext(m_rc))
|
||||
ERROR_LOG(VIDEO, "Attempt to release rendering context failed.");
|
||||
ERROR_LOG_FMT(VIDEO, "Attempt to release rendering context failed.");
|
||||
|
||||
m_rc = nullptr;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ GLContextWGL::~GLContextWGL()
|
|||
else
|
||||
{
|
||||
if (!ReleaseDC(m_window_handle, m_dc))
|
||||
ERROR_LOG(VIDEO, "Attempt to release device context failed.");
|
||||
ERROR_LOG_FMT(VIDEO, "Attempt to release device context failed.");
|
||||
|
||||
m_dc = nullptr;
|
||||
}
|
||||
|
@ -198,9 +198,14 @@ bool GLContextWGL::IsHeadless() const
|
|||
void GLContextWGL::SwapInterval(int interval)
|
||||
{
|
||||
if (wglSwapIntervalEXT)
|
||||
{
|
||||
wglSwapIntervalEXT(interval);
|
||||
}
|
||||
else
|
||||
ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO,
|
||||
"No support for SwapInterval (framerate clamped to monitor refresh rate).");
|
||||
}
|
||||
}
|
||||
void GLContextWGL::Swap()
|
||||
{
|
||||
|
@ -331,7 +336,7 @@ bool GLContextWGL::Initialize(const WindowSystemInfo& wsi, bool stereo, bool cor
|
|||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(VIDEO, "Failed to create a core OpenGL context. Using fallback context.");
|
||||
WARN_LOG_FMT(VIDEO, "Failed to create a core OpenGL context. Using fallback context.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -367,7 +372,7 @@ HGLRC GLContextWGL::CreateCoreContext(HDC dc, HGLRC share_context)
|
|||
{
|
||||
if (!wglCreateContextAttribsARB)
|
||||
{
|
||||
WARN_LOG(VIDEO, "Missing WGL_ARB_create_context extension");
|
||||
WARN_LOG_FMT(VIDEO, "Missing WGL_ARB_create_context extension");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -400,18 +405,18 @@ HGLRC GLContextWGL::CreateCoreContext(HDC dc, HGLRC share_context)
|
|||
{
|
||||
if (!wglShareLists(share_context, core_context))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "wglShareLists failed");
|
||||
ERROR_LOG_FMT(VIDEO, "wglShareLists failed");
|
||||
wglDeleteContext(core_context);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
INFO_LOG(VIDEO, "WGL: Created a GL %d.%d core context", version.first, version.second);
|
||||
INFO_LOG_FMT(VIDEO, "WGL: Created a GL {}.{} core context", version.first, version.second);
|
||||
return core_context;
|
||||
}
|
||||
}
|
||||
|
||||
WARN_LOG(VIDEO, "Unable to create a core OpenGL context of an acceptable version");
|
||||
WARN_LOG_FMT(VIDEO, "Unable to create a core OpenGL context of an acceptable version");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -421,7 +426,7 @@ bool GLContextWGL::CreatePBuffer(HDC onscreen_dc, int width, int height, HANDLE*
|
|||
if (!wglChoosePixelFormatARB || !wglCreatePbufferARB || !wglGetPbufferDCARB ||
|
||||
!wglReleasePbufferDCARB || !wglDestroyPbufferARB)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Missing WGL_ARB_pbuffer extension");
|
||||
ERROR_LOG_FMT(VIDEO, "Missing WGL_ARB_pbuffer extension");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -448,7 +453,7 @@ bool GLContextWGL::CreatePBuffer(HDC onscreen_dc, int width, int height, HANDLE*
|
|||
if (!wglChoosePixelFormatARB(onscreen_dc, pf_iattribs.data(), pf_fattribs.data(), 1,
|
||||
&pixel_format, &num_pixel_formats))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to obtain a compatible pbuffer pixel format");
|
||||
ERROR_LOG_FMT(VIDEO, "Failed to obtain a compatible pbuffer pixel format");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -458,14 +463,14 @@ bool GLContextWGL::CreatePBuffer(HDC onscreen_dc, int width, int height, HANDLE*
|
|||
wglCreatePbufferARB(onscreen_dc, pixel_format, width, height, pb_attribs.data());
|
||||
if (!pbuffer)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to create pbuffer");
|
||||
ERROR_LOG_FMT(VIDEO, "Failed to create pbuffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
HDC dc = wglGetPbufferDCARB(pbuffer);
|
||||
if (!dc)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to get drawing context from pbuffer");
|
||||
ERROR_LOG_FMT(VIDEO, "Failed to get drawing context from pbuffer");
|
||||
wglDestroyPbufferARB(pbuffer);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -31,15 +31,15 @@ GLuint CompileProgram(const std::string& vertexShader, const std::string& fragme
|
|||
|
||||
if (Result && stringBufferUsage)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL vertex shader warnings:\n%s%s", stringBuffer, vertexShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL vertex shader warnings:\n{}{}", stringBuffer, vertexShader);
|
||||
}
|
||||
else if (!Result)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL vertex shader error:\n%s%s", stringBuffer, vertexShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL vertex shader error:\n{}{}", stringBuffer, vertexShader);
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(VIDEO, "GLSL vertex shader compiled:\n%s", vertexShader.c_str());
|
||||
INFO_LOG_FMT(VIDEO, "GLSL vertex shader compiled:\n{}", vertexShader);
|
||||
}
|
||||
|
||||
bool shader_errors = !Result;
|
||||
|
@ -55,15 +55,15 @@ GLuint CompileProgram(const std::string& vertexShader, const std::string& fragme
|
|||
|
||||
if (Result && stringBufferUsage)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL fragment shader warnings:\n%s%s", stringBuffer, fragmentShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL fragment shader warnings:\n{}{}", stringBuffer, fragmentShader);
|
||||
}
|
||||
else if (!Result)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL fragment shader error:\n%s%s", stringBuffer, fragmentShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL fragment shader error:\n{}{}", stringBuffer, fragmentShader);
|
||||
}
|
||||
else
|
||||
{
|
||||
INFO_LOG(VIDEO, "GLSL fragment shader compiled:\n%s", fragmentShader.c_str());
|
||||
INFO_LOG_FMT(VIDEO, "GLSL fragment shader compiled:\n{}", fragmentShader);
|
||||
}
|
||||
|
||||
shader_errors |= !Result;
|
||||
|
@ -79,13 +79,12 @@ GLuint CompileProgram(const std::string& vertexShader, const std::string& fragme
|
|||
|
||||
if (Result && stringBufferUsage)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL linker warnings:\n%s%s%s", stringBuffer, vertexShader.c_str(),
|
||||
fragmentShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL linker warnings:\n{}{}{}", stringBuffer, vertexShader,
|
||||
fragmentShader);
|
||||
}
|
||||
else if (!Result && !shader_errors)
|
||||
{
|
||||
ERROR_LOG(VIDEO, "GLSL linker error:\n%s%s%s", stringBuffer, vertexShader.c_str(),
|
||||
fragmentShader.c_str());
|
||||
ERROR_LOG_FMT(VIDEO, "GLSL linker error:\n{}{}{}", stringBuffer, vertexShader, fragmentShader);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ HttpRequest::Response HttpRequest::Impl::Fetch(const std::string& url, Method me
|
|||
const CURLcode res = curl_easy_perform(m_curl.get());
|
||||
if (res != CURLE_OK)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Failed to %s %s: %s", type, url.c_str(), m_error_string.c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Failed to {} {}: {}", type, url, m_error_string);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -221,8 +221,8 @@ HttpRequest::Response HttpRequest::Impl::Fetch(const std::string& url, Method me
|
|||
curl_easy_getinfo(m_curl.get(), CURLINFO_RESPONSE_CODE, &response_code);
|
||||
if (response_code != 200)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Failed to %s %s: server replied with code %li and body\n\x1b[0m%.*s", type,
|
||||
url.c_str(), response_code, static_cast<int>(buffer.size()), buffer.data());
|
||||
ERROR_LOG_FMT(COMMON, "Failed to {} {}: server replied with code {} and body\n\x1b[0m{:.{}}",
|
||||
type, url, response_code, buffer.data(), static_cast<int>(buffer.size()));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static int AshmemCreateFileMapping(const char* name, size_t size)
|
|||
if (ret < 0)
|
||||
{
|
||||
close(fd);
|
||||
NOTICE_LOG(MEMMAP, "Ashmem returned error: 0x%08x", ret);
|
||||
NOTICE_LOG_FMT(MEMMAP, "Ashmem returned error: {:#010x}", ret);
|
||||
return ret;
|
||||
}
|
||||
return fd;
|
||||
|
@ -77,7 +77,7 @@ void MemArena::GrabSHMSegment(size_t size)
|
|||
fd = AshmemCreateFileMapping(("dolphin-emu." + std::to_string(getpid())).c_str(), size);
|
||||
if (fd < 0)
|
||||
{
|
||||
NOTICE_LOG(MEMMAP, "Ashmem allocation failed");
|
||||
NOTICE_LOG_FMT(MEMMAP, "Ashmem allocation failed");
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -85,12 +85,12 @@ void MemArena::GrabSHMSegment(size_t size)
|
|||
fd = shm_open(file_name.c_str(), O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||
if (fd == -1)
|
||||
{
|
||||
ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno));
|
||||
ERROR_LOG_FMT(MEMMAP, "shm_open failed: {}", strerror(errno));
|
||||
return;
|
||||
}
|
||||
shm_unlink(file_name.c_str());
|
||||
if (ftruncate(fd, size) < 0)
|
||||
ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
|
||||
ERROR_LOG_FMT(MEMMAP, "Failed to allocate low memory space");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ void* MemArena::CreateView(s64 offset, size_t size, void* base)
|
|||
|
||||
if (retval == MAP_FAILED)
|
||||
{
|
||||
NOTICE_LOG(MEMMAP, "mmap failed");
|
||||
NOTICE_LOG_FMT(MEMMAP, "mmap failed");
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -75,7 +75,7 @@ void* AllocateAlignedMemory(size_t size, size_t alignment)
|
|||
#else
|
||||
void* ptr = nullptr;
|
||||
if (posix_memalign(&ptr, alignment, size) != 0)
|
||||
ERROR_LOG(MEMMAP, "Failed to allocate aligned memory");
|
||||
ERROR_LOG_FMT(MEMMAP, "Failed to allocate aligned memory");
|
||||
#endif
|
||||
|
||||
if (ptr == nullptr)
|
||||
|
|
|
@ -112,7 +112,7 @@ bool MsgAlert(bool yes_no, MsgType style, const char* format, ...)
|
|||
CharArrayFromFormatV(buffer, sizeof(buffer) - 1, s_str_translator(format).c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
ERROR_LOG(MASTER_LOG, "%s: %s", caption, buffer);
|
||||
ERROR_LOG_FMT(MASTER_LOG, "{}: {}", caption, buffer);
|
||||
|
||||
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
|
||||
if (s_msg_handler != nullptr &&
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "Common/SDCardUtil.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
@ -208,8 +207,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
|
|||
|
||||
if (disk_size < 0x800000 || disk_size > 0x800000000ULL)
|
||||
{
|
||||
ERROR_LOG(COMMON,
|
||||
"Trying to create SD Card image of size %" PRIu64 "MB is out of range (8MB-32GB)",
|
||||
ERROR_LOG_FMT(COMMON, "Trying to create SD Card image of size {}MB is out of range (8MB-32GB)",
|
||||
disk_size / (1024 * 1024));
|
||||
return false;
|
||||
}
|
||||
|
@ -224,7 +222,7 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
|
|||
File::IOFile file(filename, "wb");
|
||||
if (!file)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Could not create file '%s', aborting...", filename.c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Could not create file '{}', aborting...", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -285,9 +283,9 @@ bool SDCardCreate(u64 disk_size /*in MB*/, const std::string& filename)
|
|||
return true;
|
||||
|
||||
FailWrite:
|
||||
ERROR_LOG(COMMON, "Could not write to '%s', aborting...", filename.c_str());
|
||||
ERROR_LOG_FMT(COMMON, "Could not write to '{}', aborting...", filename);
|
||||
if (unlink(filename.c_str()) < 0)
|
||||
ERROR_LOG(COMMON, "unlink(%s) failed: %s", filename.c_str(), LastStrerrorString().c_str());
|
||||
ERROR_LOG_FMT(COMMON, "unlink({}) failed: {}", filename, LastStrerrorString());
|
||||
return false;
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
|
@ -179,7 +179,7 @@ std::string StringFromFormatV(const char* format, va_list args)
|
|||
#endif
|
||||
if (vasprintf(&buf, format, args) < 0)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Unable to allocate memory for string");
|
||||
ERROR_LOG_FMT(COMMON, "Unable to allocate memory for string");
|
||||
buf = nullptr;
|
||||
}
|
||||
|
||||
|
@ -442,24 +442,22 @@ std::wstring CPToUTF16(u32 code_page, std::string_view input)
|
|||
|
||||
std::string UTF16ToCP(u32 code_page, std::wstring_view input)
|
||||
{
|
||||
std::string output;
|
||||
if (input.empty())
|
||||
return {};
|
||||
|
||||
if (0 != input.size())
|
||||
{
|
||||
// "If cchWideChar [input buffer size] is set to 0, the function fails." -MSDN
|
||||
auto const size = WideCharToMultiByte(
|
||||
code_page, 0, input.data(), static_cast<int>(input.size()), nullptr, 0, nullptr, nullptr);
|
||||
auto const size = WideCharToMultiByte(code_page, 0, input.data(), static_cast<int>(input.size()),
|
||||
nullptr, 0, nullptr, nullptr);
|
||||
|
||||
output.resize(size);
|
||||
std::string output(size, '\0');
|
||||
|
||||
if (size != WideCharToMultiByte(code_page, 0, input.data(), static_cast<int>(input.size()),
|
||||
&output[0], static_cast<int>(output.size()), nullptr, nullptr))
|
||||
output.data(), static_cast<int>(output.size()), nullptr, nullptr))
|
||||
{
|
||||
const DWORD error_code = GetLastError();
|
||||
ERROR_LOG(COMMON, "WideCharToMultiByte Error in String '%s': %lu",
|
||||
std::wstring(input).c_str(), error_code);
|
||||
output.clear();
|
||||
}
|
||||
ERROR_LOG_FMT(COMMON, "WideCharToMultiByte Error in String '{}': {}", WStringToUTF8(input),
|
||||
error_code);
|
||||
return {};
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@ -508,7 +506,7 @@ std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_v
|
|||
iconv_t const conv_desc = iconv_open(tocode, fromcode);
|
||||
if ((iconv_t)-1 == conv_desc)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno));
|
||||
ERROR_LOG_FMT(COMMON, "Iconv initialization failure [{}]: {}", fromcode, strerror(errno));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -541,7 +539,7 @@ std::string CodeTo(const char* tocode, const char* fromcode, std::basic_string_v
|
|||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG(COMMON, "iconv failure [%s]: %s", fromcode, strerror(errno));
|
||||
ERROR_LOG_FMT(COMMON, "iconv failure [{}]: {}", fromcode, strerror(errno));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,10 @@ void SymbolDB::List()
|
|||
{
|
||||
for (const auto& func : m_functions)
|
||||
{
|
||||
DEBUG_LOG(OSHLE, "%s @ %08x: %i bytes (hash %08x) : %i calls", func.second.name.c_str(),
|
||||
DEBUG_LOG_FMT(OSHLE, "{} @ {:08x}: {} bytes (hash {:08x}) : {} calls", func.second.name,
|
||||
func.second.address, func.second.size, func.second.hash, func.second.num_calls);
|
||||
}
|
||||
INFO_LOG(OSHLE, "%zu functions known in this program above.", m_functions.size());
|
||||
INFO_LOG_FMT(OSHLE, "{} functions known in this program above.", m_functions.size());
|
||||
}
|
||||
|
||||
bool SymbolDB::IsEmpty() const
|
||||
|
|
|
@ -93,7 +93,7 @@ bool TraversalClient::TestPacket(u8* data, size_t size, ENetAddress* from)
|
|||
{
|
||||
if (size < sizeof(TraversalPacket))
|
||||
{
|
||||
ERROR_LOG(NETPLAY, "Received too-short traversal packet.");
|
||||
ERROR_LOG_FMT(NETPLAY, "Received too-short traversal packet.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ void TraversalClient::HandleServerPacket(TraversalPacket* packet)
|
|||
break;
|
||||
}
|
||||
default:
|
||||
WARN_LOG(NETPLAY, "Received unknown packet with type %d", packet->type);
|
||||
WARN_LOG_FMT(NETPLAY, "Received unknown packet with type {}", packet->type);
|
||||
break;
|
||||
}
|
||||
if (packet->type != TraversalPacketAck)
|
||||
|
|
|
@ -52,7 +52,7 @@ static bool InitUPnP()
|
|||
#endif
|
||||
if (!devlist)
|
||||
{
|
||||
WARN_LOG(NETPLAY, "An error occurred trying to discover UPnP devices.");
|
||||
WARN_LOG_FMT(NETPLAY, "An error occurred trying to discover UPnP devices.");
|
||||
|
||||
s_error = true;
|
||||
|
||||
|
@ -81,12 +81,12 @@ static bool InitUPnP()
|
|||
parserootdesc(desc_xml.get(), desc_xml_size, &s_data);
|
||||
GetUPNPUrls(&s_urls, &s_data, dev->descURL, 0);
|
||||
|
||||
NOTICE_LOG(NETPLAY, "Got info from IGD at %s.", dev->descURL);
|
||||
NOTICE_LOG_FMT(NETPLAY, "Got info from IGD at {}.", dev->descURL);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
WARN_LOG(NETPLAY, "Error getting info from IGD at %s.", dev->descURL);
|
||||
WARN_LOG_FMT(NETPLAY, "Error getting info from IGD at {}.", dev->descURL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,11 +137,11 @@ static void MapPortThread(const u16 port)
|
|||
{
|
||||
if (InitUPnP() && MapPort(s_our_ip.data(), port))
|
||||
{
|
||||
NOTICE_LOG(NETPLAY, "Successfully mapped port %d to %s.", port, s_our_ip.data());
|
||||
NOTICE_LOG_FMT(NETPLAY, "Successfully mapped port {} to {}.", port, s_our_ip.data());
|
||||
return;
|
||||
}
|
||||
|
||||
WARN_LOG(NETPLAY, "Failed to map port %d to %s.", port, s_our_ip.data());
|
||||
WARN_LOG_FMT(NETPLAY, "Failed to map port {} to {}.", port, s_our_ip.data());
|
||||
}
|
||||
|
||||
// UPnP thread: try to unmap a port
|
||||
|
|
|
@ -1647,7 +1647,7 @@ void XEmitter::MOV(int bits, const OpArg& a1, const OpArg& a2)
|
|||
return;
|
||||
}
|
||||
if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg())
|
||||
ERROR_LOG(DYNA_REC, "Redundant MOV @ %p - bug in JIT?", code);
|
||||
ERROR_LOG_FMT(DYNA_REC, "Redundant MOV @ {} - bug in JIT?", fmt::ptr(code));
|
||||
WriteNormalOp(bits, NormalOp::MOV, a1, a2);
|
||||
}
|
||||
void XEmitter::TEST(int bits, const OpArg& a1, const OpArg& a2)
|
||||
|
|
Loading…
Reference in New Issue