summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2014-12-06 02:53:49 +0100
committerYuri Kunde Schlesner <yuriks@yuriks.net>2014-12-13 05:08:02 +0100
commit0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9 (patch)
tree40fee084c551bfb497e68181447298f862ea68ca /src/common
parentImplement text path trimming for shorter paths. (diff)
downloadyuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar.gz
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar.bz2
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar.lz
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar.xz
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.tar.zst
yuzu-0600e2d8b5b30bd68c8b19cb1f2051e096e7caa9.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/break_points.cpp2
-rw-r--r--src/common/chunk_file.h35
-rw-r--r--src/common/file_util.cpp84
-rw-r--r--src/common/log.h16
-rw-r--r--src/common/mem_arena.cpp14
-rw-r--r--src/common/memory_util.cpp2
-rw-r--r--src/common/msg_handler.cpp2
-rw-r--r--src/common/string_util.cpp10
8 files changed, 94 insertions, 71 deletions
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp
index 25528b864..587dbf40a 100644
--- a/src/common/break_points.cpp
+++ b/src/common/break_points.cpp
@@ -180,7 +180,7 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr,
{
if (Log)
{
- INFO_LOG(MEMMAP, "CHK %08x (%s) %s%i %0*x at %08x (%s)",
+ LOG_DEBUG(Debug_Breakpoint, "CHK %08x (%s) %s%i %0*x at %08x (%s)",
pc, debug_interface->getDescription(pc).c_str(),
write ? "Write" : "Read", size*8, size*2, iValue, addr,
debug_interface->getDescription(addr).c_str()
diff --git a/src/common/chunk_file.h b/src/common/chunk_file.h
index 32af74594..39a14dc81 100644
--- a/src/common/chunk_file.h
+++ b/src/common/chunk_file.h
@@ -154,7 +154,7 @@ public:
Do(foundVersion);
if (error == ERROR_FAILURE || foundVersion < minVer || foundVersion > ver) {
- WARN_LOG(COMMON, "Savestate failure: wrong version %d found for %s", foundVersion, title);
+ LOG_ERROR(Common, "Savestate failure: wrong version %d found for %s", foundVersion, title);
SetError(ERROR_FAILURE);
return PointerWrapSection(*this, -1, title);
}
@@ -178,7 +178,14 @@ public:
case MODE_READ: if (memcmp(data, *ptr, size) != 0) return false; break;
case MODE_WRITE: memcpy(*ptr, data, size); break;
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
- case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
+ case MODE_VERIFY:
+ for (int i = 0; i < size; i++) {
+ _dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i],
+ "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
+ ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i],
+ (*ptr)[i], (*ptr)[i], &(*ptr)[i]);
+ }
+ break;
default: break; // throw an error?
}
(*ptr) += size;
@@ -191,7 +198,14 @@ public:
case MODE_READ: memcpy(data, *ptr, size); break;
case MODE_WRITE: memcpy(*ptr, data, size); break;
case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
- case MODE_VERIFY: for(int i = 0; i < size; i++) _dbg_assert_msg_(COMMON, ((u8*)data)[i] == (*ptr)[i], "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n", ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i], (*ptr)[i], (*ptr)[i], &(*ptr)[i]); break;
+ case MODE_VERIFY:
+ for (int i = 0; i < size; i++) {
+ _dbg_assert_msg_(Common, ((u8*)data)[i] == (*ptr)[i],
+ "Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
+ ((u8*)data)[i], ((u8*)data)[i], &((u8*)data)[i],
+ (*ptr)[i], (*ptr)[i], &(*ptr)[i]);
+ }
+ break;
default: break; // throw an error?
}
(*ptr) += size;
@@ -476,7 +490,7 @@ public:
break;
default:
- ERROR_LOG(COMMON, "Savestate error: invalid mode %d.", mode);
+ LOG_ERROR(Common, "Savestate error: invalid mode %d.", mode);
}
}
@@ -490,7 +504,12 @@ public:
case MODE_READ: x = (char*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break;
- case MODE_VERIFY: _dbg_assert_msg_(COMMON, !strcmp(x.c_str(), (char*)*ptr), "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (char*)*ptr, ptr); break;
+ case MODE_VERIFY:
+ _dbg_assert_msg_(Common,
+ !strcmp(x.c_str(), (char*)*ptr),
+ "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n",
+ x.c_str(), (char*)*ptr, ptr);
+ break;
}
(*ptr) += stringLen;
}
@@ -504,7 +523,11 @@ public:
case MODE_READ: x = (wchar_t*)*ptr; break;
case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
case MODE_MEASURE: break;
- case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break;
+ case MODE_VERIFY:
+ _dbg_assert_msg_(Common, x == (wchar_t*)*ptr,
+ "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n",
+ x.c_str(), (wchar_t*)*ptr, ptr);
+ break;
}
(*ptr) += stringLen;
}
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 7579d8c0f..88c46c117 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -88,7 +88,7 @@ bool IsDirectory(const std::string &filename)
#endif
if (result < 0) {
- WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s",
+ LOG_WARNING(Common_Filesystem, "stat failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
}
@@ -100,33 +100,33 @@ bool IsDirectory(const std::string &filename)
// Doesn't supports deleting a directory
bool Delete(const std::string &filename)
{
- INFO_LOG(COMMON, "Delete: file %s", filename.c_str());
+ LOG_INFO(Common_Filesystem, "file %s", filename.c_str());
// Return true because we care about the file no
// being there, not the actual delete.
if (!Exists(filename))
{
- WARN_LOG(COMMON, "Delete: %s does not exist", filename.c_str());
+ LOG_WARNING(Common_Filesystem, "%s does not exist", filename.c_str());
return true;
}
// We can't delete a directory
if (IsDirectory(filename))
{
- WARN_LOG(COMMON, "Delete failed: %s is a directory", filename.c_str());
+ LOG_ERROR(Common_Filesystem, "Failed: %s is a directory", filename.c_str());
return false;
}
#ifdef _WIN32
if (!DeleteFile(Common::UTF8ToTStr(filename).c_str()))
{
- WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
+ LOG_ERROR(Common_Filesystem, "DeleteFile failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
}
#else
if (unlink(filename.c_str()) == -1) {
- WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
+ LOG_ERROR(Common_Filesystem, "unlink failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
}
@@ -138,17 +138,17 @@ 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());
+ LOG_TRACE(Common_Filesystem, "directory %s", path.c_str());
#ifdef _WIN32
if (::CreateDirectory(Common::UTF8ToTStr(path).c_str(), nullptr))
return true;
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS)
{
- WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str());
+ LOG_WARNING(Common_Filesystem, "CreateDirectory failed on %s: already exists", path.c_str());
return true;
}
- ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %i", path.c_str(), error);
+ LOG_ERROR(Common_Filesystem, "CreateDirectory failed on %s: %i", path.c_str(), error);
return false;
#else
if (mkdir(path.c_str(), 0755) == 0)
@@ -158,11 +158,11 @@ bool CreateDir(const std::string &path)
if (err == EEXIST)
{
- WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str());
+ LOG_WARNING(Common_Filesystem, "mkdir failed on %s: already exists", path.c_str());
return true;
}
- ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err));
+ LOG_ERROR(Common_Filesystem, "mkdir failed on %s: %s", path.c_str(), strerror(err));
return false;
#endif
}
@@ -171,11 +171,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());
+ LOG_TRACE(Common_Filesystem, "path %s", fullPath.c_str());
if (FileUtil::Exists(fullPath))
{
- INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
+ LOG_WARNING(Common_Filesystem, "path exists %s", fullPath.c_str());
return true;
}
@@ -192,7 +192,7 @@ bool CreateFullPath(const std::string &fullPath)
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
std::string const subPath(fullPath.substr(0, position + 1));
if (!FileUtil::IsDirectory(subPath) && !FileUtil::CreateDir(subPath)) {
- ERROR_LOG(COMMON, "CreateFullPath: directory creation failed");
+ LOG_ERROR(Common, "CreateFullPath: directory creation failed");
return false;
}
@@ -200,7 +200,7 @@ bool CreateFullPath(const std::string &fullPath)
panicCounter--;
if (panicCounter <= 0)
{
- ERROR_LOG(COMMON, "CreateFullPath: directory structure is too deep");
+ LOG_ERROR(Common, "CreateFullPath: directory structure is too deep");
return false;
}
position++;
@@ -211,12 +211,12 @@ 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());
+ LOG_INFO(Common_Filesystem, "directory %s", filename.c_str());
// check if a directory
if (!FileUtil::IsDirectory(filename))
{
- ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", filename.c_str());
+ LOG_ERROR(Common_Filesystem, "Not a directory %s", filename.c_str());
return false;
}
@@ -227,7 +227,7 @@ bool DeleteDir(const std::string &filename)
if (rmdir(filename.c_str()) == 0)
return true;
#endif
- ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg());
+ LOG_ERROR(Common_Filesystem, "failed %s: %s", filename.c_str(), GetLastErrorMsg());
return false;
}
@@ -235,11 +235,11 @@ 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",
+ LOG_TRACE(Common_Filesystem, "%s --> %s",
srcFilename.c_str(), destFilename.c_str());
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
return true;
- ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
}
@@ -247,13 +247,13 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename)
// copies file srcFilename to destFilename, returns true on success
bool Copy(const std::string &srcFilename, const std::string &destFilename)
{
- INFO_LOG(COMMON, "Copy: %s --> %s",
+ LOG_TRACE(Common_Filesystem, "%s --> %s",
srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32
if (CopyFile(Common::UTF8ToTStr(srcFilename).c_str(), Common::UTF8ToTStr(destFilename).c_str(), FALSE))
return true;
- ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem, "failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
#else
@@ -267,7 +267,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
FILE *input = fopen(srcFilename.c_str(), "rb");
if (!input)
{
- ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem, "opening input failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
}
@@ -277,7 +277,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
if (!output)
{
fclose(input);
- ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem, "opening output failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
}
@@ -291,8 +291,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
{
if (ferror(input) != 0)
{
- ERROR_LOG(COMMON,
- "Copy: failed reading from source, %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem,
+ "failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
goto bail;
}
@@ -302,8 +302,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
int wnum = fwrite(buffer, sizeof(char), rnum, output);
if (wnum != rnum)
{
- ERROR_LOG(COMMON,
- "Copy: failed writing to output, %s --> %s: %s",
+ LOG_ERROR(Common_Filesystem,
+ "failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
goto bail;
}
@@ -326,13 +326,13 @@ u64 GetSize(const std::string &filename)
{
if (!Exists(filename))
{
- WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.c_str());
+ LOG_ERROR(Common_Filesystem, "failed %s: No such file", filename.c_str());
return 0;
}
if (IsDirectory(filename))
{
- WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str());
+ LOG_ERROR(Common_Filesystem, "failed %s: is a directory", filename.c_str());
return 0;
}
@@ -343,12 +343,12 @@ u64 GetSize(const std::string &filename)
if (stat64(filename.c_str(), &buf) == 0)
#endif
{
- DEBUG_LOG(COMMON, "GetSize: %s: %lld",
+ LOG_TRACE(Common_Filesystem, "%s: %lld",
filename.c_str(), (long long)buf.st_size);
return buf.st_size;
}
- ERROR_LOG(COMMON, "GetSize: Stat failed %s: %s",
+ LOG_ERROR(Common_Filesystem, "Stat failed %s: %s",
filename.c_str(), GetLastErrorMsg());
return 0;
}
@@ -358,7 +358,7 @@ u64 GetSize(const int fd)
{
struct stat64 buf;
if (fstat64(fd, &buf) != 0) {
- ERROR_LOG(COMMON, "GetSize: stat failed %i: %s",
+ LOG_ERROR(Common_Filesystem, "GetSize: stat failed %i: %s",
fd, GetLastErrorMsg());
return 0;
}
@@ -371,13 +371,13 @@ u64 GetSize(FILE *f)
// can't use off_t here because it can be 32-bit
u64 pos = ftello(f);
if (fseeko(f, 0, SEEK_END) != 0) {
- ERROR_LOG(COMMON, "GetSize: seek failed %p: %s",
+ LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg());
return 0;
}
u64 size = ftello(f);
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
- ERROR_LOG(COMMON, "GetSize: seek failed %p: %s",
+ LOG_ERROR(Common_Filesystem, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg());
return 0;
}
@@ -387,11 +387,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());
+ LOG_TRACE(Common_Filesystem, "%s", filename.c_str());
if (!FileUtil::IOFile(filename, "wb"))
{
- ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s",
+ LOG_ERROR(Common_Filesystem, "failed %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
}
@@ -404,7 +404,7 @@ bool CreateEmptyFile(const std::string &filename)
// results into parentEntry. Returns the number of files+directories found
u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
{
- INFO_LOG(COMMON, "ScanDirectoryTree: directory %s", directory.c_str());
+ LOG_TRACE(Common_Filesystem, "directory %s", directory.c_str());
// How many files + directories we found
u32 foundEntries = 0;
#ifdef _WIN32
@@ -474,7 +474,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
// 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());
+ LOG_TRACE(Common_Filesystem, "%s", directory.c_str());
#ifdef _WIN32
// Find the first file in the directory.
WIN32_FIND_DATA ffd;
@@ -588,7 +588,7 @@ std::string GetCurrentDir()
// Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(nullptr, 0))) {
- ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
+ LOG_ERROR(Common_Filesystem, "GetCurrentDirectory failed: %s",
GetLastErrorMsg());
return nullptr;
}
@@ -647,7 +647,7 @@ std::string GetSysDirectory()
#endif
sysDir += DIR_SEP;
- INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str());
+ LOG_DEBUG(Common_Filesystem, "Setting to %s:", sysDir.c_str());
return sysDir;
}
@@ -695,7 +695,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
{
if (!FileUtil::IsDirectory(newPath))
{
- WARN_LOG(COMMON, "Invalid path specified %s", newPath.c_str());
+ LOG_ERROR(Common_Filesystem, "Invalid path specified %s", newPath.c_str());
return paths[DirIDX];
}
else
diff --git a/src/common/log.h b/src/common/log.h
index 105db9802..c0f7ca2df 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -126,23 +126,23 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int
//#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
//#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
-#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__)
-#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__)
-#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__)
-#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__)
-#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__)
-#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__)
+//#define OS_LOG(t,...) LOG_INFO(Common, __VA_ARGS__)
+//#define ERROR_LOG(t,...) LOG_ERROR(Common_Filesystem, __VA_ARGS__)
+//#define WARN_LOG(t,...) LOG_WARNING(Kernel_SVC, __VA_ARGS__)
+//#define NOTICE_LOG(t,...) LOG_INFO(Service, __VA_ARGS__)
+//#define INFO_LOG(t,...) LOG_INFO(Service_FS, __VA_ARGS__)
+//#define DEBUG_LOG(t,...) LOG_DEBUG(Common, __VA_ARGS__)
#if MAX_LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \
if (!(_a_)) {\
- ERROR_LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
+ LOG_CRITICAL(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__); \
if (!PanicYesNo("*** Assertion (see log)***\n")) {Crash();} \
}
#define _dbg_assert_msg_(_t_, _a_, ...)\
if (!(_a_)) {\
- ERROR_LOG(_t_, __VA_ARGS__); \
+ LOG_CRITICAL(_t_, __VA_ARGS__); \
if (!PanicYesNo(__VA_ARGS__)) {Crash();} \
}
#define _dbg_update_() Host_UpdateLogDisplay();
diff --git a/src/common/mem_arena.cpp b/src/common/mem_arena.cpp
index 7d4fda0e2..9904d2472 100644
--- a/src/common/mem_arena.cpp
+++ b/src/common/mem_arena.cpp
@@ -71,7 +71,7 @@ int ashmem_create_region(const char *name, size_t size)
return fd;
error:
- ERROR_LOG(MEMMAP, "NASTY ASHMEM ERROR: ret = %08x", ret);
+ LOG_ERROR(Common_Memory, "NASTY ASHMEM ERROR: ret = %08x", ret);
close(fd);
return ret;
}
@@ -130,7 +130,7 @@ void MemArena::GrabLowMemSpace(size_t size)
// Note that it appears that ashmem is pinned by default, so no need to pin.
if (fd < 0)
{
- ERROR_LOG(MEMMAP, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno));
+ LOG_ERROR(Common_Memory, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno));
return;
}
#else
@@ -148,12 +148,12 @@ void MemArena::GrabLowMemSpace(size_t size)
}
else if (errno != EEXIST)
{
- ERROR_LOG(MEMMAP, "shm_open failed: %s", strerror(errno));
+ LOG_ERROR(Common_Memory, "shm_open failed: %s", strerror(errno));
return;
}
}
if (ftruncate(fd, size) < 0)
- ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
+ LOG_ERROR(Common_Memory, "Failed to allocate low memory space");
#endif
}
@@ -197,7 +197,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
if (retval == MAP_FAILED)
{
- NOTICE_LOG(MEMMAP, "mmap failed");
+ LOG_ERROR(Common_Memory, "mmap failed");
return nullptr;
}
return retval;
@@ -423,7 +423,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
base = (u8 *)base_addr;
if (Memory_TryBase(base, views, num_views, flags, arena))
{
- INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts);
+ LOG_DEBUG(Common_Memory, "Found valid memory base at %p after %i tries.", base, base_attempts);
base_attempts = 0;
break;
}
@@ -442,7 +442,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
u8 *base = MemArena::Find4GBBase();
if (!Memory_TryBase(base, views, num_views, flags, arena))
{
- ERROR_LOG(MEMMAP, "MemoryMap_Setup: Failed finding a memory base.");
+ LOG_ERROR(Common_Memory, "MemoryMap_Setup: Failed finding a memory base.");
PanicAlert("MemoryMap_Setup: Failed finding a memory base.");
return 0;
}
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index 93da5500b..ca8a2a9e4 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -109,7 +109,7 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
ptr = memalign(alignment, size);
#else
if (posix_memalign(&ptr, alignment, size) != 0)
- ERROR_LOG(MEMMAP, "Failed to allocate aligned memory");
+ LOG_ERROR(Common_Memory, "Failed to allocate aligned memory");
#endif
#endif
diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp
index b3556aaa8..7ffedc45a 100644
--- a/src/common/msg_handler.cpp
+++ b/src/common/msg_handler.cpp
@@ -75,7 +75,7 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
Common::CharArrayFromFormatV(buffer, sizeof(buffer)-1, str_translator(format).c_str(), args);
va_end(args);
- ERROR_LOG(MASTER_LOG, "%s: %s", caption.c_str(), buffer);
+ LOG_INFO(Common, "%s: %s", caption.c_str(), buffer);
// Don't ignore questions, especially AskYesNo, PanicYesNo could be ignored
if (msg_handler && (AlertEnabled || Style == QUESTION || Style == CRITICAL))
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 7a8274a91..6d9612fb5 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -107,7 +107,7 @@ std::string StringFromFormat(const char* format, ...)
#else
va_start(args, format);
if (vasprintf(&buf, format, args) < 0)
- ERROR_LOG(COMMON, "Unable to allocate memory for string");
+ LOG_ERROR(Common, "Unable to allocate memory for string");
va_end(args);
std::string temp = buf;
@@ -475,7 +475,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
if ((iconv_t)(-1) == conv_desc)
{
- ERROR_LOG(COMMON, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno));
+ LOG_ERROR(Common, "Iconv initialization failure [%s]: %s", fromcode, strerror(errno));
iconv_close(conv_desc);
return {};
}
@@ -510,7 +510,7 @@ static std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>&
}
else
{
- ERROR_LOG(COMMON, "iconv failure [%s]: %s", fromcode, strerror(errno));
+ LOG_ERROR(Common, "iconv failure [%s]: %s", fromcode, strerror(errno));
break;
}
}
@@ -531,7 +531,7 @@ std::u16string UTF8ToUTF16(const std::string& input)
iconv_t const conv_desc = iconv_open("UTF-16LE", "UTF-8");
if ((iconv_t)(-1) == conv_desc)
{
- ERROR_LOG(COMMON, "Iconv initialization failure [UTF-8]: %s", strerror(errno));
+ LOG_ERROR(Common, "Iconv initialization failure [UTF-8]: %s", strerror(errno));
iconv_close(conv_desc);
return {};
}
@@ -566,7 +566,7 @@ std::u16string UTF8ToUTF16(const std::string& input)
}
else
{
- ERROR_LOG(COMMON, "iconv failure [UTF-8]: %s", strerror(errno));
+ LOG_ERROR(Common, "iconv failure [UTF-8]: %s", strerror(errno));
break;
}
}