Logging API change (refactor) (#19324)

* Rename LogType to Log

* Explicitly use the Log:: enum when logging. Allows for autocomplete when editing.

* Mac/ARM64 buildfix

* Do the same with the hle result log macros

* Rename the log names to mixed case while at it.

* iOS buildfix

* Qt buildfix attempt, ARM32 buildfix
This commit is contained in:
Henrik Rydgård 2024-07-14 14:42:59 +02:00 committed by GitHub
parent ae3ff686f0
commit e01ca5b057
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
393 changed files with 6198 additions and 6193 deletions

View File

@ -1041,7 +1041,7 @@ void ARM64XEmitter::QuickCallFunction(ARM64Reg scratchreg, const void *func) {
s64 distance = (s64)func - (s64)m_code;
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);
// WARN_LOG(Log::JIT, "Distance too far in function call (%p to %p)! Using scratch.", m_code, func);
MOVI2R(scratchreg, (uintptr_t)func);
BLR(scratchreg);
} else {

View File

@ -96,7 +96,7 @@ Operand2 AssumeMakeOperand2(u32 imm) {
_dbg_assert_msg_(result, "Could not make assumed Operand2.");
if (!result) {
// Make double sure that we get it logged.
ERROR_LOG(JIT, "Could not make assumed Operand2.");
ERROR_LOG(Log::JIT, "Could not make assumed Operand2.");
}
return op2;
}
@ -1506,7 +1506,7 @@ void ARMXEmitter::VLDR(ARMReg Dest, ARMReg Base, s16 offset)
_assert_msg_((imm & 0xC03) == 0, "VLDR: Offset needs to be word aligned and small enough");
if (imm & 0xC03)
ERROR_LOG(JIT, "VLDR: Bad offset %08x", imm);
ERROR_LOG(Log::JIT, "VLDR: Bad offset %08x", imm);
bool single_reg = Dest < D0;
@ -1534,7 +1534,7 @@ void ARMXEmitter::VSTR(ARMReg Src, ARMReg Base, s16 offset)
_assert_msg_((imm & 0xC03) == 0, "VSTR: Offset needs to be word aligned and small enough");
if (imm & 0xC03)
ERROR_LOG(JIT, "VSTR: Bad offset %08x", imm);
ERROR_LOG(Log::JIT, "VSTR: Bad offset %08x", imm);
bool single_reg = Src < D0;
@ -1697,7 +1697,7 @@ void ARMXEmitter::VMOV_neon(u32 Size, ARMReg Vd, ARMReg Rt, int lane)
void ARMXEmitter::VMOV(ARMReg Vd, ARMReg Rt, ARMReg Rt2)
{
_assert_msg_(cpu_info.bVFP | cpu_info.bNEON, "VMOV_neon requires VFP or NEON");
_assert_msg_(cpu_info.bVFP || cpu_info.bNEON, "VMOV_neon requires VFP or NEON");
if (Vd < S0 && Rt < S0 && Rt2 >= D0)
{
@ -1732,7 +1732,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src, bool high)
void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
{
if (Dest == Src) {
WARN_LOG(JIT, "VMOV %s, %s - same register", ARMRegAsString(Src), ARMRegAsString(Dest));
WARN_LOG(Log::JIT, "VMOV %s, %s - same register", ARMRegAsString(Src), ARMRegAsString(Dest));
}
if (Dest > R15)
{
@ -1787,7 +1787,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
_assert_msg_(SrcSize == DestSize, "VMOV doesn't support moving different register sizes");
if (SrcSize != DestSize) {
ERROR_LOG(JIT, "SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest));
ERROR_LOG(Log::JIT, "SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest));
}
Dest = SubBase(Dest);

View File

@ -48,7 +48,7 @@ void Buffer::AppendValue(int value) {
void Buffer::Take(size_t length, std::string *dest) {
if (length > data_.size()) {
ERROR_LOG(IO, "Truncating length in Buffer::Take()");
ERROR_LOG(Log::IO, "Truncating length in Buffer::Take()");
length = data_.size();
}
dest->resize(length);
@ -77,7 +77,7 @@ int Buffer::TakeLineCRLF(std::string *dest) {
void Buffer::Skip(size_t length) {
if (length > data_.size()) {
ERROR_LOG(IO, "Truncating length in Buffer::Skip()");
ERROR_LOG(Log::IO, "Truncating length in Buffer::Skip()");
length = data_.size();
}
data_.erase(data_.begin(), data_.begin() + length);
@ -109,10 +109,10 @@ void Buffer::Printf(const char *fmt, ...) {
size_t retval = vsnprintf(buffer, sizeof(buffer), fmt, vl);
if ((int)retval >= (int)sizeof(buffer)) {
// Output was truncated. TODO: Do something.
ERROR_LOG(IO, "Buffer::Printf truncated output");
ERROR_LOG(Log::IO, "Buffer::Printf truncated output");
}
if ((int)retval < 0) {
ERROR_LOG(IO, "Buffer::Printf failed");
ERROR_LOG(Log::IO, "Buffer::Printf failed");
}
va_end(vl);
char *ptr = Append(retval);

View File

@ -139,7 +139,7 @@ public:
const uint8_t *end = GetCodePtr();
size_t sz = end - writeStart_;
if (sz > writeEstimated_)
WARN_LOG(JIT, "EndWrite(): Estimated %d bytes, wrote %d", (int)writeEstimated_, (int)sz);
WARN_LOG(Log::JIT, "EndWrite(): Estimated %d bytes, wrote %d", (int)writeEstimated_, (int)sz);
// If we protected and wrote less, we may need to unprotect.
// Especially if we're linking blocks or similar.
if (sz < writeEstimated_)

View File

@ -150,7 +150,7 @@ public:
Do(p, size);
if (size != N)
{
ERROR_LOG(COMMON, "Savestate failure: Incompatible queue size.");
ERROR_LOG(Log::Common, "Savestate failure: Incompatible queue size.");
return;
}
// TODO: This is quite wasteful, could just store the actual data. Would be slightly more complex though.

View File

@ -347,7 +347,7 @@ private:
Insert(old[i].hash, old[i].value);
}
}
INFO_LOG(G3D, "Grew hashmap capacity from %d to %d", oldCapacity, capacity_);
INFO_LOG(Log::G3D, "Grew hashmap capacity from %d to %d", oldCapacity, capacity_);
_assert_msg_(oldCount == count_, "PrehashMap: count should not change in Grow()");
}
struct Pair {

View File

@ -20,7 +20,7 @@ bool compress_string(const std::string& str, std::string *dest, int compressionl
memset(&zs, 0, sizeof(zs));
if (deflateInit(&zs, compressionlevel) != Z_OK) {
ERROR_LOG(IO, "deflateInit failed while compressing.");
ERROR_LOG(Log::IO, "deflateInit failed while compressing.");
return false;
}
@ -67,7 +67,7 @@ bool decompress_string(const std::string& str, std::string *dest) {
// modification by hrydgard: inflateInit2, 16+MAXWBITS makes it read gzip data too
if (inflateInit2(&zs, 32+MAX_WBITS) != Z_OK) {
ERROR_LOG(IO, "inflateInit failed while decompressing.");
ERROR_LOG(Log::IO, "inflateInit failed while decompressing.");
return false;
}
@ -95,7 +95,7 @@ bool decompress_string(const std::string& str, std::string *dest) {
inflateEnd(&zs);
if (ret != Z_STREAM_END) { // an error occurred that was not EOF
ERROR_LOG(IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg);
ERROR_LOG(Log::IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg);
return false;
}

View File

@ -17,7 +17,7 @@ JsonReader::JsonReader(const std::string &filename) {
if (buffer_) {
parse();
} else {
ERROR_LOG(IO, "Failed to read json file '%s'", filename.c_str());
ERROR_LOG(Log::IO, "Failed to read json file '%s'", filename.c_str());
}
}
}
@ -26,7 +26,7 @@ bool JsonReader::parse() {
char *error_pos;
int status = jsonParse(buffer_, &error_pos, &root_, alloc_);
if (status != JSON_OK) {
ERROR_LOG(IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos);
ERROR_LOG(Log::IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos);
return false;
}
ok_ = true;
@ -46,7 +46,7 @@ int JsonGet::numChildren() const {
const JsonNode *JsonGet::get(const char *child_name) const {
if (!child_name) {
ERROR_LOG(IO, "JSON: Cannot get from null child name");
ERROR_LOG(Log::IO, "JSON: Cannot get from null child name");
return nullptr;
}
if (value_.getTag() != JSON_OBJECT) {
@ -71,7 +71,7 @@ const char *JsonGet::getStringOrNull(const char *child_name) const {
const JsonNode *val = get(child_name, JSON_STRING);
if (val)
return val->value.toString();
ERROR_LOG(IO, "String '%s' missing from node", child_name);
ERROR_LOG(Log::IO, "String '%s' missing from node", child_name);
return nullptr;
}

View File

@ -17,7 +17,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d
if (PNG_IMAGE_FAILED(png))
{
WARN_LOG(IO, "pngLoad: %s (%s)", png.message, file);
WARN_LOG(Log::IO, "pngLoad: %s (%s)", png.message, file);
*image_data_ptr = nullptr;
return 0;
}
@ -38,7 +38,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in
png_image_begin_read_from_memory(&png, input_ptr, input_len);
if (PNG_IMAGE_FAILED(png)) {
WARN_LOG(IO, "pngLoad: %s", png.message);
WARN_LOG(Log::IO, "pngLoad: %s", png.message);
*image_data_ptr = nullptr;
return 0;
}
@ -50,7 +50,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in
size_t size = PNG_IMAGE_SIZE(png);
if (!size) {
ERROR_LOG(IO, "pngLoad: empty image");
ERROR_LOG(Log::IO, "pngLoad: empty image");
*image_data_ptr = nullptr;
return 0;
}

View File

@ -46,7 +46,7 @@ bool RIFFReader::Descend(uint32_t intoId) {
int startLocation = pos_;
if (pos_ + length > fileSize_) {
ERROR_LOG(IO, "Block extends outside of RIFF file - failing descend");
ERROR_LOG(Log::IO, "Block extends outside of RIFF file - failing descend");
pos_ = stack[depth_].parentStartLocation;
return false;
}
@ -61,7 +61,7 @@ bool RIFFReader::Descend(uint32_t intoId) {
if (length > 0) {
pos_ += length; // try next block
} else {
ERROR_LOG(IO, "Bad data in RIFF file : block length %d. Not descending.", length);
ERROR_LOG(Log::IO, "Bad data in RIFF file : block length %d. Not descending.", length);
pos_ = stack[depth_].parentStartLocation;
return false;
}

View File

@ -51,7 +51,7 @@ int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSr
int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int *flags, uint8_t **image) {
if (zim[0] != 'Z' || zim[1] != 'I' || zim[2] != 'M' || zim[3] != 'G') {
ERROR_LOG(IO, "Not a ZIM file");
ERROR_LOG(Log::IO, "Not a ZIM file");
return 0;
}
memcpy(width, zim + 4, 4);
@ -78,14 +78,14 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
image_data_size[i] = width[i] * height[i] * 2;
break;
default:
ERROR_LOG(IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK);
ERROR_LOG(Log::IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK);
return 0;
}
total_data_size += image_data_size[i];
}
if (total_data_size == 0) {
ERROR_LOG(IO, "Invalid ZIM data size 0");
ERROR_LOG(Log::IO, "Invalid ZIM data size 0");
return 0;
}
@ -98,19 +98,19 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
long outlen = (long)total_data_size;
int retcode = ezuncompress(*image, &outlen, (unsigned char *)(zim + 16), (long)datasize - 16);
if (Z_OK != retcode) {
ERROR_LOG(IO, "ZIM zlib format decompression failed: %d", retcode);
ERROR_LOG(Log::IO, "ZIM zlib format decompression failed: %d", retcode);
free(*image);
*image = 0;
return 0;
}
if (outlen != total_data_size) {
// Shouldn't happen if return value was Z_OK.
ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size);
ERROR_LOG(Log::IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size);
}
} else if (*flags & ZIM_ZSTD_COMPRESSED) {
size_t outlen = ZSTD_decompress(*image, total_data_size, zim + 16, datasize - 16);
if (outlen != (size_t)total_data_size) {
ERROR_LOG(IO, "ZIM zstd format decompression failed: %lld", (long long)outlen);
ERROR_LOG(Log::IO, "ZIM zstd format decompression failed: %lld", (long long)outlen);
free(*image);
*image = 0;
return 0;
@ -118,7 +118,7 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int
} else {
memcpy(*image, zim + 16, datasize - 16);
if (datasize - 16 != (size_t)total_data_size) {
ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size);
ERROR_LOG(Log::IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size);
}
}
return num_levels;
@ -128,13 +128,13 @@ int LoadZIM(const char *filename, int *width, int *height, int *format, uint8_t
size_t size;
uint8_t *buffer = g_VFS.ReadFile(filename, &size);
if (!buffer) {
ERROR_LOG(IO, "Couldn't read data for '%s'", filename);
ERROR_LOG(Log::IO, "Couldn't read data for '%s'", filename);
return 0;
}
int retval = LoadZIMPtr(buffer, size, width, height, format, image);
if (!retval) {
ERROR_LOG(IO, "Not a valid ZIM file: %s (size: %lld bytes)", filename, (long long)size);
ERROR_LOG(Log::IO, "Not a valid ZIM file: %s (size: %lld bytes)", filename, (long long)size);
}
delete [] buffer;
return retval;

View File

@ -143,7 +143,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl
break;
default:
ERROR_LOG(IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK);
ERROR_LOG(Log::IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK);
*data = 0;
*data_size = 0;
return;
@ -199,7 +199,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t
if (Z_OK == ezcompress(dest, &dest_len, data, data_size, compressLevel == 0 ? Z_DEFAULT_COMPRESSION : compressLevel)) {
fwrite(dest, 1, dest_len, f);
} else {
ERROR_LOG(IO, "Zlib compression failed.\n");
ERROR_LOG(Log::IO, "Zlib compression failed.\n");
}
delete [] dest;
} else if (flags & ZIM_ZSTD_COMPRESSED) {
@ -209,7 +209,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t
if (!ZSTD_isError(dest_len)) {
fwrite(dest, 1, dest_len, f);
} else {
ERROR_LOG(IO, "Zlib compression failed.\n");
ERROR_LOG(Log::IO, "Zlib compression failed.\n");
}
delete [] dest;
} else {

View File

@ -142,7 +142,7 @@ bool I18NRepo::LoadIni(const std::string &languageID, const Path &overridePath)
IniFile ini;
Path iniPath;
// INFO_LOG(SYSTEM, "Loading lang ini %s", iniPath.c_str());
// INFO_LOG(Log::System, "Loading lang ini %s", iniPath.c_str());
if (!overridePath.empty()) {
iniPath = overridePath / (languageID + ".ini");
} else {
@ -174,7 +174,7 @@ void I18NRepo::LogMissingKeys() const {
for (size_t i = 0; i < (size_t)I18NCat::CATEGORY_COUNT; i++) {
auto &cat = cats_[i];
for (auto &key : cat->Missed()) {
INFO_LOG(SYSTEM, "Missing translation [%s]: %s (%s)", g_categoryNames[i], key.first.c_str(), key.second.c_str());
INFO_LOG(Log::System, "Missing translation [%s]: %s (%s)", g_categoryNames[i], key.first.c_str(), key.second.c_str());
}
}
}

View File

@ -81,7 +81,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
return;
}
INFO_LOG(SYSTEM, "Installing exception handler");
INFO_LOG(Log::System, "Installing exception handler");
g_badAccessHandler = badAccessHandler;
g_vectoredExceptionHandle = AddVectoredExceptionHandler(TRUE, GlobalExceptionHandler);
}
@ -89,7 +89,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
void UninstallExceptionHandler() {
if (g_vectoredExceptionHandle) {
RemoveVectoredExceptionHandler(g_vectoredExceptionHandle);
INFO_LOG(SYSTEM, "Removed exception handler");
INFO_LOG(Log::System, "Removed exception handler");
g_vectoredExceptionHandle = nullptr;
}
g_badAccessHandler = nullptr;
@ -186,7 +186,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
}
g_badAccessHandler = badAccessHandler;
INFO_LOG(SYSTEM, "Installing exception handler");
INFO_LOG(Log::System, "Installing exception handler");
mach_port_t port;
CheckKR("mach_port_allocate",
mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port));
@ -290,7 +290,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
// Add some extra room.
altStackSize += 65536;
INFO_LOG(SYSTEM, "Installed exception handler. stack size: %d", (int)altStackSize);
INFO_LOG(Log::System, "Installed exception handler. stack size: %d", (int)altStackSize);
g_badAccessHandler = badAccessHandler;
stack_t signal_stack{};
@ -323,7 +323,7 @@ void UninstallExceptionHandler() {
stack_t signal_stack{};
signal_stack.ss_flags = SS_DISABLE;
if (0 != sigaltstack(&signal_stack, nullptr)) {
ERROR_LOG(SYSTEM, "Could not remove signal altstack");
ERROR_LOG(Log::System, "Could not remove signal altstack");
}
if (altStack) {
free(altStack);
@ -333,7 +333,7 @@ void UninstallExceptionHandler() {
#ifdef __APPLE__
sigaction(SIGBUS, &old_sa_bus, nullptr);
#endif
INFO_LOG(SYSTEM, "Uninstalled exception handler");
INFO_LOG(Log::System, "Uninstalled exception handler");
g_badAccessHandler = nullptr;
}
@ -342,7 +342,7 @@ void UninstallExceptionHandler() {
#else // !MACHINE_CONTEXT_SUPPORTED
void InstallExceptionHandler(BadAccessHandler badAccessHandler) {
ERROR_LOG(SYSTEM, "Exception handler not implemented on this platform, can't install");
ERROR_LOG(Log::System, "Exception handler not implemented on this platform, can't install");
}
void UninstallExceptionHandler() { }

View File

@ -48,7 +48,7 @@ bool AndroidContentURI::Parse(std::string_view path) {
AndroidContentURI AndroidContentURI::WithRootFilePath(const std::string &filePath) {
if (root.empty()) {
ERROR_LOG(SYSTEM, "WithRootFilePath cannot be used with single file URIs.");
ERROR_LOG(Log::System, "WithRootFilePath cannot be used with single file URIs.");
return *this;
}
@ -116,7 +116,7 @@ bool AndroidContentURI::ComputePathTo(const AndroidContentURI &other, std::strin
size_t offset = FilePath().size() + 1;
const auto &otherFilePath = other.FilePath();
if (offset >= otherFilePath.size()) {
ERROR_LOG(SYSTEM, "Bad call to PathTo. '%s' -> '%s'", FilePath().c_str(), other.FilePath().c_str());
ERROR_LOG(Log::System, "Bad call to PathTo. '%s' -> '%s'", FilePath().c_str(), other.FilePath().c_str());
return false;
}

View File

@ -154,7 +154,7 @@ static bool ParseFileInfo(const std::string &line, File::FileInfo *fileInfo) {
std::vector<std::string> parts;
SplitString(line, '|', parts);
if (parts.size() != 4) {
ERROR_LOG(FILESYS, "Bad format: %s", line.c_str());
ERROR_LOG(Log::FileSystem, "Bad format: %s", line.c_str());
return false;
}
fileInfo->name = std::string(parts[2]);
@ -247,7 +247,7 @@ std::vector<File::FileInfo> Android_ListContentUri(const std::string &path, bool
double elapsed = time_now_d() - start;
double threshold = 0.1;
if (elapsed >= threshold) {
INFO_LOG(FILESYS, "Listing directory on content URI '%s' took %0.3f s (%d files, log threshold = %0.3f)", path.c_str(), elapsed, (int)items.size(), threshold);
INFO_LOG(Log::FileSystem, "Listing directory on content URI '%s' took %0.3f s (%d files, log threshold = %0.3f)", path.c_str(), elapsed, (int)items.size(), threshold);
}
return items;
}
@ -284,7 +284,7 @@ int64_t Android_ComputeRecursiveDirectorySize(const std::string &uri) {
int64_t size = env->CallLongMethod(g_nativeActivity, computeRecursiveDirectorySize, param);
double elapsed = time_now_d() - start;
INFO_LOG(IO, "ComputeRecursiveDirectorySize(%s) in %0.3f s", uri.c_str(), elapsed);
INFO_LOG(Log::IO, "ComputeRecursiveDirectorySize(%s) in %0.3f s", uri.c_str(), elapsed);
return size;
}

View File

@ -43,7 +43,7 @@ bool free_disk_space(const Path &path, int64_t &space) {
#else
if (path.Type() == PathType::CONTENT_URI) {
space = Android_GetFreeSpaceByContentUri(path.ToString());
INFO_LOG(COMMON, "Free space at '%s': %" PRIu64, path.c_str(), space);
INFO_LOG(Log::Common, "Free space at '%s': %" PRIu64, path.c_str(), space);
return space >= 0;
}

View File

@ -114,7 +114,7 @@ void SetNonBlocking(int sock, bool non_blocking) {
int opts = fcntl(sock, F_GETFL);
if (opts < 0) {
perror("fcntl(F_GETFL)");
ERROR_LOG(IO, "Error getting socket status while changing nonblocking status");
ERROR_LOG(Log::IO, "Error getting socket status while changing nonblocking status");
}
if (non_blocking) {
opts = (opts | O_NONBLOCK);
@ -124,12 +124,12 @@ void SetNonBlocking(int sock, bool non_blocking) {
if (fcntl(sock, F_SETFL, opts) < 0) {
perror("fcntl(F_SETFL)");
ERROR_LOG(IO, "Error setting socket nonblocking status");
ERROR_LOG(Log::IO, "Error setting socket nonblocking status");
}
#else
u_long val = non_blocking ? 1 : 0;
if (ioctlsocket(sock, FIONBIO, &val) != 0) {
ERROR_LOG(IO, "Error setting socket nonblocking status");
ERROR_LOG(Log::IO, "Error setting socket nonblocking status");
}
#endif
}

View File

@ -110,7 +110,7 @@ FILE *OpenCFile(const Path &path, const char *mode) {
case PathType::CONTENT_URI:
// We're gonna need some error codes..
if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt")) {
INFO_LOG(COMMON, "Opening content file for read: '%s'", path.c_str());
INFO_LOG(Log::Common, "Opening content file for read: '%s'", path.c_str());
// Read, let's support this - easy one.
int descriptor = Android_OpenContentUriFd(path.ToString(), Android_OpenContentUriMode::READ);
if (descriptor < 0) {
@ -121,20 +121,20 @@ FILE *OpenCFile(const Path &path, const char *mode) {
// Need to be able to create the file here if it doesn't exist.
// Not exactly sure which abstractions are best, let's start simple.
if (!File::Exists(path)) {
INFO_LOG(COMMON, "OpenCFile(%s): Opening content file for write. Doesn't exist, creating empty and reopening.", path.c_str());
INFO_LOG(Log::Common, "OpenCFile(%s): Opening content file for write. Doesn't exist, creating empty and reopening.", path.c_str());
std::string name = path.GetFilename();
if (path.CanNavigateUp()) {
Path parent = path.NavigateUp();
if (Android_CreateFile(parent.ToString(), name) != StorageError::SUCCESS) {
WARN_LOG(COMMON, "Failed to create file '%s' in '%s'", name.c_str(), parent.c_str());
WARN_LOG(Log::Common, "Failed to create file '%s' in '%s'", name.c_str(), parent.c_str());
return nullptr;
}
} else {
INFO_LOG_REPORT_ONCE(openCFileFailedNavigateUp, COMMON, "Failed to navigate up to create file: %s", path.c_str());
INFO_LOG_REPORT_ONCE(openCFileFailedNavigateUp, Log::Common, "Failed to navigate up to create file: %s", path.c_str());
return nullptr;
}
} else {
INFO_LOG(COMMON, "OpenCFile(%s): Opening existing content file for write (truncating). Requested mode: '%s'", path.c_str(), mode);
INFO_LOG(Log::Common, "OpenCFile(%s): Opening existing content file for write (truncating). Requested mode: '%s'", path.c_str(), mode);
}
// TODO: Support append modes and stuff... For now let's go with the most common one.
@ -146,7 +146,7 @@ FILE *OpenCFile(const Path &path, const char *mode) {
}
int descriptor = Android_OpenContentUriFd(path.ToString(), openMode);
if (descriptor < 0) {
INFO_LOG(COMMON, "Opening '%s' for write failed", path.ToString().c_str());
INFO_LOG(Log::Common, "Opening '%s' for write failed", path.ToString().c_str());
return nullptr;
}
FILE *f = fdopen(descriptor, fmode);
@ -156,12 +156,12 @@ FILE *OpenCFile(const Path &path, const char *mode) {
}
return f;
} else {
ERROR_LOG(COMMON, "OpenCFile(%s): Mode not yet supported: %s", path.c_str(), mode);
ERROR_LOG(Log::Common, "OpenCFile(%s): Mode not yet supported: %s", path.c_str(), mode);
return nullptr;
}
break;
default:
ERROR_LOG(COMMON, "OpenCFile(%s): PathType not yet supported", path.c_str());
ERROR_LOG(Log::Common, "OpenCFile(%s): PathType not yet supported", path.c_str());
return nullptr;
}
@ -206,27 +206,27 @@ int OpenFD(const Path &path, OpenFlag flags) {
case PathType::CONTENT_URI:
break;
default:
ERROR_LOG(COMMON, "OpenFD: Only supports Content URI paths. Not '%s' (%s)!", path.c_str(), OpenFlagToString(flags).c_str());
ERROR_LOG(Log::Common, "OpenFD: Only supports Content URI paths. Not '%s' (%s)!", path.c_str(), OpenFlagToString(flags).c_str());
// Not yet supported - use other paths.
return -1;
}
if (flags & OPEN_CREATE) {
if (!File::Exists(path)) {
INFO_LOG(COMMON, "OpenFD(%s): Creating file.", path.c_str());
INFO_LOG(Log::Common, "OpenFD(%s): Creating file.", path.c_str());
std::string name = path.GetFilename();
if (path.CanNavigateUp()) {
Path parent = path.NavigateUp();
if (Android_CreateFile(parent.ToString(), name) != StorageError::SUCCESS) {
WARN_LOG(COMMON, "OpenFD: Failed to create file '%s' in '%s'", name.c_str(), parent.c_str());
WARN_LOG(Log::Common, "OpenFD: Failed to create file '%s' in '%s'", name.c_str(), parent.c_str());
return -1;
}
} else {
INFO_LOG(COMMON, "Failed to navigate up to create file: %s", path.c_str());
INFO_LOG(Log::Common, "Failed to navigate up to create file: %s", path.c_str());
return -1;
}
} else {
INFO_LOG(COMMON, "OpenCFile(%s): Opening existing content file ('%s')", path.c_str(), OpenFlagToString(flags).c_str());
INFO_LOG(Log::Common, "OpenCFile(%s): Opening existing content file ('%s')", path.c_str(), OpenFlagToString(flags).c_str());
}
}
@ -242,14 +242,14 @@ int OpenFD(const Path &path, OpenFlag flags) {
// TODO: Maybe better checking of additional flags here.
} else {
// TODO: Add support for more modes if possible.
ERROR_LOG_REPORT_ONCE(openFlagNotSupported, COMMON, "OpenFlag %s not yet supported", OpenFlagToString(flags).c_str());
ERROR_LOG_REPORT_ONCE(openFlagNotSupported, Log::Common, "OpenFlag %s not yet supported", OpenFlagToString(flags).c_str());
return -1;
}
INFO_LOG(COMMON, "Android_OpenContentUriFd: %s (%s)", path.c_str(), OpenFlagToString(flags).c_str());
INFO_LOG(Log::Common, "Android_OpenContentUriFd: %s (%s)", path.c_str(), OpenFlagToString(flags).c_str());
int descriptor = Android_OpenContentUriFd(path.ToString(), mode);
if (descriptor < 0) {
ERROR_LOG(COMMON, "Android_OpenContentUriFd failed: '%s'", path.c_str());
ERROR_LOG(Log::Common, "Android_OpenContentUriFd failed: '%s'", path.c_str());
}
if (flags & OPEN_APPEND) {
@ -439,7 +439,7 @@ bool IsDirectory(const Path &filename) {
#endif
auto err = GetLastError();
if (err != ERROR_FILE_NOT_FOUND) {
WARN_LOG(COMMON, "GetFileAttributes failed on %s: %08x %s", filename.ToVisualString().c_str(), (uint32_t)err, GetStringErrorMsg(err).c_str());
WARN_LOG(Log::Common, "GetFileAttributes failed on %s: %08x %s", filename.ToVisualString().c_str(), (uint32_t)err, GetStringErrorMsg(err).c_str());
}
return false;
}
@ -450,7 +450,7 @@ bool IsDirectory(const Path &filename) {
struct stat file_info;
int result = stat(copy.c_str(), &file_info);
if (result < 0) {
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", copy.c_str(), GetLastErrorMsg().c_str());
WARN_LOG(Log::Common, "IsDirectory: stat failed on %s: %s", copy.c_str(), GetLastErrorMsg().c_str());
return false;
}
return S_ISDIR(file_info.st_mode);
@ -469,36 +469,36 @@ bool Delete(const Path &filename) {
return false;
}
INFO_LOG(COMMON, "Delete: file %s", filename.c_str());
INFO_LOG(Log::Common, "Delete: 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' already does not exist", filename.c_str());
WARN_LOG(Log::Common, "Delete: '%s' already 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());
WARN_LOG(Log::Common, "Delete failed: '%s' is a directory", filename.c_str());
return false;
}
#ifdef _WIN32
#if PPSSPP_PLATFORM(UWP)
if (!DeleteFileFromAppW(filename.ToWString().c_str())) {
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str());
WARN_LOG(Log::Common, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str());
return false;
}
#else
if (!DeleteFile(filename.ToWString().c_str())) {
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str());
WARN_LOG(Log::Common, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str());
return false;
}
#endif
#else
if (unlink(filename.c_str()) == -1) {
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
WARN_LOG(Log::Common, "Delete: unlink failed on %s: %s",
filename.c_str(), GetLastErrorMsg().c_str());
return false;
}
@ -525,11 +525,11 @@ bool CreateDir(const Path &path) {
AndroidContentURI uri(path.ToString());
std::string newDirName = uri.GetLastPart();
if (uri.NavigateUp()) {
INFO_LOG(COMMON, "Calling Android_CreateDirectory(%s, %s)", uri.ToString().c_str(), newDirName.c_str());
INFO_LOG(Log::Common, "Calling Android_CreateDirectory(%s, %s)", uri.ToString().c_str(), newDirName.c_str());
return Android_CreateDirectory(uri.ToString(), newDirName) == StorageError::SUCCESS;
} else {
// Bad path - can't create this directory.
WARN_LOG(COMMON, "CreateDir failed: '%s'", path.c_str());
WARN_LOG(Log::Common, "CreateDir failed: '%s'", path.c_str());
return false;
}
break;
@ -538,7 +538,7 @@ bool CreateDir(const Path &path) {
return false;
}
DEBUG_LOG(COMMON, "CreateDir('%s')", path.c_str());
DEBUG_LOG(Log::Common, "CreateDir('%s')", path.c_str());
#ifdef _WIN32
#if PPSSPP_PLATFORM(UWP)
if (CreateDirectoryFromAppW(path.ToWString().c_str(), NULL))
@ -550,10 +550,10 @@ bool CreateDir(const Path &path) {
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS) {
WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str());
WARN_LOG(Log::Common, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str());
return true;
}
ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %08x %s", path.c_str(), (uint32_t)error, GetStringErrorMsg(error).c_str());
ERROR_LOG(Log::Common, "CreateDir: CreateDirectory failed on %s: %08x %s", path.c_str(), (uint32_t)error, GetStringErrorMsg(error).c_str());
return false;
#else
if (mkdir(path.ToString().c_str(), 0755) == 0) {
@ -562,11 +562,11 @@ bool CreateDir(const Path &path) {
int err = errno;
if (err == EEXIST) {
WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str());
WARN_LOG(Log::Common, "CreateDir: 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));
ERROR_LOG(Log::Common, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err));
return false;
#endif
}
@ -574,7 +574,7 @@ bool CreateDir(const Path &path) {
// Creates the full path of fullPath returns true on success
bool CreateFullPath(const Path &path) {
if (File::Exists(path)) {
DEBUG_LOG(COMMON, "CreateFullPath: path exists %s", path.c_str());
DEBUG_LOG(Log::Common, "CreateFullPath: path exists %s", path.c_str());
return true;
}
@ -583,7 +583,7 @@ bool CreateFullPath(const Path &path) {
case PathType::CONTENT_URI:
break; // OK
default:
ERROR_LOG(COMMON, "CreateFullPath(%s): Not yet supported", path.c_str());
ERROR_LOG(Log::Common, "CreateFullPath(%s): Not yet supported", path.c_str());
return false;
}
@ -601,7 +601,7 @@ bool CreateFullPath(const Path &path) {
// Probably not necessary sanity check, ported from the old code.
if (parts.size() > 100) {
ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep");
ERROR_LOG(Log::Common, "CreateFullPath: directory structure too deep");
return false;
}
@ -633,16 +633,16 @@ bool Rename(const Path &srcFilename, const Path &destFilename) {
// Content URI: Can only rename if in the same folder.
// TODO: Fallback to move + rename? Or do we even care about that use case? We have MoveIfFast for such tricks.
if (srcFilename.GetDirectory() != destFilename.GetDirectory()) {
INFO_LOG(COMMON, "Content URI rename: Directories not matching, failing. %s --> %s", srcFilename.c_str(), destFilename.c_str());
INFO_LOG(Log::Common, "Content URI rename: Directories not matching, failing. %s --> %s", srcFilename.c_str(), destFilename.c_str());
return false;
}
INFO_LOG(COMMON, "Content URI rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
INFO_LOG(Log::Common, "Content URI rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
return Android_RenameFileTo(srcFilename.ToString(), destFilename.GetFilename()) == StorageError::SUCCESS;
default:
return false;
}
INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
INFO_LOG(Log::Common, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
#if defined(_WIN32) && defined(UNICODE)
#if PPSSPP_PLATFORM(UWP)
@ -659,7 +659,7 @@ bool Rename(const Path &srcFilename, const Path &destFilename) {
return true;
#endif
ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s",
ERROR_LOG(Log::Common, "Rename: failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false;
}
@ -683,7 +683,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
return false;
}
INFO_LOG(COMMON, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str());
INFO_LOG(Log::Common, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32
#if PPSSPP_PLATFORM(UWP)
if (CopyFileFromAppW(srcFilename.ToWString().c_str(), destFilename.ToWString().c_str(), FALSE))
@ -692,7 +692,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
if (CopyFile(srcFilename.ToWString().c_str(), destFilename.ToWString().c_str(), FALSE))
return true;
#endif
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s",
ERROR_LOG(Log::Common, "Copy: failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false;
#else
@ -705,7 +705,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
// Open input file
FILE *input = OpenCFile(srcFilename, "rb");
if (!input) {
ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s",
ERROR_LOG(Log::Common, "Copy: input failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false;
}
@ -714,7 +714,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
FILE *output = OpenCFile(destFilename, "wb");
if (!output) {
fclose(input);
ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s",
ERROR_LOG(Log::Common, "Copy: output failed %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false;
}
@ -725,7 +725,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
int rnum = fread(buffer, sizeof(char), BSIZE, input);
if (rnum != BSIZE) {
if (ferror(input) != 0) {
ERROR_LOG(COMMON,
ERROR_LOG(Log::Common,
"Copy: failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
fclose(input);
@ -737,7 +737,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) {
// write output
int wnum = fwrite(buffer, sizeof(char), rnum, output);
if (wnum != rnum) {
ERROR_LOG(COMMON,
ERROR_LOG(Log::Common,
"Copy: failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
fclose(input);
@ -829,14 +829,14 @@ uint64_t GetFileSize(const Path &filename) {
int result = stat64(filename.c_str(), &file_info);
#endif
if (result != 0) {
WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.ToVisualString().c_str());
WARN_LOG(Log::Common, "GetSize: failed %s: No such file", filename.ToVisualString().c_str());
return 0;
}
if (S_ISDIR(file_info.st_mode)) {
WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.ToVisualString().c_str());
WARN_LOG(Log::Common, "GetSize: failed %s: is a directory", filename.ToVisualString().c_str());
return 0;
}
DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.ToVisualString().c_str(), (long long)file_info.st_size);
DEBUG_LOG(Log::Common, "GetSize: %s: %lld", filename.ToVisualString().c_str(), (long long)file_info.st_size);
return file_info.st_size;
#endif
}
@ -885,10 +885,10 @@ uint64_t GetFileSize(FILE *f) {
// creates an empty file filename, returns true on success
bool CreateEmptyFile(const Path &filename) {
INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str());
INFO_LOG(Log::Common, "CreateEmptyFile: %s", filename.c_str());
FILE *pFile = OpenCFile(filename, "wb");
if (!pFile) {
ERROR_LOG(COMMON, "CreateEmptyFile: failed to create '%s': %s", filename.c_str(), GetLastErrorMsg().c_str());
ERROR_LOG(Log::Common, "CreateEmptyFile: failed to create '%s': %s", filename.c_str(), GetLastErrorMsg().c_str());
return false;
}
fclose(pFile);
@ -906,11 +906,11 @@ bool DeleteDir(const Path &path) {
default:
return false;
}
INFO_LOG(COMMON, "DeleteDir: directory %s", path.c_str());
INFO_LOG(Log::Common, "DeleteDir: directory %s", path.c_str());
// check if a directory
if (!File::IsDirectory(path)) {
ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", path.c_str());
ERROR_LOG(Log::Common, "DeleteDir: Not a directory %s", path.c_str());
return false;
}
@ -926,7 +926,7 @@ bool DeleteDir(const Path &path) {
if (rmdir(path.c_str()) == 0)
return true;
#endif
ERROR_LOG(COMMON, "DeleteDir: %s: %s", path.c_str(), GetLastErrorMsg().c_str());
ERROR_LOG(Log::Common, "DeleteDir: %s: %s", path.c_str(), GetLastErrorMsg().c_str());
return false;
}
@ -940,7 +940,7 @@ bool DeleteDirRecursively(const Path &path) {
// We make use of the dangerous auto-recursive property of Android_RemoveFile.
return Android_RemoveFile(path.ToString()) == StorageError::SUCCESS;
default:
ERROR_LOG(COMMON, "DeleteDirRecursively: Path type not supported");
ERROR_LOG(Log::Common, "DeleteDirRecursively: Path type not supported");
return false;
}
@ -961,7 +961,7 @@ bool OpenFileInEditor(const Path &fileName) {
case PathType::NATIVE:
break; // OK
default:
ERROR_LOG(COMMON, "OpenFileInEditor(%s): Path type not supported", fileName.c_str());
ERROR_LOG(Log::Common, "OpenFileInEditor(%s): Path type not supported", fileName.c_str());
return false;
}
@ -979,10 +979,10 @@ bool OpenFileInEditor(const Path &fileName) {
iniFile = "xdg-open ";
#endif
iniFile.append(fileName.ToString());
NOTICE_LOG(BOOT, "Launching %s", iniFile.c_str());
NOTICE_LOG(Log::Boot, "Launching %s", iniFile.c_str());
int retval = system(iniFile.c_str());
if (retval != 0) {
ERROR_LOG(COMMON, "Failed to launch ini file");
ERROR_LOG(Log::Common, "Failed to launch ini file");
}
#endif
return true;

View File

@ -51,7 +51,7 @@ void Path::Init(std::string_view str) {
// and flip it to a NATIVE url and hope for the best.
AndroidContentURI uri(str);
if (startsWith(uri.FilePath(), "raw:/")) {
INFO_LOG(SYSTEM, "Raw path detected: %s", uri.FilePath().c_str());
INFO_LOG(Log::System, "Raw path detected: %s", uri.FilePath().c_str());
path_ = uri.FilePath().substr(4);
type_ = PathType::NATIVE;
} else {

View File

@ -74,7 +74,7 @@ bool LoadRemoteFileList(const Path &url, const std::string &userAgent, bool *can
// Try to extract from an automatic webserver directory listing...
GetQuotedStrings(listing, items);
} else {
ERROR_LOG(IO, "Unsupported Content-Type: %s", contentType.c_str());
ERROR_LOG(Log::IO, "Unsupported Content-Type: %s", contentType.c_str());
return false;
}
Path basePath(baseURL.ToString());
@ -129,7 +129,7 @@ void PathBrowser::SetPath(const Path &path) {
}
void PathBrowser::RestrictToRoot(const Path &root) {
INFO_LOG(SYSTEM, "Restricting to root: %s", root.c_str());
INFO_LOG(Log::System, "Restricting to root: %s", root.c_str());
restrictedRoot_ = root;
}
@ -181,7 +181,7 @@ void PathBrowser::HandlePath() {
results.clear();
success_ = File::GetFilesInDir(lastPath, &results, nullptr);
if (!success_) {
WARN_LOG(IO, "PathBrowser: Failed to list directory: %s", lastPath.c_str());
WARN_LOG(Log::IO, "PathBrowser: Failed to list directory: %s", lastPath.c_str());
}
guard.lock();
}
@ -248,7 +248,7 @@ bool PathBrowser::GetListing(std::vector<File::FileInfo> &fileInfo, const char *
void PathBrowser::ApplyRestriction() {
if (!path_.StartsWith(restrictedRoot_) && !startsWith(path_.ToString(), "!")) {
WARN_LOG(SYSTEM, "Applying path restriction: %s (%s didn't match)", restrictedRoot_.c_str(), path_.c_str());
WARN_LOG(Log::System, "Applying path restriction: %s (%s didn't match)", restrictedRoot_.c_str(), path_.c_str());
path_ = restrictedRoot_;
}
}

View File

@ -11,9 +11,9 @@ VFS g_VFS;
void VFS::Register(const char *prefix, VFSBackend *reader) {
if (reader) {
entries_.push_back(VFSEntry{ prefix, reader });
DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
DEBUG_LOG(Log::IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str());
} else {
ERROR_LOG(IO, "Trying to register null VFS backend for prefix %s", prefix);
ERROR_LOG(Log::IO, "Trying to register null VFS backend for prefix %s", prefix);
}
}
@ -40,7 +40,7 @@ static bool IsLocalAbsolutePath(std::string_view path) {
uint8_t *VFS::ReadFile(const char *filename, size_t *size) {
if (IsLocalAbsolutePath(filename)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename);
// INFO_LOG(Log::IO, "Not a VFS path: %s . Reading local file.", filename);
return File::ReadLocalFile(Path(filename), size);
}
@ -51,7 +51,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) {
if (prefix_len >= fn_len) continue;
if (0 == memcmp(filename, entry.prefix, prefix_len)) {
fileSystemFound = true;
// INFO_LOG(IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len);
// INFO_LOG(Log::IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len);
uint8_t *data = entry.reader->ReadFile(filename + prefix_len, size);
if (data)
return data;
@ -61,7 +61,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) {
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for '%s'", filename);
ERROR_LOG(Log::IO, "Missing filesystem for '%s'", filename);
} // Otherwise, the file was just missing. No need to log.
return nullptr;
}
@ -69,7 +69,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) {
bool VFS::GetFileListing(const char *path, std::vector<File::FileInfo> *listing, const char *filter) {
if (IsLocalAbsolutePath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path);
// INFO_LOG(Log::IO, "Not a VFS path: %s . Reading local directory.", path);
File::GetFilesInDir(Path(std::string(path)), listing, filter);
return true;
}
@ -88,7 +88,7 @@ bool VFS::GetFileListing(const char *path, std::vector<File::FileInfo> *listing,
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for %s", path);
ERROR_LOG(Log::IO, "Missing filesystem for %s", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}
@ -96,7 +96,7 @@ bool VFS::GetFileListing(const char *path, std::vector<File::FileInfo> *listing,
bool VFS::GetFileInfo(const char *path, File::FileInfo *info) {
if (IsLocalAbsolutePath(path)) {
// Local path, not VFS.
// INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path);
// INFO_LOG(Log::IO, "Not a VFS path: %s . Getting local file info.", path);
return File::GetFileInfo(Path(std::string(path)), info);
}
@ -114,7 +114,7 @@ bool VFS::GetFileInfo(const char *path, File::FileInfo *info) {
}
}
if (!fileSystemFound) {
ERROR_LOG(IO, "Missing filesystem for '%s'", path);
ERROR_LOG(Log::IO, "Missing filesystem for '%s'", path);
} // Otherwise, the file was just missing. No need to log.
return false;
}

View File

@ -22,7 +22,7 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath,
int fd = File::OpenFD(zipFile, File::OPEN_READ);
if (!fd) {
if (logErrors) {
ERROR_LOG(IO, "Failed to open FD for '%s' as zip file", zipFile.c_str());
ERROR_LOG(Log::IO, "Failed to open FD for '%s' as zip file", zipFile.c_str());
}
return nullptr;
}
@ -33,7 +33,7 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath,
if (!zip_file) {
if (logErrors) {
ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str());
ERROR_LOG(Log::IO, "Failed to open %s as a zip file", zipFile.c_str());
}
return nullptr;
}
@ -61,7 +61,7 @@ uint8_t *ZipFileReader::ReadFile(const char *path, size_t *size) {
zip_stat(zip_file_, temp_path.c_str(), ZIP_FL_NOCASE | ZIP_FL_UNCHANGED, &zstat);
zip_file *file = zip_fopen(zip_file_, temp_path.c_str(), ZIP_FL_NOCASE | ZIP_FL_UNCHANGED);
if (!file) {
ERROR_LOG(IO, "Error opening %s from ZIP", temp_path.c_str());
ERROR_LOG(Log::IO, "Error opening %s from ZIP", temp_path.c_str());
return 0;
}
uint8_t *contents = new uint8_t[zstat.size + 1];
@ -107,7 +107,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vector<File::File
listing->clear();
// INFO_LOG(SYSTEM, "Zip: Listing '%s'", orig_path);
// INFO_LOG(Log::System, "Zip: Listing '%s'", orig_path);
listing->reserve(directories.size() + files.size());
for (auto diter = directories.begin(); diter != directories.end(); ++diter) {
@ -120,7 +120,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vector<File::File
info.exists = true;
info.isWritable = false;
info.isDirectory = true;
// INFO_LOG(SYSTEM, "Found file: %s (%s)", info.name.c_str(), info.fullName.c_str());
// INFO_LOG(Log::System, "Found file: %s (%s)", info.name.c_str(), info.fullName.c_str());
listing->push_back(info);
}
@ -139,7 +139,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vector<File::File
continue;
}
}
// INFO_LOG(SYSTEM, "Found dir: %s (%s)", info.name.c_str(), info.fullName.c_str());
// INFO_LOG(Log::System, "Found dir: %s (%s)", info.name.c_str(), info.fullName.c_str());
listing->push_back(info);
}
@ -279,7 +279,7 @@ VFSOpenFile *ZipFileReader::OpenFileForRead(VFSFileReference *vfsReference, size
openFile->zf = zip_fopen_index(zip_file_, reference->zi, 0);
if (!openFile->zf) {
WARN_LOG(G3D, "File with index %d not found in zip", reference->zi);
WARN_LOG(Log::G3D, "File with index %d not found in zip", reference->zi);
lock_.unlock();
delete openFile;
return nullptr;

View File

@ -1036,7 +1036,7 @@ void D3D11DrawContext::UpdateTextureLevels(Texture *texture, const uint8_t **dat
ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) {
if (language != ShaderLanguage::HLSL_D3D11) {
ERROR_LOG(G3D, "Unsupported shader language");
ERROR_LOG(Log::G3D, "Unsupported shader language");
return nullptr;
}
@ -1079,7 +1079,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
}
if (errorMsgs) {
errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize());
ERROR_LOG(G3D, "Failed compiling %s:\n%s\n%s", tag, data, errors.c_str());
ERROR_LOG(Log::G3D, "Failed compiling %s:\n%s\n%s", tag, data, errors.c_str());
errorMsgs->Release();
}
@ -1104,7 +1104,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang
result = device_->CreateGeometryShader(data, dataSize, nullptr, &module->gs);
break;
default:
ERROR_LOG(G3D, "Unsupported shader stage");
ERROR_LOG(Log::G3D, "Unsupported shader stage");
result = S_FALSE;
break;
}
@ -1484,7 +1484,7 @@ Framebuffer *D3D11DrawContext::CreateFramebuffer(const FramebufferDesc &desc) {
depthViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
hr = device_->CreateShaderResourceView(fb->depthStencilTex, &depthViewDesc, &fb->depthSRView);
if (FAILED(hr)) {
WARN_LOG(G3D, "Failed to create SRV for depth buffer.");
WARN_LOG(Log::G3D, "Failed to create SRV for depth buffer.");
fb->depthSRView = nullptr;
}
}

View File

@ -375,7 +375,7 @@ bool D3D9Texture::Create(const TextureDesc &desc) {
break;
}
if (FAILED(hr)) {
ERROR_LOG(G3D, "D3D9 Texture creation failed");
ERROR_LOG(Log::G3D, "D3D9 Texture creation failed");
return false;
}
@ -486,7 +486,7 @@ void D3D9Texture::SetImageData(int x, int y, int z, int width, int height, int d
}
default:
ERROR_LOG(G3D, "Non-LINEAR2D textures not yet supported");
ERROR_LOG(Log::G3D, "Non-LINEAR2D textures not yet supported");
break;
}
}
@ -733,7 +733,7 @@ static NVIDIAGeneration NVIDIAGetDeviceGeneration(int deviceID) {
D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx)
: d3d_(d3d), d3dEx_(d3dEx), device_(device), deviceEx_(deviceEx), adapterId_(adapterId), caps_{} {
if (FAILED(d3d->GetAdapterIdentifier(adapterId, 0, &identifier_))) {
ERROR_LOG(G3D, "Failed to get adapter identifier: %d", adapterId);
ERROR_LOG(Log::G3D, "Failed to get adapter identifier: %d", adapterId);
}
switch (identifier_.VendorId) {
case 0x10DE: caps_.vendor = GPUVendor::VENDOR_NVIDIA; break;
@ -758,7 +758,7 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID
if (SUCCEEDED(result)) {
snprintf(shadeLangVersion_, sizeof(shadeLangVersion_), "PS: %04x VS: %04x", d3dCaps_.PixelShaderVersion & 0xFFFF, d3dCaps_.VertexShaderVersion & 0xFFFF);
} else {
WARN_LOG(G3D, "Direct3D9: Failed to get the device caps!");
WARN_LOG(Log::G3D, "Direct3D9: Failed to get the device caps!");
truncate_cpy(shadeLangVersion_, "N/A");
}
@ -846,13 +846,13 @@ ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage
Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
if (!desc.shaders.size()) {
ERROR_LOG(G3D, "Pipeline %s requires at least one shader", tag);
ERROR_LOG(Log::G3D, "Pipeline %s requires at least one shader", tag);
return NULL;
}
D3D9Pipeline *pipeline = new D3D9Pipeline();
for (auto iter : desc.shaders) {
if (!iter) {
ERROR_LOG(G3D, "NULL shader passed to CreateGraphicsPipeline(%s)", tag);
ERROR_LOG(Log::G3D, "NULL shader passed to CreateGraphicsPipeline(%s)", tag);
delete pipeline;
return NULL;
}
@ -1041,7 +1041,7 @@ D3D9InputLayout::D3D9InputLayout(LPDIRECT3DDEVICE9 device, const InputLayoutDesc
HRESULT hr = device->CreateVertexDeclaration(elements, &decl_);
if (FAILED(hr)) {
ERROR_LOG(G3D, "Error creating vertex decl");
ERROR_LOG(Log::G3D, "Error creating vertex decl");
}
delete[] elements;
}
@ -1119,7 +1119,7 @@ void D3D9Context::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offse
if (!size)
return;
if (offset + size > buf->maxSize_) {
ERROR_LOG(G3D, "Can't SubData with bigger size than buffer was created with");
ERROR_LOG(Log::G3D, "Can't SubData with bigger size than buffer was created with");
return;
}
if (buf->vbuffer_) {
@ -1253,8 +1253,8 @@ bool D3D9ShaderModule::Compile(LPDIRECT3DDEVICE9 device, const uint8_t *data, si
error = "D3D9 shader compiler not installed";
}
ERROR_LOG(G3D, "Compile error: %s", error);
ERROR_LOG(G3D, "%s", LineNumberString(std::string((const char *)data)).c_str());
ERROR_LOG(Log::G3D, "Compile error: %s", error);
ERROR_LOG(Log::G3D, "%s", LineNumberString(std::string((const char *)data)).c_str());
OutputDebugStringA(source);
OutputDebugStringA(error);
@ -1307,7 +1307,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) {
HRESULT rtResult = device_->CreateTexture(desc.width, desc.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fbo->tex, nullptr);
if (FAILED(rtResult)) {
ERROR_LOG(G3D, "Failed to create render target");
ERROR_LOG(Log::G3D, "Failed to create render target");
fbo->Release();
return NULL;
}
@ -1323,7 +1323,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) {
dsResult = device_->CreateDepthStencilSurface(desc.width, desc.height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->depthstencil, NULL);
}
if (FAILED(dsResult)) {
ERROR_LOG(G3D, "Failed to create depth buffer");
ERROR_LOG(Log::G3D, "Failed to create depth buffer");
fbo->surf->Release();
fbo->tex->Release();
if (fbo->depthstenciltex) {
@ -1595,7 +1595,7 @@ void D3D9Context::HandleEvent(Event ev, int width, int height, void *param1, voi
DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) {
bool result = LoadD3DCompilerDynamic();
if (!result) {
ERROR_LOG(G3D, "Failed to load D3DCompiler!");
ERROR_LOG(Log::G3D, "Failed to load D3DCompiler!");
return nullptr;
}
return new D3D9Context(d3d, d3dEx, adapterId, device, deviceEx);

View File

@ -37,7 +37,7 @@ std::string GLEnumToString(uint16_t value) {
bool CheckGLError(const char *file, int line) {
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
ERROR_LOG(G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line);
ERROR_LOG(Log::G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line);
return false;
}
return true;

View File

@ -105,7 +105,7 @@ int GLExtensions::GLSLVersion() {
void ProcessGPUFeatures() {
gl_extensions.bugs = 0;
DEBUG_LOG(G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
DEBUG_LOG(Log::G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model);
if (gl_extensions.gpuVendor == GPU_VENDOR_IMGTEC) {
if (!strcmp(gl_extensions.model, "PowerVR SGX 545") ||
@ -115,11 +115,11 @@ void ProcessGPUFeatures() {
!strcmp(gl_extensions.model, "PowerVR SGX 540") ||
!strcmp(gl_extensions.model, "PowerVR SGX 530") ||
!strcmp(gl_extensions.model, "PowerVR SGX 520") ) {
WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad and terrible precision");
WARN_LOG(Log::G3D, "GL DRIVER BUG: PVR with bad and terrible precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD;
} else {
// TODO: I'm not sure if the Rogue series is affected by this.
WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad precision");
WARN_LOG(Log::G3D, "GL DRIVER BUG: PVR with bad precision");
gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD;
}
}
@ -193,14 +193,14 @@ bool CheckGLExtensions() {
} else if (vendor == "Apple Inc." || vendor == "Apple") {
gl_extensions.gpuVendor = GPU_VENDOR_APPLE;
} else {
WARN_LOG(G3D, "Unknown GL vendor: '%s'", vendor.c_str());
WARN_LOG(Log::G3D, "Unknown GL vendor: '%s'", vendor.c_str());
gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN;
}
} else {
gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN;
}
INFO_LOG(G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
INFO_LOG(Log::G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A");
if (renderer) {
strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model));
@ -267,7 +267,7 @@ bool CheckGLExtensions() {
gl_extensions.ver[1] = 0;
} else if (parsed[0] && (gl_extensions.ver[0] != parsed[0] || gl_extensions.ver[1] != parsed[1])) {
// Something going wrong. Possible bug in GL ES drivers. See #9688
INFO_LOG(G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.",
INFO_LOG(Log::G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.",
versionStr ? versionStr : "N/A", parsed[0], parsed[1], gl_extensions.ver[0], gl_extensions.ver[1]);
gl_extensions.ver[0] = 2;
@ -291,7 +291,7 @@ bool CheckGLExtensions() {
gl_extensions.GLES3 = true;
// Though, let's ban Mali from the GLES 3 path for now, see #4078
if (strstr(renderer, "Mali") != 0) {
INFO_LOG(G3D, "Forcing GLES3 off for Mali driver version: %s\n", versionStr ? versionStr : "N/A");
INFO_LOG(Log::G3D, "Forcing GLES3 off for Mali driver version: %s\n", versionStr ? versionStr : "N/A");
gl_extensions.GLES3 = false;
}
} else {
@ -312,9 +312,9 @@ bool CheckGLExtensions() {
if (gl_extensions.GLES3) {
if (gl_extensions.ver[1] >= 1) {
INFO_LOG(G3D, "OpenGL ES 3.1 support detected!\n");
INFO_LOG(Log::G3D, "OpenGL ES 3.1 support detected!\n");
} else {
INFO_LOG(G3D, "OpenGL ES 3.0 support detected!\n");
INFO_LOG(Log::G3D, "OpenGL ES 3.0 support detected!\n");
}
}
}
@ -410,7 +410,7 @@ bool CheckGLExtensions() {
#ifdef _DEBUG
void *invalidAddress = (void *)eglGetProcAddress("InvalidGlCall1");
void *invalidAddress2 = (void *)eglGetProcAddress("AnotherInvalidGlCall2");
DEBUG_LOG(G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2);
DEBUG_LOG(Log::G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2);
#endif
// These are all the same. Let's alias.
@ -511,7 +511,7 @@ bool CheckGLExtensions() {
// The model number comparison should probably be 400 or 500. This causes us to avoid depal-in-shader.
// It seems though that this caused large perf regressions on Adreno 5xx, so I've bumped it up to 600.
if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM && gl_extensions.modelNumber < 600) {
WARN_LOG(G3D, "Detected old Adreno - lowering reported int precision for safety");
WARN_LOG(Log::G3D, "Detected old Adreno - lowering reported int precision for safety");
gl_extensions.range[1][5][0] = 15;
gl_extensions.range[1][5][1] = 15;
}
@ -621,7 +621,7 @@ bool CheckGLExtensions() {
int error = glGetError();
if (error)
ERROR_LOG(G3D, "GL error in init: %i", error);
ERROR_LOG(Log::G3D, "GL error in init: %i", error);
#endif
return true;

View File

@ -137,7 +137,7 @@ void GLPushBuffer::Flush() {
}
void GLPushBuffer::AddBuffer() {
// INFO_LOG(G3D, "GLPushBuffer(%s): Allocating %d bytes", tag_, size_);
// INFO_LOG(Log::G3D, "GLPushBuffer(%s): Allocating %d bytes", tag_, size_);
BufInfo info;
info.localMemory = (uint8_t *)AllocateAlignedMemory(size_, 16);
_assert_msg_(info.localMemory != 0, "GLPushBuffer alloc fail: %d (%s)", (int)size_, tag_);

View File

@ -130,12 +130,12 @@ void GLQueueRunner::RunInitSteps(const FastVec<GLRInitStep> &steps, bool skipGLC
}
case GLRInitStepType::CREATE_PROGRAM:
{
WARN_LOG(G3D, "CREATE_PROGRAM found with skipGLCalls, not good");
WARN_LOG(Log::G3D, "CREATE_PROGRAM found with skipGLCalls, not good");
break;
}
case GLRInitStepType::CREATE_SHADER:
{
WARN_LOG(G3D, "CREATE_SHADER found with skipGLCalls, not good");
WARN_LOG(Log::G3D, "CREATE_SHADER found with skipGLCalls, not good");
break;
}
default:
@ -237,11 +237,11 @@ void GLQueueRunner::RunInitSteps(const FastVec<GLRInitStep> &steps, bool skipGLC
if (!anyFailed)
Reporting::ReportMessage("Error in shader program link: info: %s\nfs: %s\n%s\nvs: %s\n%s", infoLog.c_str(), fsDesc.c_str(), fsCode, vsDesc.c_str(), vsCode);
ERROR_LOG(G3D, "Could not link program:\n %s", infoLog.c_str());
ERROR_LOG(G3D, "VS desc:\n%s", vsDesc.c_str());
ERROR_LOG(G3D, "FS desc:\n%s", fsDesc.c_str());
ERROR_LOG(G3D, "VS:\n%s\n", LineNumberString(vsCode).c_str());
ERROR_LOG(G3D, "FS:\n%s\n", LineNumberString(fsCode).c_str());
ERROR_LOG(Log::G3D, "Could not link program:\n %s", infoLog.c_str());
ERROR_LOG(Log::G3D, "VS desc:\n%s", vsDesc.c_str());
ERROR_LOG(Log::G3D, "FS desc:\n%s", fsDesc.c_str());
ERROR_LOG(Log::G3D, "VS:\n%s\n", LineNumberString(vsCode).c_str());
ERROR_LOG(Log::G3D, "FS:\n%s\n", LineNumberString(fsCode).c_str());
#ifdef _WIN32
OutputDebugStringUTF8(infoLog.c_str());
@ -264,7 +264,7 @@ void GLQueueRunner::RunInitSteps(const FastVec<GLRInitStep> &steps, bool skipGLC
int location = glGetUniformLocation(program->program, query.name);
if (location < 0 && query.required) {
WARN_LOG(G3D, "Required uniform query for '%s' failed", query.name);
WARN_LOG(Log::G3D, "Required uniform query for '%s' failed", query.name);
}
*query.dest = location;
}
@ -306,7 +306,7 @@ void GLQueueRunner::RunInitSteps(const FastVec<GLRInitStep> &steps, bool skipGLC
std::vector<std::string_view> lines;
SplitString(errorString, '\n', lines);
for (auto line : lines) {
ERROR_LOG(G3D, "%.*s", (int)line.size(), line.data());
ERROR_LOG(Log::G3D, "%.*s", (int)line.size(), line.data());
}
if (errorCallback_) {
std::string desc = StringFromFormat("Shader compilation failed: %s", step.create_shader.stage == GL_VERTEX_SHADER ? "vertex" : "fragment");
@ -431,12 +431,12 @@ void GLQueueRunner::RunInitSteps(const FastVec<GLRInitStep> &steps, bool skipGLC
// Calling glGetError() isn't great, but at the end of init, only after creating textures, shouldn't be too bad...
GLenum err = glGetError();
if (err == GL_OUT_OF_MEMORY) {
WARN_LOG_REPORT(G3D, "GL ran out of GPU memory; switching to low memory mode");
WARN_LOG_REPORT(Log::G3D, "GL ran out of GPU memory; switching to low memory mode");
sawOutOfMemory_ = true;
} else if (err != GL_NO_ERROR) {
// We checked the err anyway, might as well log if there is one.
std::string errorString = GLEnumToString(err);
WARN_LOG(G3D, "Got an error after init: %08x (%s)", err, errorString.c_str());
WARN_LOG(Log::G3D, "Got an error after init: %08x (%s)", err, errorString.c_str());
if (errorCallback_) {
errorCallback_("GL frame init error", errorString.c_str(), errorCallbackUserData_);
}
@ -494,7 +494,7 @@ void GLQueueRunner::InitCreateFramebuffer(const GLRInitStep &step) {
retry_depth:
if (!fbo->z_stencil_) {
INFO_LOG(G3D, "Creating %d x %d FBO using no depth", fbo->width, fbo->height);
INFO_LOG(Log::G3D, "Creating %d x %d FBO using no depth", fbo->width, fbo->height);
fbo->z_stencil_buffer = 0;
fbo->stencil_buffer = 0;
@ -507,7 +507,7 @@ retry_depth:
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
} else if (gl_extensions.IsGLES) {
if (gl_extensions.OES_packed_depth_stencil && (gl_extensions.OES_depth_texture || gl_extensions.GLES3)) {
INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height);
INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height);
fbo->z_stencil_buffer = 0;
fbo->stencil_buffer = 0;
fbo->z_buffer = 0;
@ -528,7 +528,7 @@ retry_depth:
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, fbo->z_stencil_texture.texture, 0);
}
} else if (gl_extensions.OES_packed_depth_stencil) {
INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8", fbo->width, fbo->height);
INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8", fbo->width, fbo->height);
// Standard method
fbo->stencil_buffer = 0;
fbo->z_buffer = 0;
@ -543,7 +543,7 @@ retry_depth:
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer);
} else {
INFO_LOG(G3D, "Creating %d x %d FBO using separate stencil", fbo->width, fbo->height);
INFO_LOG(Log::G3D, "Creating %d x %d FBO using separate stencil", fbo->width, fbo->height);
// TEGRA
fbo->z_stencil_buffer = 0;
// 16/24-bit Z, separate 8-bit stencil
@ -564,7 +564,7 @@ retry_depth:
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->stencil_buffer);
}
} else if (gl_extensions.VersionGEThan(3, 0)) {
INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height);
INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height);
fbo->z_stencil_buffer = 0;
fbo->stencil_buffer = 0;
fbo->z_buffer = 0;
@ -600,13 +600,13 @@ retry_depth:
switch (status) {
case GL_FRAMEBUFFER_COMPLETE:
// INFO_LOG(G3D, "Framebuffer verified complete.");
// INFO_LOG(Log::G3D, "Framebuffer verified complete.");
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
break;
default:
_assert_msg_(false, "Other framebuffer error: %d", status);
@ -747,7 +747,7 @@ void GLQueueRunner::PerformBlit(const GLRStep &step) {
CHECK_GL_ERROR_IF_DEBUG();
#endif // defined(USING_GLES2) && defined(__ANDROID__)
} else {
ERROR_LOG(G3D, "GLQueueRunner: Tried to blit without the capability");
ERROR_LOG(Log::G3D, "GLQueueRunner: Tried to blit without the capability");
}
}
@ -1694,13 +1694,13 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) {
GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch (status) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
// INFO_LOG(G3D, "Framebuffer verified complete.");
// INFO_LOG(Log::G3D, "Framebuffer verified complete.");
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ");
ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ");
break;
default:
_assert_msg_(false, "Other framebuffer error: %d", status);

View File

@ -12,7 +12,7 @@
#include "Common/Math/math_util.h"
#if 0 // def _DEBUG
#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__)
#define VLOG(...) INFO_LOG(Log::G3D, __VA_ARGS__)
#else
#define VLOG(...)
#endif
@ -59,7 +59,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) {
renderThreadId = std::this_thread::get_id();
if (newInflightFrames_ != -1) {
INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_);
INFO_LOG(Log::G3D, "Updating inflight frames to %d", newInflightFrames_);
inflightFrames_ = newInflightFrames_;
newInflightFrames_ = -1;
}
@ -99,7 +99,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) {
}
void GLRenderManager::ThreadEnd() {
INFO_LOG(G3D, "ThreadEnd");
INFO_LOG(Log::G3D, "ThreadEnd");
queueRunner_.DestroyDeviceObjects();
VLOG(" PULL: Quitting");
@ -171,7 +171,7 @@ bool GLRenderManager::ThreadFrame() {
void GLRenderManager::StopThread() {
// There's not really a lot to do here anymore.
INFO_LOG(G3D, "GLRenderManager::StopThread()");
INFO_LOG(Log::G3D, "GLRenderManager::StopThread()");
if (runCompileThread_) {
runCompileThread_ = false;
@ -179,17 +179,17 @@ void GLRenderManager::StopThread() {
renderThreadQueue_.push(new GLRRenderThreadTask(GLRRunType::EXIT));
pushCondVar_.notify_one();
} else {
WARN_LOG(G3D, "GL submission thread was already paused.");
WARN_LOG(Log::G3D, "GL submission thread was already paused.");
}
}
void GLRenderManager::StartThread() {
// There's not really a lot to do here anymore.
INFO_LOG(G3D, "GLRenderManager::StartThread()");
INFO_LOG(Log::G3D, "GLRenderManager::StartThread()");
if (!runCompileThread_) {
runCompileThread_ = true;
} else {
INFO_LOG(G3D, "GL submission thread was already running.");
INFO_LOG(Log::G3D, "GL submission thread was already running.");
}
}

View File

@ -23,9 +23,9 @@ bool CompileShader(const char *source, GLuint shader, const char *filename, std:
GLsizei len;
glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog);
infoLog[len] = '\0';
ERROR_LOG(G3D, "Error in shader compilation of %s!\n", filename);
ERROR_LOG(G3D, "Info log: %s\n", infoLog);
ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)source);
ERROR_LOG(Log::G3D, "Error in shader compilation of %s!\n", filename);
ERROR_LOG(Log::G3D, "Info log: %s\n", infoLog);
ERROR_LOG(Log::G3D, "Shader source:\n%s\n", (const char *)source);
if (error_message)
*error_message = infoLog;
return false;
@ -46,7 +46,7 @@ GLSLProgram *glsl_create_source(const char *vshader_src, const char *fshader_src
if (glsl_recompile(program, error_message)) {
active_programs.insert(program);
} else {
ERROR_LOG(G3D, "Failed compiling GLSL program from source strings");
ERROR_LOG(Log::G3D, "Failed compiling GLSL program from source strings");
delete program;
return 0;
}
@ -105,7 +105,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
vsh_src.reset((char *)g_VFS.ReadFile(program->vshader_filename, &sz));
}
if (!program->vshader_source && !vsh_src) {
ERROR_LOG(G3D, "File missing: %s", program->vshader_filename);
ERROR_LOG(Log::G3D, "File missing: %s", program->vshader_filename);
if (error_message) {
*error_message = std::string("File missing: ") + program->vshader_filename;
}
@ -116,7 +116,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
fsh_src.reset((char *)g_VFS.ReadFile(program->fshader_filename, &sz));
}
if (!program->fshader_source && !fsh_src) {
ERROR_LOG(G3D, "File missing: %s", program->fshader_filename);
ERROR_LOG(Log::G3D, "File missing: %s", program->fshader_filename);
if (error_message) {
*error_message = std::string("File missing: ") + program->fshader_filename;
}
@ -150,15 +150,15 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
if (bufLength) {
char* buf = new char[bufLength + 1]; // safety
glGetProgramInfoLog(prog, bufLength, NULL, buf);
INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf);
INFO_LOG(Log::G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(Log::G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf);
if (error_message) {
*error_message = buf;
}
delete [] buf;
} else {
INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus);
INFO_LOG(Log::G3D, "vsh: %i fsh: %i", vsh, fsh);
ERROR_LOG(Log::G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus);
if (error_message) {
*error_message = "(no error message available)";
}
@ -193,7 +193,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) {
program->u_sundir = glGetUniformLocation(program->program_, "u_sundir");
program->u_camerapos = glGetUniformLocation(program->program_, "u_camerapos");
//INFO_LOG(G3D, "Shader compilation success: %s %s",
//INFO_LOG(Log::G3D, "Shader compilation success: %s %s",
// program->vshader_filename,
// program->fshader_filename);
return true;
@ -214,7 +214,7 @@ void glsl_destroy(GLSLProgram *program) {
glDeleteProgram(program->program_);
active_programs.erase(program);
} else {
ERROR_LOG(G3D, "Deleting null GLSL program!");
ERROR_LOG(Log::G3D, "Deleting null GLSL program!");
}
delete program;
}

View File

@ -843,7 +843,7 @@ static GLuint TypeToTarget(TextureType type) {
#endif
case TextureType::ARRAY2D: return GL_TEXTURE_2D_ARRAY;
default:
ERROR_LOG(G3D, "Bad texture type %d", (int)type);
ERROR_LOG(Log::G3D, "Bad texture type %d", (int)type);
return GL_NONE;
}
}
@ -998,30 +998,30 @@ static void LogReadPixelsError(GLenum error) {
case GL_NO_ERROR:
break;
case GL_INVALID_ENUM:
ERROR_LOG(G3D, "glReadPixels: GL_INVALID_ENUM");
ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_ENUM");
break;
case GL_INVALID_VALUE:
ERROR_LOG(G3D, "glReadPixels: GL_INVALID_VALUE");
ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_VALUE");
break;
case GL_INVALID_OPERATION:
ERROR_LOG(G3D, "glReadPixels: GL_INVALID_OPERATION");
ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_OPERATION");
break;
case GL_INVALID_FRAMEBUFFER_OPERATION:
ERROR_LOG(G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION");
ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION");
break;
case GL_OUT_OF_MEMORY:
ERROR_LOG(G3D, "glReadPixels: GL_OUT_OF_MEMORY");
ERROR_LOG(Log::G3D, "glReadPixels: GL_OUT_OF_MEMORY");
break;
#ifndef USING_GLES2
case GL_STACK_UNDERFLOW:
ERROR_LOG(G3D, "glReadPixels: GL_STACK_UNDERFLOW");
ERROR_LOG(Log::G3D, "glReadPixels: GL_STACK_UNDERFLOW");
break;
case GL_STACK_OVERFLOW:
ERROR_LOG(G3D, "glReadPixels: GL_STACK_OVERFLOW");
ERROR_LOG(Log::G3D, "glReadPixels: GL_STACK_OVERFLOW");
break;
#endif
default:
ERROR_LOG(G3D, "glReadPixels: %08x", error);
ERROR_LOG(Log::G3D, "glReadPixels: %08x", error);
break;
}
}
@ -1166,15 +1166,15 @@ void OpenGLContext::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t off
Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) {
if (!desc.shaders.size()) {
ERROR_LOG(G3D, "Pipeline requires at least one shader");
ERROR_LOG(Log::G3D, "Pipeline requires at least one shader");
return nullptr;
}
if ((uint32_t)desc.prim >= (uint32_t)Primitive::PRIMITIVE_TYPE_COUNT) {
ERROR_LOG(G3D, "Invalid primitive type");
ERROR_LOG(Log::G3D, "Invalid primitive type");
return nullptr;
}
if (!desc.depthStencil || !desc.blend || !desc.raster) {
ERROR_LOG(G3D, "Incomplete prim desciption");
ERROR_LOG(Log::G3D, "Incomplete prim desciption");
return nullptr;
}
@ -1184,7 +1184,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const
iter->AddRef();
pipeline->shaders.push_back(static_cast<OpenGLShaderModule *>(iter));
} else {
ERROR_LOG(G3D, "ERROR: Tried to create graphics pipeline %s with a null shader module", tag ? tag : "no tag");
ERROR_LOG(Log::G3D, "ERROR: Tried to create graphics pipeline %s with a null shader module", tag ? tag : "no tag");
delete pipeline;
return nullptr;
}
@ -1205,7 +1205,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const
pipeline->inputLayout = (OpenGLInputLayout *)desc.inputLayout;
return pipeline;
} else {
ERROR_LOG(G3D, "Failed to create pipeline %s - shaders failed to link", tag ? tag : "no tag");
ERROR_LOG(Log::G3D, "Failed to create pipeline %s - shaders failed to link", tag ? tag : "no tag");
delete pipeline;
return nullptr;
}
@ -1274,11 +1274,11 @@ bool OpenGLPipeline::LinkShaders(const PipelineDesc &desc) {
if (shader) {
linkShaders.push_back(shader);
} else {
ERROR_LOG(G3D, "LinkShaders: Bad shader module");
ERROR_LOG(Log::G3D, "LinkShaders: Bad shader module");
return false;
}
} else {
ERROR_LOG(G3D, "LinkShaders: Bad shader in module");
ERROR_LOG(Log::G3D, "LinkShaders: Bad shader in module");
return false;
}
}
@ -1462,7 +1462,7 @@ void OpenGLInputLayout::Compile(const InputLayoutDesc &desc) {
break;
case DataFormat::UNDEFINED:
default:
ERROR_LOG(G3D, "Thin3DGLVertexFormat: Invalid or unknown component type applied.");
ERROR_LOG(Log::G3D, "Thin3DGLVertexFormat: Invalid or unknown component type applied.");
break;
}

View File

@ -203,7 +203,7 @@ bool ConvertToVulkanGLSL(std::string *dest, TranslatedShaderMetadata *destMetada
}
// DUMPLOG(src.c_str());
// INFO_LOG(SYSTEM, "---->");
// INFO_LOG(Log::System, "---->");
// DUMPLOG(LineNumberString(out.str()).c_str());
*dest = out.str();

View File

@ -8,7 +8,7 @@
VulkanBarrierBatch::~VulkanBarrierBatch() {
// _dbg_assert_(imageBarriers_.empty());
if (!imageBarriers_.empty()) {
ERROR_LOG(G3D, "~VulkanBarrierBatch: %d barriers remaining", (int)imageBarriers_.size());
ERROR_LOG(Log::G3D, "~VulkanBarrierBatch: %d barriers remaining", (int)imageBarriers_.size());
}
}

View File

@ -165,9 +165,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
}
instance_extensions_enabled_.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
extensionsLookup_.EXT_debug_utils = true;
INFO_LOG(G3D, "Vulkan debug_utils validation enabled.");
INFO_LOG(Log::G3D, "Vulkan debug_utils validation enabled.");
} else {
ERROR_LOG(G3D, "Validation layer extension not available - not enabling Vulkan validation.");
ERROR_LOG(Log::G3D, "Validation layer extension not available - not enabling Vulkan validation.");
flags_ &= ~VULKAN_FLAG_VALIDATE;
}
}
@ -192,7 +192,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
// Validate that all the instance extensions we ask for are actually available.
for (auto ext : instance_extensions_enabled_) {
if (!IsInstanceExtensionAvailable(ext))
WARN_LOG(G3D, "WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext);
WARN_LOG(Log::G3D, "WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext);
}
VkApplicationInfo app_info{ VK_STRUCTURE_TYPE_APPLICATION_INFO };
@ -222,7 +222,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
#endif
if (res != VK_SUCCESS) {
if (res == VK_ERROR_LAYER_NOT_PRESENT) {
WARN_LOG(G3D, "Validation on but instance layer not available - dropping layers");
WARN_LOG(Log::G3D, "Validation on but instance layer not available - dropping layers");
// Drop the validation layers and try again.
instance_layer_names_.clear();
device_layer_names_.clear();
@ -230,9 +230,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
inst_info.ppEnabledLayerNames = nullptr;
res = vkCreateInstance(&inst_info, nullptr, &instance_);
if (res != VK_SUCCESS)
ERROR_LOG(G3D, "Failed to create instance even without validation: %d", res);
ERROR_LOG(Log::G3D, "Failed to create instance even without validation: %d", res);
} else {
ERROR_LOG(G3D, "Failed to create instance : %d", res);
ERROR_LOG(Log::G3D, "Failed to create instance : %d", res);
}
}
if (res != VK_SUCCESS) {
@ -242,7 +242,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
VulkanLoadInstanceFunctions(instance_, extensionsLookup_, vulkanApiVersion_);
if (!CheckLayers(instance_layer_properties_, instance_layer_names_)) {
WARN_LOG(G3D, "CheckLayers for instance failed");
WARN_LOG(Log::G3D, "CheckLayers for instance failed");
// init_error_ = "Failed to validate instance layers";
// return;
}
@ -254,7 +254,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) {
res = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr);
#endif
if (gpu_count <= 0) {
ERROR_LOG(G3D, "Vulkan driver found but no supported GPU is available");
ERROR_LOG(Log::G3D, "Vulkan driver found but no supported GPU is available");
init_error_ = "No Vulkan physical devices found";
vkDestroyInstance(instance_, nullptr);
instance_ = nullptr;
@ -561,11 +561,11 @@ int VulkanContext::GetBestPhysicalDevice() {
void VulkanContext::ChooseDevice(int physical_device) {
physical_device_ = physical_device;
INFO_LOG(G3D, "Chose physical device %d: %s", physical_device, physicalDeviceProperties_[physical_device].properties.deviceName);
INFO_LOG(Log::G3D, "Chose physical device %d: %s", physical_device, physicalDeviceProperties_[physical_device].properties.deviceName);
GetDeviceLayerProperties();
if (!CheckLayers(device_layer_properties_, device_layer_names_)) {
WARN_LOG(G3D, "CheckLayers for device %d failed", physical_device);
WARN_LOG(Log::G3D, "CheckLayers for device %d failed", physical_device);
}
vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr);
@ -603,12 +603,12 @@ void VulkanContext::ChooseDevice(int physical_device) {
// This is as good a place as any to do this. Though, we don't use this much anymore after we added
// support for VMA.
vkGetPhysicalDeviceMemoryProperties(physical_devices_[physical_device_], &memory_properties_);
INFO_LOG(G3D, "Memory Types (%d):", memory_properties_.memoryTypeCount);
INFO_LOG(Log::G3D, "Memory Types (%d):", memory_properties_.memoryTypeCount);
for (int i = 0; i < (int)memory_properties_.memoryTypeCount; i++) {
// Don't bother printing dummy memory types.
if (!memory_properties_.memoryTypes[i].propertyFlags)
continue;
INFO_LOG(G3D, " %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties_.memoryTypes[i].heapIndex,
INFO_LOG(Log::G3D, " %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties_.memoryTypes[i].heapIndex,
(memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) ? "DEVICE_LOCAL " : "",
(memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) ? "HOST_VISIBLE " : "",
(memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) ? "HOST_CACHED " : "",
@ -671,7 +671,7 @@ bool VulkanContext::EnableInstanceExtension(const char *extension, uint32_t core
VkResult VulkanContext::CreateDevice() {
if (!init_error_.empty() || physical_device_ < 0) {
ERROR_LOG(G3D, "Vulkan init failed: %s", init_error_.c_str());
ERROR_LOG(Log::G3D, "Vulkan init failed: %s", init_error_.c_str());
return VK_ERROR_INITIALIZATION_FAILED;
}
@ -772,11 +772,11 @@ VkResult VulkanContext::CreateDevice() {
VkResult res = vkCreateDevice(physical_devices_[physical_device_], &device_info, nullptr, &device_);
if (res != VK_SUCCESS) {
init_error_ = "Unable to create Vulkan device";
ERROR_LOG(G3D, "Unable to create Vulkan device");
ERROR_LOG(Log::G3D, "Unable to create Vulkan device");
} else {
VulkanLoadDeviceFunctions(device_, extensionsLookup_, vulkanApiVersion_);
}
INFO_LOG(G3D, "Vulkan Device created: %s", physicalDeviceProperties_[physical_device_].properties.deviceName);
INFO_LOG(Log::G3D, "Vulkan Device created: %s", physicalDeviceProperties_[physical_device_].properties.deviceName);
// Since we successfully created a device (however we got here, might be interesting in debug), we force the choice to be visible in the menu.
VulkanSetAvailable(true);
@ -847,10 +847,10 @@ VkResult VulkanContext::InitDebugUtilsCallback() {
VkDebugUtilsMessengerEXT messenger;
VkResult res = vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT");
ERROR_LOG(Log::G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT");
// Do error handling for VK_ERROR_OUT_OF_MEMORY
} else {
INFO_LOG(G3D, "Debug callback registered with vkCreateDebugUtilsMessengerEXT.");
INFO_LOG(Log::G3D, "Debug callback registered with vkCreateDebugUtilsMessengerEXT.");
utils_callbacks.push_back(messenger);
}
return res;
@ -859,23 +859,23 @@ VkResult VulkanContext::InitDebugUtilsCallback() {
bool VulkanContext::CreateInstanceAndDevice(const CreateInfo &info) {
VkResult res = CreateInstance(info);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "Failed to create vulkan context: %s", InitError().c_str());
ERROR_LOG(Log::G3D, "Failed to create vulkan context: %s", InitError().c_str());
VulkanSetAvailable(false);
return false;
}
int physicalDevice = GetBestPhysicalDevice();
if (physicalDevice < 0) {
ERROR_LOG(G3D, "No usable Vulkan device found.");
ERROR_LOG(Log::G3D, "No usable Vulkan device found.");
DestroyInstance();
return false;
}
ChooseDevice(physicalDevice);
INFO_LOG(G3D, "Creating Vulkan device (flags: %08x)", info.flags);
INFO_LOG(Log::G3D, "Creating Vulkan device (flags: %08x)", info.flags);
if (CreateDevice() != VK_SUCCESS) {
INFO_LOG(G3D, "Failed to create vulkan device: %s", InitError().c_str());
INFO_LOG(Log::G3D, "Failed to create vulkan device: %s", InitError().c_str());
DestroyInstance();
return false;
}
@ -900,12 +900,12 @@ VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data
VkResult VulkanContext::ReinitSurface() {
if (surface_ != VK_NULL_HANDLE) {
INFO_LOG(G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height);
INFO_LOG(Log::G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height);
vkDestroySurfaceKHR(instance_, surface_, nullptr);
surface_ = VK_NULL_HANDLE;
}
INFO_LOG(G3D, "Creating Vulkan surface for window (data1=%p data2=%p)", winsysData1_, winsysData2_);
INFO_LOG(Log::G3D, "Creating Vulkan surface for window (data1=%p data2=%p)", winsysData1_, winsysData2_);
VkResult retval = VK_SUCCESS;
@ -1225,7 +1225,7 @@ bool VulkanContext::ChooseQueue() {
// Generate error if could not find both a graphics and a present queue
if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX) {
ERROR_LOG(G3D, "Could not find a graphics and a present queue");
ERROR_LOG(Log::G3D, "Could not find a graphics and a present queue");
return false;
}
@ -1249,7 +1249,7 @@ bool VulkanContext::ChooseQueue() {
// the surface has no preferred format. Otherwise, at least one
// supported format will be returned.
if (formatCount == 0 || (formatCount == 1 && surfFormats_[0].format == VK_FORMAT_UNDEFINED)) {
INFO_LOG(G3D, "swapchain_format: Falling back to B8G8R8A8_UNORM");
INFO_LOG(Log::G3D, "swapchain_format: Falling back to B8G8R8A8_UNORM");
swapchainFormat_ = VK_FORMAT_B8G8R8A8_UNORM;
} else {
swapchainFormat_ = VK_FORMAT_UNDEFINED;
@ -1266,7 +1266,7 @@ bool VulkanContext::ChooseQueue() {
// Okay, take the first one then.
swapchainFormat_ = surfFormats_[0].format;
}
INFO_LOG(G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount);
INFO_LOG(Log::G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount);
}
vkGetDeviceQueue(device_, graphics_queue_family_index_, 0, &gfx_queue_);
@ -1298,14 +1298,14 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans
bool VulkanContext::InitSwapchain() {
_assert_(physical_device_ >= 0 && physical_device_ < physical_devices_.size());
if (!surface_) {
ERROR_LOG(G3D, "VK: No surface, can't create swapchain");
ERROR_LOG(Log::G3D, "VK: No surface, can't create swapchain");
return false;
}
VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_);
if (res == VK_ERROR_SURFACE_LOST_KHR) {
// Not much to do.
ERROR_LOG(G3D, "VK: Surface lost in InitSwapchain");
ERROR_LOG(Log::G3D, "VK: Surface lost in InitSwapchain");
return false;
}
_dbg_assert_(res == VK_SUCCESS);
@ -1334,7 +1334,7 @@ bool VulkanContext::InitSwapchain() {
swapChainExtent_.width = clamp(currentExtent.width, surfCapabilities_.minImageExtent.width, surfCapabilities_.maxImageExtent.width);
swapChainExtent_.height = clamp(currentExtent.height, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.height);
INFO_LOG(G3D, "surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d",
INFO_LOG(Log::G3D, "surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d",
currentExtent.width, currentExtent.height,
surfCapabilities_.minImageExtent.width, surfCapabilities_.minImageExtent.height,
surfCapabilities_.maxImageExtent.width, surfCapabilities_.maxImageExtent.height,
@ -1353,7 +1353,7 @@ bool VulkanContext::InitSwapchain() {
availablePresentModes_.push_back(presentModes[i]);
}
INFO_LOG(G3D, "Supported present modes: %s", modes.c_str());
INFO_LOG(Log::G3D, "Supported present modes: %s", modes.c_str());
for (size_t i = 0; i < presentModeCount; i++) {
bool match = false;
match = match || ((flags_ & VULKAN_FLAG_PRESENT_MAILBOX) && presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR);
@ -1381,7 +1381,7 @@ bool VulkanContext::InitSwapchain() {
desiredNumberOfSwapChainImages = surfCapabilities_.maxImageCount;
}
INFO_LOG(G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d",
INFO_LOG(Log::G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d",
swapchainPresentMode, VulkanPresentModeToString(swapchainPresentMode),
desiredNumberOfSwapChainImages, surfCapabilities_.maxImageCount);
@ -1428,13 +1428,13 @@ bool VulkanContext::InitSwapchain() {
}
std::string preTransformStr = surface_transforms_to_string(preTransform);
INFO_LOG(G3D, "Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str());
INFO_LOG(Log::G3D, "Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str());
if (physicalDeviceProperties_[physical_device_].properties.vendorID == VULKAN_VENDOR_IMGTEC) {
u32 driverVersion = physicalDeviceProperties_[physical_device_].properties.driverVersion;
// Cutoff the hack at driver version 1.386.1368 (0x00582558, see issue #15773).
if (driverVersion < 0x00582558) {
INFO_LOG(G3D, "Applying PowerVR hack (rounding off the width!) driverVersion=%08x", driverVersion);
INFO_LOG(Log::G3D, "Applying PowerVR hack (rounding off the width!) driverVersion=%08x", driverVersion);
// Swap chain width hack to avoid issue #11743 (PowerVR driver bug).
// To keep the size consistent even with pretransform, do this after the swap. Should be fine.
// This is fixed in newer PowerVR drivers but I don't know the cutoff.
@ -1444,7 +1444,7 @@ bool VulkanContext::InitSwapchain() {
// This will get a bit messy. Ideally we should remove that logic from app-android.cpp
// and move it here, but the OpenGL code still needs it.
} else {
INFO_LOG(G3D, "PowerVR driver version new enough (%08x), not applying swapchain width hack", driverVersion);
INFO_LOG(Log::G3D, "PowerVR driver version new enough (%08x), not applying swapchain width hack", driverVersion);
}
}
@ -1488,10 +1488,10 @@ bool VulkanContext::InitSwapchain() {
res = vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "vkCreateSwapchainKHR failed!");
ERROR_LOG(Log::G3D, "vkCreateSwapchainKHR failed!");
return false;
}
INFO_LOG(G3D, "Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height);
INFO_LOG(Log::G3D, "Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height);
return true;
}
@ -1516,17 +1516,17 @@ void VulkanContext::PerformPendingDeletes() {
void VulkanContext::DestroyDevice() {
if (swapchain_) {
ERROR_LOG(G3D, "DestroyDevice: Swapchain should have been destroyed.");
ERROR_LOG(Log::G3D, "DestroyDevice: Swapchain should have been destroyed.");
}
if (surface_) {
ERROR_LOG(G3D, "DestroyDevice: Surface should have been destroyed.");
ERROR_LOG(Log::G3D, "DestroyDevice: Surface should have been destroyed.");
}
for (int i = 0; i < ARRAY_SIZE(frame_); i++) {
frame_[i].profiler.Shutdown();
}
INFO_LOG(G3D, "VulkanContext::DestroyDevice (performing deletes)");
INFO_LOG(Log::G3D, "VulkanContext::DestroyDevice (performing deletes)");
PerformPendingDeletes();
vmaDestroyAllocator(allocator_);

View File

@ -121,7 +121,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
count = g_errorCount[messageCode]++;
}
if (count == MAX_SAME_ERROR_COUNT) {
WARN_LOG(G3D, "Too many validation messages with message %d, stopping", messageCode);
WARN_LOG(Log::G3D, "Too many validation messages with message %d, stopping", messageCode);
}
if (count >= MAX_SAME_ERROR_COUNT) {
return false;
@ -166,9 +166,9 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
#endif
if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) {
ERROR_LOG(G3D, "VKDEBUG: %s", msg.c_str());
ERROR_LOG(Log::G3D, "VKDEBUG: %s", msg.c_str());
} else {
WARN_LOG(G3D, "VKDEBUG: %s", msg.c_str());
WARN_LOG(Log::G3D, "VKDEBUG: %s", msg.c_str());
}
// false indicates that layer should not bail-out of an

View File

@ -56,7 +56,7 @@ bool VulkanDescSetPool::Allocate(VkDescriptorSet *descriptorSets, int count, con
VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, descriptorSets);
if (result == VK_ERROR_FRAGMENTED_POOL || result < 0) {
WARN_LOG(G3D, "Pool %s %s - recreating", tag_, result == VK_ERROR_FRAGMENTED_POOL ? "fragmented" : "full");
WARN_LOG(Log::G3D, "Pool %s %s - recreating", tag_, result == VK_ERROR_FRAGMENTED_POOL ? "fragmented" : "full");
// There seems to have been a spec revision. Here we should apparently recreate the descriptor pool,
// so let's do that. See https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkAllocateDescriptorSets.html
// Fragmentation shouldn't really happen though since we wipe the pool every frame.
@ -113,7 +113,7 @@ VkResult VulkanDescSetPool::Recreate(bool grow) {
// Delete the pool if it already exists.
if (descPool_ != VK_NULL_HANDLE) {
INFO_LOG(G3D, "Reallocating %s desc pool from %d to %d", tag_, prevSize, info_.maxSets);
INFO_LOG(Log::G3D, "Reallocating %s desc pool from %d to %d", tag_, prevSize, info_.maxSets);
vulkan_->Delete().QueueDeleteDescriptorPool(descPool_);
usage_ = 0;
}

View File

@ -5,7 +5,7 @@
#include "Common/StringUtils.h"
#if 0 // def _DEBUG
#define VLOG(...) NOTICE_LOG(G3D, __VA_ARGS__)
#define VLOG(...) NOTICE_LOG(Log::G3D, __VA_ARGS__)
#else
#define VLOG(...)
#endif
@ -90,17 +90,17 @@ void FrameData::AcquireNextImage(VulkanContext *vulkan) {
case VK_SUBOPTIMAL_KHR:
hasAcquired = true;
// Hopefully the resize will happen shortly. Ignore - one frame might look bad or something.
WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring");
WARN_LOG(Log::G3D, "VK_SUBOPTIMAL_KHR returned - ignoring");
break;
case VK_ERROR_OUT_OF_DATE_KHR:
case VK_TIMEOUT:
case VK_NOT_READY:
// We do not set hasAcquired here!
WARN_LOG(G3D, "%s returned from AcquireNextImage - processing the frame, but not presenting", VulkanResultToString(res));
WARN_LOG(Log::G3D, "%s returned from AcquireNextImage - processing the frame, but not presenting", VulkanResultToString(res));
skipSwap = true;
break;
case VK_ERROR_SURFACE_LOST_KHR:
ERROR_LOG(G3D, "%s returned from AcquireNextImage - ignoring, but this better be during shutdown", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "%s returned from AcquireNextImage - ignoring, but this better be during shutdown", VulkanResultToString(res));
skipSwap = true;
break;
default:

View File

@ -117,7 +117,7 @@ VkFramebuffer VKRFramebuffer::Get(VKRRenderPass *compatibleRenderPass, RenderPas
views[attachmentCount++] = color.rtView; // 2D array texture if multilayered.
if (hasDepth) {
if (!depth.rtView) {
WARN_LOG(G3D, "depth render type to non-depth fb: %p %p fmt=%d (%s %dx%d)", (void *)depth.image, (void *)depth.texAllLayersView, depth.format, tag_.c_str(), width, height);
WARN_LOG(Log::G3D, "depth render type to non-depth fb: %p %p fmt=%d (%s %dx%d)", (void *)depth.image, (void *)depth.texAllLayersView, depth.format, tag_.c_str(), width, height);
// Will probably crash, depending on driver.
}
views[attachmentCount++] = depth.rtView;

View File

@ -40,12 +40,12 @@ static bool IsDepthStencilFormat(VkFormat format) {
bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat format, VkImageLayout initialLayout, VkImageUsageFlags usage, VulkanBarrierBatch *barrierBatch, const VkComponentMapping *mapping) {
if (w == 0 || h == 0 || numMips == 0) {
ERROR_LOG(G3D, "Can't create a zero-size VulkanTexture");
ERROR_LOG(Log::G3D, "Can't create a zero-size VulkanTexture");
return false;
}
int maxDim = vulkan_->GetPhysicalDeviceProperties(0).properties.limits.maxImageDimension2D;
if (w > maxDim || h > maxDim) {
ERROR_LOG(G3D, "Can't create a texture this large");
ERROR_LOG(Log::G3D, "Can't create a texture this large");
return false;
}
@ -137,7 +137,7 @@ bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat
res = vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view_);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "vkCreateImageView failed: %s. Destroying image.", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "vkCreateImageView failed: %s. Destroying image.", VulkanResultToString(res));
_assert_msg_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS, "%d", (int)res);
vmaDestroyImage(vulkan_->Allocator(), image_, allocation_);
view_ = VK_NULL_HANDLE;

View File

@ -264,17 +264,17 @@ static VulkanLibraryHandle vulkanLibrary;
bool g_vulkanAvailabilityChecked = false;
bool g_vulkanMayBeAvailable = false;
#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (instance): %s", #x);}
#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(Log::G3D, "Missing (instance): %s", #x);}
#define LOAD_INSTANCE_FUNC_CORE(instance, x, ext_x, min_core) \
x = (PFN_ ## x)vkGetInstanceProcAddr(instance, vulkanApiVersion >= min_core ? #x : #ext_x); \
if (vulkanApiVersion >= min_core && !x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #ext_x); \
if (!x) {INFO_LOG(G3D, "Missing (instance): %s (%s)", #x, #ext_x);}
#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (device): %s", #x);}
if (!x) {INFO_LOG(Log::G3D, "Missing (instance): %s (%s)", #x, #ext_x);}
#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(Log::G3D, "Missing (device): %s", #x);}
#define LOAD_DEVICE_FUNC_CORE(instance, x, ext_x, min_core) \
x = (PFN_ ## x)vkGetDeviceProcAddr(instance, vulkanApiVersion >= min_core ? #x : #ext_x); \
if (vulkanApiVersion >= min_core && !x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #ext_x); \
if (!x) {INFO_LOG(G3D, "Missing (device): %s (%s)", #x, #ext_x);}
#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(G3D,"Missing (global): %s", #x);}
if (!x) {INFO_LOG(Log::G3D, "Missing (device): %s (%s)", #x, #ext_x);}
#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(Log::G3D,"Missing (global): %s", #x);}
#define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x);
@ -337,9 +337,9 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) {
(std::string(driverPath.c_str()) + "/").c_str(), driverLibName.c_str(),
(std::string(fileRedirectDir.c_str()) + "/").c_str(), nullptr);
if (!lib) {
ERROR_LOG(G3D, "Failed to load custom driver with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str());
ERROR_LOG(Log::G3D, "Failed to load custom driver with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str());
} else {
INFO_LOG(G3D, "Vulkan library loaded with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str());
INFO_LOG(Log::G3D, "Vulkan library loaded with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str());
}
}
}
@ -349,7 +349,7 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) {
for (int i = 0; i < ARRAY_SIZE(so_names); i++) {
lib = dlopen(so_names[i], RTLD_NOW | RTLD_LOCAL);
if (lib) {
INFO_LOG(G3D, "Vulkan library loaded ('%s')", so_names[i]);
INFO_LOG(Log::G3D, "Vulkan library loaded ('%s')", so_names[i]);
break;
}
}
@ -375,7 +375,7 @@ static void VulkanFreeLibrary(VulkanLibraryHandle &h) {
#endif
void VulkanSetAvailable(bool available) {
INFO_LOG(G3D, "Setting Vulkan availability to true");
INFO_LOG(Log::G3D, "Setting Vulkan availability to true");
g_vulkanAvailabilityChecked = true;
g_vulkanMayBeAvailable = available;
}
@ -399,18 +399,18 @@ bool VulkanMayBeAvailable() {
std::string name = System_GetProperty(SYSPROP_NAME);
for (const char *blacklisted_name : device_name_blacklist) {
if (!strcmp(name.c_str(), blacklisted_name)) {
INFO_LOG(G3D, "VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str());
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str());
g_vulkanAvailabilityChecked = true;
g_vulkanMayBeAvailable = false;
return false;
}
}
INFO_LOG(G3D, "VulkanMayBeAvailable: Device allowed ('%s')", name.c_str());
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Device allowed ('%s')", name.c_str());
std::string errorStr;
VulkanLibraryHandle lib = VulkanLoadLibrary(&errorStr);
if (!lib) {
INFO_LOG(G3D, "Vulkan loader: Library not available: %s", errorStr.c_str());
INFO_LOG(Log::G3D, "Vulkan loader: Library not available: %s", errorStr.c_str());
g_vulkanAvailabilityChecked = true;
g_vulkanMayBeAvailable = false;
return false;
@ -450,32 +450,32 @@ bool VulkanMayBeAvailable() {
#endif
if (!localEnumerateInstanceExtensionProperties || !localCreateInstance || !localEnumerate || !localDestroyInstance || !localGetPhysicalDeviceProperties) {
WARN_LOG(G3D, "VulkanMayBeAvailable: Function pointer missing, bailing");
WARN_LOG(Log::G3D, "VulkanMayBeAvailable: Function pointer missing, bailing");
goto bail;
}
INFO_LOG(G3D, "VulkanMayBeAvailable: Enumerating instance extensions");
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Enumerating instance extensions");
res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, nullptr);
// Maximum paranoia.
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res));
goto bail;
}
if (instanceExtCount == 0) {
ERROR_LOG(G3D, "No VK instance extensions - won't be able to present.");
ERROR_LOG(Log::G3D, "No VK instance extensions - won't be able to present.");
goto bail;
}
INFO_LOG(G3D, "VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount);
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount);
instanceExts.resize(instanceExtCount);
res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, instanceExts.data());
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res));
goto bail;
}
for (const auto &iter : instanceExts) {
INFO_LOG(G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion);
INFO_LOG(Log::G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion);
if (platformSurfaceExtension && !strcmp(iter.extensionName, platformSurfaceExtension)) {
INFO_LOG(G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension);
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension);
instanceExtensions[ci.enabledExtensionCount++] = platformSurfaceExtension;
platformSurfaceExtensionFound = true;
break;
@ -486,19 +486,19 @@ bool VulkanMayBeAvailable() {
}
if (platformSurfaceExtension) {
if (!platformSurfaceExtensionFound || !surfaceExtensionFound) {
ERROR_LOG(G3D, "Platform surface extension not found");
ERROR_LOG(Log::G3D, "Platform surface extension not found");
goto bail;
}
} else {
if (!surfaceExtensionFound) {
ERROR_LOG(G3D, "Surface extension not found");
ERROR_LOG(Log::G3D, "Surface extension not found");
goto bail;
}
}
// This can't happen unless the driver is double-reporting a surface extension.
if (ci.enabledExtensionCount > 2) {
ERROR_LOG(G3D, "Unexpected number of enabled instance extensions");
ERROR_LOG(Log::G3D, "Unexpected number of enabled instance extensions");
goto bail;
}
@ -511,27 +511,27 @@ bool VulkanMayBeAvailable() {
info.pEngineName = "VulkanCheckerEngine";
ci.pApplicationInfo = &info;
ci.flags = 0;
INFO_LOG(G3D, "VulkanMayBeAvailable: Calling vkCreateInstance");
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Calling vkCreateInstance");
res = localCreateInstance(&ci, nullptr, &instance);
if (res != VK_SUCCESS) {
instance = nullptr;
ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res));
goto bail;
}
INFO_LOG(G3D, "VulkanMayBeAvailable: Vulkan test instance created successfully.");
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Vulkan test instance created successfully.");
res = localEnumerate(instance, &physicalDeviceCount, nullptr);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res));
goto bail;
}
if (physicalDeviceCount == 0) {
ERROR_LOG(G3D, "VulkanMayBeAvailable: No physical Vulkan devices (count = 0).");
ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: No physical Vulkan devices (count = 0).");
goto bail;
}
devices.resize(physicalDeviceCount);
res = localEnumerate(instance, &physicalDeviceCount, devices.data());
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res));
ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res));
goto bail;
}
anyGood = false;
@ -543,34 +543,34 @@ bool VulkanMayBeAvailable() {
case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
anyGood = true;
INFO_LOG(G3D, "VulkanMayBeAvailable: Eligible device found: '%s'", props.deviceName);
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Eligible device found: '%s'", props.deviceName);
break;
default:
INFO_LOG(G3D, "VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName);
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName);
break;
}
// TODO: Should also check queuefamilyproperties for a GRAPHICS queue family? Oh well.
}
if (!anyGood) {
WARN_LOG(G3D, "VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!");
WARN_LOG(Log::G3D, "VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!");
g_vulkanMayBeAvailable = false;
} else {
INFO_LOG(G3D, "VulkanMayBeAvailable: Found working Vulkan API!");
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Found working Vulkan API!");
g_vulkanMayBeAvailable = true;
}
bail:
g_vulkanAvailabilityChecked = true;
if (instance) {
INFO_LOG(G3D, "VulkanMayBeAvailable: Destroying instance");
INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Destroying instance");
localDestroyInstance(instance, nullptr);
}
if (lib) {
VulkanFreeLibrary(lib);
}
if (!g_vulkanMayBeAvailable) {
WARN_LOG(G3D, "Vulkan with working device not detected.");
WARN_LOG(Log::G3D, "Vulkan with working device not detected.");
}
return g_vulkanMayBeAvailable;
#endif
@ -578,7 +578,7 @@ bail:
bool VulkanLoad(std::string *errorStr) {
#if PPSSPP_PLATFORM(IOS_APP_STORE)
INFO_LOG(G3D, "iOS: Vulkan doesn't need loading");
INFO_LOG(Log::G3D, "iOS: Vulkan doesn't need loading");
return true;
#else
@ -598,12 +598,12 @@ bool VulkanLoad(std::string *errorStr) {
LOAD_GLOBAL_FUNC(vkEnumerateInstanceLayerProperties);
if (vkCreateInstance && vkGetInstanceProcAddr && vkGetDeviceProcAddr && vkEnumerateInstanceExtensionProperties && vkEnumerateInstanceLayerProperties) {
INFO_LOG(G3D, "VulkanLoad: Base functions loaded.");
INFO_LOG(Log::G3D, "VulkanLoad: Base functions loaded.");
// NOTE: It's ok if vkEnumerateInstanceVersion is missing.
return true;
} else {
*errorStr = "Failed to load Vulkan base functions";
ERROR_LOG(G3D, "VulkanLoad: %s", errorStr->c_str());
ERROR_LOG(Log::G3D, "VulkanLoad: %s", errorStr->c_str());
VulkanFreeLibrary(vulkanLibrary);
return false;
}
@ -678,7 +678,7 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en
LOAD_INSTANCE_FUNC(instance, vkSetDebugUtilsObjectTagEXT);
}
INFO_LOG(G3D, "Vulkan instance functions loaded.");
INFO_LOG(Log::G3D, "Vulkan instance functions loaded.");
#endif
}
@ -687,7 +687,7 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en
// good for multi-device - not likely we'll ever try that anyway though.
void VulkanLoadDeviceFunctions(VkDevice device, const VulkanExtensions &enabledExtensions, uint32_t vulkanApiVersion) {
#if !PPSSPP_PLATFORM(IOS_APP_STORE)
INFO_LOG(G3D, "Vulkan device functions loaded.");
INFO_LOG(Log::G3D, "Vulkan device functions loaded.");
LOAD_DEVICE_FUNC(device, vkQueueSubmit);
LOAD_DEVICE_FUNC(device, vkQueueWaitIdle);

View File

@ -121,7 +121,7 @@ void VulkanPushPool::BeginFrame() {
size_t size = blocks_.back().size;
blocks_.back().Destroy(vulkan_);
blocks_.pop_back();
DEBUG_LOG(G3D, "%s: Garbage collected block of size %s in %0.2f ms", name_, NiceSizeFormat(size).c_str(), time_now_d() - start);
DEBUG_LOG(Log::G3D, "%s: Garbage collected block of size %s in %0.2f ms", name_, NiceSizeFormat(size).c_str(), time_now_d() - start);
}
}
@ -153,7 +153,7 @@ void VulkanPushPool::NextBlock(VkDeviceSize allocationSize) {
blocks_.back().used = allocationSize;
blocks_.back().lastUsed = time_now_d();
// curBlockIndex_ is already set correctly here.
DEBUG_LOG(G3D, "%s: Created new block of size %s in %0.2f ms", name_, NiceSizeFormat(newBlockSize).c_str(), 1000.0 * (time_now_d() - start));
DEBUG_LOG(Log::G3D, "%s: Created new block of size %s in %0.2f ms", name_, NiceSizeFormat(newBlockSize).c_str(), 1000.0 * (time_now_d() - start));
}
size_t VulkanPushPool::GetUsedThisFrame() const {

View File

@ -50,13 +50,13 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm
static const char * const indent[4] = { "", " ", " ", " " };
if (!scopes_.empty()) {
INFO_LOG(G3D, "Profiling events this frame:");
INFO_LOG(Log::G3D, "Profiling events this frame:");
}
// Log it all out.
for (auto &scope : scopes_) {
if (scope.endQueryId == -1) {
WARN_LOG(G3D, "Unclosed scope: %s", scope.name);
WARN_LOG(Log::G3D, "Unclosed scope: %s", scope.name);
continue;
}
uint64_t startTime = results[scope.startQueryId];
@ -66,7 +66,7 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm
double milliseconds = (double)delta * timestampConversionFactor;
INFO_LOG(G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name, milliseconds);
INFO_LOG(Log::G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name, milliseconds);
}
scopes_.clear();

View File

@ -44,7 +44,7 @@ RenderPassType MergeRPTypes(RenderPassType a, RenderPassType b) {
}
void VulkanQueueRunner::CreateDeviceObjects() {
INFO_LOG(G3D, "VulkanQueueRunner::CreateDeviceObjects");
INFO_LOG(Log::G3D, "VulkanQueueRunner::CreateDeviceObjects");
RPKey key{
VKRRenderPassLoadAction::CLEAR, VKRRenderPassLoadAction::CLEAR, VKRRenderPassLoadAction::CLEAR,
@ -56,19 +56,19 @@ void VulkanQueueRunner::CreateDeviceObjects() {
// Just to check whether it makes sense to split some of these. drawidx is way bigger than the others...
// We should probably just move to variable-size data in a raw buffer anyway...
VkRenderData rd;
INFO_LOG(G3D, "sizeof(pipeline): %d", (int)sizeof(rd.pipeline));
INFO_LOG(G3D, "sizeof(draw): %d", (int)sizeof(rd.draw));
INFO_LOG(G3D, "sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed));
INFO_LOG(G3D, "sizeof(clear): %d", (int)sizeof(rd.clear));
INFO_LOG(G3D, "sizeof(viewport): %d", (int)sizeof(rd.viewport));
INFO_LOG(G3D, "sizeof(scissor): %d", (int)sizeof(rd.scissor));
INFO_LOG(G3D, "sizeof(blendColor): %d", (int)sizeof(rd.blendColor));
INFO_LOG(G3D, "sizeof(push): %d", (int)sizeof(rd.push));
INFO_LOG(Log::G3D, "sizeof(pipeline): %d", (int)sizeof(rd.pipeline));
INFO_LOG(Log::G3D, "sizeof(draw): %d", (int)sizeof(rd.draw));
INFO_LOG(Log::G3D, "sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed));
INFO_LOG(Log::G3D, "sizeof(clear): %d", (int)sizeof(rd.clear));
INFO_LOG(Log::G3D, "sizeof(viewport): %d", (int)sizeof(rd.viewport));
INFO_LOG(Log::G3D, "sizeof(scissor): %d", (int)sizeof(rd.scissor));
INFO_LOG(Log::G3D, "sizeof(blendColor): %d", (int)sizeof(rd.blendColor));
INFO_LOG(Log::G3D, "sizeof(push): %d", (int)sizeof(rd.push));
#endif
}
void VulkanQueueRunner::DestroyDeviceObjects() {
INFO_LOG(G3D, "VulkanQueueRunner::DestroyDeviceObjects");
INFO_LOG(Log::G3D, "VulkanQueueRunner::DestroyDeviceObjects");
syncReadback_.Destroy(vulkan_);
@ -87,7 +87,7 @@ bool VulkanQueueRunner::CreateSwapchain(VkCommandBuffer cmdInit, VulkanBarrierBa
VkImage *swapchainImages = new VkImage[swapchainImageCount_];
res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "vkGetSwapchainImagesKHR failed");
ERROR_LOG(Log::G3D, "vkGetSwapchainImagesKHR failed");
delete[] swapchainImages;
return false;
}
@ -245,7 +245,7 @@ void VulkanQueueRunner::DestroyBackBuffers() {
}
framebuffers_.clear();
INFO_LOG(G3D, "Backbuffers destroyed");
INFO_LOG(Log::G3D, "Backbuffers destroyed");
}
// Self-dependency: https://github.com/gpuweb/gpuweb/issues/442#issuecomment-547604827
@ -802,7 +802,7 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector<VKRStep *> &steps) {
}
void VulkanQueueRunner::LogSteps(const std::vector<VKRStep *> &steps, bool verbose) {
INFO_LOG(G3D, "=================== FRAME ====================");
INFO_LOG(Log::G3D, "=================== FRAME ====================");
for (size_t i = 0; i < steps.size(); i++) {
const VKRStep &step = *steps[i];
switch (step.stepType) {
@ -822,11 +822,11 @@ void VulkanQueueRunner::LogSteps(const std::vector<VKRStep *> &steps, bool verbo
LogReadbackImage(step);
break;
case VKRStepType::RENDER_SKIP:
INFO_LOG(G3D, "(skipped render pass)");
INFO_LOG(Log::G3D, "(skipped render pass)");
break;
}
}
INFO_LOG(G3D, "------------------- SUBMIT ------------------");
INFO_LOG(Log::G3D, "------------------- SUBMIT ------------------");
}
const char *RenderPassActionName(VKRRenderPassLoadAction a) {
@ -861,47 +861,47 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass, bool verbose) {
int w = r.framebuffer ? r.framebuffer->width : vulkan_->GetBackbufferWidth();
int h = r.framebuffer ? r.framebuffer->height : vulkan_->GetBackbufferHeight();
INFO_LOG(G3D, "RENDER %s Begin(%s, draws: %d, %dx%d, %s, %s, %s)", pass.tag, framebuf, r.numDraws, w, h, RenderPassActionName(r.colorLoad), RenderPassActionName(r.depthLoad), RenderPassActionName(r.stencilLoad));
INFO_LOG(Log::G3D, "RENDER %s Begin(%s, draws: %d, %dx%d, %s, %s, %s)", pass.tag, framebuf, r.numDraws, w, h, RenderPassActionName(r.colorLoad), RenderPassActionName(r.depthLoad), RenderPassActionName(r.stencilLoad));
// TODO: Log these in detail.
for (int i = 0; i < (int)pass.preTransitions.size(); i++) {
INFO_LOG(G3D, " PRETRANSITION: %s %s -> %s", pass.preTransitions[i].fb->Tag(), AspectToString(pass.preTransitions[i].aspect), ImageLayoutToString(pass.preTransitions[i].targetLayout));
INFO_LOG(Log::G3D, " PRETRANSITION: %s %s -> %s", pass.preTransitions[i].fb->Tag(), AspectToString(pass.preTransitions[i].aspect), ImageLayoutToString(pass.preTransitions[i].targetLayout));
}
if (verbose) {
for (auto &cmd : pass.commands) {
switch (cmd.cmd) {
case VKRRenderCommand::REMOVED:
INFO_LOG(G3D, " (Removed)");
INFO_LOG(Log::G3D, " (Removed)");
break;
case VKRRenderCommand::BIND_GRAPHICS_PIPELINE:
INFO_LOG(G3D, " BindGraphicsPipeline(%x)", (int)(intptr_t)cmd.graphics_pipeline.pipeline);
INFO_LOG(Log::G3D, " BindGraphicsPipeline(%x)", (int)(intptr_t)cmd.graphics_pipeline.pipeline);
break;
case VKRRenderCommand::BLEND:
INFO_LOG(G3D, " BlendColor(%08x)", cmd.blendColor.color);
INFO_LOG(Log::G3D, " BlendColor(%08x)", cmd.blendColor.color);
break;
case VKRRenderCommand::CLEAR:
INFO_LOG(G3D, " Clear");
INFO_LOG(Log::G3D, " Clear");
break;
case VKRRenderCommand::DRAW:
INFO_LOG(G3D, " Draw(%d)", cmd.draw.count);
INFO_LOG(Log::G3D, " Draw(%d)", cmd.draw.count);
break;
case VKRRenderCommand::DRAW_INDEXED:
INFO_LOG(G3D, " DrawIndexed(%d)", cmd.drawIndexed.count);
INFO_LOG(Log::G3D, " DrawIndexed(%d)", cmd.drawIndexed.count);
break;
case VKRRenderCommand::SCISSOR:
INFO_LOG(G3D, " Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height);
INFO_LOG(Log::G3D, " Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height);
break;
case VKRRenderCommand::STENCIL:
INFO_LOG(G3D, " Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask);
INFO_LOG(Log::G3D, " Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask);
break;
case VKRRenderCommand::VIEWPORT:
INFO_LOG(G3D, " Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth);
INFO_LOG(Log::G3D, " Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth);
break;
case VKRRenderCommand::PUSH_CONSTANTS:
INFO_LOG(G3D, " PushConstants(%d)", cmd.push.size);
INFO_LOG(Log::G3D, " PushConstants(%d)", cmd.push.size);
break;
case VKRRenderCommand::DEBUG_ANNOTATION:
INFO_LOG(G3D, " DebugAnnotation(%s)", cmd.debugAnnotation.annotation);
INFO_LOG(Log::G3D, " DebugAnnotation(%s)", cmd.debugAnnotation.annotation);
break;
case VKRRenderCommand::NUM_RENDER_COMMANDS:
@ -910,24 +910,24 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass, bool verbose) {
}
}
INFO_LOG(G3D, " Final: %s %s", ImageLayoutToString(pass.render.finalColorLayout), ImageLayoutToString(pass.render.finalDepthStencilLayout));
INFO_LOG(G3D, "RENDER End(%s) - %d commands executed", framebuf, (int)pass.commands.size());
INFO_LOG(Log::G3D, " Final: %s %s", ImageLayoutToString(pass.render.finalColorLayout), ImageLayoutToString(pass.render.finalDepthStencilLayout));
INFO_LOG(Log::G3D, "RENDER End(%s) - %d commands executed", framebuf, (int)pass.commands.size());
}
void VulkanQueueRunner::LogCopy(const VKRStep &step) {
INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str());
INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str());
}
void VulkanQueueRunner::LogBlit(const VKRStep &step) {
INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str());
INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str());
}
void VulkanQueueRunner::LogReadback(const VKRStep &step) {
INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str());
INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str());
}
void VulkanQueueRunner::LogReadbackImage(const VKRStep &step) {
INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str());
INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str());
}
void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer cmd, int curFrame, QueueProfileContext &profile) {
@ -1214,7 +1214,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c
break;
default:
ERROR_LOG(G3D, "Unimpl queue command");
ERROR_LOG(Log::G3D, "Unimpl queue command");
break;
}
}
@ -1777,7 +1777,7 @@ bool VulkanQueueRunner::CopyReadbackBuffer(FrameData &frameData, VKRFramebuffer
VkResult res = vmaMapMemory(vulkan_->Allocator(), readback->allocation, &mappedData);
if (res != VK_SUCCESS) {
ERROR_LOG(G3D, "CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res);
ERROR_LOG(Log::G3D, "CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res);
return false;
}
@ -1805,7 +1805,7 @@ bool VulkanQueueRunner::CopyReadbackBuffer(FrameData &frameData, VKRFramebuffer
ConvertToD16(pixels, (const uint8_t *)mappedData, pixelStride, width, width, height, srcFormat);
} else {
// TODO: Maybe a depth conversion or something?
ERROR_LOG(G3D, "CopyReadbackBuffer: Unknown format");
ERROR_LOG(Log::G3D, "CopyReadbackBuffer: Unknown format");
_assert_msg_(false, "CopyReadbackBuffer: Unknown src format %d", (int)srcFormat);
}

View File

@ -17,7 +17,7 @@
#include "Common/VR/PPSSPPVR.h"
#if 0 // def _DEBUG
#define VLOG(...) NOTICE_LOG(G3D, __VA_ARGS__)
#define VLOG(...) NOTICE_LOG(Log::G3D, __VA_ARGS__)
#else
#define VLOG(...)
#endif
@ -46,7 +46,7 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
// Sanity check.
// Seen in crash reports from PowerVR GE8320, presumably we failed creating some shader modules.
if (!desc->vertexShader || !desc->fragmentShader) {
ERROR_LOG(G3D, "Failed creating graphics pipeline - missing vs/fs shader module pointers!");
ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - missing vs/fs shader module pointers!");
pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE);
return false;
}
@ -57,13 +57,13 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
VkShaderModule gs = desc->geometryShader ? desc->geometryShader->BlockUntilReady() : VK_NULL_HANDLE;
if (!vs || !fs || (!gs && desc->geometryShader)) {
ERROR_LOG(G3D, "Failed creating graphics pipeline - missing shader modules");
ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - missing shader modules");
pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE);
return false;
}
if (!compatibleRenderPass) {
ERROR_LOG(G3D, "Failed creating graphics pipeline - compatible render pass was nullptr");
ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - compatible render pass was nullptr");
pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE);
return false;
}
@ -130,10 +130,10 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
double taken_ms = (now - start) * 1000.0;
if (taken_ms < 0.1) {
DEBUG_LOG(G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling (fast) rpType: %04x sampleBits: %d (%s)",
DEBUG_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling (fast) rpType: %04x sampleBits: %d (%s)",
countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str());
} else {
INFO_LOG(G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling rpType: %04x sampleBits: %d (%s)",
INFO_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling rpType: %04x sampleBits: %d (%s)",
countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str());
}
@ -144,12 +144,12 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR
//
// At least create a null placeholder to avoid creating over and over if something is broken.
pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE);
ERROR_LOG(G3D, "Failed creating graphics pipeline! VK_INCOMPLETE");
ERROR_LOG(Log::G3D, "Failed creating graphics pipeline! VK_INCOMPLETE");
LogCreationFailure();
success = false;
} else if (result != VK_SUCCESS) {
pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE);
ERROR_LOG(G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result));
ERROR_LOG(Log::G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result));
LogCreationFailure();
success = false;
} else {
@ -228,13 +228,13 @@ u32 VKRGraphicsPipeline::GetVariantsBitmask() const {
}
void VKRGraphicsPipeline::LogCreationFailure() const {
ERROR_LOG(G3D, "vs: %s\n[END VS]", desc->vertexShaderSource.c_str());
ERROR_LOG(G3D, "fs: %s\n[END FS]", desc->fragmentShaderSource.c_str());
ERROR_LOG(Log::G3D, "vs: %s\n[END VS]", desc->vertexShaderSource.c_str());
ERROR_LOG(Log::G3D, "fs: %s\n[END FS]", desc->fragmentShaderSource.c_str());
if (desc->geometryShader) {
ERROR_LOG(G3D, "gs: %s\n[END GS]", desc->geometryShaderSource.c_str());
ERROR_LOG(Log::G3D, "gs: %s\n[END GS]", desc->geometryShaderSource.c_str());
}
// TODO: Maybe log various other state?
ERROR_LOG(G3D, "======== END OF PIPELINE ==========");
ERROR_LOG(Log::G3D, "======== END OF PIPELINE ==========");
}
struct SinglePipelineTask {
@ -310,7 +310,7 @@ VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan, bool useThread,
bool VulkanRenderManager::CreateBackbuffers() {
if (!vulkan_->GetSwapchain()) {
ERROR_LOG(G3D, "No swapchain - can't create backbuffers");
ERROR_LOG(Log::G3D, "No swapchain - can't create backbuffers");
return false;
}
@ -328,7 +328,7 @@ bool VulkanRenderManager::CreateBackbuffers() {
}
if (newInflightFrames_ != -1) {
INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_);
INFO_LOG(Log::G3D, "Updating inflight frames to %d", newInflightFrames_);
vulkan_->UpdateInflightFrames(newInflightFrames_);
newInflightFrames_ = -1;
}
@ -356,14 +356,14 @@ void VulkanRenderManager::StartThreads() {
runCompileThread_ = true; // For controlling the compiler thread's exit
if (useRenderThread_) {
INFO_LOG(G3D, "Starting Vulkan submission thread");
INFO_LOG(Log::G3D, "Starting Vulkan submission thread");
renderThread_ = std::thread(&VulkanRenderManager::RenderThreadFunc, this);
}
INFO_LOG(G3D, "Starting Vulkan compiler thread");
INFO_LOG(Log::G3D, "Starting Vulkan compiler thread");
compileThread_ = std::thread(&VulkanRenderManager::CompileThreadFunc, this);
if (measurePresentTime_ && vulkan_->Extensions().KHR_present_wait && vulkan_->GetPresentMode() == VK_PRESENT_MODE_FIFO_KHR) {
INFO_LOG(G3D, "Starting Vulkan present wait thread");
INFO_LOG(Log::G3D, "Starting Vulkan present wait thread");
presentWaitThread_ = std::thread(&VulkanRenderManager::PresentWaitThreadFunc, this);
}
}
@ -385,7 +385,7 @@ void VulkanRenderManager::StopThreads() {
pushCondVar_.notify_one();
// Once the render thread encounters the above exit task, it'll exit.
renderThread_.join();
INFO_LOG(G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
INFO_LOG(Log::G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
}
for (int i = 0; i < vulkan_->GetInflightFrames(); i++) {
@ -406,7 +406,7 @@ void VulkanRenderManager::StopThreads() {
presentWaitThread_.join();
}
INFO_LOG(G3D, "Vulkan compiler thread joined. Now wait for any straggling compile tasks.");
INFO_LOG(Log::G3D, "Vulkan compiler thread joined. Now wait for any straggling compile tasks.");
CreateMultiPipelinesTask::WaitForAll();
{
@ -431,7 +431,7 @@ void VulkanRenderManager::CheckNothingPending() {
}
VulkanRenderManager::~VulkanRenderManager() {
INFO_LOG(G3D, "VulkanRenderManager destructor");
INFO_LOG(Log::G3D, "VulkanRenderManager destructor");
{
std::unique_lock<std::mutex> lock(compileMutex_);
@ -507,7 +507,7 @@ void VulkanRenderManager::CompileThreadFunc() {
auto &shaders = iter.first;
auto &entries = iter.second;
// NOTICE_LOG(G3D, "For this shader pair, we have %d pipelines to create", (int)entries.size());
// NOTICE_LOG(Log::G3D, "For this shader pair, we have %d pipelines to create", (int)entries.size());
Task *task = new CreateMultiPipelinesTask(vulkan_, entries);
g_threadManager.EnqueueTask(task);
@ -582,7 +582,7 @@ void VulkanRenderManager::PresentWaitThreadFunc() {
}
#endif
INFO_LOG(G3D, "Leaving PresentWaitThreadFunc()");
INFO_LOG(Log::G3D, "Leaving PresentWaitThreadFunc()");
}
void VulkanRenderManager::PollPresentTiming() {
@ -768,12 +768,12 @@ void VulkanRenderManager::ReportBadStateForDraw() {
std::string str = VulkanQueueRunner::StepToString(vulkan_, *curRenderStep_);
truncate_cpy(cause2, str.c_str());
}
ERROR_LOG_REPORT_ONCE(baddraw, G3D, "Can't draw: %s%s. Step count: %d", cause1, cause2, (int)steps_.size());
ERROR_LOG_REPORT_ONCE(baddraw, Log::G3D, "Can't draw: %s%s. Step count: %d", cause1, cause2, (int)steps_.size());
}
VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipelineDesc *desc, PipelineFlags pipelineFlags, uint32_t variantBitmask, VkSampleCountFlagBits sampleCount, bool cacheLoad, const char *tag) {
if (!desc->vertexShader || !desc->fragmentShader) {
ERROR_LOG(G3D, "Can't create graphics pipeline with missing vs/ps: %p %p", desc->vertexShader, desc->fragmentShader);
ERROR_LOG(Log::G3D, "Can't create graphics pipeline with missing vs/ps: %p %p", desc->vertexShader, desc->fragmentShader);
return nullptr;
}
@ -785,7 +785,7 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe
pipelinesToCheck_.push_back(pipeline);
} else {
if (!variantBitmask) {
WARN_LOG(G3D, "WARNING: Will not compile any variants of pipeline, not in renderpass and empty variantBitmask");
WARN_LOG(Log::G3D, "WARNING: Will not compile any variants of pipeline, not in renderpass and empty variantBitmask");
}
// Presumably we're in initialization, loading the shader cache.
// Look at variantBitmask to see what variants we should queue up.
@ -803,12 +803,12 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe
// Sanity check - don't compile incompatible types (could be caused by corrupt caches, changes in data structures, etc).
if ((pipelineFlags & PipelineFlags::USES_DEPTH_STENCIL) && !RenderPassTypeHasDepth(rpType)) {
WARN_LOG(G3D, "Not compiling pipeline that requires depth, for non depth renderpass type");
WARN_LOG(Log::G3D, "Not compiling pipeline that requires depth, for non depth renderpass type");
continue;
}
// Shouldn't hit this, these should have been filtered elsewhere. However, still a good check to do.
if (sampleCount == VK_SAMPLE_COUNT_1_BIT && RenderPassTypeHasMultisample(rpType)) {
WARN_LOG(G3D, "Not compiling single sample pipeline for a multisampled render pass type");
WARN_LOG(Log::G3D, "Not compiling single sample pipeline for a multisampled render pass type");
continue;
}
@ -841,7 +841,7 @@ void VulkanRenderManager::EndCurRenderStep() {
RenderPassType rpType = depthStencil ? RenderPassType::HAS_DEPTH : RenderPassType::DEFAULT;
if (curRenderStep_->render.framebuffer && (rpType & RenderPassType::HAS_DEPTH) && !curRenderStep_->render.framebuffer->HasDepth()) {
WARN_LOG(G3D, "Trying to render with a depth-writing pipeline to a framebuffer without depth: %s", curRenderStep_->render.framebuffer->Tag());
WARN_LOG(Log::G3D, "Trying to render with a depth-writing pipeline to a framebuffer without depth: %s", curRenderStep_->render.framebuffer->Tag());
rpType = RenderPassType::DEFAULT;
}
@ -1089,7 +1089,7 @@ bool VulkanRenderManager::CopyFramebufferToMemory(VKRFramebuffer *src, VkImageAs
} else {
// Backbuffer.
if (!(vulkan_->GetSurfaceCapabilities().supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)) {
ERROR_LOG(G3D, "Copying from backbuffer not supported, can't take screenshots");
ERROR_LOG(Log::G3D, "Copying from backbuffer not supported, can't take screenshots");
return false;
}
switch (vulkan_->GetSwapchainFormat()) {
@ -1097,7 +1097,7 @@ bool VulkanRenderManager::CopyFramebufferToMemory(VKRFramebuffer *src, VkImageAs
case VK_FORMAT_R8G8B8A8_UNORM: srcFormat = Draw::DataFormat::R8G8B8A8_UNORM; break;
// NOTE: If you add supported formats here, make sure to also support them in VulkanQueueRunner::CopyReadbackBuffer.
default:
ERROR_LOG(G3D, "Unsupported backbuffer format for screenshots");
ERROR_LOG(Log::G3D, "Unsupported backbuffer format for screenshots");
return false;
}
}
@ -1216,7 +1216,7 @@ void VulkanRenderManager::Clear(uint32_t clearColor, float clearZ, int clearSten
if (clearMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
if (curRenderStep_->render.framebuffer && !curRenderStep_->render.framebuffer->HasDepth()) {
WARN_LOG(G3D, "Trying to clear depth/stencil on a non-depth framebuffer: %s", curRenderStep_->render.framebuffer->Tag());
WARN_LOG(Log::G3D, "Trying to clear depth/stencil on a non-depth framebuffer: %s", curRenderStep_->render.framebuffer->Tag());
} else {
curPipelineFlags_ |= PipelineFlags::USES_DEPTH_STENCIL;
}

View File

@ -221,7 +221,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
std::vector<uint32_t> spirv;
std::string errorMessage;
if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) {
WARN_LOG(G3D, "Shader compile to module failed (%s): %s", tag_.c_str(), errorMessage.c_str());
WARN_LOG(Log::G3D, "Shader compile to module failed (%s): %s", tag_.c_str(), errorMessage.c_str());
return false;
}
@ -239,7 +239,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con
module_ = Promise<VkShaderModule>::AlreadyDone(shaderModule);
ok_ = true;
} else {
WARN_LOG(G3D, "vkCreateShaderModule failed (%s)", tag_.c_str());
WARN_LOG(Log::G3D, "vkCreateShaderModule failed (%s)", tag_.c_str());
ok_ = false;
}
return ok_;
@ -781,7 +781,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanBarrierBatch *postBarriers, Vu
// Zero-sized textures not allowed.
_assert_(desc.width * desc.height * desc.depth > 0); // remember to set depth to 1!
if (desc.width * desc.height * desc.depth <= 0) {
ERROR_LOG(G3D, "Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth);
ERROR_LOG(Log::G3D, "Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth);
return false;
}
_dbg_assert_(pushBuffer);
@ -802,7 +802,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanBarrierBatch *postBarriers, Vu
VulkanBarrierBatch barrier;
if (!vkTex_->CreateDirect(width_, height_, 1, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits, &barrier, desc.swizzle == TextureSwizzle::R8_AS_ALPHA ? r8AsAlpha : nullptr)) {
ERROR_LOG(G3D, "Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_);
ERROR_LOG(Log::G3D, "Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_);
return false;
}
barrier.Flush(cmd);
@ -940,7 +940,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
case VULKAN_VENDOR_APPLE: caps_.vendor = GPUVendor::VENDOR_APPLE; break;
case VULKAN_VENDOR_MESA: caps_.vendor = GPUVendor::VENDOR_MESA; break;
default:
WARN_LOG(G3D, "Unknown vendor ID %08x", deviceProps.vendorID);
WARN_LOG(Log::G3D, "Unknown vendor ID %08x", deviceProps.vendorID);
caps_.vendor = GPUVendor::VENDOR_UNKNOWN;
break;
}
@ -1051,7 +1051,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
}
if (!vulkan->Extensions().KHR_depth_stencil_resolve) {
INFO_LOG(G3D, "KHR_depth_stencil_resolve not supported, disabling multisampling");
INFO_LOG(Log::G3D, "KHR_depth_stencil_resolve not supported, disabling multisampling");
}
// We limit multisampling functionality to reasonably recent and known-good tiling GPUs.
@ -1062,9 +1062,9 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
const auto &resolveProperties = vulkan->GetPhysicalDeviceProperties().depthStencilResolve;
if (((resolveProperties.supportedDepthResolveModes & resolveProperties.supportedStencilResolveModes) & VK_RESOLVE_MODE_SAMPLE_ZERO_BIT) != 0) {
caps_.multiSampleLevelsMask = (limits.framebufferColorSampleCounts & limits.framebufferDepthSampleCounts & limits.framebufferStencilSampleCounts);
INFO_LOG(G3D, "Multisample levels mask: %d", caps_.multiSampleLevelsMask);
INFO_LOG(Log::G3D, "Multisample levels mask: %d", caps_.multiSampleLevelsMask);
} else {
INFO_LOG(G3D, "Not enough depth/stencil resolve modes supported, disabling multisampling.");
INFO_LOG(Log::G3D, "Not enough depth/stencil resolve modes supported, disabling multisampling.");
caps_.multiSampleLevelsMask = 1;
}
} else {
@ -1196,7 +1196,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char
} else if (vkshader->GetStage() == ShaderStage::Fragment) {
gDesc.fragmentShader = vkshader->Get();
} else {
ERROR_LOG(G3D, "Bad stage");
ERROR_LOG(Log::G3D, "Bad stage");
delete pipeline;
return nullptr;
}
@ -1309,14 +1309,14 @@ Texture *VKContext::CreateTexture(const TextureDesc &desc) {
VkCommandBuffer initCmd = renderManager_.GetInitCmd();
if (!push_ || !initCmd) {
// Too early! Fail.
ERROR_LOG(G3D, "Can't create textures before the first frame has started.");
ERROR_LOG(Log::G3D, "Can't create textures before the first frame has started.");
return nullptr;
}
VKTexture *tex = new VKTexture(vulkan_, initCmd, push_, desc);
if (tex->Create(initCmd, &renderManager_.PostInitBarrier(), push_, desc)) {
return tex;
} else {
ERROR_LOG(G3D, "Failed to create texture");
ERROR_LOG(Log::G3D, "Failed to create texture");
tex->Release();
return nullptr;
}
@ -1326,7 +1326,7 @@ void VKContext::UpdateTextureLevels(Texture *texture, const uint8_t **data, Text
VkCommandBuffer initCmd = renderManager_.GetInitCmd();
if (!push_ || !initCmd) {
// Too early! Fail.
ERROR_LOG(G3D, "Can't create textures before the first frame has started.");
ERROR_LOG(Log::G3D, "Can't create textures before the first frame has started.");
return;
}
@ -1438,7 +1438,7 @@ ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage la
if (shader->Compile(vulkan_, language, data, size)) {
return shader;
} else {
ERROR_LOG(G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str());
ERROR_LOG(Log::G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str());
shader->Release();
return nullptr;
}

View File

@ -601,7 +601,7 @@ void ConvertFromRGBA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u
case Draw::DataFormat::R8G8B8A8_UNORM:
case Draw::DataFormat::UNDEFINED:
default:
WARN_LOG(G3D, "Unable to convert from format: %d", (int)format);
WARN_LOG(Log::G3D, "Unable to convert from format: %d", (int)format);
break;
}
}
@ -663,7 +663,7 @@ void ConvertFromBGRA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u
case Draw::DataFormat::R8G8B8A8_UNORM:
case Draw::DataFormat::UNDEFINED:
default:
WARN_LOG(G3D, "Unable to convert from format to BGRA: %d", (int)format);
WARN_LOG(Log::G3D, "Unable to convert from format to BGRA: %d", (int)format);
break;
}
}

View File

@ -70,8 +70,8 @@ bool HandleAssert(const char *function, const char *file, int line, const char *
}
// Normal logging (will also log to Android log)
ERROR_LOG(SYSTEM, "%s", formatted);
// Also do a simple printf for good measure, in case logging of SYSTEM is disabled (should we disallow that?)
ERROR_LOG(Log::System, "%s", formatted);
// Also do a simple printf for good measure, in case logging of System is disabled (should we disallow that?)
fprintf(stderr, "%s\n", formatted);
hitAnyAsserts = true;

View File

@ -27,41 +27,41 @@
#define VERBOSE_LEVEL 6 // Noisy debugging - sometimes needed but usually unimportant.
// NOTE: Needs to be kept in sync with the g_logTypeNames array.
enum class LogType {
SYSTEM = 0, // Catch-all for uncategorized things
BOOT,
COMMON,
enum class Log {
System = 0, // Catch-all for uncategorized things
Boot,
Common,
CPU,
FILESYS,
FileSystem,
G3D,
HLE, // dumping ground that we should get rid of
JIT,
LOADER,
Loader,
ME,
MEMMAP,
SASMIX,
SAVESTATE,
FRAMEBUF,
AUDIO,
MemMap,
SasMix,
SaveState,
FrameBuf,
Audio,
IO,
ACHIEVEMENTS,
Achievements,
HTTP,
PRINTF,
Printf,
SCEAUDIO,
SCECTRL,
SCEDISPLAY,
SCEFONT,
SCEGE,
SCEINTC,
SCEIO,
SCEKERNEL,
SCEMODULE,
SCENET,
SCERTC,
SCESAS,
SCEUTILITY,
SCEMISC,
sceAudio,
sceCtrl,
sceDisplay,
sceFont,
sceGe,
sceIntc,
sceIo,
sceKernel,
sceModule,
sceNet,
sceRtc,
sceSas,
sceUtility,
sceMisc,
NUMBER_OF_LOGS, // Must be last
};
@ -75,13 +75,12 @@ enum class LogLevel : int {
LVERBOSE = VERBOSE_LEVEL,
};
void GenericLog(LogLevel level, LogType type,
const char *file, int line, const char *fmt, ...)
void GenericLog(LogLevel level, Log type, const char *file, int line, const char *fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 5, 6)))
#endif
;
bool GenericLogEnabled(LogLevel level, LogType type);
bool GenericLogEnabled(LogLevel level, Log type);
// Exception for Windows - enable more log levels in release mode than on other platforms.
#if defined(_DEBUG) || defined(_WIN32)
@ -104,12 +103,12 @@ bool GenericLogEnabled(LogLevel level, LogType type);
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
}
#define ERROR_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LERROR, __VA_ARGS__) } while (false)
#define WARN_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LWARNING, __VA_ARGS__) } while (false)
#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LNOTICE, __VA_ARGS__) } while (false)
#define INFO_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LINFO, __VA_ARGS__) } while (false)
#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LDEBUG, __VA_ARGS__) } while (false)
#define VERBOSE_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LVERBOSE, __VA_ARGS__) } while (false)
#define ERROR_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LERROR, __VA_ARGS__) } while (false)
#define WARN_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LWARNING, __VA_ARGS__) } while (false)
#define NOTICE_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LNOTICE, __VA_ARGS__) } while (false)
#define INFO_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LINFO, __VA_ARGS__) } while (false)
#define DEBUG_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LDEBUG, __VA_ARGS__) } while (false)
#define VERBOSE_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LVERBOSE, __VA_ARGS__) } while (false)
// Currently only actually shows a dialog box on Windows.
bool HandleAssert(const char *function, const char *file, int line, const char *expression, const char* format, ...)

View File

@ -47,14 +47,14 @@ static const char level_to_char[8] = "-NEWIDV";
#define LOG_MSC_OUTPUTDEBUG false
#endif
void GenericLog(LogLevel level, LogType type, const char *file, int line, const char* fmt, ...) {
void GenericLog(LogLevel level, Log type, const char *file, int line, const char* fmt, ...) {
if (g_bLogEnabledSetting && !(*g_bLogEnabledSetting))
return;
va_list args;
va_start(args, fmt);
LogManager *instance = LogManager::GetInstance();
if (instance) {
instance->Log(level, type, file, line, fmt, args);
instance->LogLine(level, type, file, line, fmt, args);
} else {
// Fall back to printf or direct android logger with a small buffer if the log manager hasn't been initialized yet.
#if PPSSPP_PLATFORM(ANDROID)
@ -69,7 +69,7 @@ void GenericLog(LogLevel level, LogType type, const char *file, int line, const
va_end(args);
}
bool GenericLogEnabled(LogLevel level, LogType type) {
bool GenericLogEnabled(LogLevel level, Log type) {
if (LogManager::GetInstance())
return (*g_bLogEnabledSetting) && LogManager::GetInstance()->IsEnabled(level, type);
return false;
@ -77,7 +77,7 @@ bool GenericLogEnabled(LogLevel level, LogType type) {
LogManager *LogManager::logManager_ = NULL;
// NOTE: Needs to be kept in sync with the LogType enum.
// NOTE: Needs to be kept in sync with the Log enum.
static const char * const g_logTypeNames[] = {
"SYSTEM",
"BOOT",
@ -118,7 +118,7 @@ static const char * const g_logTypeNames[] = {
LogManager::LogManager(bool *enabledSetting) {
g_bLogEnabledSetting = enabledSetting;
_dbg_assert_(ARRAY_SIZE(g_logTypeNames) == (size_t)LogType::NUMBER_OF_LOGS);
_dbg_assert_(ARRAY_SIZE(g_logTypeNames) == (size_t)Log::NUMBER_OF_LOGS);
for (size_t i = 0; i < ARRAY_SIZE(g_logTypeNames); i++) {
truncate_cpy(log_[i].m_shortName, g_logTypeNames[i]);
@ -158,7 +158,7 @@ LogManager::LogManager(bool *enabledSetting) {
}
LogManager::~LogManager() {
for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; ++i) {
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) {
#if !defined(MOBILE_DEVICE) || defined(_DEBUG)
RemoveListener(fileLog_);
RemoveListener(consoleLog_);
@ -194,14 +194,14 @@ void LogManager::ChangeFileLog(const char *filename) {
}
void LogManager::SaveConfig(Section *section) {
for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; i++) {
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) {
section->Set((std::string(log_[i].m_shortName) + "Enabled").c_str(), log_[i].enabled);
section->Set((std::string(log_[i].m_shortName) + "Level").c_str(), (int)log_[i].level);
}
}
void LogManager::LoadConfig(const Section *section, bool debugDefaults) {
for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; i++) {
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) {
bool enabled = false;
int level = 0;
section->Get((std::string(log_[i].m_shortName) + "Enabled").c_str(), &enabled, true);
@ -211,7 +211,7 @@ void LogManager::LoadConfig(const Section *section, bool debugDefaults) {
}
}
void LogManager::Log(LogLevel level, LogType type, const char *file, int line, const char *format, va_list args) {
void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, const char *format, va_list args) {
const LogChannel &log = log_[(size_t)type];
if (level > log.level || !log.enabled)
return;
@ -268,7 +268,7 @@ void LogManager::Log(LogLevel level, LogType type, const char *file, int line, c
}
}
bool LogManager::IsEnabled(LogLevel level, LogType type) {
bool LogManager::IsEnabled(LogLevel level, Log type) {
LogChannel &log = log_[(size_t)type];
if (level > log.level || !log.enabled)
return false;
@ -356,7 +356,7 @@ void OutputDebugStringUTF8(const char *p) {
#else
void OutputDebugStringUTF8(const char *p) {
INFO_LOG(SYSTEM, "%s", p);
INFO_LOG(Log::System, "%s", p);
}
#endif

View File

@ -114,7 +114,7 @@ private:
LogManager(const LogManager &) = delete;
void operator=(const LogManager &) = delete;
LogChannel log_[(size_t)LogType::NUMBER_OF_LOGS];
LogChannel log_[(size_t)Log::NUMBER_OF_LOGS];
FileLogListener *fileLog_ = nullptr;
ConsoleListener *consoleLog_ = nullptr;
OutputDebugStringLogListener *debuggerLog_ = nullptr;
@ -129,31 +129,31 @@ public:
void RemoveListener(LogListener *listener);
static u32 GetMaxLevel() { return (u32)MAX_LOGLEVEL; }
static int GetNumChannels() { return (int)LogType::NUMBER_OF_LOGS; }
static int GetNumChannels() { return (int)Log::NUMBER_OF_LOGS; }
void Log(LogLevel level, LogType type,
const char *file, int line, const char *fmt, va_list args);
bool IsEnabled(LogLevel level, LogType type);
void LogLine(LogLevel level, Log type,
const char *file, int line, const char *fmt, va_list args);
bool IsEnabled(LogLevel level, Log type);
LogChannel *GetLogChannel(LogType type) {
LogChannel *GetLogChannel(Log type) {
return &log_[(size_t)type];
}
void SetLogLevel(LogType type, LogLevel level) {
void SetLogLevel(Log type, LogLevel level) {
log_[(size_t)type].level = level;
}
void SetAllLogLevels(LogLevel level) {
for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; ++i) {
for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) {
log_[i].level = level;
}
}
void SetEnabled(LogType type, bool enable) {
void SetEnabled(Log type, bool enable) {
log_[(size_t)type].enabled = enable;
}
LogLevel GetLogLevel(LogType type) {
LogLevel GetLogLevel(Log type) {
return log_[(size_t)type].level;
}

View File

@ -59,7 +59,7 @@ void SetupCallbacks(AllowedCallback allowed, MessageCallback message) {
void ReportMessage(const char *message, ...) {
if (!allowedCallback || !messageCallback) {
ERROR_LOG(SYSTEM, "Reporting not initialized, skipping: %s", message);
ERROR_LOG(Log::System, "Reporting not initialized, skipping: %s", message);
return;
}
@ -80,7 +80,7 @@ void ReportMessage(const char *message, ...) {
void ReportMessageFormatted(const char *message, const char *formatted) {
if (!allowedCallback || !messageCallback) {
ERROR_LOG(SYSTEM, "Reporting not initialized, skipping: %s", message);
ERROR_LOG(Log::System, "Reporting not initialized, skipping: %s", message);
return;
}

View File

@ -88,7 +88,7 @@ static int legacy_ashmem_create_region(const char *name, size_t size) {
return fd;
error:
ERROR_LOG(MEMMAP, "NASTY ASHMEM ERROR: ret = %08x", ret);
ERROR_LOG(Log::MemMap, "NASTY ASHMEM ERROR: ret = %08x", ret);
close(fd);
return ret;
}
@ -110,7 +110,7 @@ bool MemArena::GrabMemSpace(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));
ERROR_LOG(Log::MemMap, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno));
return false;
}
return true;
@ -123,7 +123,7 @@ void MemArena::ReleaseSpace() {
void *MemArena::CreateView(s64 offset, size_t size, void *base) {
void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | ((base == 0) ? 0 : MAP_FIXED), fd, offset);
if (retval == MAP_FAILED) {
NOTICE_LOG(MEMMAP, "mmap on ashmem (fd: %d) failed", (int)fd);
NOTICE_LOG(Log::MemMap, "mmap on ashmem (fd: %d) failed", (int)fd);
return nullptr;
}
return retval;
@ -142,14 +142,14 @@ u8* MemArena::Find4GBBase() {
const uint64_t EIGHT_GIGS = 0x200000000ULL;
void *base = mmap(0, EIGHT_GIGS, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
if (base && base != MAP_FAILED) {
INFO_LOG(SYSTEM, "base: %p", base);
INFO_LOG(Log::System, "base: %p", base);
uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL;
INFO_LOG(SYSTEM, "aligned_base: %p", (void *)aligned_base);
INFO_LOG(Log::System, "aligned_base: %p", (void *)aligned_base);
munmap(base, EIGHT_GIGS);
return reinterpret_cast<u8 *>(aligned_base);
} else {
u8 *hardcoded_ptr = reinterpret_cast<u8*>(0x2300000000ULL);
INFO_LOG(SYSTEM, "Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr);
INFO_LOG(Log::System, "Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr);
// Just grab some random 4GB...
// This has been known to fail lately though, see issue #12249.
return hardcoded_ptr;
@ -159,7 +159,7 @@ u8* MemArena::Find4GBBase() {
void *base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
if (base == MAP_FAILED) {
ERROR_LOG(SYSTEM, "Failed to map 256 MB of memory space: %s", strerror(errno));
ERROR_LOG(Log::System, "Failed to map 256 MB of memory space: %s", strerror(errno));
return nullptr;
}

View File

@ -42,10 +42,10 @@ bool MemArena::GrabMemSpace(size_t size) {
vm_size = size;
kern_return_t retval = vm_allocate(mach_task_self(), &vm_mem, size, VM_FLAGS_ANYWHERE);
if (retval != KERN_SUCCESS) {
ERROR_LOG(MEMMAP, "Failed to grab a block of virtual memory");
ERROR_LOG(Log::MemMap, "Failed to grab a block of virtual memory");
return false;
} else {
INFO_LOG(MEMMAP, "Successfully allocated %d bytes at %p", (int)size, (void *)vm_mem);
INFO_LOG(Log::MemMap, "Successfully allocated %d bytes at %p", (int)size, (void *)vm_mem);
return true;
}
}
@ -72,7 +72,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) {
// 1 == KERN_INVALID_ADDRESS
// 3 == KERN_NO_SPACE (race?)
// 4 == KERN_INVALID_ARGUMENT
ERROR_LOG(MEMMAP, "vm_remap failed (%d) - could not remap from %llx (offset %llx) of size %llx to %p",
ERROR_LOG(Log::MemMap, "vm_remap failed (%d) - could not remap from %llx (offset %llx) of size %llx to %p",
(int)retval, (uint64_t)source, (uint64_t)offset, (uint64_t)size, base);
return nullptr;
}

View File

@ -63,11 +63,11 @@ bool MemArena::GrabMemSpace(size_t size) {
// This opens atomically, so will fail if another process is starting.
fd = shm_open(ram_temp_filename, O_RDWR | O_CREAT | O_EXCL, mode);
if (fd >= 0) {
INFO_LOG(MEMMAP, "Got shm file: %s", ram_temp_filename);
INFO_LOG(Log::MemMap, "Got shm file: %s", ram_temp_filename);
is_shm = true;
// Our handle persists per POSIX, so no need to keep it around.
if (shm_unlink(ram_temp_filename) != 0) {
WARN_LOG(MEMMAP, "Failed to shm_unlink %s", ram_temp_file.c_str());
WARN_LOG(Log::MemMap, "Failed to shm_unlink %s", ram_temp_file.c_str());
}
break;
}
@ -79,24 +79,24 @@ bool MemArena::GrabMemSpace(size_t size) {
if (fd >= 0) {
// Great, this definitely shouldn't flush to disk.
ram_temp_file = tmpfs_ram_temp_file;
INFO_LOG(MEMMAP, "Got tmpfs ram file: %s", tmpfs_ram_temp_file.c_str());
INFO_LOG(Log::MemMap, "Got tmpfs ram file: %s", tmpfs_ram_temp_file.c_str());
}
}
if (fd < 0) {
INFO_LOG(MEMMAP, "Trying '%s' as ram temp file", ram_temp_file.c_str());
INFO_LOG(Log::MemMap, "Trying '%s' as ram temp file", ram_temp_file.c_str());
fd = open(ram_temp_file.c_str(), O_RDWR | O_CREAT, mode);
}
if (fd < 0) {
ERROR_LOG(MEMMAP, "Failed to grab memory space as a file: %s of size: %08x. Error: %s", ram_temp_file.c_str(), (int)size, strerror(errno));
ERROR_LOG(Log::MemMap, "Failed to grab memory space as a file: %s of size: %08x. Error: %s", ram_temp_file.c_str(), (int)size, strerror(errno));
return false;
}
// delete immediately, we keep the fd so it still lives
if (!is_shm && unlink(ram_temp_file.c_str()) != 0) {
WARN_LOG(MEMMAP, "Failed to unlink %s", ram_temp_file.c_str());
WARN_LOG(Log::MemMap, "Failed to unlink %s", ram_temp_file.c_str());
}
if (ftruncate(fd, size) != 0) {
ERROR_LOG(MEMMAP, "Failed to ftruncate %d (%s) to size %08x", (int)fd, ram_temp_file.c_str(), (int)size);
ERROR_LOG(Log::MemMap, "Failed to ftruncate %d (%s) to size %08x", (int)fd, ram_temp_file.c_str(), (int)size);
// Should this be a failure?
}
#endif
@ -122,7 +122,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base)
((base == 0) ? 0 : MAP_FIXED), fd, offset);
if (retval == MAP_FAILED) {
NOTICE_LOG(MEMMAP, "mmap on %s (fd: %d) failed: %s", ram_temp_file.c_str(), (int)fd, strerror(errno));
NOTICE_LOG(Log::MemMap, "mmap on %s (fd: %d) failed: %s", ram_temp_file.c_str(), (int)fd, strerror(errno));
return 0;
}
return retval;
@ -145,14 +145,14 @@ u8* MemArena::Find4GBBase() {
const uint64_t EIGHT_GIGS = 0x200000000ULL;
void *base = mmap(0, EIGHT_GIGS, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
if (base && base != MAP_FAILED) {
INFO_LOG(MEMMAP, "base: %p", base);
INFO_LOG(Log::MemMap, "base: %p", base);
uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL;
INFO_LOG(MEMMAP, "aligned_base: %p", (void *)aligned_base);
INFO_LOG(Log::MemMap, "aligned_base: %p", (void *)aligned_base);
munmap(base, EIGHT_GIGS);
return reinterpret_cast<u8 *>(aligned_base);
} else {
u8 *hardcoded_ptr = reinterpret_cast<u8*>(0x2300000000ULL);
INFO_LOG(MEMMAP, "Failed to anonymously map 8GB (%s). Fall back to the hardcoded pointer %p.", strerror(errno), hardcoded_ptr);
INFO_LOG(Log::MemMap, "Failed to anonymously map 8GB (%s). Fall back to the hardcoded pointer %p.", strerror(errno), hardcoded_ptr);
// Just grab some random 4GB...
// This has been known to fail lately though, see issue #12249.
return hardcoded_ptr;

View File

@ -146,7 +146,7 @@ void *AllocateExecutableMemory(size_t size) {
if (ptr) {
ptr = VirtualAlloc(ptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot);
} else {
WARN_LOG(COMMON, "Unable to find nearby executable memory for jit. Proceeding with far memory.");
WARN_LOG(Log::Common, "Unable to find nearby executable memory for jit. Proceeding with far memory.");
// Can still run, thanks to "RipAccessible".
ptr = VirtualAlloc(nullptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot);
}
@ -161,7 +161,7 @@ void *AllocateExecutableMemory(size_t size) {
#endif
}
if (!ptr) {
ERROR_LOG(MEMMAP, "Failed to allocate executable memory (%d)", (int)size);
ERROR_LOG(Log::MemMap, "Failed to allocate executable memory (%d)", (int)size);
}
return ptr;
}
@ -193,7 +193,7 @@ void *AllocateExecutableMemory(size_t size) {
if (ptr == MAP_FAILED) {
ptr = nullptr;
ERROR_LOG(MEMMAP, "Failed to allocate executable memory (%d) errno=%d", (int)size, errno);
ERROR_LOG(Log::MemMap, "Failed to allocate executable memory (%d) errno=%d", (int)size, errno);
}
#if PPSSPP_ARCH(AMD64)
@ -227,7 +227,7 @@ void *AllocateMemoryPages(size_t size, uint32_t memProtFlags) {
void* ptr = VirtualAlloc(0, size, MEM_COMMIT, protect);
#endif
if (!ptr) {
ERROR_LOG(MEMMAP, "Failed to allocate raw memory pages");
ERROR_LOG(Log::MemMap, "Failed to allocate raw memory pages");
return nullptr;
}
#else
@ -235,7 +235,7 @@ void *AllocateMemoryPages(size_t size, uint32_t memProtFlags) {
uint32_t protect = ConvertProtFlagsUnix(memProtFlags);
void *ptr = mmap(0, size, protect, MAP_ANON | MAP_PRIVATE, -1, 0);
if (ptr == MAP_FAILED) {
ERROR_LOG(MEMMAP, "Failed to allocate raw memory pages: errno=%d", errno);
ERROR_LOG(Log::MemMap, "Failed to allocate raw memory pages: errno=%d", errno);
return nullptr;
}
#endif
@ -271,7 +271,7 @@ void FreeMemoryPages(void *ptr, size_t size) {
size = (size + page_size - 1) & (~(page_size - 1));
#ifdef _WIN32
if (!VirtualFree(ptr, 0, MEM_RELEASE)) {
ERROR_LOG(MEMMAP, "FreeMemoryPages failed!\n%s", GetLastErrorMsg().c_str());
ERROR_LOG(Log::MemMap, "FreeMemoryPages failed!\n%s", GetLastErrorMsg().c_str());
}
#else
munmap(ptr, size);
@ -306,7 +306,7 @@ bool PlatformIsWXExclusive() {
}
bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) {
VERBOSE_LOG(JIT, "ProtectMemoryPages: %p (%d) : r%d w%d x%d", ptr, (int)size,
VERBOSE_LOG(Log::JIT, "ProtectMemoryPages: %p (%d) : r%d w%d x%d", ptr, (int)size,
(memProtFlags & MEM_PROT_READ) != 0, (memProtFlags & MEM_PROT_WRITE) != 0, (memProtFlags & MEM_PROT_EXEC) != 0);
if (PlatformIsWXExclusive()) {
@ -322,13 +322,13 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) {
#if PPSSPP_PLATFORM(UWP)
DWORD oldValue;
if (!VirtualProtectFromApp((void *)ptr, size, protect, &oldValue)) {
ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str());
ERROR_LOG(Log::MemMap, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str());
return false;
}
#else
DWORD oldValue;
if (!VirtualProtect((void *)ptr, size, protect, &oldValue)) {
ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str());
ERROR_LOG(Log::MemMap, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str());
return false;
}
#endif
@ -343,7 +343,7 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) {
end = (end + page_size - 1) & ~(page_size - 1);
int retval = mprotect((void *)start, end - start, protect);
if (retval != 0) {
ERROR_LOG(MEMMAP, "mprotect failed (%p)! errno=%d (%s)", (void *)start, errno, strerror(errno));
ERROR_LOG(Log::MemMap, "mprotect failed (%p)! errno=%d (%s)", (void *)start, errno, strerror(errno));
return false;
}
return true;

View File

@ -69,11 +69,11 @@ const char *DNSTypeAsString(DNSType type) {
bool Connection::Resolve(const char *host, int port, DNSType type) {
if ((intptr_t)sock_ != -1) {
ERROR_LOG(IO, "Resolve: Already have a socket");
ERROR_LOG(Log::IO, "Resolve: Already have a socket");
return false;
}
if (!host || port < 1 || port > 65535) {
ERROR_LOG(IO, "Resolve: Invalid host or port (%d)", port);
ERROR_LOG(Log::IO, "Resolve: Invalid host or port (%d)", port);
return false;
}
@ -85,7 +85,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) {
std::string err;
if (!net::DNSResolve(host, port_str, &resolved_, err, type)) {
WARN_LOG(IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type));
WARN_LOG(Log::IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type));
// Zero port so that future calls fail.
port_ = 0;
return false;
@ -108,7 +108,7 @@ static void FormatAddr(char *addrbuf, size_t bufsize, const addrinfo *info) {
bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
if (port_ <= 0) {
ERROR_LOG(IO, "Bad port");
ERROR_LOG(Log::IO, "Bad port");
return false;
}
sock_ = -1;
@ -124,13 +124,13 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
int sock = socket(possible->ai_family, SOCK_STREAM, IPPROTO_TCP);
if ((intptr_t)sock == -1) {
ERROR_LOG(IO, "Bad socket");
ERROR_LOG(Log::IO, "Bad socket");
continue;
}
// Windows sockets aren't limited by socket number, just by count, so checking FD_SETSIZE there is wrong.
#if !PPSSPP_PLATFORM(WINDOWS)
if (sock >= FD_SETSIZE) {
ERROR_LOG(IO, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock);
ERROR_LOG(Log::IO, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock);
closesocket(sock);
continue;
}
@ -155,9 +155,9 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
char addrStr[128]{};
FormatAddr(addrStr, sizeof(addrStr), possible);
if (!unreachable) {
ERROR_LOG(HTTP, "connect(%d) call to %s failed (%d: %s)", sock, addrStr, errorCode, errorString.c_str());
ERROR_LOG(Log::HTTP, "connect(%d) call to %s failed (%d: %s)", sock, addrStr, errorCode, errorString.c_str());
} else {
INFO_LOG(HTTP, "connect(%d): Ignoring unreachable resolved address %s", sock, addrStr);
INFO_LOG(Log::HTTP, "connect(%d): Ignoring unreachable resolved address %s", sock, addrStr);
}
closesocket(sock);
continue;
@ -186,7 +186,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
selectResult = select(maxfd, nullptr, &fds, nullptr, &tv);
if (cancelConnect && *cancelConnect) {
WARN_LOG(HTTP, "connect: cancelled (1)");
WARN_LOG(Log::HTTP, "connect: cancelled (1)");
break;
}
}
@ -210,7 +210,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
}
if (cancelConnect && *cancelConnect) {
WARN_LOG(HTTP, "connect: cancelled (2)");
WARN_LOG(Log::HTTP, "connect: cancelled (2)");
break;
}
@ -396,13 +396,13 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
return -1;
ready = fd_util::WaitUntilReady(sock(), CANCEL_INTERVAL, false);
if (!ready && time_now_d() > endTimeout) {
ERROR_LOG(HTTP, "HTTP headers timed out");
ERROR_LOG(Log::HTTP, "HTTP headers timed out");
return -1;
}
};
// Let's hope all the headers are available in a single packet...
if (readbuf->Read(sock(), 4096) < 0) {
ERROR_LOG(HTTP, "Failed to read HTTP headers :(");
ERROR_LOG(Log::HTTP, "Failed to read HTTP headers :(");
return -1;
}
@ -420,7 +420,7 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
if (code_pos != line.npos) {
code = atoi(&line[code_pos]);
} else {
ERROR_LOG(HTTP, "Could not parse HTTP status code: %s", line.c_str());
ERROR_LOG(Log::HTTP, "Could not parse HTTP status code: %s", line.c_str());
return -1;
}
@ -432,7 +432,7 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector<std::string> &
}
if (responseHeaders.size() == 0) {
ERROR_LOG(HTTP, "No HTTP response headers");
ERROR_LOG(Log::HTTP, "No HTTP response headers");
return -1;
}
@ -469,7 +469,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
}
if (contentLength < 0) {
WARN_LOG(HTTP, "Negative content length %d", contentLength);
WARN_LOG(Log::HTTP, "Negative content length %d", contentLength);
// Just sanity checking...
contentLength = 0;
}
@ -481,7 +481,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
if (!output->IsVoid()) {
if (chunked) {
if (!DeChunk(readbuf, output, contentLength)) {
ERROR_LOG(HTTP, "Bad chunked data, couldn't read chunk size");
ERROR_LOG(Log::HTTP, "Bad chunked data, couldn't read chunk size");
progress->Update(0, 0, true);
return -1;
}
@ -495,7 +495,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vector<std::stri
output->TakeAll(&compressed);
bool result = decompress_string(compressed, &decompressed);
if (!result) {
ERROR_LOG(HTTP, "Error decompressing using zlib");
ERROR_LOG(Log::HTTP, "Error decompressing using zlib");
progress->Update(0, 0, true);
return -1;
}
@ -523,7 +523,7 @@ void HTTPRequest::Start() {
void HTTPRequest::Join() {
if (joined_) {
ERROR_LOG(HTTP, "Already joined thread!");
ERROR_LOG(Log::HTTP, "Already joined thread!");
}
thread_.join();
joined_ = true;
@ -547,7 +547,7 @@ int HTTPRequest::Perform(const std::string &url) {
}
if (!client.Resolve(fileUrl.Host().c_str(), fileUrl.Port())) {
ERROR_LOG(HTTP, "Failed resolving %s", url.c_str());
ERROR_LOG(Log::HTTP, "Failed resolving %s", url.c_str());
return -1;
}
@ -556,7 +556,7 @@ int HTTPRequest::Perform(const std::string &url) {
}
if (!client.Connect(2, 20.0, &cancelled_)) {
ERROR_LOG(HTTP, "Failed connecting to server or cancelled.");
ERROR_LOG(Log::HTTP, "Failed connecting to server or cancelled.");
return -1;
}
@ -600,7 +600,7 @@ void HTTPRequest::Do() {
if (resultCode == 301 || resultCode == 302 || resultCode == 303 || resultCode == 307 || resultCode == 308) {
std::string redirectURL = RedirectLocation(downloadURL);
if (redirectURL.empty()) {
ERROR_LOG(HTTP, "Could not find Location header for redirect");
ERROR_LOG(Log::HTTP, "Could not find Location header for redirect");
resultCode_ = resultCode;
} else if (redirectURL == downloadURL || redirectURL == url_) {
// Simple loop detected, bail out.
@ -609,7 +609,7 @@ void HTTPRequest::Do() {
// Perform the next GET.
if (resultCode_ == 0) {
INFO_LOG(HTTP, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str());
INFO_LOG(Log::HTTP, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str());
buffer_.clear();
responseHeaders_.clear();
}
@ -618,12 +618,12 @@ void HTTPRequest::Do() {
}
if (resultCode == 200) {
INFO_LOG(HTTP, "Completed requesting %s (storing result to %s)", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str());
INFO_LOG(Log::HTTP, "Completed requesting %s (storing result to %s)", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str());
if (!outfile_.empty() && !buffer_.FlushToFile(outfile_)) {
ERROR_LOG(HTTP, "Failed writing download to '%s'", outfile_.c_str());
ERROR_LOG(Log::HTTP, "Failed writing download to '%s'", outfile_.c_str());
}
} else {
ERROR_LOG(HTTP, "Error requesting '%s' (storing result to '%s'): %i", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str(), resultCode);
ERROR_LOG(Log::HTTP, "Error requesting '%s' (storing result to '%s'): %i", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str(), resultCode);
}
resultCode_ = resultCode;
}

View File

@ -31,7 +31,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co
for (size_t i = 0; i < v.size(); i++) {
std::vector<std::string_view> parts;
SplitString(v[i], '=', parts);
DEBUG_LOG(IO, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data());
DEBUG_LOG(Log::IO, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data());
if (parts[0] == param_name) {
*value = parts[1];
return true;
@ -119,13 +119,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) {
if (!strncasecmp(key, "User-Agent", key_len)) {
user_agent = new char[value_len + 1];
memcpy(user_agent, buffer, value_len + 1);
VERBOSE_LOG(IO, "user-agent: %s", user_agent);
VERBOSE_LOG(Log::IO, "user-agent: %s", user_agent);
} else if (!strncasecmp(key, "Referer", key_len)) {
referer = new char[value_len + 1];
memcpy(referer, buffer, value_len + 1);
} else if (!strncasecmp(key, "Content-Length", key_len)) {
content_length = atoi(buffer);
VERBOSE_LOG(IO, "Content-Length: %i", (int)content_length);
VERBOSE_LOG(Log::IO, "Content-Length: %i", (int)content_length);
} else {
std::string key_str(key, key_len);
std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower);
@ -148,12 +148,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) {
line_count++;
if (type == SIMPLE) {
// Done!
VERBOSE_LOG(IO, "Simple: Done parsing http request.");
VERBOSE_LOG(Log::IO, "Simple: Done parsing http request.");
break;
}
}
VERBOSE_LOG(IO, "finished parsing request.");
VERBOSE_LOG(Log::IO, "finished parsing request.");
ok = line_count > 1 && resource != nullptr;
}

View File

@ -60,7 +60,7 @@ void HTTPSRequest::Join() {
res_ = nullptr;
req_ = nullptr;
} else {
ERROR_LOG(IO, "HTTPSDownload::Join not implemented");
ERROR_LOG(Log::IO, "HTTPSDownload::Join not implemented");
}
}
@ -85,33 +85,33 @@ bool HTTPSRequest::Done() {
// It's a naett error. Translate and handle.
switch (resultCode_) {
case naettConnectionError: // -1
ERROR_LOG(IO, "Connection error");
ERROR_LOG(Log::IO, "Connection error");
break;
case naettProtocolError: // -2
ERROR_LOG(IO, "Protocol error");
ERROR_LOG(Log::IO, "Protocol error");
break;
case naettReadError: // -3
ERROR_LOG(IO, "Read error");
ERROR_LOG(Log::IO, "Read error");
break;
case naettWriteError: // -4
ERROR_LOG(IO, "Write error");
ERROR_LOG(Log::IO, "Write error");
break;
case naettGenericError: // -5
ERROR_LOG(IO, "Generic error");
ERROR_LOG(Log::IO, "Generic error");
break;
default:
ERROR_LOG(IO, "Unhandled naett error %d", resultCode_);
ERROR_LOG(Log::IO, "Unhandled naett error %d", resultCode_);
break;
}
failed_ = true;
progress_.Update(bodyLength, bodyLength, true);
} else if (resultCode_ == 200) {
if (!outfile_.empty() && !buffer_.FlushToFile(outfile_)) {
ERROR_LOG(IO, "Failed writing download to '%s'", outfile_.c_str());
ERROR_LOG(Log::IO, "Failed writing download to '%s'", outfile_.c_str());
}
progress_.Update(bodyLength, bodyLength, true);
} else {
WARN_LOG(IO, "Naett request failed: %d", resultCode_);
WARN_LOG(Log::IO, "Naett request failed: %d", resultCode_);
failed_ = true;
progress_.Update(0, 0, true);
}

View File

@ -10,7 +10,7 @@
namespace http {
Request::Request(RequestMethod method, const std::string &url, std::string_view name, bool *cancelled, ProgressBarMode mode) : method_(method), url_(url), name_(name), progress_(cancelled), progressBarMode_(mode) {
INFO_LOG(HTTP, "HTTP %s request: %s (%.*s)", RequestMethodToString(method), url.c_str(), (int)name.size(), name.data());
INFO_LOG(Log::HTTP, "HTTP %s request: %s (%.*s)", RequestMethodToString(method), url.c_str(), (int)name.size(), name.data());
progress_.callback = [=](int64_t bytes, int64_t contentLength, bool done) {
std::string message;

View File

@ -67,7 +67,7 @@ ServerRequest::ServerRequest(int fd)
header_.ParseHeaders(in_);
if (header_.ok) {
VERBOSE_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length);
VERBOSE_LOG(Log::IO, "The request carried with it %i bytes", (int)header_.content_length);
} else {
Close();
}
@ -77,11 +77,11 @@ ServerRequest::~ServerRequest() {
Close();
if (!in_->Empty()) {
ERROR_LOG(IO, "Input not empty - invalid request?");
ERROR_LOG(Log::IO, "Input not empty - invalid request?");
}
delete in_;
if (!out_->Empty()) {
WARN_LOG(IO, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining());
WARN_LOG(Log::IO, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining());
}
delete out_;
}
@ -191,7 +191,7 @@ bool Server::Listen4(int port) {
#else
int err = errno;
#endif
ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv4)", port, err);
ERROR_LOG(Log::IO, "Failed to bind to port %d, error=%d - Bailing (ipv4)", port, err);
closesocket(listener_);
return false;
}
@ -209,7 +209,7 @@ bool Server::Listen4(int port) {
port = ntohs(server_addr.sin_port);
}
INFO_LOG(IO, "HTTP server started on port %d", port);
INFO_LOG(Log::IO, "HTTP server started on port %d", port);
port_ = port;
return true;
@ -241,7 +241,7 @@ bool Server::Listen6(int port, bool ipv6_only) {
#else
int err = errno;
#endif
ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv6)", port, err);
ERROR_LOG(Log::IO, "Failed to bind to port %d, error=%d - Bailing (ipv6)", port, err);
closesocket(listener_);
return false;
}
@ -259,7 +259,7 @@ bool Server::Listen6(int port, bool ipv6_only) {
port = ntohs(server_addr.sin6_port);
}
INFO_LOG(IO, "HTTP server started on port %d", port);
INFO_LOG(Log::IO, "HTTP server started on port %d", port);
port_ = port;
return true;
@ -294,7 +294,7 @@ bool Server::RunSlice(double timeout) {
return true;
}
else {
ERROR_LOG(IO, "socket accept failed: %i", conn_fd);
ERROR_LOG(Log::IO, "socket accept failed: %i", conn_fd);
return false;
}
}
@ -319,7 +319,7 @@ void Server::Stop() {
void Server::HandleConnection(int conn_fd) {
ServerRequest request(conn_fd);
if (!request.IsOK()) {
WARN_LOG(IO, "Bad request, ignoring.");
WARN_LOG(Log::IO, "Bad request, ignoring.");
return;
}
HandleRequest(request);
@ -351,7 +351,7 @@ void Server::HandleRequestDefault(const ServerRequest &request) {
}
void Server::Handle404(const ServerRequest &request) {
INFO_LOG(IO, "No handler for '%s', falling back to 404.", request.resource());
INFO_LOG(Log::IO, "No handler for '%s', falling back to 404.", request.resource());
const char *payload = "<html><body>404 not found</body></html>\r\n";
request.WriteHttpResponseHeader("1.0", 404, strlen(payload));
request.Out()->Push(payload);

View File

@ -44,14 +44,14 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) {
return false;
ready = fd_util::WaitUntilReady(sock, CANCEL_INTERVAL, true);
if (!ready && time_now_d() > endTimeout) {
ERROR_LOG(IO, "FlushSocket timed out");
ERROR_LOG(Log::IO, "FlushSocket timed out");
return false;
}
}
int sent = send(sock, &data_[pos], end - pos, MSG_NOSIGNAL);
// TODO: Do we need some retry logic here, instead of just giving up?
if (sent < 0) {
ERROR_LOG(IO, "FlushSocket failed to send: %d", errno);
ERROR_LOG(Log::IO, "FlushSocket failed to send: %d", errno);
return false;
}
pos += sent;
@ -94,7 +94,7 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, RequestProgress *progres
#else
if (errno != EWOULDBLOCK) {
#endif
ERROR_LOG(IO, "Error reading from buffer: %i", retval);
ERROR_LOG(Log::IO, "Error reading from buffer: %i", retval);
return false;
}

View File

@ -133,7 +133,7 @@ bool GetIPList(std::vector<std::string> &IP4s) {
char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4
// getifaddrs first appeared in glibc 2.3, On Android officially supported since __ANDROID_API__ >= 24
#if defined(_IFADDRS_H_) || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__ANDROID_API__ >= 24)
INFO_LOG(SCENET, "GetIPList from getifaddrs");
INFO_LOG(Log::sceNet, "GetIPList from getifaddrs");
struct ifaddrs* ifAddrStruct = NULL;
struct ifaddrs* ifa = NULL;
@ -161,7 +161,7 @@ bool GetIPList(std::vector<std::string> &IP4s) {
return true;
}
#elif defined(SIOCGIFCONF) // Better detection on Linux/UNIX/MacOS/some Android
INFO_LOG(SCENET, "GetIPList from SIOCGIFCONF");
INFO_LOG(Log::sceNet, "GetIPList from SIOCGIFCONF");
static struct ifreq ifreqs[32];
struct ifconf ifc;
memset(&ifc, 0, sizeof(ifconf));
@ -170,13 +170,13 @@ bool GetIPList(std::vector<std::string> &IP4s) {
int sd = socket(AF_INET, SOCK_DGRAM, 0);
if (sd < 0) {
ERROR_LOG(SCENET, "GetIPList failed to create socket (result = %i, errno = %i)", sd, errno);
ERROR_LOG(Log::sceNet, "GetIPList failed to create socket (result = %i, errno = %i)", sd, errno);
return false;
}
int r = ioctl(sd, SIOCGIFCONF, (char*)&ifc);
if (r != 0) {
ERROR_LOG(SCENET, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, errno);
ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, errno);
return false;
}
@ -192,7 +192,7 @@ bool GetIPList(std::vector<std::string> &IP4s) {
r = ioctl(sd, SIOCGIFADDR, item);
if (r != 0)
{
ERROR_LOG(SCENET, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, errno);
ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, errno);
}
if (ifreqs[i].ifr_addr.sa_family == AF_INET) {
@ -212,7 +212,7 @@ bool GetIPList(std::vector<std::string> &IP4s) {
close(sd);
return true;
#else // Fallback to POSIX/Cross-platform way but may not works well on Linux (ie. only shows 127.0.0.1)
INFO_LOG(SCENET, "GetIPList from Fallback");
INFO_LOG(Log::sceNet, "GetIPList from Fallback");
struct addrinfo hints, * res, * p;
memset(&hints, 0, sizeof hints);
hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version

View File

@ -200,7 +200,7 @@ void InputSink::AccountFill(int bytes) {
if (errno == EWOULDBLOCK || errno == EAGAIN)
return;
#endif
ERROR_LOG(IO, "Error reading from socket");
ERROR_LOG(Log::IO, "Error reading from socket");
return;
}
@ -321,10 +321,10 @@ bool OutputSink::Printf(const char *fmt, ...) {
// Okay, did we actually write?
if (result >= (int)avail) {
// This means the result string was too big for the buffer.
ERROR_LOG(IO, "Not enough space to format output.");
ERROR_LOG(Log::IO, "Not enough space to format output.");
return false;
} else if (result < 0) {
ERROR_LOG(IO, "vsnprintf failed.");
ERROR_LOG(Log::IO, "vsnprintf failed.");
return false;
}
@ -407,7 +407,7 @@ void OutputSink::AccountDrain(int bytes) {
if (errno == EWOULDBLOCK || errno == EAGAIN)
return;
#endif
ERROR_LOG(IO, "Error writing to socket");
ERROR_LOG(Log::IO, "Error writing to socket");
return;
}

View File

@ -34,7 +34,7 @@ void UrlEncoder::AppendEscaped(const std::string &value)
void Url::Split() {
size_t colonSlashSlash = url_.find("://");
if (colonSlashSlash == std::string::npos) {
ERROR_LOG(IO, "Invalid URL: %s", url_.c_str());
ERROR_LOG(Log::IO, "Invalid URL: %s", url_.c_str());
return;
}

View File

@ -146,7 +146,7 @@ int internal_profiler_enter(const char *category_name, int *out_thread_id) {
}
internal_profiler_resume(thread_id, category, now);
} else {
DEBUG_LOG(SYSTEM, "profiler: recursive enter (%i - %s)", category, category_name);
DEBUG_LOG(Log::System, "profiler: recursive enter (%i - %s)", category, category_name);
}
depth++;
@ -163,7 +163,7 @@ void internal_profiler_leave(int thread_id, int category) {
int &depth = profiler.depth[thread_id];
if (category < 0 || category >= MAX_CATEGORIES) {
ERROR_LOG(SYSTEM, "Bad category index %d", category);
ERROR_LOG(Log::System, "Bad category index %d", category);
depth--;
return;
}

View File

@ -69,7 +69,7 @@ void DrawBuffer::Flush(bool set_blend_state) {
if (count_ == 0)
return;
if (!pipeline_) {
ERROR_LOG(G3D, "DrawBuffer: No program set, skipping flush!");
ERROR_LOG(Log::G3D, "DrawBuffer: No program set, skipping flush!");
count_ = 0;
return;
}

View File

@ -32,7 +32,7 @@ public:
size_t fileSize;
uint8_t *buffer = g_VFS.ReadFile(filename_.c_str(), &fileSize);
if (!buffer) {
ERROR_LOG(IO, "Failed to read file '%s'", filename_.c_str());
ERROR_LOG(Log::IO, "Failed to read file '%s'", filename_.c_str());
filename_.clear();
*state_ = ManagedTexture::LoadState::FAILED;
waitable_->Notify();
@ -90,7 +90,7 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size,
typeSuggestion = DetectImageFileType(data, size);
}
if (typeSuggestion == ImageFileType::UNKNOWN) {
ERROR_LOG(G3D, "File (size: %d) has unknown format", (int)size);
ERROR_LOG(Log::G3D, "File (size: %d) has unknown format", (int)size);
return false;
}
@ -109,11 +109,11 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size,
numLevels = 1;
fmt = Draw::DataFormat::R8G8B8A8_UNORM;
if (!levels[0]) {
ERROR_LOG(IO, "pngLoadPtr failed (input size = %d)", (int)size);
ERROR_LOG(Log::IO, "pngLoadPtr failed (input size = %d)", (int)size);
return false;
}
} else {
ERROR_LOG(IO, "PNG load failed");
ERROR_LOG(Log::IO, "PNG load failed");
return false;
}
break;
@ -131,7 +131,7 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size,
}
default:
ERROR_LOG(IO, "Unsupported image format %d", (int)type);
ERROR_LOG(Log::IO, "Unsupported image format %d", (int)type);
return false;
}
@ -144,7 +144,7 @@ Draw::Texture *CreateTextureFromTempImage(Draw::DrawContext *draw, const TempIma
int numLevels = image.numLevels;
if (numLevels < 0 || numLevels >= 16) {
ERROR_LOG(IO, "Invalid num_levels: %d. Falling back to one. Image: %dx%d", numLevels, image.width[0], image.height[0]);
ERROR_LOG(Log::IO, "Invalid num_levels: %d. Falling back to one. Image: %dx%d", numLevels, image.width[0], image.height[0]);
numLevels = 1;
}
@ -178,7 +178,7 @@ Draw::Texture *CreateTextureFromFile(Draw::DrawContext *draw, const char *filena
size_t fileSize;
uint8_t *buffer = g_VFS.ReadFile(filename, &fileSize);
if (!buffer) {
ERROR_LOG(IO, "Failed to read file '%s'", filename);
ERROR_LOG(Log::IO, "Failed to read file '%s'", filename);
return nullptr;
}
Draw::Texture *texture = CreateTextureFromFileData(draw, buffer, fileSize, type, generateMips, filename);
@ -228,7 +228,7 @@ void ManagedTexture::StartLoadTask() {
}
void ManagedTexture::DeviceLost() {
INFO_LOG(G3D, "ManagedTexture::DeviceLost(%s)", filename_.c_str());
INFO_LOG(Log::G3D, "ManagedTexture::DeviceLost(%s)", filename_.c_str());
if (taskWaitable_) {
taskWaitable_->WaitAndRelease();
taskWaitable_ = nullptr;
@ -243,13 +243,13 @@ void ManagedTexture::DeviceLost() {
}
void ManagedTexture::DeviceRestored(Draw::DrawContext *draw) {
INFO_LOG(G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str());
INFO_LOG(Log::G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str());
draw_ = draw;
_dbg_assert_(!texture_);
if (texture_) {
ERROR_LOG(G3D, "ManagedTexture: Unexpected - texture already present: %s", filename_.c_str());
ERROR_LOG(Log::G3D, "ManagedTexture: Unexpected - texture already present: %s", filename_.c_str());
return;
}

View File

@ -179,7 +179,7 @@ void TextDrawer::OncePerFrame() {
// If DPI changed (small-mode, future proper monitor DPI support), drop everything.
float newDpiScale = CalculateDPIScale();
if (newDpiScale != dpiScale_) {
INFO_LOG(G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items)", dpiScale_, newDpiScale, (int)cache_.size());
INFO_LOG(Log::G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items)", dpiScale_, newDpiScale, (int)cache_.size());
dpiScale_ = newDpiScale;
ClearCache();
ClearFonts();

View File

@ -25,11 +25,11 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw)
method_measureText = env->GetStaticMethodID(cls_textRenderer, "measureText", "(Ljava/lang/String;D)I");
method_renderText = env->GetStaticMethodID(cls_textRenderer, "renderText", "(Ljava/lang/String;D)[I");
} else {
ERROR_LOG(G3D, "Failed to find class: '%s'", textRendererClassName);
ERROR_LOG(Log::G3D, "Failed to find class: '%s'", textRendererClassName);
}
dpiScale_ = CalculateDPIScale();
INFO_LOG(G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_);
INFO_LOG(Log::G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_);
}
TextDrawerAndroid::~TextDrawerAndroid() {
@ -71,7 +71,7 @@ void TextDrawerAndroid::SetFont(uint32_t fontHandle) {
if (iter != fontMap_.end()) {
fontHash_ = fontHandle;
} else {
ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle);
ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle);
}
}
@ -93,7 +93,7 @@ void TextDrawerAndroid::MeasureString(std::string_view str, float *w, float *h)
if (iter != fontMap_.end()) {
scaledSize = iter->second.size;
} else {
ERROR_LOG(G3D, "Missing font");
ERROR_LOG(Log::G3D, "Missing font");
}
std::string text(str);
auto env = getEnv();
@ -123,7 +123,7 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextS
if (iter != fontMap_.end()) {
size = iter->second.size;
} else {
ERROR_LOG(G3D, "Missing font");
ERROR_LOG(Log::G3D, "Missing font");
}
auto env = getEnv();

View File

@ -43,7 +43,7 @@ public:
void Create() {
// Create an attributed string with string and font information
CGFloat fontSize = ceilf((height / dpiScale) * 1.25f);
INFO_LOG(G3D, "Creating cocoa typeface '%s' size %d (effective size %0.1f)", APPLE_FONT, height, fontSize);
INFO_LOG(Log::G3D, "Creating cocoa typeface '%s' size %d (effective size %0.1f)", APPLE_FONT, height, fontSize);
// CTFontRef font = CTFontCreateWithName(CFSTR(APPLE_FONT), fontSize, nil);
CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, fontSize, nil);
attributes = [NSDictionary dictionaryWithObjectsAndKeys:
@ -125,7 +125,7 @@ void TextDrawerCocoa::MeasureString(std::string_view str, float *w, float *h) {
if (iter != sizeCache_.end()) {
entry = iter->second.get();
} else {
// INFO_LOG(SYSTEM, "Measuring %.*s", (int)str.length(), str.data());
// INFO_LOG(Log::System, "Measuring %.*s", (int)str.length(), str.data());
auto iter = fontMap_.find(fontHash_);
NSDictionary *attributes = nil;
@ -174,7 +174,7 @@ bool TextDrawerCocoa::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStr
return false;
}
// INFO_LOG(SYSTEM, "Rasterizing %.*s", (int)str.length(), str.data());
// INFO_LOG(Log::System, "Rasterizing %.*s", (int)str.length(), str.data());
NSString* string = [[NSString alloc] initWithBytes:str.data() length:str.length() encoding: NSUTF8StringEncoding];
@ -192,7 +192,7 @@ bool TextDrawerCocoa::DrawStringBitmap(std::vector<uint8_t> &bitmapData, TextStr
int width = (int)ceilf(w);
int height = (int)ceilf(h);
if (width <= 0 || height <= 0) {
WARN_LOG(G3D, "Text '%.*s' caused a zero size image", (int)str.length(), str.data());
WARN_LOG(Log::G3D, "Text '%.*s' caused a zero size image", (int)str.length(), str.data());
return false;
}

View File

@ -47,7 +47,7 @@ void TextDrawerQt::SetFont(uint32_t fontHandle) {
if (iter != fontMap_.end()) {
fontHash_ = fontHandle;
} else {
ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle);
ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle);
}
}

View File

@ -32,7 +32,7 @@ static std::string getlocale() {
TextDrawerSDL::TextDrawerSDL(Draw::DrawContext *draw): TextDrawer(draw) {
if (TTF_Init() < 0) {
ERROR_LOG(G3D, "Unable to initialize SDL2_ttf");
ERROR_LOG(Log::G3D, "Unable to initialize SDL2_ttf");
}
dpiScale_ = CalculateDPIScale();
@ -275,7 +275,7 @@ void TextDrawerSDL::SetFont(uint32_t fontHandle) {
if (iter != fontMap_.end()) {
fontHash_ = fontHandle;
} else {
ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle);
ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle);
}
}

View File

@ -48,7 +48,7 @@ public:
&textFmt
);
if (FAILED(hr)) {
ERROR_LOG(G3D, "Failed creating font %s", fname.c_str());
ERROR_LOG(Log::G3D, "Failed creating font %s", fname.c_str());
}
}
void Destroy() {
@ -106,9 +106,9 @@ TextDrawerUWP::TextDrawerUWP(Draw::DrawContext *draw) : TextDrawer(draw), ctx_(n
// Load the Roboto font
hr = m_dwriteFactory->CreateFontFileReference(L"Content/Roboto-Condensed.ttf", nullptr, &m_fontFile);
if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontFileReference failed");
if (FAILED(hr)) ERROR_LOG(Log::System, "CreateFontFileReference failed");
hr = m_dwriteFactory->CreateFontSetBuilder(&m_fontSetBuilder);
if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontSetBuilder failed");
if (FAILED(hr)) ERROR_LOG(Log::System, "CreateFontSetBuilder failed");
hr = m_fontSetBuilder->AddFontFile(m_fontFile);
hr = m_fontSetBuilder->CreateFontSet(&m_fontSet);
hr = m_dwriteFactory->CreateFontCollectionFromFontSet(m_fontSet, &m_fontCollection);

View File

@ -121,7 +121,7 @@ enum class Opcode32 {
BRANCH = 0b1100011,
JALR = 0b1100111,
JAL = 0b1101111,
SYSTEM = 0b1110011,
System = 0b1110011,
};
enum class Opcode16 {
@ -1853,11 +1853,11 @@ void RiscVEmitter::FENCE_TSO() {
}
void RiscVEmitter::ECALL() {
Write32(EncodeI(Opcode32::SYSTEM, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::ECALL));
Write32(EncodeI(Opcode32::System, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::ECALL));
}
void RiscVEmitter::EBREAK() {
Write32(EncodeI(Opcode32::SYSTEM, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::EBREAK));
Write32(EncodeI(Opcode32::System, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::EBREAK));
}
void RiscVEmitter::LWU(RiscVReg rd, RiscVReg rs1, s32 simm12) {
@ -2506,40 +2506,40 @@ void RiscVEmitter::QuickFLI(int bits, RiscVReg rd, float v, RiscVReg scratchReg)
void RiscVEmitter::CSRRW(RiscVReg rd, Csr csr, RiscVReg rs1) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRW, rs1, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRW, rs1, (Funct12)csr));
}
void RiscVEmitter::CSRRS(RiscVReg rd, Csr csr, RiscVReg rs1) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRS, rs1, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRS, rs1, (Funct12)csr));
}
void RiscVEmitter::CSRRC(RiscVReg rd, Csr csr, RiscVReg rs1) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRC, rs1, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRC, rs1, (Funct12)csr));
}
void RiscVEmitter::CSRRWI(RiscVReg rd, Csr csr, u8 uimm5) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
_assert_msg_((u32)uimm5 <= 0x1F, "%s can only specify lowest 5 bits", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRWI, (RiscVReg)uimm5, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRWI, (RiscVReg)uimm5, (Funct12)csr));
}
void RiscVEmitter::CSRRSI(RiscVReg rd, Csr csr, u8 uimm5) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
_assert_msg_((u32)uimm5 <= 0x1F, "%s can only set lowest 5 bits", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRSI, (RiscVReg)uimm5, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRSI, (RiscVReg)uimm5, (Funct12)csr));
}
void RiscVEmitter::CSRRCI(RiscVReg rd, Csr csr, u8 uimm5) {
_assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__);
_assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__);
_assert_msg_((u32)uimm5 <= 0x1F, "%s can only clear lowest 5 bits", __func__);
Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRCI, (RiscVReg)uimm5, (Funct12)csr));
Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRCI, (RiscVReg)uimm5, (Funct12)csr));
}
void RiscVEmitter::VSETVLI(RiscVReg rd, RiscVReg rs1, VType vtype) {

View File

@ -75,7 +75,7 @@ void DoLinkedList(PointerWrap &p, LinkedListItem<T> *&list_start, LinkedListItem
}
} else {
if (shouldExist != 0) {
WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist);
WARN_LOG(Log::SaveState, "Savestate failure: incorrect item marker %d", shouldExist);
p.SetError(p.ERROR_FAILURE);
}
if (p.mode == PointerWrap::MODE_READ) {

View File

@ -46,11 +46,11 @@ bool PointerWrap::CheckAfterWrite() {
_assert_(error != ERROR_NONE || mode == MODE_WRITE);
size_t offset = Offset();
if (measuredSize_ != 0 && offset != measuredSize_) {
WARN_LOG(SAVESTATE, "CheckAfterWrite: Size mismatch! %d but expected %d", (int)offset, (int)measuredSize_);
WARN_LOG(Log::SaveState, "CheckAfterWrite: Size mismatch! %d but expected %d", (int)offset, (int)measuredSize_);
return false;
}
if (!checkpoints_.empty() && curCheckpoint_ != checkpoints_.size()) {
WARN_LOG(SAVESTATE, "Checkpoint count mismatch!");
WARN_LOG(Log::SaveState, "Checkpoint count mismatch!");
return false;
}
return true;
@ -71,20 +71,20 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver)
} else if (mode == MODE_WRITE) {
if (!checkpoints_.empty()) {
if (checkpoints_.size() <= curCheckpoint_) {
WARN_LOG(SAVESTATE, "Write: Not enough checkpoints from measure pass (%d). cur section: %s", (int)checkpoints_.size(), title);
WARN_LOG(Log::SaveState, "Write: Not enough checkpoints from measure pass (%d). cur section: %s", (int)checkpoints_.size(), title);
SetError(ERROR_FAILURE);
return PointerWrapSection(*this, -1, title);
}
if (!checkpoints_[curCheckpoint_].Matches(marker, offset)) {
WARN_LOG(SAVESTATE, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, (int)offset, (int)checkpoints_[curCheckpoint_].offset);
WARN_LOG(Log::SaveState, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, (int)offset, (int)checkpoints_[curCheckpoint_].offset);
if (curCheckpoint_ > 1) {
WARN_LOG(SAVESTATE, "Previous checkpoint: %s (%d)", checkpoints_[curCheckpoint_ - 1].title, (int)checkpoints_[curCheckpoint_ - 1].offset);
WARN_LOG(Log::SaveState, "Previous checkpoint: %s (%d)", checkpoints_[curCheckpoint_ - 1].title, (int)checkpoints_[curCheckpoint_ - 1].offset);
}
SetError(ERROR_FAILURE);
return PointerWrapSection(*this, -1, title);
}
} else {
WARN_LOG(SAVESTATE, "Writing savestate without checkpoints. This is OK but should be fixed.");
WARN_LOG(Log::SaveState, "Writing savestate without checkpoints. This is OK but should be fixed.");
}
curCheckpoint_++;
}
@ -106,7 +106,7 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver)
firstBadSectionTitle_ = title;
}
if (mode != MODE_NOOP) {
WARN_LOG(SAVESTATE, "Savestate failure: wrong version %d found for section '%s'", foundVersion, title);
WARN_LOG(Log::SaveState, "Savestate failure: wrong version %d found for section '%s'", foundVersion, title);
SetError(ERROR_FAILURE);
}
return PointerWrapSection(*this, -1, title);
@ -162,7 +162,7 @@ void Do(PointerWrap &p, std::string &x) {
Do(p, stringLen);
if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) {
WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen);
WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen);
p.SetError(PointerWrap::ERROR_FAILURE);
return;
}
@ -182,7 +182,7 @@ void Do(PointerWrap &p, std::wstring &x) {
Do(p, stringLen);
if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) {
WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen);
WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen);
p.SetError(PointerWrap::ERROR_FAILURE);
return;
}
@ -210,7 +210,7 @@ void Do(PointerWrap &p, std::u16string &x) {
Do(p, stringLen);
if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) {
WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen);
WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen);
p.SetError(PointerWrap::ERROR_FAILURE);
return;
}
@ -271,7 +271,7 @@ void PointerWrap::DoMarker(const char *prevName, u32 arbitraryNumber) {
u32 cookie = arbitraryNumber;
Do(*this, cookie);
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) {
ERROR_LOG(SAVESTATE, "Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
ERROR_LOG(Log::SaveState, "Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber);
SetError(ERROR_FAILURE);
}
}
@ -284,31 +284,31 @@ PointerWrapSection::~PointerWrapSection() {
CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SChunkHeader &header, std::string *title) {
if (!pFile) {
ERROR_LOG(SAVESTATE, "ChunkReader: Can't open file for reading");
ERROR_LOG(Log::SaveState, "ChunkReader: Can't open file for reading");
return ERROR_BAD_FILE;
}
const u64 fileSize = pFile.GetSize();
u64 headerSize = sizeof(SChunkHeader);
if (fileSize < headerSize) {
ERROR_LOG(SAVESTATE, "ChunkReader: File too small");
ERROR_LOG(Log::SaveState, "ChunkReader: File too small");
return ERROR_BAD_FILE;
}
if (!pFile.ReadArray(&header, 1)) {
ERROR_LOG(SAVESTATE, "ChunkReader: Bad header size");
ERROR_LOG(Log::SaveState, "ChunkReader: Bad header size");
return ERROR_BAD_FILE;
}
if (header.Revision < REVISION_MIN) {
ERROR_LOG(SAVESTATE, "ChunkReader: Wrong file revision, got %d expected >= %d", header.Revision, REVISION_MIN);
ERROR_LOG(Log::SaveState, "ChunkReader: Wrong file revision, got %d expected >= %d", header.Revision, REVISION_MIN);
return ERROR_BAD_FILE;
}
if (header.Revision >= REVISION_TITLE) {
char titleFixed[128];
if (!pFile.ReadArray(titleFixed, sizeof(titleFixed))) {
ERROR_LOG(SAVESTATE, "ChunkReader: Unable to read title");
ERROR_LOG(Log::SaveState, "ChunkReader: Unable to read title");
return ERROR_BAD_FILE;
}
@ -323,7 +323,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SC
u32 sz = (u32)(fileSize - headerSize);
if (header.ExpectedSize != sz) {
ERROR_LOG(SAVESTATE, "ChunkReader: Bad file size, got %u expected %u", sz, header.ExpectedSize);
ERROR_LOG(Log::SaveState, "ChunkReader: Bad file size, got %u expected %u", sz, header.ExpectedSize);
return ERROR_BAD_FILE;
}
@ -332,7 +332,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SC
CChunkFileReader::Error CChunkFileReader::GetFileTitle(const Path &filename, std::string *title) {
if (!File::Exists(filename)) {
ERROR_LOG(SAVESTATE, "ChunkReader: File doesn't exist");
ERROR_LOG(Log::SaveState, "ChunkReader: File doesn't exist");
return ERROR_BAD_FILE;
}
@ -344,7 +344,7 @@ CChunkFileReader::Error CChunkFileReader::GetFileTitle(const Path &filename, std
CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::string *gitVersion, u8 *&_buffer, size_t &sz, std::string *failureReason) {
if (!File::Exists(filename)) {
*failureReason = "LoadStateDoesntExist";
ERROR_LOG(SAVESTATE, "ChunkReader: File doesn't exist");
ERROR_LOG(Log::SaveState, "ChunkReader: File doesn't exist");
return ERROR_BAD_FILE;
}
@ -360,7 +360,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st
u8 *buffer = new u8[sz];
if (!pFile.ReadBytes(buffer, sz))
{
ERROR_LOG(SAVESTATE, "ChunkReader: Error reading file");
ERROR_LOG(Log::SaveState, "ChunkReader: Error reading file");
delete [] buffer;
return ERROR_BAD_FILE;
}
@ -379,16 +379,16 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st
uncomp_size = status;
}
} else {
ERROR_LOG(SAVESTATE, "ChunkReader: Unexpected compression type %d", header.Compress);
ERROR_LOG(Log::SaveState, "ChunkReader: Unexpected compression type %d", header.Compress);
}
if (!success) {
ERROR_LOG(SAVESTATE, "ChunkReader: Failed to decompress file");
ERROR_LOG(Log::SaveState, "ChunkReader: Failed to decompress file");
delete [] uncomp_buffer;
delete [] buffer;
return ERROR_BAD_FILE;
}
if ((u32)uncomp_size != header.UncompressedSize) {
ERROR_LOG(SAVESTATE, "Size mismatch: file: %u calc: %u", header.UncompressedSize, (u32)uncomp_size);
ERROR_LOG(Log::SaveState, "Size mismatch: file: %u calc: %u", header.UncompressedSize, (u32)uncomp_size);
delete [] uncomp_buffer;
delete [] buffer;
return ERROR_BAD_FILE;
@ -411,11 +411,11 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st
// Takes ownership of buffer.
CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const std::string &title, const char *gitVersion, u8 *buffer, size_t sz) {
INFO_LOG(SAVESTATE, "ChunkReader: Writing %s", filename.c_str());
INFO_LOG(Log::SaveState, "ChunkReader: Writing %s", filename.c_str());
File::IOFile pFile(filename, "wb");
if (!pFile) {
ERROR_LOG(SAVESTATE, "ChunkReader: Error opening file for write");
ERROR_LOG(Log::SaveState, "ChunkReader: Error opening file for write");
free(buffer);
return ERROR_BAD_FILE;
}
@ -438,7 +438,7 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s
u8 *write_buffer = buffer;
if (!compressed_buffer) {
if (write_len != 0)
ERROR_LOG(SAVESTATE, "ChunkReader: Unable to allocate compressed buffer");
ERROR_LOG(Log::SaveState, "ChunkReader: Unable to allocate compressed buffer");
// We'll save uncompressed. Better than not saving...
write_len = sz;
usedType = SerializeCompressType::NONE;
@ -473,7 +473,7 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s
free(buffer);
write_buffer = compressed_buffer;
} else {
ERROR_LOG(SAVESTATE, "ChunkReader: Compression failed");
ERROR_LOG(Log::SaveState, "ChunkReader: Compression failed");
free(compressed_buffer);
// We can still save uncompressed.
@ -496,25 +496,25 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s
// Now let's start writing out the file...
if (!pFile.WriteArray(&header, 1)) {
ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing header");
ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing header");
free(write_buffer);
return ERROR_BAD_FILE;
}
if (!pFile.WriteArray(titleFixed, sizeof(titleFixed))) {
ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing title");
ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing title");
free(write_buffer);
return ERROR_BAD_FILE;
}
if (!pFile.WriteBytes(write_buffer, write_len)) {
ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing compressed data");
ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing compressed data");
free(write_buffer);
return ERROR_BAD_FILE;
} else if (sz != write_len) {
INFO_LOG(SAVESTATE, "Savestate: Compressed %i bytes into %i", (int)sz, (int)write_len);
INFO_LOG(Log::SaveState, "Savestate: Compressed %i bytes into %i", (int)sz, (int)write_len);
}
free(write_buffer);
INFO_LOG(SAVESTATE, "ChunkReader: Done writing %s", filename.c_str());
INFO_LOG(Log::SaveState, "ChunkReader: Done writing %s", filename.c_str());
return ERROR_NONE;
}

View File

@ -269,9 +269,9 @@ public:
failureReason->clear();
error = LoadPtr(ptr, _class, failureReason);
delete [] ptr;
INFO_LOG(SAVESTATE, "ChunkReader: Done loading '%s'", filename.c_str());
INFO_LOG(Log::SaveState, "ChunkReader: Done loading '%s'", filename.c_str());
} else {
WARN_LOG(SAVESTATE, "ChunkReader: Error found during load of '%s'", filename.c_str());
WARN_LOG(Log::SaveState, "ChunkReader: Error found during load of '%s'", filename.c_str());
}
return error;
}

View File

@ -48,7 +48,7 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to
callbackMap_[requestId] = { callback, failedCallback, token };
}
VERBOSE_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId);
VERBOSE_LOG(Log::System, "Making system request %s: id %d", RequestTypeAsString(type), requestId);
std::string p1(param1);
std::string p2(param2);
// TODO: Convert to string_view
@ -65,7 +65,7 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to
void RequestManager::ForgetRequestsWithToken(RequesterToken token) {
for (auto &iter : callbackMap_) {
if (iter.second.token == token) {
INFO_LOG(SYSTEM, "Forgetting about requester with token %d", token);
INFO_LOG(Log::System, "Forgetting about requester with token %d", token);
iter.second.callback = nullptr;
iter.second.failedCallback = nullptr;
}
@ -76,7 +76,7 @@ void RequestManager::PostSystemSuccess(int requestId, const char *responseString
std::lock_guard<std::mutex> guard(callbackMutex_);
auto iter = callbackMap_.find(requestId);
if (iter == callbackMap_.end()) {
ERROR_LOG(SYSTEM, "PostSystemSuccess: Unexpected request ID %d (responseString=%s)", requestId, responseString);
ERROR_LOG(Log::System, "PostSystemSuccess: Unexpected request ID %d (responseString=%s)", requestId, responseString);
return;
}
@ -86,7 +86,7 @@ void RequestManager::PostSystemSuccess(int requestId, const char *responseString
response.responseString = responseString;
response.responseValue = responseValue;
pendingSuccesses_.push_back(response);
DEBUG_LOG(SYSTEM, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue);
DEBUG_LOG(Log::System, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue);
callbackMap_.erase(iter);
}
@ -94,11 +94,11 @@ void RequestManager::PostSystemFailure(int requestId) {
std::lock_guard<std::mutex> guard(callbackMutex_);
auto iter = callbackMap_.find(requestId);
if (iter == callbackMap_.end()) {
ERROR_LOG(SYSTEM, "PostSystemFailure: Unexpected request ID %d", requestId);
ERROR_LOG(Log::System, "PostSystemFailure: Unexpected request ID %d", requestId);
return;
}
WARN_LOG(SYSTEM, "PostSystemFailure: Request %d failed", requestId);
WARN_LOG(Log::System, "PostSystemFailure: Request %d failed", requestId);
std::lock_guard<std::mutex> responseGuard(responseMutex_);
PendingFailure response;

View File

@ -99,7 +99,7 @@ void ThreadManager::Teardown() {
global_->threads_.clear();
if (global_->compute_queue_size > 0 || global_->io_queue_size > 0) {
WARN_LOG(SYSTEM, "ThreadManager::Teardown() with tasks still enqueued");
WARN_LOG(Log::System, "ThreadManager::Teardown() with tasks still enqueued");
}
}
@ -222,7 +222,7 @@ void ThreadManager::Init(int numRealCores, int numLogicalCoresPerCpu) {
int numThreads = numComputeThreads_ + std::max(MIN_IO_BLOCKING_THREADS, numComputeThreads_);
numThreads_ = numThreads;
INFO_LOG(SYSTEM, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_);
INFO_LOG(Log::System, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_);
for (int i = 0; i < numThreads; i++) {
TaskThreadContext *thread = new TaskThreadContext();

View File

@ -218,7 +218,7 @@ void SetCurrentThreadNameThroughException(const char *threadName) {
void AssertCurrentThreadName(const char *threadName) {
#ifdef TLS_SUPPORTED
if (strcmp(curThreadName, threadName) != 0) {
ERROR_LOG(SYSTEM, "Thread name assert failed: Expected %s, was %s", threadName, curThreadName);
ERROR_LOG(Log::System, "Thread name assert failed: Expected %s, was %s", threadName, curThreadName);
}
#endif
}

View File

@ -59,7 +59,7 @@ void UIContext::BeginFrame() {
// Load the smaller ascii font only, like on Android. For debug ui etc.
fontTexture_ = CreateTextureFromFile(draw_, "asciifont_atlas.zim", ImageFileType::ZIM, false);
if (!fontTexture_) {
WARN_LOG(SYSTEM, "Failed to load font_atlas.zim or asciifont_atlas.zim");
WARN_LOG(Log::System, "Failed to load font_atlas.zim or asciifont_atlas.zim");
}
}
}
@ -171,7 +171,7 @@ void UIContext::ActivateTopScissor() {
int w = std::max(0.0f, ceilf(scale_x * bounds.w));
int h = std::max(0.0f, ceilf(scale_y * bounds.h));
if (x < 0 || y < 0 || x + w > g_display.pixel_xres || y + h > g_display.pixel_yres) {
DEBUG_LOG(G3D, "UI scissor out of bounds: %d,%d-%d,%d / %d,%d", x, y, w, h, g_display.pixel_xres, g_display.pixel_yres);
DEBUG_LOG(Log::G3D, "UI scissor out of bounds: %d,%d-%d,%d / %d,%d", x, y, w, h, g_display.pixel_xres, g_display.pixel_yres);
if (x < 0) { w += x; x = 0; }
if (y < 0) { h += y; y = 0; }
if (x >= g_display.pixel_xres) { x = g_display.pixel_xres - 1; }

View File

@ -242,7 +242,7 @@ bool IconCache::InsertIcon(const std::string &key, IconFormat format, std::strin
if (data.empty()) {
_dbg_assert_(false);
ERROR_LOG(G3D, "Can't insert empty data into icon cache");
ERROR_LOG(Log::G3D, "Can't insert empty data into icon cache");
return false;
}
@ -253,7 +253,7 @@ bool IconCache::InsertIcon(const std::string &key, IconFormat format, std::strin
}
if (data.size() > 1024 * 512) {
WARN_LOG(G3D, "Unusually large icon inserted in icon cache: %s (%d bytes)", key.c_str(), (int)data.size());
WARN_LOG(Log::G3D, "Unusually large icon inserted in icon cache: %s (%d bytes)", key.c_str(), (int)data.size());
}
pending_.erase(key);
@ -299,7 +299,7 @@ Draw::Texture *IconCache::BindIconTexture(UIContext *context, const std::string
&height, &buffer);
if (result != 1) {
ERROR_LOG(G3D, "IconCache: Failed to load png (%d bytes) for key %s", (int)iter->second.data.size(), key.c_str());
ERROR_LOG(Log::G3D, "IconCache: Failed to load png (%d bytes) for key %s", (int)iter->second.data.size(), key.c_str());
iter->second.badData = true;
return nullptr;
}

View File

@ -98,7 +98,7 @@ bool IsFocusMovementEnabled() {
void LayoutViewHierarchy(const UIContext &dc, ViewGroup *root, bool ignoreInsets) {
if (!root) {
ERROR_LOG(SYSTEM, "Tried to layout a view hierarchy from a zero pointer root");
ERROR_LOG(Log::System, "Tried to layout a view hierarchy from a zero pointer root");
return;
}
@ -378,7 +378,7 @@ void UpdateViewHierarchy(ViewGroup *root) {
frameCount++;
if (!root) {
ERROR_LOG(SYSTEM, "Tried to update a view hierarchy from a zero pointer root");
ERROR_LOG(Log::System, "Tried to update a view hierarchy from a zero pointer root");
return;
}

View File

@ -19,7 +19,7 @@ void Screen::focusChanged(ScreenFocusChange focusChange) {
case ScreenFocusChange::FOCUS_LOST_TOP: eventName = "FOCUS_LOST_TOP"; break;
case ScreenFocusChange::FOCUS_BECAME_TOP: eventName = "FOCUS_BECAME_TOP"; break;
}
DEBUG_LOG(SYSTEM, "Screen %s got %s", this->tag(), eventName);
DEBUG_LOG(Log::System, "Screen %s got %s", this->tag(), eventName);
}
int Screen::GetRequesterToken() {
@ -45,7 +45,7 @@ void ScreenManager::switchScreen(Screen *screen) {
// TODO: inputLock_ ?
if (!nextStack_.empty() && screen == nextStack_.front().screen) {
ERROR_LOG(SYSTEM, "Already switching to this screen");
ERROR_LOG(Log::System, "Already switching to this screen");
return;
}
// Note that if a dialog is found, this will be a silent background switch that
@ -53,12 +53,12 @@ void ScreenManager::switchScreen(Screen *screen) {
// until that switch.
// TODO: is this still true?
if (!nextStack_.empty()) {
ERROR_LOG(SYSTEM, "Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen.");
ERROR_LOG(Log::System, "Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen.");
delete screen;
return;
}
if (screen == nullptr) {
WARN_LOG(SYSTEM, "Switching to a zero screen, this can't be good");
WARN_LOG(Log::System, "Switching to a zero screen, this can't be good");
}
if (stack_.empty() || screen != stack_.back().screen) {
screen->setScreenManager(this);
@ -85,7 +85,7 @@ void ScreenManager::update() {
void ScreenManager::switchToNext() {
std::lock_guard<std::recursive_mutex> guard(inputLock_);
if (nextStack_.empty()) {
ERROR_LOG(SYSTEM, "switchToNext: No nextStack_!");
ERROR_LOG(Log::System, "switchToNext: No nextStack_!");
}
Layer temp = {nullptr, 0};
@ -161,7 +161,7 @@ void ScreenManager::deviceRestored() {
}
void ScreenManager::resized() {
INFO_LOG(SYSTEM, "ScreenManager::resized(dp: %dx%d)", g_display.dp_xres, g_display.dp_yres);
INFO_LOG(Log::System, "ScreenManager::resized(dp: %dx%d)", g_display.dp_xres, g_display.dp_yres);
std::lock_guard<std::recursive_mutex> guard(inputLock_);
// Have to notify the whole stack, otherwise there will be problems when going back
// to non-top screens.
@ -238,7 +238,7 @@ ScreenRenderFlags ScreenManager::render() {
postRenderCb_(getUIContext(), postRenderUserdata_);
}
} else {
ERROR_LOG(SYSTEM, "No current screen!");
ERROR_LOG(Log::System, "No current screen!");
}
processFinishDialog();
@ -333,7 +333,7 @@ void ScreenManager::pop() {
stack_.back().screen->focusChanged(ScreenFocusChange::FOCUS_LOST_TOP);
}
} else {
ERROR_LOG(SYSTEM, "Can't pop when stack empty");
ERROR_LOG(Log::System, "Can't pop when stack empty");
}
}
@ -346,11 +346,11 @@ void ScreenManager::RecreateAllViews() {
void ScreenManager::finishDialog(Screen *dialog, DialogResult result) {
if (stack_.empty()) {
ERROR_LOG(SYSTEM, "Must be in a dialog to finishDialog");
ERROR_LOG(Log::System, "Must be in a dialog to finishDialog");
return;
}
if (dialog != stack_.back().screen) {
ERROR_LOG(SYSTEM, "Wrong dialog being finished!");
ERROR_LOG(Log::System, "Wrong dialog being finished!");
return;
}
dialog->onFinish(result);
@ -389,10 +389,10 @@ void ScreenManager::processFinishDialog() {
}
if (!caller) {
ERROR_LOG(SYSTEM, "ERROR: no top screen when finishing dialog");
ERROR_LOG(Log::System, "ERROR: no top screen when finishing dialog");
} else if (caller != topScreen()) {
// The caller may get confused if we call dialogFinished() now.
WARN_LOG(SYSTEM, "Skipping non-top dialog when finishing dialog.");
WARN_LOG(Log::System, "Skipping non-top dialog when finishing dialog.");
} else {
caller->dialogFinished(dialogFinished_, dialogResult_);
}

View File

@ -84,11 +84,11 @@ bool UIScreen::key(const KeyInput &key) {
bool UIScreen::UnsyncTouch(const TouchInput &touch) {
if (ClickDebug && root_ && (touch.flags & TOUCH_DOWN)) {
INFO_LOG(SYSTEM, "Touch down!");
INFO_LOG(Log::System, "Touch down!");
std::vector<UI::View *> views;
root_->Query(touch.x, touch.y, views);
for (auto view : views) {
INFO_LOG(SYSTEM, "%s", view->DescribeLog().c_str());
INFO_LOG(Log::System, "%s", view->DescribeLog().c_str());
}
}
@ -167,11 +167,11 @@ void UIScreen::update() {
break;
case QueuedEventType::TOUCH:
if (ClickDebug && (ev.touch.flags & TOUCH_DOWN)) {
INFO_LOG(SYSTEM, "Touch down!");
INFO_LOG(Log::System, "Touch down!");
std::vector<UI::View *> views;
root_->Query(ev.touch.x, ev.touch.y, views);
for (auto view : views) {
INFO_LOG(SYSTEM, "%s", view->DescribeLog().c_str());
INFO_LOG(Log::System, "%s", view->DescribeLog().c_str());
}
}
touch(ev.touch);
@ -262,7 +262,7 @@ bool UIDialogScreen::key(const KeyInput &key) {
bool retval = UIScreen::key(key);
if (!retval && (key.flags & KEY_DOWN) && UI::IsEscapeKey(key)) {
if (finished_) {
ERROR_LOG(SYSTEM, "Screen already finished");
ERROR_LOG(Log::System, "Screen already finished");
} else {
finished_ = true;
TriggerFinish(DR_BACK);

View File

@ -322,7 +322,7 @@ float GetTargetScore(const Point2D &originPos, int originIndex, const View *orig
float vertOverlap = VerticalOverlap(origin->GetBounds(), destination->GetBounds());
if (horizOverlap == 1.0f && vertOverlap == 1.0f) {
if (direction != FOCUS_PREV_PAGE && direction != FOCUS_NEXT_PAGE) {
INFO_LOG(SYSTEM, "Contain overlap");
INFO_LOG(Log::System, "Contain overlap");
return 0.0;
}
}
@ -379,7 +379,7 @@ float GetTargetScore(const Point2D &originPos, int originIndex, const View *orig
break;
case FOCUS_PREV:
case FOCUS_NEXT:
ERROR_LOG(SYSTEM, "Invalid focus direction");
ERROR_LOG(Log::System, "Invalid focus direction");
break;
}
@ -401,7 +401,7 @@ static float GetDirectionScore(int originIndex, const View *origin, View *destin
NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, NeighborResult result) {
if (!IsEnabled()) {
INFO_LOG(SCECTRL, "Not enabled");
INFO_LOG(Log::sceCtrl, "Not enabled");
return result;
}
if (GetVisibility() != V_VISIBLE) {
@ -467,7 +467,7 @@ NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, Nei
return NeighborResult(views_[(num + 1) % views_.size()], 0.0f);
default:
ERROR_LOG(SYSTEM, "Bad focus direction %d", (int)direction);
ERROR_LOG(Log::System, "Bad focus direction %d", (int)direction);
return result;
}
}
@ -882,7 +882,7 @@ void AnchorLayout::Layout() {
GridLayout::GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams)
: ViewGroup(layoutParams), settings_(settings) {
if (settings.orientation != ORIENT_HORIZONTAL)
ERROR_LOG(SYSTEM, "GridLayout: Vertical layouts not yet supported");
ERROR_LOG(Log::System, "GridLayout: Vertical layouts not yet supported");
}
void GridLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) {

View File

@ -188,7 +188,7 @@ bool X86AnalyzeMOV(const unsigned char *codePtr, LSInstructionInfo &info)
break;
default:
ERROR_LOG(CPU, "Unhandled disasm case in write handler!\n\nPlease implement or avoid.");
ERROR_LOG(Log::CPU, "Unhandled disasm case in write handler!\n\nPlease implement or avoid.");
return false;
}
}

View File

@ -1322,7 +1322,7 @@ void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {CheckFlags(); W
void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2)
{
if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg())
ERROR_LOG(JIT, "Redundant MOV @ %p - bug in JIT?", code);
ERROR_LOG(Log::JIT, "Redundant MOV @ %p - bug in JIT?", code);
WriteNormalOp(this, bits, nrmMOV, a1, a2);
}
void XEmitter::TEST(int bits, const OpArg &a1, const OpArg &a2) {CheckFlags(); WriteNormalOp(this, bits, nrmTEST, a1, a2);}

View File

@ -109,7 +109,7 @@ bool AVIDump::CreateAVI() {
const char *filename = s_format_context->filename;
snprintf(s_format_context->filename, sizeof(s_format_context->filename), "%s", video_file_name.c_str());
#endif
INFO_LOG(COMMON, "Recording Video to: %s", video_file_name.ToVisualString().c_str());
INFO_LOG(Log::Common, "Recording Video to: %s", video_file_name.ToVisualString().c_str());
// Make sure that the path exists
if (!File::Exists(GetSysDirectory(DIRECTORY_VIDEO)))
@ -168,9 +168,9 @@ bool AVIDump::CreateAVI() {
return false;
#endif
NOTICE_LOG(G3D, "Opening file %s for dumping", filename);
NOTICE_LOG(Log::G3D, "Opening file %s for dumping", filename);
if (avio_open(&s_format_context->pb, filename, AVIO_FLAG_WRITE) < 0 || avformat_write_header(s_format_context, nullptr)) {
WARN_LOG(G3D, "Could not open %s", filename);
WARN_LOG(Log::G3D, "Could not open %s", filename);
return false;
}
@ -264,10 +264,10 @@ void AVIDump::AddFrame() {
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
av_packet_unref(&pkt);
if (error < 0 && error != AVERROR(EAGAIN) && error != AVERROR_EOF)
ERROR_LOG(G3D, "Error while encoding video: %d", error);
ERROR_LOG(Log::G3D, "Error while encoding video: %d", error);
#else
if (error < 0)
ERROR_LOG(G3D, "Error while encoding video: %d", error);
ERROR_LOG(Log::G3D, "Error while encoding video: %d", error);
#endif
#endif
delete[] flipbuffer;
@ -280,7 +280,7 @@ void AVIDump::Stop() {
CloseFile();
s_file_index = 0;
#endif
NOTICE_LOG(G3D, "Stopping frame dump");
NOTICE_LOG(Log::G3D, "Stopping frame dump");
}
void AVIDump::CloseFile() {

View File

@ -149,7 +149,7 @@ void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID)
CheckSetting(iniFile, gameID, "Skyplane", &vrCompat_.Skyplane);
CheckSetting(iniFile, gameID, "UnitsPerMeter", &vrCompat_.UnitsPerMeter);
NOTICE_LOG(G3D, "UnitsPerMeter for %s: %f", gameID.c_str(), vrCompat_.UnitsPerMeter);
NOTICE_LOG(Log::G3D, "UnitsPerMeter for %s: %f", gameID.c_str(), vrCompat_.UnitsPerMeter);
}
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {

View File

@ -22,7 +22,7 @@
#include <set>
// Compatibility flags are controlled by assets/compat.ini.
// Alternatively, if PSP/SYSTEM/compat.ini exists, it is merged on top, to enable editing
// Alternatively, if PSP/System/compat.ini exists, it is merged on top, to enable editing
// the file on Android for tests.
//
// This file is not meant to be user-editable, although is kept as a separate ini

View File

@ -370,7 +370,7 @@ static int DefaultInternalResolution() {
}
int longestDisplaySide = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES));
int scale = longestDisplaySide >= 1000 ? 2 : 1;
INFO_LOG(G3D, "Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale);
INFO_LOG(Log::G3D, "Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale);
return scale;
#endif
}
@ -481,7 +481,7 @@ int Config::NextValidBackend() {
}
if (failed.count((GPUBackend)iGPUBackend)) {
ERROR_LOG(LOADER, "Graphics backend failed for %d, trying another", iGPUBackend);
ERROR_LOG(Log::Loader, "Graphics backend failed for %d, trying another", iGPUBackend);
#if !PPSSPP_PLATFORM(UWP)
if (!failed.count(GPUBackend::VULKAN) && VulkanMayBeAvailable()) {
@ -506,7 +506,7 @@ int Config::NextValidBackend() {
// They've all failed. Let them try the default - or on Android, OpenGL.
sFailedGPUBackends += ",ALL";
ERROR_LOG(LOADER, "All graphics backends failed");
ERROR_LOG(Log::Loader, "All graphics backends failed");
#if PPSSPP_PLATFORM(ANDROID)
return (int)GPUBackend::OPENGL;
#else
@ -1096,7 +1096,7 @@ void Config::UpdateIniLocation(const char *iniFileName, const char *controllerIn
bool Config::LoadAppendedConfig() {
IniFile iniFile;
if (!iniFile.Load(appendedConfigFileName_)) {
ERROR_LOG(LOADER, "Failed to read appended config '%s'.", appendedConfigFileName_.c_str());
ERROR_LOG(Log::Loader, "Failed to read appended config '%s'.", appendedConfigFileName_.c_str());
return false;
}
@ -1105,7 +1105,7 @@ bool Config::LoadAppendedConfig() {
setting.Get(section);
});
INFO_LOG(LOADER, "Loaded appended config '%s'.", appendedConfigFileName_.c_str());
INFO_LOG(Log::Loader, "Loaded appended config '%s'.", appendedConfigFileName_.c_str());
Save("Loaded appended config"); // Let's prevent reset
return true;
@ -1137,12 +1137,12 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
UpdateIniLocation(iniFileName, controllerIniFilename);
INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str());
INFO_LOG(Log::Loader, "Loading config: %s", iniFilename_.c_str());
bSaveSettings = true;
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
ERROR_LOG(LOADER, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str());
ERROR_LOG(Log::Loader, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str());
// Continue anyway to initialize the config.
}
@ -1179,7 +1179,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
// Fix JIT setting if no longer available.
if (!System_GetPropertyBool(SYSPROP_CAN_JIT)) {
if (iCpuCore == (int)CPUCore::JIT || iCpuCore == (int)CPUCore::JIT_IR) {
WARN_LOG(LOADER, "Forcing JIT off due to unavailablility");
WARN_LOG(Log::Loader, "Forcing JIT off due to unavailablility");
iCpuCore = (int)CPUCore::IR_INTERPRETER;
}
}
@ -1275,7 +1275,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
g_DownloadManager.StartDownloadWithCallback(versionUrl, Path(), http::ProgressBarMode::NONE, &DownloadCompletedCallback, "version", acceptMime);
}
INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str());
INFO_LOG(Log::Loader, "Loading controller config: %s", controllerIniFilename_.c_str());
bSaveSettings = true;
LoadStandardControllerIni();
@ -1291,7 +1291,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
PostLoadCleanup(false);
INFO_LOG(LOADER, "Config loaded: '%s' (%0.1f ms)", iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0);
INFO_LOG(Log::Loader, "Config loaded: '%s' (%0.1f ms)", iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0);
}
bool Config::Save(const char *saveReason) {
@ -1299,7 +1299,7 @@ bool Config::Save(const char *saveReason) {
if (!IsFirstInstance()) {
// TODO: Should we allow saving config if started from a different directory?
// How do we tell?
WARN_LOG(LOADER, "Not saving config - secondary instances don't.");
WARN_LOG(Log::Loader, "Not saving config - secondary instances don't.");
// Don't want to retry or something.
return true;
@ -1313,7 +1313,7 @@ bool Config::Save(const char *saveReason) {
CleanRecent();
IniFile iniFile;
if (!iniFile.Load(iniFilename_)) {
WARN_LOG(LOADER, "Likely saving config for first time - couldn't read ini '%s'", iniFilename_.c_str());
WARN_LOG(Log::Loader, "Likely saving config for first time - couldn't read ini '%s'", iniFilename_.c_str());
}
// Need to do this somewhere...
@ -1375,28 +1375,28 @@ bool Config::Save(const char *saveReason) {
playTimeTracker_.Save(playTime);
if (!iniFile.Save(iniFilename_)) {
ERROR_LOG(LOADER, "Error saving config (%s) - can't write ini '%s'", saveReason, iniFilename_.c_str());
ERROR_LOG(Log::Loader, "Error saving config (%s) - can't write ini '%s'", saveReason, iniFilename_.c_str());
return false;
}
INFO_LOG(LOADER, "Config saved (%s): '%s' (%0.1f ms)", saveReason, iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0);
INFO_LOG(Log::Loader, "Config saved (%s): '%s' (%0.1f ms)", saveReason, iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0);
if (!bGameSpecific) //otherwise we already did this in saveGameConfig()
{
IniFile controllerIniFile;
if (!controllerIniFile.Load(controllerIniFilename_)) {
ERROR_LOG(LOADER, "Error saving controller config - can't read ini first '%s'", controllerIniFilename_.c_str());
ERROR_LOG(Log::Loader, "Error saving controller config - can't read ini first '%s'", controllerIniFilename_.c_str());
}
KeyMap::SaveToIni(controllerIniFile);
if (!controllerIniFile.Save(controllerIniFilename_)) {
ERROR_LOG(LOADER, "Error saving config - can't write ini '%s'", controllerIniFilename_.c_str());
ERROR_LOG(Log::Loader, "Error saving config - can't write ini '%s'", controllerIniFilename_.c_str());
return false;
}
INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());
INFO_LOG(Log::Loader, "Controller config saved: %s", controllerIniFilename_.c_str());
}
PostSaveCleanup(false);
} else {
INFO_LOG(LOADER, "Not saving config");
INFO_LOG(Log::Loader, "Not saving config");
}
return true;
@ -1468,20 +1468,20 @@ void Config::NotifyUpdatedCpuCore() {
void Config::DownloadCompletedCallback(http::Request &download) {
if (download.ResultCode() != 200) {
ERROR_LOG(LOADER, "Failed to download %s: %d", download.url().c_str(), download.ResultCode());
ERROR_LOG(Log::Loader, "Failed to download %s: %d", download.url().c_str(), download.ResultCode());
return;
}
std::string data;
download.buffer().TakeAll(&data);
if (data.empty()) {
ERROR_LOG(LOADER, "Version check: Empty data from server!");
ERROR_LOG(Log::Loader, "Version check: Empty data from server!");
return;
}
json::JsonReader reader(data.c_str(), data.size());
const json::JsonGet root = reader.root();
if (!root) {
ERROR_LOG(LOADER, "Failed to parse json");
ERROR_LOG(Log::Loader, "Failed to parse json");
return;
}
@ -1494,16 +1494,16 @@ void Config::DownloadCompletedCallback(http::Request &download) {
Version dismissed(g_Config.dismissedVersion);
if (!installed.IsValid()) {
ERROR_LOG(LOADER, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION);
ERROR_LOG(Log::Loader, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION);
return;
}
if (!upgrade.IsValid()) {
ERROR_LOG(LOADER, "Version check: Invalid server version: %s", version.c_str());
ERROR_LOG(Log::Loader, "Version check: Invalid server version: %s", version.c_str());
return;
}
if (installed >= upgrade) {
INFO_LOG(LOADER, "Version check: Already up to date, erasing any upgrade message");
INFO_LOG(Log::Loader, "Version check: Already up to date, erasing any upgrade message");
g_Config.upgradeMessage.clear();
g_Config.upgradeVersion = upgrade.ToString();
g_Config.dismissedVersion.clear();
@ -1560,7 +1560,7 @@ void Config::RemoveRecent(const std::string &file) {
// The GUID part changes on each launch.
static bool TryUpdateSavedPath(Path *path) {
#if PPSSPP_PLATFORM(IOS)
INFO_LOG(LOADER, "Original path: %s", path->c_str());
INFO_LOG(Log::Loader, "Original path: %s", path->c_str());
std::string pathStr = path->ToString();
const std::string_view applicationRoot = "/var/mobile/Containers/Data/Application/";
@ -1593,7 +1593,7 @@ void Config::CleanRecent() {
std::lock_guard<std::mutex> guard(private_->recentIsosLock);
std::vector<std::string> cleanedRecent;
if (recentIsos.empty()) {
INFO_LOG(LOADER, "No recents list found.");
INFO_LOG(Log::Loader, "No recents list found.");
}
for (size_t i = 0; i < recentIsos.size(); i++) {
@ -1606,7 +1606,7 @@ void Config::CleanRecent() {
if (!exists) {
if (TryUpdateSavedPath(&path)) {
exists = File::Exists(path);
INFO_LOG(LOADER, "Exists=%d when checking updated path: %s", exists, path.c_str());
INFO_LOG(Log::Loader, "Exists=%d when checking updated path: %s", exists, path.c_str());
}
}
break;
@ -1625,13 +1625,13 @@ void Config::CleanRecent() {
cleanedRecent.push_back(pathStr);
}
} else {
DEBUG_LOG(LOADER, "Removed %s from recent. errno=%d", path.c_str(), errno);
DEBUG_LOG(Log::Loader, "Removed %s from recent. errno=%d", path.c_str(), errno);
}
}
double recentTime = time_now_d() - startTime;
if (recentTime > 0.1) {
INFO_LOG(SYSTEM, "CleanRecent took %0.2f", recentTime);
INFO_LOG(Log::System, "CleanRecent took %0.2f", recentTime);
}
recentIsos = cleanedRecent;
});
@ -1790,7 +1790,7 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title
Path iniFileNameFull = getGameConfigFile(pGameId);
if (!hasGameConfig(pGameId)) {
DEBUG_LOG(LOADER, "No game-specific settings found in %s. Using global defaults.", iniFileNameFull.c_str());
DEBUG_LOG(Log::Loader, "No game-specific settings found in %s. Using global defaults.", iniFileNameFull.c_str());
return false;
}
@ -1805,7 +1805,7 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title
if (sscanf(it.second.c_str(), "%f", &value)) {
mPostShaderSetting[it.first] = value;
} else {
WARN_LOG(LOADER, "Invalid float value string for param %s: '%s'", it.first.c_str(), it.second.c_str());
WARN_LOG(Log::Loader, "Invalid float value string for param %s: '%s'", it.first.c_str(), it.second.c_str());
}
}
@ -1870,7 +1870,7 @@ void Config::unloadGameConfig() {
void Config::LoadStandardControllerIni() {
IniFile controllerIniFile;
if (!controllerIniFile.Load(controllerIniFilename_)) {
ERROR_LOG(LOADER, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str());
ERROR_LOG(Log::Loader, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str());
KeyMap::RestoreDefault();
} else {
// Continue anyway to initialize the config. It will just restore the defaults.
@ -1934,7 +1934,7 @@ void PlayTimeTracker::Start(const std::string &gameId) {
if (gameId.empty()) {
return;
}
INFO_LOG(SYSTEM, "GameTimeTracker::Start(%s)", gameId.c_str());
INFO_LOG(Log::System, "GameTimeTracker::Start(%s)", gameId.c_str());
auto iter = tracker_.find(std::string(gameId));
if (iter != tracker_.end()) {
@ -1957,7 +1957,7 @@ void PlayTimeTracker::Stop(const std::string &gameId) {
return;
}
INFO_LOG(SYSTEM, "GameTimeTracker::Stop(%s)", gameId.c_str());
INFO_LOG(Log::System, "GameTimeTracker::Stop(%s)", gameId.c_str());
auto iter = tracker_.find(std::string(gameId));
if (iter != tracker_.end()) {
@ -1970,7 +1970,7 @@ void PlayTimeTracker::Stop(const std::string &gameId) {
}
// Shouldn't happen, ignore this case.
WARN_LOG(SYSTEM, "GameTimeTracker::Stop called without corresponding GameTimeTracker::Start");
WARN_LOG(Log::System, "GameTimeTracker::Stop called without corresponding GameTimeTracker::Start");
}
void PlayTimeTracker::Load(const Section *section) {

View File

@ -170,7 +170,7 @@ enum class DebugOverlay : int {
FRAME_PROFILE,
#endif
CONTROL,
AUDIO,
Audio,
GPU_PROFILE,
GPU_ALLOCATOR,
FRAMEBUFFER_LIST,

View File

@ -57,7 +57,7 @@ float ControlMapper::GetDeviceAxisThreshold(int device, const InputMapping &mapp
if (absCoValue > 0.0f) {
// Bias down the threshold if the other axis is active.
float biasedThreshold = AXIS_BIND_THRESHOLD * (1.0f - absCoValue * 0.35f);
// INFO_LOG(SYSTEM, "coValue: %f threshold: %f", absCoValue, biasedThreshold);
// INFO_LOG(Log::System, "coValue: %f threshold: %f", absCoValue, biasedThreshold);
return biasedThreshold;
}
}
@ -309,7 +309,7 @@ float ControlMapper::MapAxisValue(float value, int vkId, const InputMapping &map
if (direction == -1) {
ranged = 1.0f - ranged;
}
// NOTICE_LOG(SYSTEM, "rawValue: %f other: %f signed: %f ranged: %f", iter->second, valueOther, signedValue, ranged);
// NOTICE_LOG(Log::System, "rawValue: %f other: %f signed: %f ranged: %f", iter->second, valueOther, signedValue, ranged);
return ranged;
} else {
return value;
@ -506,13 +506,13 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no
bool bValue = value >= threshold;
if (virtKeys_[i] != value) {
// INFO_LOG(G3D, "vkeyanalog %s : %f", KeyMap::GetVirtKeyName(vkId), value);
// INFO_LOG(Log::G3D, "vkeyanalog %s : %f", KeyMap::GetVirtKeyName(vkId), value);
onVKeyAnalog(changedMapping.deviceId, vkId, value);
virtKeys_[i] = value;
}
if (!bPrevValue && bValue) {
// INFO_LOG(G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId));
// INFO_LOG(Log::G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId));
onVKey(vkId, true);
virtKeyOn_[vkId - VIRTKEY_FIRST] = true;
@ -520,7 +520,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no
updateAnalogSticks = true;
}
} else if (bPrevValue && !bValue) {
// INFO_LOG(G3D, "vkeyoff %s", KeyMap::GetVirtKeyName(vkId));
// INFO_LOG(Log::G3D, "vkeyoff %s", KeyMap::GetVirtKeyName(vkId));
onVKey(vkId, false);
virtKeyOn_[vkId - VIRTKEY_FIRST] = false;
@ -563,7 +563,7 @@ bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) {
// TODO: See if this can be simplified further somehow.
if ((key.flags & KEY_DOWN) && key.keyCode == NKCODE_BACK) {
bool mappingFound = KeyMap::InputMappingToPspButton(mapping, nullptr);
DEBUG_LOG(SYSTEM, "Key: %d DeviceId: %d", key.keyCode, key.deviceId);
DEBUG_LOG(Log::System, "Key: %d DeviceId: %d", key.keyCode, key.deviceId);
if (!mappingFound || key.deviceId == DEVICE_ID_DEFAULT) {
*pauseTrigger = true;
return true;
@ -682,7 +682,7 @@ void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) {
onVKeyAnalog(deviceId, pspKeyCode, 0.0f);
}
} else {
// INFO_LOG(SYSTEM, "pspKey %d %d", pspKeyCode, flags);
// INFO_LOG(Log::System, "pspKey %d %d", pspKeyCode, flags);
if (flags & KEY_DOWN)
updatePSPButtons_(pspKeyCode, 0);
if (flags & KEY_UP)
@ -715,7 +715,7 @@ void ControlMapper::onVKeyAnalog(int deviceId, int vkey, float value) {
float oppVal = virtKeys_[oppositeVKey - VIRTKEY_FIRST];
if (oppVal != 0.0f) {
value -= oppVal;
// NOTICE_LOG(SCECTRL, "Reducing %f by %f (from %08x : %s)", value, oppVal, oppositeVKey, KeyMap::GetPspButtonName(oppositeVKey).c_str());
// NOTICE_LOG(Log::sceCtrl, "Reducing %f by %f (from %08x : %s)", value, oppVal, oppositeVKey, KeyMap::GetPspButtonName(oppositeVKey).c_str());
}
}
SetPSPAxis(deviceId, stick, axis, sign * value);

View File

@ -404,16 +404,16 @@ void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionTy
const char *desc = MemoryExceptionTypeAsString(type);
// In jit, we only flush PC when bIgnoreBadMemAccess is off.
if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) {
WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x)", desc, address, accessSize);
WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x)", desc, address, accessSize);
} else {
WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
}
if (!g_Config.bIgnoreBadMemAccess) {
// Try to fetch a call stack, to start with.
std::vector<MIPSStackWalk::StackFrame> stackFrames = WalkCurrentStack(-1);
std::string stackTrace = FormatStackTrace(stackFrames);
WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str());
WARN_LOG(Log::MemMap, "\n%s", stackTrace.c_str());
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
@ -432,16 +432,16 @@ void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExcepti
const char *desc = MemoryExceptionTypeAsString(type);
// In jit, we only flush PC when bIgnoreBadMemAccess is off.
if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) {
WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x). %.*s", desc, address, accessSize, (int)additionalInfo.length(), additionalInfo.data());
WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x). %.*s", desc, address, accessSize, (int)additionalInfo.length(), additionalInfo.data());
} else {
WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x %.*s", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA], (int)additionalInfo.length(), additionalInfo.data());
WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x %.*s", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA], (int)additionalInfo.length(), additionalInfo.data());
}
if (!g_Config.bIgnoreBadMemAccess || forceReport) {
// Try to fetch a call stack, to start with.
std::vector<MIPSStackWalk::StackFrame> stackFrames = WalkCurrentStack(-1);
std::string stackTrace = FormatStackTrace(stackFrames);
WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str());
WARN_LOG(Log::MemMap, "\n%s", stackTrace.c_str());
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
@ -459,7 +459,7 @@ void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExcepti
// Can't be ignored
void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) {
const char *desc = ExecExceptionTypeAsString(type);
WARN_LOG(MEMMAP, "%s: Invalid exec address %08x PC %08x LR %08x", desc, address, pc, currentMIPS->r[MIPS_REG_RA]);
WARN_LOG(Log::MemMap, "%s: Invalid exec address %08x PC %08x LR %08x", desc, address, pc, currentMIPS->r[MIPS_REG_RA]);
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};
@ -475,7 +475,7 @@ void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) {
}
void Core_Break(u32 pc) {
ERROR_LOG(CPU, "BREAK!");
ERROR_LOG(Log::CPU, "BREAK!");
MIPSExceptionInfo &e = g_exceptionInfo;
e = {};

View File

@ -152,7 +152,7 @@ int RegisterEvent(const char *name, TimedCallback callback) {
}
void AntiCrashCallback(u64 userdata, int cyclesLate) {
ERROR_LOG(SAVESTATE, "Savestate broken: an unregistered event was called.");
ERROR_LOG(Log::SaveState, "Savestate broken: an unregistered event was called.");
Core_EnableStepping(true, "savestate.crash", 0);
}
@ -366,7 +366,7 @@ void RemoveEvent(int event_type)
void ProcessEvents() {
while (first) {
if (first->time <= (s64)GetTicks()) {
// INFO_LOG(CPU, "%s (%lld, %lld) ", first->name ? first->name : "?", (u64)GetTicks(), (u64)first->time);
// INFO_LOG(Log::CPU, "%s (%lld, %lld) ", first->name ? first->name : "?", (u64)GetTicks(), (u64)first->time);
Event *evt = first;
first = first->next;
if (evt->type >= 0 && evt->type < event_types.size()) {
@ -425,7 +425,7 @@ void Advance() {
void LogPendingEvents() {
Event *ptr = first;
while (ptr) {
//INFO_LOG(CPU, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
//INFO_LOG(Log::CPU, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type);
ptr = ptr->next;
}
}
@ -447,7 +447,7 @@ void Idle(int maxIdle) {
if (cyclesDown < 0)
cyclesDown = 0;
// VERBOSE_LOG(CPU, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f));
// VERBOSE_LOG(Log::CPU, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f));
idledCycles += cyclesDown;
currentMIPS->downcount -= cyclesDown;
@ -499,7 +499,7 @@ void DoState(PointerWrap &p) {
int current = n;
Do(p, n);
if (n > current) {
WARN_LOG(SAVESTATE, "Savestate failure: more events than current (can't ever remove an event)");
WARN_LOG(Log::SaveState, "Savestate failure: more events than current (can't ever remove an event)");
p.SetError(p.ERROR_FAILURE);
return;
}

View File

@ -47,11 +47,11 @@ void MemCheck::Log(u32 addr, bool write, int size, u32 pc, const char *reason) {
if (result & BREAK_ACTION_LOG) {
const char *type = write ? "Write" : "Read";
if (logFormat.empty()) {
NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str());
NOTICE_LOG(Log::MemMap, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str());
} else {
std::string formatted;
CBreakPoints::EvaluateLogFormat(currentDebugMIPS, logFormat, formatted);
NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason, addr, formatted.c_str());
NOTICE_LOG(Log::MemMap, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason, addr, formatted.c_str());
}
}
}
@ -323,11 +323,11 @@ BreakAction CBreakPoints::ExecBreakPoint(u32 addr) {
if (info.result & BREAK_ACTION_LOG) {
if (info.logFormat.empty()) {
NOTICE_LOG(JIT, "BKP PC=%08x (%s)", addr, g_symbolMap->GetDescription(addr).c_str());
NOTICE_LOG(Log::JIT, "BKP PC=%08x (%s)", addr, g_symbolMap->GetDescription(addr).c_str());
} else {
std::string formatted;
CBreakPoints::EvaluateLogFormat(currentDebugMIPS, info.logFormat, formatted);
NOTICE_LOG(JIT, "BKP PC=%08x: %s", addr, formatted.c_str());
NOTICE_LOG(Log::JIT, "BKP PC=%08x: %s", addr, formatted.c_str());
}
}
if ((info.result & BREAK_ACTION_PAUSE) && coreState != CORE_POWERUP) {

View File

@ -165,7 +165,7 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) {
type = (SymbolType) typeInt;
if (!hasModules) {
if (!Memory::IsValidAddress(vaddress)) {
ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name);
ERROR_LOG(Log::Loader, "Invalid address in symbol file: %08x (%s)", vaddress, name);
continue;
}
} else {
@ -173,7 +173,7 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) {
moduleIndex = vaddress;
vaddress = GetModuleAbsoluteAddr(address, moduleIndex);
if (!Memory::IsValidAddress(vaddress)) {
ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name);
ERROR_LOG(Log::Loader, "Invalid address in symbol file: %08x (%s)", vaddress, name);
continue;
}
}

View File

@ -108,7 +108,7 @@ static void WebSocketNotifyLifecycle(CoreLifecycle stage) {
case CoreLifecycle::STOPPING:
case CoreLifecycle::MEMORY_REINITING:
if (debuggersConnected > 0) {
DEBUG_LOG(SYSTEM, "Waiting for debugger to complete on shutdown");
DEBUG_LOG(Log::System, "Waiting for debugger to complete on shutdown");
}
lifecycleLock.lock();
break;
@ -118,7 +118,7 @@ static void WebSocketNotifyLifecycle(CoreLifecycle stage) {
case CoreLifecycle::MEMORY_REINITED:
lifecycleLock.unlock();
if (debuggersConnected > 0) {
DEBUG_LOG(SYSTEM, "Debugger ready for shutdown");
DEBUG_LOG(Log::System, "Debugger ready for shutdown");
}
break;
}

Some files were not shown because too many files have changed in this diff Show More