diff --git a/Common/Log.h b/Common/Log.h index 1b1ab1ed07..481795bde2 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -38,7 +38,7 @@ namespace LogTypes { enum LOG_TYPE { - SYSTEM = 0, + SYSTEM = 0, // Catch-all for uncategorized things BOOT, COMMON, CPU, @@ -52,6 +52,8 @@ enum LOG_TYPE { SASMIX, SAVESTATE, FRAMEBUF, + AUDIO, + IO, SCEAUDIO, SCECTRL, diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index c13a3d712f..f16971c70c 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -93,7 +93,9 @@ static const LogNameTableEntry logTable[] = { {LogTypes::MEMMAP, "MEMMAP"}, {LogTypes::SASMIX, "SASMIX"}, {LogTypes::SAVESTATE, "SAVESTATE"}, - {LogTypes::FRAMEBUF, "FRAMEBUF"}, + {LogTypes::FRAMEBUF, "FRAMEBUF"}, + {LogTypes::AUDIO, "AUDIO"}, + {LogTypes::IO, "IO"}, {LogTypes::SCEAUDIO, "SCEAUDIO"}, {LogTypes::SCECTRL, "SCECTRL"}, @@ -113,9 +115,7 @@ static const LogNameTableEntry logTable[] = { LogManager::LogManager() { for (size_t i = 0; i < ARRAY_SIZE(logTable); i++) { - if (i != logTable[i].logType) { - FLOG("Bad logtable at %i", (int)i); - } + _assert_msg_(i == logTable[i].logType, "Bad logtable at %i", (int)i); truncate_cpy(log_[logTable[i].logType].m_shortName, logTable[i].name); log_[logTable[i].logType].enabled = true; #if defined(_DEBUG) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index c049729246..987b626d6b 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1799,7 +1799,7 @@ void __KernelGPUReplay() { // Special ABI: s0 and s1 are the "args". Not null terminated. const char *filenamep = Memory::GetCharPointer(currentMIPS->r[MIPS_REG_S1]); if (!filenamep) { - ERROR_LOG(SYSTEM, "Failed to load dump filename"); + ERROR_LOG(G3D, "Failed to load dump filename"); Core_Stop(); return; } diff --git a/Core/Screenshot.cpp b/Core/Screenshot.cpp index fb1ef83944..74c10ca2fe 100644 --- a/Core/Screenshot.cpp +++ b/Core/Screenshot.cpp @@ -71,13 +71,12 @@ private: static bool WriteScreenshotToJPEG(const char *filename, int width, int height, int num_channels, const uint8_t *image_data, const jpge::params &comp_params) { JPEGFileStream dst_stream(filename); if (!dst_stream.Valid()) { - ERROR_LOG(SYSTEM, "Unable to open screenshot file for writing."); + ERROR_LOG(IO, "Unable to open screenshot file for writing."); return false; } jpge::jpeg_encoder dst_image; if (!dst_image.init(&dst_stream, width, height, num_channels, comp_params)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode init failed."); return false; } @@ -85,12 +84,10 @@ static bool WriteScreenshotToJPEG(const char *filename, int width, int height, i for (int i = 0; i < height; i++) { const uint8_t *buf = image_data + i * width * num_channels; if (!dst_image.process_scanline(buf)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode scanline failed."); return false; } } if (!dst_image.process_scanline(NULL)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode scanline flush failed."); return false; } } @@ -106,18 +103,15 @@ static bool WriteScreenshotToJPEG(const char *filename, int width, int height, i static bool WriteScreenshotToPNG(png_imagep image, const char *filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(SYSTEM, "Unable to open screenshot file for writing."); + ERROR_LOG(IO, "Unable to open screenshot file for writing."); return false; } if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer, row_stride, colormap)) { - if (fclose(fp) != 0) { - ERROR_LOG(SYSTEM, "Screenshot file write failed."); - return false; - } + fclose(fp); return true; } else { - ERROR_LOG(SYSTEM, "Screenshot PNG encode failed."); + ERROR_LOG(IO, "Screenshot PNG encode failed."); fclose(fp); remove(filename); return false; @@ -347,7 +341,7 @@ bool TakeGameScreenshot(const char *filename, ScreenshotFormat fmt, ScreenshotTy delete [] flipbuffer; if (!success) { - ERROR_LOG(SYSTEM, "Failed to write screenshot."); + ERROR_LOG(IO, "Failed to write screenshot."); } return success; } @@ -368,7 +362,7 @@ bool Save888RGBScreenshot(const char *filename, ScreenshotFormat fmt, const u8 * png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(SYSTEM, "Saving screenshot to PNG produced errors."); + ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); success = false; } return success; @@ -397,7 +391,7 @@ bool Save8888RGBAScreenshot(const char *filename, const u8 *buffer, int w, int h png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(SYSTEM, "Saving screenshot to PNG produced errors."); + ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); success = false; } return success; diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index f403deba44..ad1de50dd4 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -380,15 +380,11 @@ void TextureReplacer::PopulateReplacement(ReplacedTexture *result, u64 cachekey, static bool WriteTextureToPNG(png_imagep image, const std::string &filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(SYSTEM, "Unable to open texture file for writing."); + ERROR_LOG(IO, "Unable to open texture file for writing."); return false; } if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer, row_stride, colormap)) { - if (fclose(fp) != 0) { - ERROR_LOG(SYSTEM, "Texture file write failed."); - return false; - } return true; } else { ERROR_LOG(SYSTEM, "Texture PNG encode failed."); diff --git a/Core/WaveFile.cpp b/Core/WaveFile.cpp index 038c66e80f..b1c56b002c 100644 --- a/Core/WaveFile.cpp +++ b/Core/WaveFile.cpp @@ -11,9 +11,7 @@ constexpr size_t WaveFileWriter::BUFFER_SIZE; -WaveFileWriter::WaveFileWriter() -{ -} +WaveFileWriter::WaveFileWriter() {} WaveFileWriter::~WaveFileWriter() { @@ -30,7 +28,7 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa file.Open(filename, "wb"); if (!file) { - ERROR_LOG(SYSTEM, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); + ERROR_LOG(IO, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); return false; } diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 8e291942db..864cf678e6 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -887,7 +887,8 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (vfb) { // Okay, we found one above. - INFO_LOG_REPORT_ONCE(displayoffset, HLE, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); + // Log should be "Displaying from framebuf" but not worth changing the report. + INFO_LOG_REPORT_ONCE(displayoffset, FRAMEBUF, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); } } diff --git a/ext/native/file/chunk_file.cpp b/ext/native/file/chunk_file.cpp index 4cd4e5157c..0804040038 100644 --- a/ext/native/file/chunk_file.cpp +++ b/ext/native/file/chunk_file.cpp @@ -49,7 +49,7 @@ bool RIFFReader::Descend(uint32_t intoId) { int startLocation = pos_; if (pos_ + length > fileSize_) { - ERROR_LOG(SYSTEM, "Block extends outside of RIFF file - failing descend"); + ERROR_LOG(IO, "Block extends outside of RIFF file - failing descend"); pos_ = stack[depth_].parentStartLocation; return false; } @@ -64,7 +64,7 @@ bool RIFFReader::Descend(uint32_t intoId) { if (length > 0) { pos_ += length; // try next block } else { - ERROR_LOG(SYSTEM, "Bad data in RIFF file : block length %d. Not descending.", length); + ERROR_LOG(IO, "Bad data in RIFF file : block length %d. Not descending.", length); pos_ = stack[depth_].parentStartLocation; return false; } diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index 61ce579814..b77a8fd4fd 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -791,30 +791,30 @@ static void LogReadPixelsError(GLenum error) { case GL_NO_ERROR: break; case GL_INVALID_ENUM: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_ENUM"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_ENUM"); break; case GL_INVALID_VALUE: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_VALUE"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_VALUE"); break; case GL_INVALID_OPERATION: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_OPERATION"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_OPERATION"); break; case GL_INVALID_FRAMEBUFFER_OPERATION: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); break; case GL_OUT_OF_MEMORY: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_OUT_OF_MEMORY"); + ERROR_LOG(G3D, "glReadPixels: GL_OUT_OF_MEMORY"); break; #ifndef USING_GLES2 case GL_STACK_UNDERFLOW: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_STACK_UNDERFLOW"); + ERROR_LOG(G3D, "glReadPixels: GL_STACK_UNDERFLOW"); break; case GL_STACK_OVERFLOW: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_STACK_OVERFLOW"); + ERROR_LOG(G3D, "glReadPixels: GL_STACK_OVERFLOW"); break; #endif default: - ERROR_LOG(FRAMEBUF, "glReadPixels: %08x", error); + ERROR_LOG(G3D, "glReadPixels: %08x", error); break; } }