diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp new file mode 100644 index 0000000000..f4e0cdbdd2 --- /dev/null +++ b/Utilities/Log.cpp @@ -0,0 +1,225 @@ +#include "stdafx.h" +#include "Log.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace Log; + +LogManager *gLogManager = nullptr; + +u32 LogMessage::size() +{ + //1 byte for NULL terminator + return sizeof(LogMessage::size_type) + sizeof(LogType) + sizeof(LogSeverity) + sizeof(std::string::value_type)*mText.size() + 1; +} + +void LogMessage::serialize(char *output) +{ + LogMessage::size_type size = this->size(); + memcpy(output, &size, sizeof(LogMessage::size_type)); + output += sizeof(LogMessage::size_type); + memcpy(output, &mType, sizeof(LogType)); + output += sizeof(LogType); + memcpy(output, &mServerity, sizeof(LogSeverity)); + output += sizeof(LogSeverity); + memcpy(output, mText.c_str(), mText.size() ); + output += sizeof(std::string::value_type)*mText.size(); + *output = '\0'; + +} +LogMessage LogMessage::deserialize(char *input, u32* size_out) +{ + LogMessage msg; + LogMessage::size_type msgSize = *(reinterpret_cast(input)); + input += sizeof(LogMessage::size_type); + msg.mType = *(reinterpret_cast(input)); + input += sizeof(LogType); + msg.mServerity = *(reinterpret_cast(input)); + input += sizeof(LogSeverity); + if (msgSize > 9000) + { + int wtf = 6; + } + msg.mText.append(input, msgSize - 1 - sizeof(LogSeverity) - sizeof(LogType)); + if (size_out){(*size_out) = msgSize;} + return msg; +} + + + +LogChannel::LogChannel() : LogChannel("unknown") +{} + +LogChannel::LogChannel(const std::string& name) : + name(name) + , mEnabled(true) + , mLogLevel(Warning) +{} + +void LogChannel::log(LogMessage msg) +{ + std::lock_guard lock(mListenerLock); + for (auto &listener : mListeners) + { + listener->log(msg); + } +} + +void LogChannel::addListener(std::shared_ptr listener) +{ + std::lock_guard lock(mListenerLock); + mListeners.insert(listener); +} +void LogChannel::removeListener(std::shared_ptr listener) +{ + std::lock_guard lock(mListenerLock); + mListeners.erase(listener); +} + +struct CoutListener : LogListener +{ + void log(LogMessage msg) + { + std::cerr << msg.mText << std::endl; + } +}; + +struct FileListener : LogListener +{ + rFile mFile; + bool mPrependChannelName; + + FileListener(const std::string& name = _PRGNAME_, bool prependChannel = true) + : mFile(name + ".log", rFile::write), + mPrependChannelName(prependChannel) + { + if (!mFile.IsOpened()) + { + rMessageBox("Can't create log file! (" + name + ".log)", rMessageBoxCaptionStr, rICON_ERROR); + } + } + + void log(LogMessage msg) + { + if (mPrependChannelName) + { + msg.mText.insert(0, gTypeNameTable[static_cast(msg.mType)].mName); + } + mFile.Write(msg.mText); + } +}; + +LogManager::LogManager() +#ifdef BUFFERED_LOGGING + : mExiting(false), mLogConsumer() +#endif +{ + auto it = mChannels.begin(); + std::shared_ptr listener(new FileListener()); + for (const LogTypeName& name : gTypeNameTable) + { + it->name = name.mName; + it->addListener(listener); + it++; + } + std::shared_ptr TTYListener(new FileListener("TTY",false)); + getChannel(TTY).addListener(TTYListener); +#ifdef BUFFERED_LOGGING + mLogConsumer = std::thread(&LogManager::consumeLog, this); +#endif +} + +LogManager::~LogManager() +{ +#ifdef BUFFERED_LOGGING + mExiting = true; + mBufferReady.notify_all(); + mLogConsumer.join(); +} + +void LogManager::consumeLog() +{ + std::unique_lock lock(mStatusMut); + while (!mExiting) + { + mBufferReady.wait(lock); + mBuffer.lockGet(); + size_t size = mBuffer.size(); + std::vector local_messages(size); + mBuffer.popN(&local_messages.front(), size); + mBuffer.unlockGet(); + + u32 cursor = 0; + u32 removed = 0; + while (cursor < size) + { + Log::LogMessage msg = Log::LogMessage::deserialize(local_messages.data() + cursor, &removed); + cursor += removed; + getChannel(msg.mType).log(msg); + } + } +#endif +} + +void LogManager::log(LogMessage msg) +{ + //don't do any formatting changes or filtering to the TTY output since we + //use the raw output to do diffs with the output of a real PS3 and some + //programs write text in single bytes to the console + if (msg.mType != TTY) + { + std::string prefix; + switch (msg.mServerity) + { + case Success: + prefix = "S "; + break; + case Notice: + prefix = "! "; + break; + case Warning: + prefix = "W "; + break; + case Error: + prefix = "E "; + break; + } + if (NamedThreadBase* thr = GetCurrentNamedThread()) + { + prefix += thr->GetThreadName(); + } + msg.mText.insert(0, prefix); + msg.mText.append(1,'\n'); + } +#ifdef BUFFERED_LOGGING + size_t size = msg.size(); + std::vector temp_buffer(size); + msg.serialize(temp_buffer.data()); + mBuffer.pushRange(temp_buffer.begin(), temp_buffer.end()); + mBufferReady.notify_one(); +#else + mChannels[static_cast(msg.mType)].log(msg); +#endif +} + + +LogManager& LogManager::getInstance() +{ + if (!gLogManager) + { + gLogManager = new LogManager(); + } + return *gLogManager; +} +LogChannel &LogManager::getChannel(LogType type) +{ + return mChannels[static_cast(type)]; +} \ No newline at end of file diff --git a/Utilities/Log.h b/Utilities/Log.h new file mode 100644 index 0000000000..bf98355690 --- /dev/null +++ b/Utilities/Log.h @@ -0,0 +1,139 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include "Utilities/MTRingbuffer.h" + +//#define BUFFERED_LOGGING 1 + +//another msvc bug makes these not work, uncomment these and replace it with the one at the bottom when it's fixed +//#define LOG_MESSAGE(logType, severity, text) Log::LogManager::getInstance().log({logType, severity, text}) + +//first parameter is of type Log::LogType and text is of type std::string +#define LOG_MESSAGE(logType, severity, text) do{Log::LogMessage msg{logType, severity, text}; Log::LogManager::getInstance().log(msg);}while(0) + +#define LOG_SUCCESS(logType, text) LOG_MESSAGE(logType, Log::Success, text) +#define LOG_NOTICE(logType, text) LOG_MESSAGE(logType, Log::Notice, text) +#define LOG_WARNING(logType, text) LOG_MESSAGE(logType, Log::Warning, text) +#define LOG_ERROR(logType, text) LOG_MESSAGE(logType, Log::Error, text) + +#define LOGF_SUCCESS(logType, fmtstring, ...) LOG_SUCCESS(logType, fmt::Format(fmtstring, ##__VA_ARGS__ )) +#define LOGF_NOTICE(logType, fmtstring, ...) LOG_NOTICE(logType, fmt::Format(fmtstring, ##__VA_ARGS__ )) +#define LOGF_WARNING(logType, fmtstring, ...) LOG_WARNING(logType, fmt::Format(fmtstring, ##__VA_ARGS__ )) +#define LOGF_ERROR(logType, fmtstring, ...) LOG_ERROR(logType, fmt::Format(fmtstring, ##__VA_ARGS__ )) + +namespace Log +{ + const unsigned int MAX_LOG_BUFFER_LENGTH = 1024*1024; + const unsigned int gBuffSize = 1000; + + enum LogType : u32 + { + GENERAL = 0, + LOADER, + MEMORY, + RSX, + HLE, + PPU, + SPU, + TTY, + }; + + + struct LogTypeName + { + LogType mType; + std::string mName; + }; + + //well I'd love make_array() but alas manually counting is not the end of the world + static const std::array gTypeNameTable = { { + { GENERAL, "G: " }, + { LOADER, "LDR: " }, + { MEMORY, "MEM: " }, + { RSX, "RSX: " }, + { HLE, "HLE: " }, + { PPU, "PPU: " }, + { SPU, "SPU: " }, + { TTY, "TTY: " } + } }; + + enum LogSeverity : u32 + { + Success = 0, + Notice, + Warning, + Error, + }; + + struct LogMessage + { + using size_type = u32; + LogType mType; + LogSeverity mServerity; + std::string mText; + + u32 size(); + void serialize(char *output); + static LogMessage deserialize(char *input, u32* size_out=nullptr); + }; + + struct LogListener + { + virtual ~LogListener() {}; + virtual void log(LogMessage msg) = 0; + }; + + struct LogChannel + { + LogChannel(); + LogChannel(const std::string& name); + LogChannel(LogChannel& other) = delete; + LogChannel& operator = (LogChannel& other) = delete; + void log(LogMessage msg); + void addListener(std::shared_ptr listener); + void removeListener(std::shared_ptr listener); + std::string name; + private: + bool mEnabled; + LogSeverity mLogLevel; + std::mutex mListenerLock; + std::set> mListeners; + }; + + struct LogManager + { + LogManager(); + ~LogManager(); + static LogManager& getInstance(); + LogChannel& getChannel(LogType type); + void log(LogMessage msg); +#ifdef BUFFERED_LOGGING + void consumeLog(); +#endif + private: +#ifdef BUFFERED_LOGGING + MTRingbuffer mBuffer; + std::condition_variable mBufferReady; + std::mutex mStatusMut; + std::atomic mExiting; + std::thread mLogConsumer; +#endif + std::array::value> mChannels; + //std::array mChannels; //TODO: use this once Microsoft sorts their shit out + }; +} + +static struct { inline operator Log::LogType() { return Log::LogType::GENERAL; } } GENERAL; +static struct { inline operator Log::LogType() { return Log::LogType::LOADER; } } LOADER; +static struct { inline operator Log::LogType() { return Log::LogType::MEMORY; } } MEMORY; +static struct { inline operator Log::LogType() { return Log::LogType::RSX; } } RSX; +static struct { inline operator Log::LogType() { return Log::LogType::HLE; } } HLE; +static struct { inline operator Log::LogType() { return Log::LogType::PPU; } } PPU; +static struct { inline operator Log::LogType() { return Log::LogType::SPU; } } SPU; +static struct { inline operator Log::LogType() { return Log::LogType::TTY; } } TTY; diff --git a/Utilities/MTRingbuffer.h b/Utilities/MTRingbuffer.h new file mode 100644 index 0000000000..cb01422a0d --- /dev/null +++ b/Utilities/MTRingbuffer.h @@ -0,0 +1,159 @@ +#pragma once +#include +#include +#include +#include + +//Simple non-resizable FIFO Ringbuffer that can be simultaneously be read from and written to +//if we ever get to use boost please replace this with boost::circular_buffer, there's no reason +//why we would have to keep this amateur attempt at such a fundamental data-structure around +template< typename T, unsigned int MAX_MTRINGBUFFER_BUFFER_SIZE> +class MTRingbuffer{ + std::array mBuffer; + //this is a recursive mutex because the get methods lock it but the only + //way to be sure that they do not block is to check the size and the only + //way to check the size and use get atomically is to lock this mutex, + //so it goes: + //lock get mutex-->check size-->call get-->lock get mutex-->unlock get mutex-->return from get-->unlock get mutex + std::recursive_mutex mMutGet; + std::mutex mMutPut; + + size_t mGet; + size_t mPut; + size_t moveGet(size_t by = 1){ return (mGet + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; } + size_t movePut(size_t by = 1){ return (mPut + by) % MAX_MTRINGBUFFER_BUFFER_SIZE; } +public: + MTRingbuffer() : mGet(0), mPut(0){} + + //blocks until there's something to get, so check "free()" if you want to avoid blocking + //also lock the get mutex around the free() check and the pop if you want to avoid racing + T pop() + { + std::lock_guard lock(mMutGet); + while (mGet == mPut) + { + //wait until there's actually something to get + //throwing an exception might be better, blocking here is a little awkward + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + size_t ret = mGet; + mGet = moveGet(); + return mBuffer[ret]; + } + + //blocks if the buffer is full until there's enough room + void push(T &putEle) + { + std::lock_guard lock(mMutPut); + while (movePut() == mGet) + { + //if this is reached a lot it's time to increase the buffer size + //or implement dynamic re-sizing + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + mBuffer[mPut] = std::forward(putEle); + mPut = movePut(); + } + + bool empty() + { + return mGet == mPut; + } + + //returns the amount of free places, this is the amount of actual free spaces-1 + //since mGet==mPut signals an empty buffer we can't actually use the last free + //space, so we shouldn't report it as free. + size_t free() + { + if (mGet < mPut) + { + return mBuffer.size() - (mPut - mGet) - 1; + } + else if (mGet > mPut) + { + return mGet - mPut - 1; + } + else + { + return mBuffer.size() - 1; + } + } + + size_t size() + { + //the magic -1 is the same magic 1 that is explained in the free() function + return mBuffer.size() - free() - 1; + } + + //takes random access iterator to T + template + void pushRange(IteratorType from, IteratorType until) + { + std::lock_guard lock(mMutPut); + size_t length = until - from; + + //if whatever we're trying to store is greater than the entire buffer the following loop will be infinite + assert(mBuffer.size() > length); + while (free() < length) + { + //if this is reached a lot it's time to increase the buffer size + //or implement dynamic re-sizing + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + if (mPut + length <= mBuffer.size()) + { + std::copy(from, until, mBuffer.begin() + mPut); + } + else + { + size_t tillEnd = mBuffer.size() - mPut; + std::copy(from, from + tillEnd, mBuffer.begin() + mPut); + std::copy(from + tillEnd, until, mBuffer.begin()); + } + mPut = movePut(length); + + } + + //takes output iterator to T + template + void popN(IteratorType output, size_t n) + { + std::lock_guard lock(mMutGet); + //make sure we're not trying to retrieve more than is in + assert(n <= size()); + peekN(output, n); + mGet = moveGet(n); + } + + //takes output iterator to T + template + void peekN(IteratorType output, size_t n) + { + size_t lGet = mGet; + if (lGet + n <= mBuffer.size()) + { + std::copy_n(mBuffer.begin() + lGet, n, output); + } + else + { + auto next = std::copy(mBuffer.begin() + lGet, mBuffer.end(), output); + std::copy_n(mBuffer.begin(), n - (mBuffer.size() - lGet), next); + } + } + + //well this is just asking for trouble + //but the comment above the declaration of mMutGet explains why it's there + //if there's a better way please remove this + void lockGet() + { + mMutGet.lock(); + } + + //well this is just asking for trouble + //but the comment above the declaration of mMutGet explains why it's there + //if there's a better way please remove this + void unlockGet() + { + mMutGet.unlock(); + } +}; diff --git a/Utilities/SMutex.cpp b/Utilities/SMutex.cpp index 807a55c268..157e9103f0 100644 --- a/Utilities/SMutex.cpp +++ b/Utilities/SMutex.cpp @@ -1,5 +1,5 @@ #include -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/CPU/CPUThread.h" diff --git a/Utilities/SMutex.h b/Utilities/SMutex.h index 1e129809fc..9ca53ce0e9 100644 --- a/Utilities/SMutex.h +++ b/Utilities/SMutex.h @@ -148,7 +148,7 @@ public: { if (!Emu.IsStopped()) { - ConLog.Error("SMutexLockerBase: thread id == 0"); + LOG_ERROR(HLE, "SMutexLockerBase: thread id == 0"); Emu.Pause(); } return; diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index 2ac1d27cc7..596a4d1a9e 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -4,6 +4,7 @@ #include #include #include +#include #if defined(_MSC_VER) #define snprintf _snprintf diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index ed54c45245..c11a48183f 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Thread.h" @@ -134,7 +134,7 @@ void thread::start(std::function func) } catch(...) { - ConLog.Error("Crash :("); + LOG_ERROR(HLE, "Crash :("); //std::terminate(); } diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp index 51f47a990e..40cd2e0c49 100644 --- a/Utilities/rFile.cpp +++ b/Utilities/rFile.cpp @@ -120,7 +120,7 @@ size_t rFile::Write(const void *buffer, size_t count) bool rFile::Write(const std::string &text) { - return reinterpret_cast(handle)->Write(fmt::FromUTF8(text)); + return reinterpret_cast(handle)->Write(reinterpret_cast(text.c_str()),text.size()); } bool rFile::Close() diff --git a/rpcs3/Crypto/unedat.cpp b/rpcs3/Crypto/unedat.cpp index ea8c9bab5f..6ad5207582 100644 --- a/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/Crypto/unedat.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "unedat.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" void generate_key(int crypto_mode, int version, unsigned char *key_final, unsigned char *iv_final, unsigned char *key, unsigned char *iv) { @@ -74,7 +74,7 @@ bool crypto(int hash_mode, int crypto_mode, int version, unsigned char *in, unsi } else { - ConLog.Error("EDAT: Unknown crypto algorithm!\n"); + LOG_ERROR(LOADER, "EDAT: Unknown crypto algorithm!\n"); return false; } @@ -92,7 +92,7 @@ bool crypto(int hash_mode, int crypto_mode, int version, unsigned char *in, unsi } else { - ConLog.Error("EDAT: Unknown hashing algorithm!\n"); + LOG_ERROR(LOADER, "EDAT: Unknown hashing algorithm!\n"); return false; } } @@ -158,7 +158,7 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, if ((edat->flags & EDAT_FLAG_0x3C) != 0 || (edat->flags & EDAT_FLAG_0x3D) != 0) { - ConLog.Error("EDAT: Flag 0x3C/0x3D EDAT files are unsupported yet"); + LOG_ERROR(LOADER, "EDAT: Flag 0x3C/0x3D EDAT files are unsupported yet"); return -1; } @@ -268,15 +268,15 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, memset(decomp_data, 0, decomp_size); if (verbose) - ConLog.Write("EDAT: Decompressing...\n"); + LOG_NOTICE(LOADER, "EDAT: Decompressing...\n"); int res = lz_decompress(decomp_data, dec_data, decomp_size); out->Write(decomp_data, res); if (verbose) { - ConLog.Write("EDAT: Compressed block size: %d\n", pad_length); - ConLog.Write("EDAT: Decompressed block size: %d\n", res); + LOGF_NOTICE(LOADER, "EDAT: Compressed block size: %d\n", pad_length); + LOGF_NOTICE(LOADER, "EDAT: Decompressed block size: %d\n", res); } edat->file_size -= res; @@ -285,11 +285,11 @@ int decrypt_data(rFile *in, rFile *out, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, { if (res < 0) { - ConLog.Error("EDAT: Decompression failed!\n"); + LOG_ERROR(LOADER, "EDAT: Decompression failed!\n"); return 1; } else - ConLog.Success("EDAT: Data successfully decompressed!\n"); + LOG_SUCCESS(LOADER, "EDAT: Data successfully decompressed!\n"); } delete[] decomp_data; @@ -315,7 +315,7 @@ static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd) { if (edat->flags & 0x7EFFFFFE) { - ConLog.Error("EDAT: Bad header flags!\n"); + LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); return false; } } @@ -323,7 +323,7 @@ static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd) { if (edat->flags & 0x7EFFFFE0) { - ConLog.Error("EDAT: Bad header flags!\n"); + LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); return false; } } @@ -331,13 +331,13 @@ static bool check_flags(EDAT_SDAT_HEADER *edat, NPD_HEADER *npd) { if (edat->flags & 0x7EFFFFC0) { - ConLog.Error("EDAT: Bad header flags!\n"); + LOG_ERROR(LOADER, "EDAT: Bad header flags!\n"); return false; } } else if (npd->version > 4) { - ConLog.Error("EDAT: Unknown version - %d\n", npd->version); + LOGF_ERROR(LOADER, "EDAT: Unknown version - %d\n", npd->version); return false; } @@ -370,7 +370,7 @@ int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFil int hash_mode = ((edat->flags & EDAT_ENCRYPTED_KEY_FLAG) == 0) ? 0x00000002 : 0x10000002; if ((edat->flags & EDAT_DEBUG_DATA_FLAG) != 0) { - ConLog.Warning("EDAT: DEBUG data detected!\n"); + LOG_ERROR(LOADER, "EDAT: DEBUG data detected!\n"); hash_mode |= 0x01000000; } @@ -382,14 +382,14 @@ int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFil if (!crypto(hash_mode, crypto_mode, (npd->version == 4), header, tmp, 0xA0, header_key, header_iv, key, hash_result)) { if (verbose) - ConLog.Warning("EDAT: Header hash is invalid!\n"); + LOG_WARNING(LOADER, "EDAT: Header hash is invalid!\n"); } // Parse the metadata info. int metadata_section_size = 0x10; if (((edat->flags & EDAT_COMPRESSED_FLAG) != 0)) { - ConLog.Warning("EDAT: COMPRESSED data detected!\n"); + LOG_WARNING(LOADER, "EDAT: COMPRESSED data detected!\n"); metadata_section_size = 0x20; } @@ -418,7 +418,7 @@ int check_data(unsigned char *key, EDAT_SDAT_HEADER *edat, NPD_HEADER *npd, rFil if (!crypto(hash_mode, crypto_mode, (npd->version == 4), data, tmp, block_size, header_key, header_iv, key, hash_result)) { if (verbose) - ConLog.Warning("EDAT: Metadata hash from block 0x%08x is invalid!\n", metadata_offset + bytes_read); + LOGF_WARNING(LOADER, "EDAT: Metadata hash from block 0x%08x is invalid!\n", metadata_offset + bytes_read); } // Adjust sizes. @@ -455,9 +455,9 @@ void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER * if (verbose) { if (title_hash_result) - ConLog.Success("EDAT: NPD title hash is valid!\n"); + LOG_SUCCESS(LOADER, "EDAT: NPD title hash is valid!\n"); else - ConLog.Warning("EDAT: NPD title hash is invalid!\n"); + LOG_WARNING(LOADER, "EDAT: NPD title hash is invalid!\n"); } // Check for an empty dev_hash (can't validate if devklic is NULL); @@ -474,7 +474,7 @@ void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER * if (isDevklicEmpty) { if (verbose) - ConLog.Warning("EDAT: NPD dev hash is empty!\n"); + LOG_WARNING(LOADER, "EDAT: NPD dev hash is empty!\n"); } else { @@ -487,9 +487,9 @@ void validate_data(const char* file_name, unsigned char *klicensee, NPD_HEADER * if (verbose) { if (dev_hash_result) - ConLog.Success("EDAT: NPD dev hash is valid!\n"); + LOG_SUCCESS(LOADER, "EDAT: NPD dev hash is valid!\n"); else - ConLog.Warning("EDAT: NPD dev hash is invalid!\n"); + LOG_WARNING(LOADER, "EDAT: NPD dev hash is invalid!\n"); } } @@ -522,7 +522,7 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi unsigned char npd_magic[4] = {0x4E, 0x50, 0x44, 0x00}; //NPD0 if(memcmp(NPD->magic, npd_magic, 4)) { - ConLog.Error("EDAT: File has invalid NPD header."); + LOG_ERROR(LOADER, "EDAT: File has invalid NPD header."); delete NPD; delete EDAT; return 1; @@ -534,16 +534,16 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi if (verbose) { - ConLog.Write("NPD HEADER\n"); - ConLog.Write("NPD version: %d\n", NPD->version); - ConLog.Write("NPD license: %d\n", NPD->license); - ConLog.Write("NPD type: %d\n", NPD->type); - ConLog.Write("\n"); - ConLog.Write("EDAT HEADER\n"); - ConLog.Write("EDAT flags: 0x%08X\n", EDAT->flags); - ConLog.Write("EDAT block size: 0x%08X\n", EDAT->block_size); - ConLog.Write("EDAT file size: 0x%08X\n", EDAT->file_size); - ConLog.Write("\n"); + LOG_NOTICE(LOADER, "NPD HEADER\n"); + LOGF_NOTICE(LOADER, "NPD version: %d\n", NPD->version); + LOGF_NOTICE(LOADER, "NPD license: %d\n", NPD->license); + LOGF_NOTICE(LOADER, "NPD type: %d\n", NPD->type); + LOG_NOTICE(LOADER, "\n"); + LOG_NOTICE(LOADER, "EDAT HEADER\n"); + LOGF_NOTICE(LOADER, "EDAT flags: 0x%08X\n", EDAT->flags); + LOGF_NOTICE(LOADER, "EDAT block size: 0x%08X\n", EDAT->block_size); + LOGF_NOTICE(LOADER, "EDAT file size: 0x%08X\n", EDAT->file_size); + LOG_NOTICE(LOADER, "\n"); } // Set decryption key. @@ -552,7 +552,7 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi if((EDAT->flags & SDAT_FLAG) == SDAT_FLAG) { - ConLog.Warning("EDAT: SDAT detected!\n"); + LOG_WARNING(LOADER, "EDAT: SDAT detected!\n"); xor_(key, NPD->dev_hash, SDAT_KEY, 0x10); } else @@ -579,7 +579,7 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi if (!test) { - ConLog.Error("EDAT: A valid RAP file is needed!"); + LOG_ERROR(LOADER, "EDAT: A valid RAP file is needed!"); delete NPD; delete EDAT; return 1; @@ -587,19 +587,19 @@ bool extract_data(rFile *input, rFile *output, const char* input_file_name, unsi } } - ConLog.Write("EDAT: Parsing data...\n"); + LOG_NOTICE(LOADER, "EDAT: Parsing data...\n"); if (check_data(key, EDAT, NPD, input, verbose)) - ConLog.Error("EDAT: Data parsing failed!\n"); + LOG_ERROR(LOADER, "EDAT: Data parsing failed!\n"); else - ConLog.Success("EDAT: Data successfully parsed!\n"); + LOG_SUCCESS(LOADER, "EDAT: Data successfully parsed!\n"); printf("\n"); - ConLog.Write("EDAT: Decrypting data...\n"); + LOG_NOTICE(LOADER, "EDAT: Decrypting data...\n"); if (decrypt_data(input, output, EDAT, NPD, key, verbose)) - ConLog.Error("EDAT: Data decryption failed!"); + LOG_ERROR(LOADER, "EDAT: Data decryption failed!"); else - ConLog.Success("EDAT: Data successfully decrypted!"); + LOG_SUCCESS(LOADER, "EDAT: Data successfully decrypted!"); delete NPD; delete EDAT; @@ -652,21 +652,21 @@ int DecryptEDAT(const std::string& input_file_name, const std::string& output_fi memcpy(devklic, custom_klic, 0x10); else { - ConLog.Error("EDAT: Invalid custom klic!\n"); + LOG_ERROR(LOADER, "EDAT: Invalid custom klic!\n"); return -1; } break; } default: - ConLog.Error("EDAT: Invalid mode!\n"); + LOG_ERROR(LOADER, "EDAT: Invalid mode!\n"); return -1; } // Check the input/output files. if (!input.IsOpened() || !output.IsOpened()) { - ConLog.Error("EDAT: Failed to open files!\n"); + LOG_ERROR(LOADER, "EDAT: Failed to open files!\n"); return -1; } diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index 1192304f34..1b499ce61c 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -2,13 +2,13 @@ #include "unpkg.h" #include -#include "Emu/ConLog.h" +#include "Utilities/Log.h" // Decryption. bool CheckHeader(rFile& pkg_f, PKGHeader* m_header) { if (m_header->pkg_magic != 0x7F504B47) { - ConLog.Error("PKG: Not a package file!"); + LOG_ERROR(LOADER, "PKG: Not a package file!"); return false; } @@ -17,7 +17,7 @@ bool CheckHeader(rFile& pkg_f, PKGHeader* m_header) case PKG_RELEASE_TYPE_DEBUG: break; case PKG_RELEASE_TYPE_RELEASE: break; default: - ConLog.Error("PKG: Unknown PKG type!"); + LOG_ERROR(LOADER, "PKG: Unknown PKG type!"); return false; } @@ -26,22 +26,22 @@ bool CheckHeader(rFile& pkg_f, PKGHeader* m_header) case PKG_PLATFORM_TYPE_PS3: break; case PKG_PLATFORM_TYPE_PSP: break; default: - ConLog.Error("PKG: Unknown PKG type!"); + LOG_ERROR(LOADER, "PKG: Unknown PKG type!"); return false; } if (m_header->header_size != PKG_HEADER_SIZE) { - ConLog.Error("PKG: Wrong header size!"); + LOG_ERROR(LOADER, "PKG: Wrong header size!"); return false; } if (m_header->pkg_size != pkg_f.Length()) { - ConLog.Error("PKG: File size mismatch."); + LOG_ERROR(LOADER, "PKG: File size mismatch."); return false; } if (m_header->data_size + m_header->data_offset + 0x60 != pkg_f.Length()) { - ConLog.Error("PKG: Data size mismatch."); + LOG_ERROR(LOADER, "PKG: Data size mismatch."); return false; } @@ -53,7 +53,7 @@ bool LoadHeader(rFile& pkg_f, PKGHeader* m_header) pkg_f.Seek(0); if (pkg_f.Read(m_header, sizeof(PKGHeader)) != sizeof(PKGHeader)) { - ConLog.Error("PKG: Package file is too short!"); + LOG_ERROR(LOADER, "PKG: Package file is too short!"); return false; } @@ -141,7 +141,7 @@ bool LoadEntries(rFile& dec_pkg_f, PKGHeader* m_header, PKGEntry *m_entries) dec_pkg_f.Read(m_entries, sizeof(PKGEntry) * m_header->file_count); if (m_entries->name_offset / sizeof(PKGEntry) != m_header->file_count) { - ConLog.Error("PKG: Entries are damaged!"); + LOG_ERROR(LOADER, "PKG: Entries are damaged!"); return false; } diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 4ee7c41806..7f889a8c8b 100644 --- a/rpcs3/Crypto/unself.cpp +++ b/rpcs3/Crypto/unself.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/FS/vfsLocalFile.h" #include "unself.h" @@ -17,7 +17,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) // Check SCE magic. if (!sce_hdr.CheckMagic()) { - ConLog.Error("SELF: Not a SELF file!"); + LOGF_ERROR(LOADER, "SELF: Not a SELF file!"); return false; } @@ -41,7 +41,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) phdr32_arr.clear(); if(elf32_hdr.e_phoff == 0 && elf32_hdr.e_phnum) { - ConLog.Error("SELF: ELF program header offset is null!"); + LOGF_ERROR(LOADER, "SELF: ELF program header offset is null!"); return false; } self_f.Seek(self_hdr.se_phdroff); @@ -56,7 +56,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) phdr64_arr.clear(); if(elf64_hdr.e_phoff == 0 && elf64_hdr.e_phnum) { - ConLog.Error("SELF: ELF program header offset is null!"); + LOGF_ERROR(LOADER, "SELF: ELF program header offset is null!"); return false; } self_f.Seek(self_hdr.se_phdroff); @@ -101,7 +101,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) shdr32_arr.clear(); if(elf32_hdr.e_shoff == 0 && elf32_hdr.e_shnum) { - ConLog.Warning("SELF: ELF section header offset is null!"); + LOGF_WARNING(LOADER, "SELF: ELF section header offset is null!"); return true; } self_f.Seek(self_hdr.se_shdroff); @@ -116,7 +116,7 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) shdr64_arr.clear(); if(elf64_hdr.e_shoff == 0 && elf64_hdr.e_shnum) { - ConLog.Warning("SELF: ELF section header offset is null!"); + LOGF_WARNING(LOADER, "SELF: ELF section header offset is null!"); return true; } self_f.Seek(self_hdr.se_shdroff); @@ -132,46 +132,46 @@ bool SELFDecrypter::LoadHeaders(bool isElf32) void SELFDecrypter::ShowHeaders(bool isElf32) { - ConLog.Write("SCE header"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "SCE header"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); sce_hdr.Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("SELF header"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "SELF header"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); self_hdr.Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("APP INFO"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "APP INFO"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); app_info.Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("ELF header"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "ELF header"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); isElf32 ? elf32_hdr.Show() : elf64_hdr.Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("ELF program headers"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "ELF program headers"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); for(unsigned int i = 0; i < ((isElf32) ? phdr32_arr.size() : phdr64_arr.size()); i++) isElf32 ? phdr32_arr[i].Show() : phdr64_arr[i].Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("Section info"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "Section info"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); for(unsigned int i = 0; i < secinfo_arr.size(); i++) secinfo_arr[i].Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("SCE version info"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "SCE version info"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); scev_info.Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("Control info"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "Control info"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); for(unsigned int i = 0; i < ctrlinfo_arr.size(); i++) ctrlinfo_arr[i].Show(); - ConLog.Write("----------------------------------------------------"); - ConLog.Write("ELF section headers"); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); + LOGF_NOTICE(LOADER, "ELF section headers"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); for(unsigned int i = 0; i < ((isElf32) ? shdr32_arr.size() : shdr64_arr.size()); i++) isElf32 ? shdr32_arr[i].Show() : shdr64_arr[i].Show(); - ConLog.Write("----------------------------------------------------"); + LOGF_NOTICE(LOADER, "----------------------------------------------------"); } bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) @@ -195,7 +195,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) // If not, the data has no NPDRM layer. if (!ctrl) { - ConLog.Warning("SELF: No NPDRM control info found!"); + LOGF_WARNING(LOADER, "SELF: No NPDRM control info found!"); return true; } @@ -208,7 +208,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) if (ctrl->npdrm.license == 1) // Network license. { - ConLog.Error("SELF: Can't decrypt network NPDRM!"); + LOGF_ERROR(LOADER, "SELF: Can't decrypt network NPDRM!"); return false; } else if (ctrl->npdrm.license == 2) // Local license. @@ -216,7 +216,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) // Try to find a RAP file to get the key. if (!GetKeyFromRap(ctrl->npdrm.content_id, npdrm_key)) { - ConLog.Error("SELF: Can't find RAP file for NPDRM decryption!"); + LOGF_ERROR(LOADER, "SELF: Can't find RAP file for NPDRM decryption!"); return false; } } @@ -227,7 +227,7 @@ bool SELFDecrypter::DecryptNPDRM(u8 *metadata, u32 metadata_size) } else { - ConLog.Error("SELF: Invalid NPDRM license type!"); + LOGF_ERROR(LOADER, "SELF: Invalid NPDRM license type!"); return false; } @@ -290,7 +290,7 @@ bool SELFDecrypter::LoadMetadata() if ((meta_info.key_pad[0] != 0x00) || (meta_info.iv_pad[0] != 0x00)) { - ConLog.Error("SELF: Failed to decrypt metadata info!"); + LOGF_ERROR(LOADER, "SELF: Failed to decrypt metadata info!"); return false; } @@ -392,7 +392,7 @@ bool SELFDecrypter::MakeElf(const std::string& elf, bool isElf32) rFile e(elf.c_str(), rFile::write); if(!e.IsOpened()) { - ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); + LOGF_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str()); return false; } @@ -510,7 +510,7 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key) // Check if we have a valid RAP file. if (!rFile::Exists(rap_path)) { - ConLog.Error("This application requires a valid RAP file for decryption!"); + LOGF_ERROR(LOADER, "This application requires a valid RAP file for decryption!"); return false; } @@ -519,11 +519,11 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key) if (!rap_file.IsOpened()) { - ConLog.Error("Failed to load RAP file!"); + LOGF_ERROR(LOADER, "Failed to load RAP file!"); return false; } - ConLog.Write("Loading RAP file %s", (ci_str + ".rap").c_str()); + LOGF_NOTICE(LOADER, "Loading RAP file %s", (ci_str + ".rap").c_str()); rap_file.Read(rap_key, 0x10); rap_file.Close(); @@ -573,7 +573,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf) if(!s.IsOpened()) { - ConLog.Error("Could not open SELF file! (%s)", self.c_str()); + LOGF_ERROR(LOADER, "Could not open SELF file! (%s)", self.c_str()); return false; } @@ -585,7 +585,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf) // Check for DEBUG version. if(swap16(key_version) == 0x8000) { - ConLog.Warning("Debug SELF detected! Removing fake header..."); + LOGF_WARNING(LOADER, "Debug SELF detected! Removing fake header..."); // Get the real elf offset. s.Seek(0x10); @@ -600,7 +600,7 @@ bool CheckDebugSelf(const std::string& self, const std::string& elf) rFile e(elf, rFile::write); if(!e.IsOpened()) { - ConLog.Error("Could not create ELF file! (%s)", elf.c_str()); + LOGF_ERROR(LOADER, "Could not create ELF file! (%s)", elf.c_str()); return false; } @@ -640,28 +640,28 @@ bool DecryptSelf(const std::string& elf, const std::string& self) // Load the SELF file headers. if (!self_dec.LoadHeaders(isElf32)) { - ConLog.Error("SELF: Failed to load SELF file headers!"); + LOGF_ERROR(LOADER, "SELF: Failed to load SELF file headers!"); return false; } // Load and decrypt the SELF file metadata. if (!self_dec.LoadMetadata()) { - ConLog.Error("SELF: Failed to load SELF file metadata!"); + LOGF_ERROR(LOADER, "SELF: Failed to load SELF file metadata!"); return false; } // Decrypt the SELF file data. if (!self_dec.DecryptData()) { - ConLog.Error("SELF: Failed to decrypt SELF file data!"); + LOGF_ERROR(LOADER, "SELF: Failed to decrypt SELF file data!"); return false; } // Make a new ELF file from this SELF. if (!self_dec.MakeElf(elf, isElf32)) { - ConLog.Error("SELF: Failed to make ELF file from SELF!"); + LOGF_ERROR(LOADER, "SELF: Failed to make ELF file from SELF!"); return false; } } diff --git a/rpcs3/Crypto/unself.h b/rpcs3/Crypto/unself.h index bd72125eac..b4e504853e 100644 --- a/rpcs3/Crypto/unself.h +++ b/rpcs3/Crypto/unself.h @@ -25,10 +25,10 @@ struct AppInfo void Show() { - ConLog.Write("AuthID: 0x%llx", authid); - ConLog.Write("VendorID: 0x%08x", vendor_id); - ConLog.Write("SELF type: 0x%08x", self_type); - ConLog.Write("Version: 0x%llx", version); + LOGF_NOTICE(LOADER, "AuthID: 0x%llx", authid); + LOGF_NOTICE(LOADER, "VendorID: 0x%08x", vendor_id); + LOGF_NOTICE(LOADER, "SELF type: 0x%08x", self_type); + LOGF_NOTICE(LOADER, "Version: 0x%llx", version); } }; @@ -53,12 +53,12 @@ struct SectionInfo void Show() { - ConLog.Write("Offset: 0x%llx", offset); - ConLog.Write("Size: 0x%llx", size); - ConLog.Write("Compressed: 0x%08x", compressed); - ConLog.Write("Unknown1: 0x%08x", unknown1); - ConLog.Write("Unknown2: 0x%08x", unknown2); - ConLog.Write("Encrypted: 0x%08x", encrypted); + LOGF_NOTICE(LOADER, "Offset: 0x%llx", offset); + LOGF_NOTICE(LOADER, "Size: 0x%llx", size); + LOGF_NOTICE(LOADER, "Compressed: 0x%08x", compressed); + LOGF_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1); + LOGF_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2); + LOGF_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted); } }; @@ -79,10 +79,10 @@ struct SCEVersionInfo void Show() { - ConLog.Write("Sub-header type: 0x%08x", subheader_type); - ConLog.Write("Present: 0x%08x", present); - ConLog.Write("Size: 0x%08x", size); - ConLog.Write("Unknown: 0x%08x", unknown); + LOGF_NOTICE(LOADER, "Sub-header type: 0x%08x", subheader_type); + LOGF_NOTICE(LOADER, "Present: 0x%08x", present); + LOGF_NOTICE(LOADER, "Size: 0x%08x", size); + LOGF_NOTICE(LOADER, "Unknown: 0x%08x", unknown); } }; @@ -181,20 +181,20 @@ struct ControlInfo void Show() { - ConLog.Write("Type: 0x%08x", type); - ConLog.Write("Size: 0x%08x", size); - ConLog.Write("Next: 0x%llx", next); + LOGF_NOTICE(LOADER, "Type: 0x%08x", type); + LOGF_NOTICE(LOADER, "Size: 0x%08x", size); + LOGF_NOTICE(LOADER, "Next: 0x%llx", next); if (type == 1) { - ConLog.Write("Control flag 1: 0x%08x", control_flags.ctrl_flag1); - ConLog.Write("Unknown1: 0x%08x", control_flags.unknown1); - ConLog.Write("Unknown2: 0x%08x", control_flags.unknown2); - ConLog.Write("Unknown3: 0x%08x", control_flags.unknown3); - ConLog.Write("Unknown4: 0x%08x", control_flags.unknown4); - ConLog.Write("Unknown5: 0x%08x", control_flags.unknown5); - ConLog.Write("Unknown6: 0x%08x", control_flags.unknown6); - ConLog.Write("Unknown7: 0x%08x", control_flags.unknown7); + LOGF_NOTICE(LOADER, "Control flag 1: 0x%08x", control_flags.ctrl_flag1); + LOGF_NOTICE(LOADER, "Unknown1: 0x%08x", control_flags.unknown1); + LOGF_NOTICE(LOADER, "Unknown2: 0x%08x", control_flags.unknown2); + LOGF_NOTICE(LOADER, "Unknown3: 0x%08x", control_flags.unknown3); + LOGF_NOTICE(LOADER, "Unknown4: 0x%08x", control_flags.unknown4); + LOGF_NOTICE(LOADER, "Unknown5: 0x%08x", control_flags.unknown5); + LOGF_NOTICE(LOADER, "Unknown6: 0x%08x", control_flags.unknown6); + LOGF_NOTICE(LOADER, "Unknown7: 0x%08x", control_flags.unknown7); } else if (type == 2) { @@ -204,8 +204,8 @@ struct ControlInfo for (int i = 0; i < 20; i++) digest_str += fmt::Format("%02x", file_digest_30.digest[i]); - ConLog.Write("Digest: %s", digest_str.c_str()); - ConLog.Write("Unknown: 0x%llx", file_digest_30.unknown); + LOGF_NOTICE(LOADER, "Digest: %s", digest_str.c_str()); + LOGF_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_30.unknown); } else if (size == 0x40) { @@ -217,9 +217,9 @@ struct ControlInfo digest_str2 += fmt::Format("%02x", file_digest_40.digest2[i]); } - ConLog.Write("Digest1: %s", digest_str1.c_str()); - ConLog.Write("Digest2: %s", digest_str2.c_str()); - ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown); + LOGF_NOTICE(LOADER, "Digest1: %s", digest_str1.c_str()); + LOGF_NOTICE(LOADER, "Digest2: %s", digest_str2.c_str()); + LOGF_NOTICE(LOADER, "Unknown: 0x%llx", file_digest_40.unknown); } } else if (type == 3) @@ -237,16 +237,16 @@ struct ControlInfo xordigest_str += fmt::Format("%02x", npdrm.xordigest[i]); } - ConLog.Write("Magic: 0x%08x", npdrm.magic); - ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1); - ConLog.Write("License: 0x%08x", npdrm.license); - ConLog.Write("Type: 0x%08x", npdrm.type); - ConLog.Write("ContentID: %s", contentid_str.c_str()); - ConLog.Write("Digest: %s", digest_str.c_str()); - ConLog.Write("Inverse digest: %s", invdigest_str.c_str()); - ConLog.Write("XOR digest: %s", xordigest_str.c_str()); - ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2); - ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3); + LOGF_NOTICE(LOADER, "Magic: 0x%08x", npdrm.magic); + LOGF_NOTICE(LOADER, "Unknown1: 0x%08x", npdrm.unknown1); + LOGF_NOTICE(LOADER, "License: 0x%08x", npdrm.license); + LOGF_NOTICE(LOADER, "Type: 0x%08x", npdrm.type); + LOGF_NOTICE(LOADER, "ContentID: %s", contentid_str.c_str()); + LOGF_NOTICE(LOADER, "Digest: %s", digest_str.c_str()); + LOGF_NOTICE(LOADER, "Inverse digest: %s", invdigest_str.c_str()); + LOGF_NOTICE(LOADER, "XOR digest: %s", xordigest_str.c_str()); + LOGF_NOTICE(LOADER, "Unknown2: 0x%llx", npdrm.unknown2); + LOGF_NOTICE(LOADER, "Unknown3: 0x%llx", npdrm.unknown3); } } }; @@ -281,10 +281,10 @@ struct MetadataInfo iv_pad_str += fmt::Format("%02x", iv_pad[i]); } - ConLog.Write("Key: %s", key_str.c_str()); - ConLog.Write("Key pad: %s", key_pad_str.c_str()); - ConLog.Write("IV: %s", iv_str.c_str()); - ConLog.Write("IV pad: %s", iv_pad_str.c_str()); + LOGF_NOTICE(LOADER, "Key: %s", key_str.c_str()); + LOGF_NOTICE(LOADER, "Key pad: %s", key_pad_str.c_str()); + LOGF_NOTICE(LOADER, "IV: %s", iv_str.c_str()); + LOGF_NOTICE(LOADER, "IV pad: %s", iv_pad_str.c_str()); } }; @@ -320,13 +320,13 @@ struct MetadataHeader void Show() { - ConLog.Write("Signature input length: 0x%llx", signature_input_length); - ConLog.Write("Unknown1: 0x%08x", unknown1); - ConLog.Write("Section count: 0x%08x", section_count); - ConLog.Write("Key count: 0x%08x", key_count); - ConLog.Write("Optional header size: 0x%08x", opt_header_size); - ConLog.Write("Unknown2: 0x%08x", unknown2); - ConLog.Write("Unknown3: 0x%08x", unknown3); + LOGF_NOTICE(LOADER, "Signature input length: 0x%llx", signature_input_length); + LOGF_NOTICE(LOADER, "Unknown1: 0x%08x", unknown1); + LOGF_NOTICE(LOADER, "Section count: 0x%08x", section_count); + LOGF_NOTICE(LOADER, "Key count: 0x%08x", key_count); + LOGF_NOTICE(LOADER, "Optional header size: 0x%08x", opt_header_size); + LOGF_NOTICE(LOADER, "Unknown2: 0x%08x", unknown2); + LOGF_NOTICE(LOADER, "Unknown3: 0x%08x", unknown3); } }; @@ -371,16 +371,16 @@ struct MetadataSectionHeader void Show() { - ConLog.Write("Data offset: 0x%llx", data_offset); - ConLog.Write("Data size: 0x%llx", data_size); - ConLog.Write("Type: 0x%08x", type); - ConLog.Write("Program index: 0x%08x", program_idx); - ConLog.Write("Hashed: 0x%08x", hashed); - ConLog.Write("SHA1 index: 0x%08x", sha1_idx); - ConLog.Write("Encrypted: 0x%08x", encrypted); - ConLog.Write("Key index: 0x%08x", key_idx); - ConLog.Write("IV index: 0x%08x", iv_idx); - ConLog.Write("Compressed: 0x%08x", compressed); + LOGF_NOTICE(LOADER, "Data offset: 0x%llx", data_offset); + LOGF_NOTICE(LOADER, "Data size: 0x%llx", data_size); + LOGF_NOTICE(LOADER, "Type: 0x%08x", type); + LOGF_NOTICE(LOADER, "Program index: 0x%08x", program_idx); + LOGF_NOTICE(LOADER, "Hashed: 0x%08x", hashed); + LOGF_NOTICE(LOADER, "SHA1 index: 0x%08x", sha1_idx); + LOGF_NOTICE(LOADER, "Encrypted: 0x%08x", encrypted); + LOGF_NOTICE(LOADER, "Key index: 0x%08x", key_idx); + LOGF_NOTICE(LOADER, "IV index: 0x%08x", iv_idx); + LOGF_NOTICE(LOADER, "Compressed: 0x%08x", compressed); } }; diff --git a/rpcs3/Emu/ARMv7/ARMv7Interpreter.h b/rpcs3/Emu/ARMv7/ARMv7Interpreter.h index 9aabb473fc..5a820cb512 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Interpreter.h +++ b/rpcs3/Emu/ARMv7/ARMv7Interpreter.h @@ -260,7 +260,7 @@ public: protected: void NULL_OP() { - ConLog.Error("null"); + LOG_ERROR(HLE, "null"); Emu.Pause(); } @@ -316,7 +316,7 @@ protected: void UNK(const u16 code0, const u16 code1) { - ConLog.Error("Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1); + LOGF_ERROR(HLE, "Unknown/Illegal opcode! (0x%04x : 0x%04x)", code0, code1); Emu.Pause(); } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp index ed38c8d96d..d4cdddc2c9 100644 --- a/rpcs3/Emu/ARMv7/ARMv7Thread.cpp +++ b/rpcs3/Emu/ARMv7/ARMv7Thread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPCThread.h" diff --git a/rpcs3/Emu/Audio/AL/OpenALThread.cpp b/rpcs3/Emu/Audio/AL/OpenALThread.cpp index f07b0eb1a4..a7111511be 100644 --- a/rpcs3/Emu/Audio/AL/OpenALThread.cpp +++ b/rpcs3/Emu/Audio/AL/OpenALThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3/Ini.h" @@ -18,7 +18,7 @@ void printAlError(ALenum err, const char* situation) { if(err != AL_NO_ERROR) { - ConLog.Error("%s: OpenAL error 0x%04x", situation, err); + LOGF_ERROR(HLE, "%s: OpenAL error 0x%04x", situation, err); Emu.Pause(); } } @@ -27,7 +27,7 @@ void printAlcError(ALCenum err, const char* situation) { if(err != ALC_NO_ERROR) { - ConLog.Error("%s: OpenALC error 0x%04x", situation, err); + LOGF_ERROR(HLE, "%s: OpenALC error 0x%04x", situation, err); Emu.Pause(); } } @@ -137,7 +137,7 @@ void OpenALThread::AddData(const void* src, ALsizei size) int bsize = size < m_buffer_size ? size : m_buffer_size; if (!AddBlock(buffer, bsize, bsrc)) - ConLog.Error("OpenALThread::AddBlock: invalid block size: %d", bsize); + LOGF_ERROR(HLE, "OpenALThread::AddBlock: invalid block size: %d", bsize); alSourceQueueBuffers(m_source, 1, &buffer); checkForAlError("alSourceQueueBuffers"); diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index 10da0f8608..74934b68eb 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -1,6 +1,6 @@ #include "stdafx.h" #include "Emu/SysCalls/ErrorCodes.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3/Ini.h" @@ -149,7 +149,7 @@ void CPUThread::SetBranch(const u64 pc, bool record_branch) { if(!Memory.IsGoodAddr(m_offset + pc)) { - ConLog.Error("%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().c_str(), m_offset + pc, m_offset + PC); + LOGF_ERROR(PPU, "%s branch error: bad address 0x%llx #pc: 0x%llx", GetFName().c_str(), m_offset + pc, m_offset + PC); Emu.Pause(); } @@ -282,7 +282,7 @@ void CPUThread::ExecOnce() void CPUThread::Task() { - if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", CPUThread::GetFName().c_str()); + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(PPU, "%s enter", CPUThread::GetFName().c_str()); const std::vector& bp = Emu.GetBreakPoints(); @@ -333,18 +333,18 @@ void CPUThread::Task() } catch(const std::string& e) { - ConLog.Error("Exception: %s", e.c_str()); + LOGF_ERROR(PPU, "Exception: %s", e.c_str()); } catch(const char* e) { - ConLog.Error("Exception: %s", e); + LOGF_ERROR(PPU, "Exception: %s", e); } catch(int exitcode) { - ConLog.Success("Exit Code: %d", exitcode); + LOGF_SUCCESS(PPU, "Exit Code: %d", exitcode); } - if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", CPUThread::GetFName().c_str()); + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(PPU, "%s leave", CPUThread::GetFName().c_str()); } s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) // not multithread-safe @@ -353,7 +353,7 @@ s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) { if (Emu.IsStopped()) { - ConLog.Warning("ExecAsCallback() aborted"); + LOGF_WARNING(PPU, "ExecAsCallback() aborted"); return CELL_ECANCELED; // doesn't mean anything } Sleep(1); @@ -379,11 +379,11 @@ s64 CPUThread::ExecAsCallback(u64 pc, bool wait, u64 a1, u64 a2, u64 a3, u64 a4) { if (Emu.IsStopped()) { - ConLog.Warning("ExecAsCallback(wait=%s) aborted", wait ? "true" : "false"); + LOGF_WARNING(PPU, "ExecAsCallback(wait=%s) aborted", wait ? "true" : "false"); return CELL_EABORT; // doesn't mean anything } Sleep(1); } return wait * m_exit_status; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/CPU/CPUThreadManager.cpp b/rpcs3/Emu/CPU/CPUThreadManager.cpp index b89c58fbeb..e2e3ad886d 100644 --- a/rpcs3/Emu/CPU/CPUThreadManager.cpp +++ b/rpcs3/Emu/CPU/CPUThreadManager.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" diff --git a/rpcs3/Emu/Cell/MFC.h b/rpcs3/Emu/Cell/MFC.h index a4cb348559..f3d9d9ebee 100644 --- a/rpcs3/Emu/Cell/MFC.h +++ b/rpcs3/Emu/Cell/MFC.h @@ -183,7 +183,7 @@ struct DMAC return true; default: - ConLog.Error("DMAC::ProcessCmd(): Unknown DMA cmd."); + LOGF_ERROR(HLE, "DMAC::ProcessCmd(): Unknown DMA cmd."); return true; } } @@ -268,19 +268,19 @@ struct DMAC u16 tag = (u16)size_tag; u16 size = size_tag >> 16; - ConLog.Warning("RawSPU DMA %s:", op == MFC_PUT_CMD ? "PUT" : "GET"); - ConLog.Warning("*** lsa = 0x%x", lsa); - ConLog.Warning("*** ea = 0x%llx", ea); - ConLog.Warning("*** tag = 0x%x", tag); - ConLog.Warning("*** size = 0x%x", size); - ConLog.SkipLn(); + LOGF_WARNING(HLE, "RawSPU DMA %s:", op == MFC_PUT_CMD ? "PUT" : "GET"); + LOGF_WARNING(HLE, "*** lsa = 0x%x", lsa); + LOGF_WARNING(HLE, "*** ea = 0x%llx", ea); + LOGF_WARNING(HLE, "*** tag = 0x%x", tag); + LOGF_WARNING(HLE, "*** size = 0x%x", size); + LOG_WARNING(HLE, " "); MFC_CMDStatus.SetValue(dmac.Cmd(cmd, tag, lsa, ea, size)); } break; default: - ConLog.Error("Unknown MFC cmd. (opcode=0x%x, cmd=0x%x)", op, cmd); + LOGF_ERROR(HLE, "Unknown MFC cmd. (opcode=0x%x, cmd=0x%x)", op, cmd); break; } } diff --git a/rpcs3/Emu/Cell/PPCDecoder.cpp b/rpcs3/Emu/Cell/PPCDecoder.cpp index fa7d5fc75e..bff5c3e02f 100644 --- a/rpcs3/Emu/Cell/PPCDecoder.cpp +++ b/rpcs3/Emu/Cell/PPCDecoder.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "PPCDecoder.h" diff --git a/rpcs3/Emu/Cell/PPCThread.cpp b/rpcs3/Emu/Cell/PPCThread.cpp index a813d10558..c8f5411432 100644 --- a/rpcs3/Emu/Cell/PPCThread.cpp +++ b/rpcs3/Emu/Cell/PPCThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "PPCThread.h" diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index a28ee3a050..84aafcd45f 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -70,16 +70,16 @@ private: if(Ini.HLELogging.GetValue()) { - ConLog.Warning("SysCall[0x%llx ('%s')] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], SysCalls::GetHLEFuncName(CPU.GPR[11]).c_str(), CPU.GPR[3], CPU.PC); + LOGF_WARNING(PPU, "SysCall[0x%llx ('%s')] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], SysCalls::GetHLEFuncName(CPU.GPR[11]).c_str(), CPU.GPR[3], CPU.PC); } /*else if ((s64)CPU.GPR[3] < 0) // probably, error code { - ConLog.Error("SysCall[0x%llx] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC); + LOGF_ERROR(PPU, "SysCall[0x%llx] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC); if(CPU.GPR[11] > 1024) SysCalls::DoFunc(CPU.GPR[11]); }*/ #ifdef HLE_CALL_DEBUG - ConLog.Write("SysCall[%lld] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC); + LOGF_NOTICE(PPU, "SysCall[%lld] done with code [0x%llx]! #pc: 0x%llx", CPU.GPR[11], CPU.GPR[3], CPU.PC); #endif } @@ -2097,7 +2097,7 @@ private: Emu.GetSFuncManager().StaticExecute(CPU.GPR[11]); if (Ini.HLELogging.GetValue()) { - ConLog.Write("'%s' done with code[0x%llx]! #pc: 0x%llx", + LOGF_NOTICE(PPU, "'%s' done with code[0x%llx]! #pc: 0x%llx", Emu.GetSFuncManager()[CPU.GPR[11]]->name, CPU.GPR[3], CPU.PC); } break; @@ -2687,7 +2687,7 @@ private: const u64 RA = CPU.GPR[ra]; CPU.GPR[rd] = RA + CPU.XER.CA; CPU.XER.CA = CPU.IsCarry(RA, CPU.XER.CA); - if(oe) ConLog.Warning("addzeo"); + if(oe) LOG_WARNING(PPU, "addzeo"); if(rc) CPU.UpdateCR0(CPU.GPR[rd]); } void SUBFZE(u32 rd, u32 ra, u32 oe, bool rc) @@ -2695,7 +2695,7 @@ private: const u64 RA = CPU.GPR[ra]; CPU.GPR[rd] = ~RA + CPU.XER.CA; CPU.XER.CA = CPU.IsCarry(~RA, CPU.XER.CA); - if (oe) ConLog.Warning("subfzeo"); + if (oe) LOG_WARNING(PPU, "subfzeo"); if (rc) CPU.UpdateCR0(CPU.GPR[rd]); } void STDCX_(u32 rs, u32 ra, u32 rb) @@ -2728,7 +2728,7 @@ private: const u64 RA = CPU.GPR[ra]; CPU.GPR[rd] = ~RA + CPU.XER.CA + ~0ULL; CPU.XER.CA = CPU.IsCarry(~RA, CPU.XER.CA, ~0ULL); - if (oe) ConLog.Warning("subfmeo"); + if (oe) LOG_WARNING(PPU, "subfmeo"); if (rc) CPU.UpdateCR0(CPU.GPR[rd]); } void MULLD(u32 rd, u32 ra, u32 rb, u32 oe, bool rc) @@ -3509,7 +3509,7 @@ private: void MTFSB1(u32 crbd, bool rc) { u64 mask = (1ULL << crbd); - if ((crbd == 29) && !CPU.FPSCR.NI) ConLog.Warning("Non-IEEE mode enabled"); + if ((crbd == 29) && !CPU.FPSCR.NI) LOG_WARNING(PPU, "Non-IEEE mode enabled"); CPU.FPSCR.FPSCR |= mask; if(rc) UNIMPLEMENTED(); @@ -3523,7 +3523,7 @@ private: void MTFSB0(u32 crbd, bool rc) { u64 mask = (1ULL << crbd); - if ((crbd == 29) && !CPU.FPSCR.NI) ConLog.Warning("Non-IEEE mode disabled"); + if ((crbd == 29) && !CPU.FPSCR.NI) LOG_WARNING(PPU, "Non-IEEE mode disabled"); CPU.FPSCR.FPSCR &= ~mask; if(rc) UNIMPLEMENTED(); @@ -3534,12 +3534,12 @@ private: if(i) { - if ((crfd == 29) && !CPU.FPSCR.NI) ConLog.Warning("Non-IEEE mode enabled"); + if ((crfd == 29) && !CPU.FPSCR.NI) LOG_WARNING(PPU, "Non-IEEE mode enabled"); CPU.FPSCR.FPSCR |= mask; } else { - if ((crfd == 29) && CPU.FPSCR.NI) ConLog.Warning("Non-IEEE mode disabled"); + if ((crfd == 29) && CPU.FPSCR.NI) LOG_WARNING(PPU, "Non-IEEE mode disabled"); CPU.FPSCR.FPSCR &= ~mask; } @@ -3563,9 +3563,9 @@ private: if (CPU.FPSCR.NI != oldNI) { if (oldNI) - ConLog.Warning("Non-IEEE mode disabled"); + LOG_WARNING(PPU, "Non-IEEE mode disabled"); else - ConLog.Warning("Non-IEEE mode enabled"); + LOG_WARNING(PPU, "Non-IEEE mode enabled"); } if(rc) UNK("mtfsf."); } @@ -3995,20 +3995,20 @@ private: void UNK(const std::string& err, bool pause = true) { - ConLog.Error(err + fmt::Format(" #pc: 0x%llx", CPU.PC)); + LOGF_ERROR(PPU, err + fmt::Format(" #pc: 0x%llx", CPU.PC)); if(!pause) return; Emu.Pause(); - for(uint i=0; i<32; ++i) ConLog.Write("r%d = 0x%llx", i, CPU.GPR[i]); - for(uint i=0; i<32; ++i) ConLog.Write("f%d = %llf", i, CPU.FPR[i]); - for(uint i=0; i<32; ++i) ConLog.Write("v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true).c_str(), CPU.VPR[i].ToString().c_str()); - ConLog.Write("CR = 0x%08x", CPU.CR); - ConLog.Write("LR = 0x%llx", CPU.LR); - ConLog.Write("CTR = 0x%llx", CPU.CTR); - ConLog.Write("XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER, fmt::by_value(CPU.XER.CA), fmt::by_value(CPU.XER.OV), fmt::by_value(CPU.XER.SO)); - ConLog.Write("FPSCR = 0x%x " + for(uint i=0; i<32; ++i) LOGF_NOTICE(PPU, "r%d = 0x%llx", i, CPU.GPR[i]); + for(uint i=0; i<32; ++i) LOGF_NOTICE(PPU, "f%d = %llf", i, CPU.FPR[i]); + for(uint i=0; i<32; ++i) LOGF_NOTICE(PPU, "v%d = 0x%s [%s]", i, CPU.VPR[i].ToString(true).c_str(), CPU.VPR[i].ToString().c_str()); + LOGF_NOTICE(PPU, "CR = 0x%08x", CPU.CR); + LOGF_NOTICE(PPU, "LR = 0x%llx", CPU.LR); + LOGF_NOTICE(PPU, "CTR = 0x%llx", CPU.CTR); + LOGF_NOTICE(PPU, "XER = 0x%llx [CA=%lld | OV=%lld | SO=%lld]", CPU.XER, fmt::by_value(CPU.XER.CA), fmt::by_value(CPU.XER.OV), fmt::by_value(CPU.XER.SO)); + LOGF_NOTICE(PPU, "FPSCR = 0x%x " "[RN=%d | NI=%d | XE=%d | ZE=%d | UE=%d | OE=%d | VE=%d | " "VXCVI=%d | VXSQRT=%d | VXSOFT=%d | FPRF=%d | " "FI=%d | FR=%d | VXVC=%d | VXIMZ=%d | " diff --git a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp index cc4da73fb1..6c239fe1cc 100644 --- a/rpcs3/Emu/Cell/PPUProgramCompiler.cpp +++ b/rpcs3/Emu/Cell/PPUProgramCompiler.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "PPUProgramCompiler.h" diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 09cbc477c5..4e2396d668 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -76,7 +76,7 @@ void PPUThread::InitRegs() if(thread_num < 0) { - ConLog.Error("GetThreadNumById failed."); + LOG_ERROR(PPU, "GetThreadNumById failed."); Emu.Pause(); return; } @@ -87,7 +87,7 @@ void PPUThread::InitRegs() if(tls_size >= Emu.GetTLSMemsz()) { - ConLog.Error("Out of TLS memory."); + LOG_ERROR(PPU, "Out of TLS memory."); Emu.Pause(); return; } @@ -163,7 +163,7 @@ void PPUThread::DoRun() break; default: - ConLog.Error("Invalid CPU decoder mode: %d", Ini.CPUDecoderMode.GetValue()); + LOGF_ERROR(PPU, "Invalid CPU decoder mode: %d", Ini.CPUDecoderMode.GetValue()); Emu.Pause(); } } diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index 53a1710093..fe3d115739 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/lv2/SC_Lwmutex.h" @@ -38,7 +38,7 @@ bool RawSPUThread::Read8(const u64 addr, u8* value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Read8(0x%x)", m_index, offset); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Read8(0x%x)", m_index, offset); Emu.Pause(); return false; } @@ -51,7 +51,7 @@ bool RawSPUThread::Read16(const u64 addr, u16* value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Read16(0x%x)", m_index, offset); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Read16(0x%x)", m_index, offset); Emu.Pause(); return false; } @@ -66,39 +66,39 @@ bool RawSPUThread::Read32(const u64 addr, u32* value) u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; switch(offset) { - case MFC_LSA_offs: ConLog.Warning("RawSPUThread[%d]: Read32(MFC_LSA)", m_index); *value = MFC2.LSA.GetValue(); break; - case MFC_EAH_offs: ConLog.Warning("RawSPUThread[%d]: Read32(MFC_EAH)", m_index); *value = MFC2.EAH.GetValue(); break; - case MFC_EAL_offs: ConLog.Warning("RawSPUThread[%d]: Read32(MFC_EAL)", m_index); *value = MFC2.EAL.GetValue(); break; - case MFC_Size_Tag_offs: ConLog.Warning("RawSPUThread[%d]: Read32(MFC_Size_Tag)", m_index); *value = MFC2.Size_Tag.GetValue(); break; - case MFC_CMDStatus_offs: ConLog.Warning("RawSPUThread[%d]: Read32(MFC_CMDStatus)", m_index); *value = MFC2.CMDStatus.GetValue(); break; + case MFC_LSA_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_LSA)", m_index); *value = MFC2.LSA.GetValue(); break; + case MFC_EAH_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_EAH)", m_index); *value = MFC2.EAH.GetValue(); break; + case MFC_EAL_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_EAL)", m_index); *value = MFC2.EAL.GetValue(); break; + case MFC_Size_Tag_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_Size_Tag)", m_index); *value = MFC2.Size_Tag.GetValue(); break; + case MFC_CMDStatus_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_CMDStatus)", m_index); *value = MFC2.CMDStatus.GetValue(); break; case MFC_QStatus_offs: - ConLog.Warning("RawSPUThread[%d]: Read32(MFC_QStatus)", m_index); + LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(MFC_QStatus)", m_index); *value = MFC2.QStatus.GetValue(); break; - case Prxy_QueryType_offs: ConLog.Warning("RawSPUThread[%d]: Read32(Prxy_QueryType)", m_index); *value = Prxy.QueryType.GetValue(); break; - case Prxy_QueryMask_offs: ConLog.Warning("RawSPUThread[%d]: Read32(Prxy_QueryMask)", m_index); *value = Prxy.QueryMask.GetValue(); break; - case Prxy_TagStatus_offs: ConLog.Warning("RawSPUThread[%d]: Read32(Prxy_TagStatus)", m_index); *value = Prxy.TagStatus.GetValue(); break; + case Prxy_QueryType_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_QueryType)", m_index); *value = Prxy.QueryType.GetValue(); break; + case Prxy_QueryMask_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_QueryMask)", m_index); *value = Prxy.QueryMask.GetValue(); break; + case Prxy_TagStatus_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(Prxy_TagStatus)", m_index); *value = Prxy.TagStatus.GetValue(); break; case SPU_Out_MBox_offs: - //ConLog.Warning("RawSPUThread[%d]: Read32(SPU_Out_MBox)", m_index); + //LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_Out_MBox)", m_index); SPU.Out_MBox.PopUncond(*value); //if Out_MBox is empty yet, the result will be undefined break; - case SPU_In_MBox_offs: ConLog.Warning("RawSPUThread[%d]: Read32(SPU_In_MBox)", m_index); while(!SPU.In_MBox.Pop(*value) && !Emu.IsStopped()) Sleep(1); break; - case SPU_MBox_Status_offs: //ConLog.Warning("RawSPUThread[%d]: Read32(SPU_MBox_Status)", m_index); + case SPU_In_MBox_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_In_MBox)", m_index); while(!SPU.In_MBox.Pop(*value) && !Emu.IsStopped()) Sleep(1); break; + case SPU_MBox_Status_offs: //LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_MBox_Status)", m_index); //SPU.MBox_Status.SetValue(SPU.Out_MBox.GetCount() ? SPU.MBox_Status.GetValue() | 1 : SPU.MBox_Status.GetValue() & ~1); SPU.MBox_Status.SetValue((SPU.Out_MBox.GetCount() & 0xff) | (SPU.In_MBox.GetFreeCount() << 8)); *value = SPU.MBox_Status.GetValue(); break; - case SPU_RunCntl_offs: ConLog.Warning("RawSPUThread[%d]: Read32(SPU_RunCntl)", m_index); *value = SPU.RunCntl.GetValue(); break; + case SPU_RunCntl_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RunCntl)", m_index); *value = SPU.RunCntl.GetValue(); break; case SPU_Status_offs: - //ConLog.Warning("RawSPUThread[%d]: Read32(SPU_Status)", m_index); + //LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_Status)", m_index); *value = SPU.Status.GetValue(); break; - case SPU_NPC_offs: ConLog.Warning("RawSPUThread[%d]: Read32(SPU_NPC)", m_index); *value = SPU.NPC.GetValue(); break; - case SPU_RdSigNotify1_offs: ConLog.Warning("RawSPUThread[%d]: Read32(SPU_RdSigNotify1)", m_index); *value = SPU.SNR[0].GetValue(); break; - case SPU_RdSigNotify2_offs: ConLog.Warning("RawSPUThread[%d]: Read32(SPU_RdSigNotify2)", m_index); *value = SPU.SNR[1].GetValue(); break; + case SPU_NPC_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_NPC)", m_index); *value = SPU.NPC.GetValue(); break; + case SPU_RdSigNotify1_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RdSigNotify1)", m_index); *value = SPU.SNR[0].GetValue(); break; + case SPU_RdSigNotify2_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Read32(SPU_RdSigNotify2)", m_index); *value = SPU.SNR[1].GetValue(); break; default: - ConLog.Error("RawSPUThread[%d]: Read32(0x%x)", m_index, offset); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Read32(0x%x)", m_index, offset); Emu.Pause(); break; } @@ -114,7 +114,7 @@ bool RawSPUThread::Read64(const u64 addr, u64* value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Read64(0x%x)", m_index, offset); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Read64(0x%x)", m_index, offset); Emu.Pause(); return false; } @@ -127,7 +127,7 @@ bool RawSPUThread::Read128(const u64 addr, u128* value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Read128(0x%x)", m_index, offset); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Read128(0x%x)", m_index, offset); Emu.Pause(); return false; } @@ -140,7 +140,7 @@ bool RawSPUThread::Write8(const u64 addr, const u8 value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Write8(0x%x, 0x%x)", m_index, offset, value); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Write8(0x%x, 0x%x)", m_index, offset, value); Emu.Pause(); return false; } @@ -153,7 +153,7 @@ bool RawSPUThread::Write16(const u64 addr, const u16 value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Write16(0x%x, 0x%x)", m_index, offset, value); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Write16(0x%x, 0x%x)", m_index, offset, value); Emu.Pause(); return false; } @@ -177,20 +177,20 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value) MFC2.CMDStatus.SetValue(value); EnqMfcCmd(MFC2); break; - case MFC_QStatus_offs: ConLog.Warning("RawSPUThread[%d]: Write32(MFC_QStatus, 0x%x)", m_index, value); MFC2.QStatus.SetValue(value); break; + case MFC_QStatus_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(MFC_QStatus, 0x%x)", m_index, value); MFC2.QStatus.SetValue(value); break; case Prxy_QueryType_offs: { - ConLog.Warning("RawSPUThread[%d]: Write32(Prxy_QueryType, 0x%x)", m_index, value); + LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_QueryType, 0x%x)", m_index, value); Prxy.QueryType.SetValue(value); switch(value) { case 2: - ConLog.Warning("RawSPUThread[%d]: Prxy Query Immediate.", m_index); + LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Prxy Query Immediate.", m_index); break; default: - ConLog.Error("RawSPUThread[%d]: Unknown Prxy Query Type. (prxy_query=0x%x)", m_index, value); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Unknown Prxy Query Type. (prxy_query=0x%x)", m_index, value); break; } @@ -198,22 +198,22 @@ bool RawSPUThread::Write32(const u64 addr, const u32 value) MFC2.QStatus.SetValue(Prxy.QueryMask.GetValue()); } break; - case Prxy_QueryMask_offs: ConLog.Warning("RawSPUThread[%d]: Write32(Prxy_QueryMask, 0x%x)", m_index, value); Prxy.QueryMask.SetValue(value); break; - case Prxy_TagStatus_offs: ConLog.Warning("RawSPUThread[%d]: Write32(Prxy_TagStatus, 0x%x)", m_index, value); Prxy.TagStatus.SetValue(value); break; - case SPU_Out_MBox_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_Out_MBox, 0x%x)", m_index, value); while(!SPU.Out_MBox.Push(value) && !Emu.IsStopped()) Sleep(1); break; + case Prxy_QueryMask_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_QueryMask, 0x%x)", m_index, value); Prxy.QueryMask.SetValue(value); break; + case Prxy_TagStatus_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(Prxy_TagStatus, 0x%x)", m_index, value); Prxy.TagStatus.SetValue(value); break; + case SPU_Out_MBox_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_Out_MBox, 0x%x)", m_index, value); while(!SPU.Out_MBox.Push(value) && !Emu.IsStopped()) Sleep(1); break; case SPU_In_MBox_offs: - //ConLog.Warning("RawSPUThread[%d]: Write32(SPU_In_MBox, 0x%x)", m_index, value); + //LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_In_MBox, 0x%x)", m_index, value); SPU.In_MBox.PushUncond(value); //if In_MBox is already full, the last message will be overwritten break; - case SPU_MBox_Status_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_MBox_Status, 0x%x)", m_index, value); SPU.MBox_Status.SetValue(value); break; - case SPU_RunCntl_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_RunCntl, 0x%x)", m_index, value); SPU.RunCntl.SetValue(value); break; - case SPU_Status_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_Status, 0x%x)", m_index, value); SPU.Status.SetValue(value); break; - case SPU_NPC_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_NPC, 0x%x)", m_index, value); SPU.NPC.SetValue(value); break; - case SPU_RdSigNotify1_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_RdSigNotify1, 0x%x)", m_index, value); SPU.SNR[0].SetValue(value); break; - case SPU_RdSigNotify2_offs: ConLog.Warning("RawSPUThread[%d]: Write32(SPU_RdSigNotify2, 0x%x)", m_index, value); SPU.SNR[1].SetValue(value); break; + case SPU_MBox_Status_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_MBox_Status, 0x%x)", m_index, value); SPU.MBox_Status.SetValue(value); break; + case SPU_RunCntl_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_RunCntl, 0x%x)", m_index, value); SPU.RunCntl.SetValue(value); break; + case SPU_Status_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_Status, 0x%x)", m_index, value); SPU.Status.SetValue(value); break; + case SPU_NPC_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_NPC, 0x%x)", m_index, value); SPU.NPC.SetValue(value); break; + case SPU_RdSigNotify1_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_RdSigNotify1, 0x%x)", m_index, value); SPU.SNR[0].SetValue(value); break; + case SPU_RdSigNotify2_offs: LOGF_WARNING(Log::SPU, "RawSPUThread[%d]: Write32(SPU_RdSigNotify2, 0x%x)", m_index, value); SPU.SNR[1].SetValue(value); break; default: - ConLog.Error("RawSPUThread[%d]: Write32(0x%x, 0x%x)", m_index, offset, value); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Write32(0x%x, 0x%x)", m_index, offset, value); Emu.Pause(); break; } @@ -229,7 +229,7 @@ bool RawSPUThread::Write64(const u64 addr, const u64 value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Write64(0x%x, 0x%llx)", m_index, offset, value); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Write64(0x%x, 0x%llx)", m_index, offset, value); Emu.Pause(); return false; } @@ -242,7 +242,7 @@ bool RawSPUThread::Write128(const u64 addr, const u128 value) } u32 offset = addr - GetStartAddr() - RAW_SPU_PROB_OFFSET; - ConLog.Error("RawSPUThread[%d]: Write128(0x%x, 0x%llx_%llx)", m_index, offset, value._u64[1], value._u64[0]); + LOGF_ERROR(Log::SPU, "RawSPUThread[%d]: Write128(0x%x, 0x%llx_%llx)", m_index, offset, value._u64[1], value._u64[0]); Emu.Pause(); return false; } @@ -260,7 +260,7 @@ u32 RawSPUThread::GetIndex() const void RawSPUThread::Task() { - if (Ini.HLELogging.GetValue()) ConLog.Write("%s enter", PPCThread::GetFName().c_str()); + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(Log::SPU, "%s enter", PPCThread::GetFName().c_str()); const std::vector& bp = Emu.GetBreakPoints(); @@ -312,7 +312,7 @@ void RawSPUThread::Task() is_last_paused = false; PC = SPU.NPC.GetValue(); SPU.Status.SetValue(SPU_STATUS_RUNNING); - ConLog.Warning("Starting RawSPU..."); + LOGF_WARNING(Log::SPU, "Starting RawSPU..."); } Step(); @@ -336,12 +336,12 @@ void RawSPUThread::Task() } catch(const std::string& e) { - ConLog.Error("Exception: %s", e.c_str()); + LOGF_ERROR(Log::SPU, "Exception: %s", e.c_str()); } catch(const char* e) { - ConLog.Error("Exception: %s", e); + LOGF_ERROR(Log::SPU, "Exception: %s", e); } - if (Ini.HLELogging.GetValue()) ConLog.Write("%s leave", PPCThread::GetFName().c_str()); + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(Log::SPU, "%s leave", PPCThread::GetFName().c_str()); } diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index 209d3c5efb..2161b4f7f6 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -18,9 +18,9 @@ #define MEM_AND_REG_HASH() \ unsigned char mem_h[20]; sha1(&Memory[CPU.dmac.ls_offset], 256*1024, mem_h); \ unsigned char reg_h[20]; sha1((const unsigned char*)CPU.GPR, sizeof(CPU.GPR), reg_h); \ - ConLog.Write("Mem hash: 0x%llx, reg hash: 0x%llx", *(u64*)mem_h, *(u64*)reg_h); + LOGF_NOTICE(Log::SPU, "Mem hash: 0x%llx, reg hash: 0x%llx", *(u64*)mem_h, *(u64*)reg_h); -#define LOG2_OPCODE(...) //MEM_AND_REG_HASH(); ConLog.Write(__FUNCTION__ "(): " __VA_ARGS__) +#define LOG2_OPCODE(...) //MEM_AND_REG_HASH(); LOGF_NOTICE(Log::SPU, __FUNCTION__ "(): " __VA_ARGS__) #define LOG5_OPCODE(...) /// @@ -339,7 +339,7 @@ private: u32 lsa = (CPU.GPR[ra]._u32[3] + CPU.GPR[rb]._u32[3]) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("STQX: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "STQX: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -438,7 +438,7 @@ private: if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("LQX: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "LQX: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1126,7 +1126,7 @@ private: u32 lsa = (i16 << 2) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("STQA: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "STQA: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1177,7 +1177,7 @@ private: u32 lsa = branchTarget(CPU.PC, i16) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("STQR: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "STQR: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1195,7 +1195,7 @@ private: u32 lsa = (i16 << 2) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("LQA: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "LQA: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1245,7 +1245,7 @@ private: u32 lsa = branchTarget(CPU.PC, i16) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("LQR: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "LQR: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1334,11 +1334,11 @@ private: const u32 lsa = (CPU.GPR[ra]._i32[3] + i10) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("STQD: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "STQD: bad lsa (0x%x)", lsa); Emu.Pause(); return; } - //ConLog.Write("STQD(lsa=0x%x): GPR[%d] (0x%llx%llx)", lsa, rt, CPU.GPR[rt]._u64[1], CPU.GPR[rt]._u64[0]); + //LOGF_NOTICE(Log::SPU, "STQD(lsa=0x%x): GPR[%d] (0x%llx%llx)", lsa, rt, CPU.GPR[rt]._u64[1], CPU.GPR[rt]._u64[0]); CPU.WriteLS128(lsa, CPU.GPR[rt]._u128); } void LQD(u32 rt, s32 i10, u32 ra) //i10 is shifted left by 4 while decoding @@ -1346,7 +1346,7 @@ private: const u32 lsa = (CPU.GPR[ra]._i32[3] + i10) & 0x3fff0; if(!CPU.IsGoodLSA(lsa)) { - ConLog.Error("LQD: bad lsa (0x%x)", lsa); + LOGF_ERROR(Log::SPU, "LQD: bad lsa (0x%x)", lsa); Emu.Pause(); return; } @@ -1540,8 +1540,8 @@ private: void UNK(const std::string& err) { - ConLog.Error(err + fmt::Format(" #pc: 0x%x", CPU.PC)); + LOGF_ERROR(Log::SPU, err + fmt::Format(" #pc: 0x%x", CPU.PC)); Emu.Pause(); - for(uint i=0; i<128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); + for(uint i=0; i<128; ++i) LOGF_NOTICE(Log::SPU, "r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); } }; diff --git a/rpcs3/Emu/Cell/SPURecompiler.h b/rpcs3/Emu/Cell/SPURecompiler.h index b68a7c6cd1..382f064b0e 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.h +++ b/rpcs3/Emu/Cell/SPURecompiler.h @@ -3845,7 +3845,7 @@ private: void UNK(const std::string& err) { - ConLog.Error(err + fmt::Format(" #pc: 0x%x", CPU.PC)); + LOGF_ERROR(Log::SPU, err + fmt::Format(" #pc: 0x%x", CPU.PC)); c.mov(cpu_qword(PC), (u32)CPU.PC); do_finalize = true; Emu.Pause(); diff --git a/rpcs3/Emu/Cell/SPURecompilerCore.cpp b/rpcs3/Emu/Cell/SPURecompilerCore.cpp index 565132430f..2d990c5d55 100644 --- a/rpcs3/Emu/Cell/SPURecompilerCore.cpp +++ b/rpcs3/Emu/Cell/SPURecompilerCore.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/lv2/SC_Lwmutex.h" @@ -164,7 +164,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) if (!pos) { - ConLog.Error("SPURecompilerCore::DecodeMemory(): ls_addr = 0"); + LOGF_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(): ls_addr = 0"); Emu.Pause(); return 0; } @@ -185,7 +185,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) if (!is_valid) { // TODO - ConLog.Error("SPURecompilerCore::DecodeMemory(ls_addr=0x%x): code has changed", pos * sizeof(u32)); + LOGF_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(ls_addr=0x%x): code has changed", pos * sizeof(u32)); Emu.Pause(); return 0; } @@ -198,7 +198,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) did_compile = true; if (entry[pos].valid == 0) { - ConLog.Error("SPURecompilerCore::Compile(ls_addr=0x%x): branch to 0x0 opcode", pos * sizeof(u32)); + LOGF_ERROR(Log::SPU, "SPURecompilerCore::Compile(ls_addr=0x%x): branch to 0x0 opcode", pos * sizeof(u32)); Emu.Pause(); return 0; } @@ -206,7 +206,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) if (!entry[pos].pointer) { - ConLog.Error("SPURecompilerCore::DecodeMemory(ls_addr=0x%x): compilation failed", pos * sizeof(u32)); + LOGF_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(ls_addr=0x%x): compilation failed", pos * sizeof(u32)); Emu.Pause(); return 0; } @@ -223,7 +223,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) //if (pos == 0x19c >> 2) { //Emu.Pause(); - //for (uint i = 0; i < 128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); + //for (uint i = 0; i < 128; ++i) LOGF_NOTICE(Log::SPU, "r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); } } @@ -243,7 +243,7 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) //if (pos == 0x340 >> 2) { //Emu.Pause(); - //for (uint i = 0; i < 128; ++i) ConLog.Write("r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); + //for (uint i = 0; i < 128; ++i) LOGF_NOTICE(Log::SPU, "r%d = 0x%s", i, CPU.GPR[i].ToString().c_str()); } } diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index c454171422..9e6acd5827 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/lv2/SC_Lwmutex.h" @@ -86,7 +86,7 @@ void SPUThread::DoRun() break; default: - ConLog.Error("Invalid SPU decoder mode: %d", Ini.SPUDecoderMode.GetValue()); + LOGF_ERROR(Log::SPU, "Invalid SPU decoder mode: %d", Ini.SPUDecoderMode.GetValue()); Emu.Pause(); } } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 8a789cee2a..a28f8e906b 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -211,7 +211,7 @@ public: return this->low >> 22 & 0x3; default: - ConLog.Error("Unexpected slice value in FPSCR::checkSliceRounding(): %d", slice); + LOGF_ERROR(SPU, "Unexpected slice value in FPSCR::checkSliceRounding(): %d", slice); return 0; } } @@ -599,7 +599,7 @@ public: u32 num = (ea & SYS_SPU_THREAD_BASE_MASK) / SYS_SPU_THREAD_OFFSET; // thread number in group if (num >= group->list.size() || !group->list[num]) { - ConLog.Error("DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx): invalid thread", ea); + LOGF_ERROR(Log::SPU, "DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx): invalid thread", ea); return false; } @@ -618,13 +618,13 @@ public: } else { - ConLog.Error("DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx, size=%d, cmd=0x%x): invalid command", ea, size, cmd); + LOGF_ERROR(Log::SPU, "DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx, size=%d, cmd=0x%x): invalid command", ea, size, cmd); return false; } } else { - ConLog.Error("DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx): group not set", ea); + LOGF_ERROR(Log::SPU, "DMAC::ProcessCmd(): SPU Thread Group MMIO Access (ea=0x%llx): group not set", ea); return false; } } @@ -646,7 +646,7 @@ public: default: { - ConLog.Error("DMAC::ProcessCmd(): Unknown DMA cmd."); + LOG_ERROR(Log::SPU, "DMAC::ProcessCmd(): Unknown DMA cmd."); return false; } } @@ -664,7 +664,7 @@ public: } else { - ConLog.Error("DMAC::ProcessCmd(): PUT* cmd failed (ea=0x%llx, lsa=0x%x, size=%d)", ea, lsa, size); + LOGF_ERROR(Log::SPU, "DMAC::ProcessCmd(): PUT* cmd failed (ea=0x%llx, lsa=0x%x, size=%d)", ea, lsa, size); return false; // TODO: page fault (?) } } @@ -677,14 +677,14 @@ public: } else { - ConLog.Error("DMAC::ProcessCmd(): GET* cmd failed (ea=0x%llx, lsa=0x%x, size=%d)", ea, lsa, size); + LOGF_ERROR(Log::SPU, "DMAC::ProcessCmd(): GET* cmd failed (ea=0x%llx, lsa=0x%x, size=%d)", ea, lsa, size); return false; // TODO: page fault (?) } } default: { - ConLog.Error("DMAC::ProcessCmd(): Unknown DMA cmd."); + LOG_ERROR(Log::SPU, "DMAC::ProcessCmd(): Unknown DMA cmd."); return false; // ??? } } @@ -725,7 +725,7 @@ public: u32 size = rec->ts; if (size < 16 && size != 1 && size != 2 && size != 4 && size != 8) { - ConLog.Error("DMA List: invalid transfer size(%d)", size); + LOGF_ERROR(Log::SPU, "DMA List: invalid transfer size(%d)", size); return; } @@ -737,7 +737,7 @@ public: } if (Ini.HLELogging.GetValue() || rec->s) - ConLog.Write("*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)", + LOGF_NOTICE(Log::SPU, "*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)", i, list_size, (u16)rec->s, (u16)rec->ts, (u32)rec->ea, lsa | (addr & 0xf)); lsa += std::max(size, (u32)16); @@ -748,7 +748,7 @@ public: if (StallList[tag].MFCArgs) { - ConLog.Error("DMA List: existing stalled list found (tag=%d)", tag); + LOGF_ERROR(Log::SPU, "DMA List: existing stalled list found (tag=%d)", tag); } StallList[tag].MFCArgs = &MFCArgs; StallList[tag].cmd = cmd; @@ -780,7 +780,7 @@ public: case MFC_PUTR_CMD: // ??? case MFC_GET_CMD: { - if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(Log::SPU, "DMA %s%s%s%s: lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", (op & MFC_PUT_CMD ? "PUT" : "GET"), (op & MFC_RESULT_MASK ? "R" : ""), (op & MFC_BARRIER_MASK ? "B" : ""), @@ -795,7 +795,7 @@ public: case MFC_PUTRL_CMD: // ??? case MFC_GETL_CMD: { - if (Ini.HLELogging.GetValue()) ConLog.Write("DMA %s%s%s%s: lsa = 0x%x, list = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(Log::SPU, "DMA %s%s%s%s: lsa = 0x%x, list = 0x%llx, tag = 0x%x, size = 0x%x, cmd = 0x%x", (op & MFC_PUT_CMD ? "PUT" : "GET"), (op & MFC_RESULT_MASK ? "RL" : "L"), (op & MFC_BARRIER_MASK ? "B" : ""), @@ -811,7 +811,7 @@ public: case MFC_PUTLLUC_CMD: case MFC_PUTQLLUC_CMD: { - if (Ini.HLELogging.GetValue() || size != 128) ConLog.Write("DMA %s: lsa=0x%x, ea = 0x%llx, (tag) = 0x%x, (size) = 0x%x, cmd = 0x%x", + if (Ini.HLELogging.GetValue() || size != 128) LOGF_NOTICE(Log::SPU, "DMA %s: lsa=0x%x, ea = 0x%llx, (tag) = 0x%x, (size) = 0x%x, cmd = 0x%x", (op == MFC_GETLLAR_CMD ? "GETLLAR" : op == MFC_PUTLLC_CMD ? "PUTLLC" : op == MFC_PUTLLUC_CMD ? "PUTLLUC" : "PUTQLLUC"), @@ -857,7 +857,7 @@ public: { if (buf[last].hi != reservation.data[last].hi && buf[last].lo != reservation.data[last].lo) { - ConLog.Error("MFC_PUTLLC_CMD: TODO: 128bit compare and swap"); + LOG_ERROR(Log::SPU, "MFC_PUTLLC_CMD: TODO: 128bit compare and swap"); Emu.Pause(); Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS); } @@ -885,7 +885,7 @@ public: } else // full 64 bit { - ConLog.Error("MFC_PUTLLC_CMD: TODO: 64bit compare and swap"); + LOGF_ERROR(Log::SPU, "MFC_PUTLLC_CMD: TODO: 64bit compare and swap"); Emu.Pause(); Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS); }*/ @@ -894,7 +894,7 @@ public: else { ProcessCmd(MFC_PUT_CMD, tag, lsa, ea, 128); - ConLog.Error("MFC_PUTLLC_CMD: Reservation Error: impossibru (~ 16x%d (mask=0x%x)) (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)", + LOGF_ERROR(Log::SPU, "MFC_PUTLLC_CMD: Reservation Error: impossibru (~ 16x%d (mask=0x%x)) (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)", changed, mask, op, cmd, lsa, ea, tag, size); Emu.Pause(); Prxy.AtomicStat.PushUncond(MFC_PUTLLC_SUCCESS); @@ -929,7 +929,7 @@ public: break; default: - ConLog.Error("Unknown MFC cmd. (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)", + LOGF_ERROR( Log::SPU, "Unknown MFC cmd. (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)", op, cmd, lsa, ea, tag, size); break; } @@ -949,7 +949,7 @@ public: return count; case SPU_WrOutIntrMbox: - ConLog.Warning("GetChannelCount(%s) = 0", spu_ch_name[ch]); + LOGF_WARNING(Log::SPU, "GetChannelCount(%s) = 0", spu_ch_name[ch]); return 0; case MFC_RdTagStat: @@ -971,7 +971,7 @@ public: return Prxy.AtomicStat.GetCount(); default: - ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", + LOGF_ERROR(Log::SPU, "%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]); break; } @@ -988,7 +988,7 @@ public: case SPU_WrOutIntrMbox: if (!group) // if RawSPU { - if (Ini.HLELogging.GetValue()) ConLog.Write("SPU_WrOutIntrMbox: interrupt(v=0x%x)", v); + if (Ini.HLELogging.GetValue()) LOGF_NOTICE(Log::SPU, "SPU_WrOutIntrMbox: interrupt(v=0x%x)", v); SPU.Out_IntrMBox.PushUncond(v); m_intrtag[2].stat |= 1; if (CPUThread* t = Emu.GetCPU().GetThread(m_intrtag[2].thread)) @@ -998,7 +998,7 @@ public: Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); + LOGF_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); return; } } @@ -1019,20 +1019,20 @@ public: u32 data; if (!SPU.Out_MBox.Pop(data)) { - ConLog.Error("sys_spu_thread_send_event(v=0x%x, spup=%d): Out_MBox is empty", v, spup); + LOGF_ERROR(Log::SPU, "sys_spu_thread_send_event(v=0x%x, spup=%d): Out_MBox is empty", v, spup); return; } if (SPU.In_MBox.GetCount()) { - ConLog.Error("sys_spu_thread_send_event(v=0x%x, spup=%d): In_MBox is not empty", v, spup); + LOGF_ERROR(Log::SPU, "sys_spu_thread_send_event(v=0x%x, spup=%d): In_MBox is not empty", v, spup); SPU.In_MBox.PushUncond(CELL_EBUSY); // ??? return; } if (Ini.HLELogging.GetValue()) { - ConLog.Write("sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data); + LOGF_NOTICE(Log::SPU, "sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data); } EventPort& port = SPUPs[spup]; @@ -1042,7 +1042,7 @@ public: if (!port.eq) { // spu_printf fails there - ConLog.Warning("sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x): event queue not connected", spup, v & 0x00ffffff, data); + LOGF_WARNING(Log::SPU, "sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x): event queue not connected", spup, (v & 0x00ffffff), data); SPU.In_MBox.PushUncond(CELL_ENOTCONN); // TODO: check error passing return; } @@ -1064,25 +1064,25 @@ public: u32 data; if (!SPU.Out_MBox.Pop(data)) { - ConLog.Error("sys_event_flag_set_bit(v=0x%x (flag=%d)): Out_MBox is empty", v, flag); + LOGF_ERROR(Log::SPU, "sys_event_flag_set_bit(v=0x%x (flag=%d)): Out_MBox is empty", v, flag); return; } if (flag > 63) { - ConLog.Error("sys_event_flag_set_bit(id=%d, v=0x%x): flag > 63", data, v, flag); + LOGF_ERROR(Log::SPU, "sys_event_flag_set_bit(id=%d, v=0x%x): flag > 63", data, v, flag); return; } //if (Ini.HLELogging.GetValue()) { - ConLog.Warning("sys_event_flag_set_bit(id=%d, v=0x%x (flag=%d))", data, v, flag); + LOGF_WARNING(Log::SPU, "sys_event_flag_set_bit(id=%d, v=0x%x (flag=%d))", data, v, flag); } EventFlag* ef; if (!Emu.GetIdManager().GetIDData(data, ef)) { - ConLog.Error("sys_event_flag_set_bit(id=%d, v=0x%x (flag=%d)): EventFlag not found", data, v, flag); + LOGF_ERROR(Log::SPU, "sys_event_flag_set_bit(id=%d, v=0x%x (flag=%d)): EventFlag not found", data, v, flag); SPU.In_MBox.PushUncond(CELL_ESRCH); return; } @@ -1110,11 +1110,11 @@ public: u32 data; if (SPU.Out_MBox.Pop(data)) { - ConLog.Error("SPU_WrOutIntrMbox: unknown data (v=0x%x); Out_MBox = 0x%x", v, data); + LOGF_ERROR(Log::SPU, "SPU_WrOutIntrMbox: unknown data (v=0x%x); Out_MBox = 0x%x", v, data); } else { - ConLog.Error("SPU_WrOutIntrMbox: unknown data (v=0x%x)", v); + LOGF_ERROR(Log::SPU, "SPU_WrOutIntrMbox: unknown data (v=0x%x)", v); } SPU.In_MBox.PushUncond(CELL_EINVAL); // ??? return; @@ -1166,13 +1166,13 @@ public: { if (v >= 32) { - ConLog.Error("MFC_WrListStallAck error: invalid tag(%d)", v); + LOGF_ERROR(Log::SPU, "MFC_WrListStallAck error: invalid tag(%d)", v); return; } StalledList temp = StallList[v]; if (!temp.MFCArgs) { - ConLog.Error("MFC_WrListStallAck error: empty tag(%d)", v); + LOGF_ERROR(Log::SPU, "MFC_WrListStallAck error: empty tag(%d)", v); return; } StallList[v].MFCArgs = nullptr; @@ -1181,11 +1181,11 @@ public: break; default: - ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]); + LOGF_ERROR(Log::SPU, "%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]); break; } - if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); + if (Emu.IsStopped()) LOGF_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); } void ReadChannel(SPU_GPR_hdr& r, u32 ch) @@ -1224,11 +1224,11 @@ public: break; default: - ConLog.Error("%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]); + LOGF_ERROR(Log::SPU, "%s error: unknown/illegal channel (%d [%s]).", __FUNCTION__, ch, spu_ch_name[ch]); break; } - if (Emu.IsStopped()) ConLog.Warning("%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); + if (Emu.IsStopped()) LOGF_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); } void DoStop(u32 code) @@ -1242,21 +1242,21 @@ public: u32 spuq = 0; if (!SPU.Out_MBox.Pop(spuq)) { - ConLog.Error("sys_spu_thread_receive_event: cannot read Out_MBox"); + LOG_ERROR(Log::SPU, "sys_spu_thread_receive_event: cannot read Out_MBox"); SPU.In_MBox.PushUncond(CELL_EINVAL); // ??? return; } if (SPU.In_MBox.GetCount()) { - ConLog.Error("sys_spu_thread_receive_event(spuq=0x%x): In_MBox is not empty", spuq); + LOGF_ERROR(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x): In_MBox is not empty", spuq); SPU.In_MBox.PushUncond(CELL_EBUSY); // ??? return; } if (Ini.HLELogging.GetValue()) { - ConLog.Write("sys_spu_thread_receive_event(spuq=0x%x)", spuq); + LOGF_NOTICE(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x)", spuq); } EventQueue* eq; @@ -1307,7 +1307,7 @@ public: Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("sys_spu_thread_receive_event(spuq=0x%x) aborted", spuq); + LOGF_WARNING(Log::SPU, "sys_spu_thread_receive_event(spuq=0x%x) aborted", spuq); eq->sq.invalidate(tid); return; } @@ -1317,12 +1317,12 @@ public: case 0x102: if (!SPU.Out_MBox.GetCount()) { - ConLog.Error("sys_spu_thread_exit (no status, code 0x102)"); + LOG_ERROR(Log::SPU, "sys_spu_thread_exit (no status, code 0x102)"); } else if (Ini.HLELogging.GetValue()) { // the real exit status - ConLog.Write("sys_spu_thread_exit (status=0x%x)", SPU.Out_MBox.GetValue()); + LOGF_NOTICE(Log::SPU, "sys_spu_thread_exit (status=0x%x)", SPU.Out_MBox.GetValue()); } SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_STOP); Stop(); @@ -1330,11 +1330,11 @@ public: default: if (!SPU.Out_MBox.GetCount()) { - ConLog.Error("Unknown STOP code: 0x%x (no message)", code); + LOGF_ERROR(Log::SPU, "Unknown STOP code: 0x%x (no message)", code); } else { - ConLog.Error("Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue()); + LOGF_ERROR(Log::SPU, "Unknown STOP code: 0x%x (message=0x%x)", code, SPU.Out_MBox.GetValue()); } SPU.Status.SetValue(SPU_STATUS_STOPPED_BY_STOP); Stop(); diff --git a/rpcs3/Emu/ConLog.h b/rpcs3/Emu/ConLog.h deleted file mode 100644 index 615d8e6d29..0000000000 --- a/rpcs3/Emu/ConLog.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -class LogWriter -{ - rFile m_logfile; - - void WriteToLog(const std::string& prefix, const std::string& value, u8 lvl); - -public: - LogWriter(); - - template - void Write(const std::string &fmt, Arg... args) - { - std::string frmt = fmt::Format(fmt, std::forward(args)...); - WriteToLog("!", frmt, 2); - } - - template - void Error(const std::string &fmt, Arg... args) - { - std::string frmt = fmt::Format(fmt, std::forward(args)...); - WriteToLog("E", frmt, 4); - } - - template - void Warning(const std::string &fmt, Arg... args) - { - std::string frmt = fmt::Format(fmt, std::forward(args)...); - WriteToLog("W", frmt, 3); - } - - template - void Success(const std::string &fmt, Arg... args) - { - std::string frmt = fmt::Format(fmt, std::forward(args)...); - WriteToLog("S", frmt, 1); - } - - virtual void SkipLn(); -}; - - -extern LogWriter ConLog; diff --git a/rpcs3/Emu/DbgConsole.cpp b/rpcs3/Emu/DbgConsole.cpp deleted file mode 100644 index 3e9605cbbd..0000000000 --- a/rpcs3/Emu/DbgConsole.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "stdafx.h" -#include "Emu/ConLog.h" -#include "Emu/Memory/Memory.h" -#include "Emu/System.h" -#include "DbgConsole.h" - -BEGIN_EVENT_TABLE(DbgConsole, FrameBase) -EVT_CLOSE(DbgConsole::OnQuit) -END_EVENT_TABLE() - -DbgConsole::DbgConsole() -: FrameBase(nullptr, wxID_ANY, "Debug Console", "", wxDefaultSize, wxDefaultPosition, wxDEFAULT_FRAME_STYLE, true) -, ThreadBase("DbgConsole thread") -, m_output(nullptr) -{ - m_console = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, - wxSize(500, 500), wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2); - m_console->SetBackgroundColour(wxColor("Black")); - m_console->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); - - m_color_white = new wxTextAttr(wxColour(255, 255, 255)); - m_color_red = new wxTextAttr(wxColour(255, 0, 0)); - - if (Ini.HLESaveTTY.GetValue()) - m_output = new wxFile("tty.log", wxFile::write); -} - -DbgConsole::~DbgConsole() -{ - ThreadBase::Stop(); - m_dbg_buffer.Flush(); - - safe_delete(m_console); - safe_delete(m_color_white); - safe_delete(m_color_red); - safe_delete(m_output); -} - -void DbgConsole::Write(int ch, const std::string& text) -{ - while (m_dbg_buffer.IsBusy()) - { - if (Emu.IsStopped()) - { - return; - } - Sleep(1); - } - m_dbg_buffer.Push(DbgPacket(ch, text)); - - if (!IsAlive()) Start(); -} - -void DbgConsole::Clear() -{ - m_console->Clear(); -} - -void DbgConsole::Task() -{ - while (!TestDestroy()) - { - if (!m_dbg_buffer.HasNewPacket()) - { - if (Emu.IsStopped()) - { - break; - } - Sleep(1); - continue; - } - - DbgPacket packet = m_dbg_buffer.Pop(); - m_console->SetDefaultStyle(packet.m_ch == 1 ? *m_color_red : *m_color_white); - m_console->SetInsertionPointEnd(); - m_console->WriteText(fmt::FromUTF8(packet.m_text)); - - if (m_output && Ini.HLESaveTTY.GetValue()) - m_output->Write(fmt::FromUTF8(packet.m_text)); - - if (!DbgConsole::IsShown()) Show(); - } -} - -void DbgConsole::OnQuit(wxCloseEvent& event) -{ - ThreadBase::Stop(false); - Hide(); - - if (m_output) - { - m_output->Close(); - m_output = nullptr; - } - - //event.Skip(); -} diff --git a/rpcs3/Emu/DbgConsole.h b/rpcs3/Emu/DbgConsole.h deleted file mode 100644 index 5775f98865..0000000000 --- a/rpcs3/Emu/DbgConsole.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#include //for memset - -struct DbgPacket -{ - int m_ch; - std::string m_text; - - DbgPacket(int ch, const std::string& text) - : m_ch(ch) - , m_text(text) - { - } - - DbgPacket() - { - } - - void Clear() - { - m_text.clear(); - } -}; - -struct _DbgBuffer : public MTPacketBuffer -{ - _DbgBuffer() : MTPacketBuffer(1024) - { - } - - void _push(const DbgPacket& data) - { - const u32 stext = data.m_text.length(); - - m_buffer.resize(m_buffer.size() + sizeof(int) + sizeof(u32) + stext); - - u32 c_put = m_put; - - memcpy(&m_buffer[c_put], &data.m_ch, sizeof(int)); - c_put += sizeof(int); - - memcpy(&m_buffer[c_put], &stext, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_text.data(), stext); - c_put += stext; - - m_put = c_put; - CheckBusy(); - } - - DbgPacket _pop() - { - DbgPacket ret; - - u32 c_get = m_get; - - ret.m_ch = *(int*)&m_buffer[c_get]; - c_get += sizeof(int); - - const u32& stext = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - if (stext) ret.m_text = std::string(reinterpret_cast(&m_buffer[c_get]), stext); - c_get += stext; - - m_get = c_get; - if (!HasNewPacket()) Flush(); - - return ret; - } -}; - -class DbgConsole - : public FrameBase - , public ThreadBase -{ - wxFile* m_output; - wxTextCtrl* m_console; - wxTextAttr* m_color_white; - wxTextAttr* m_color_red; - _DbgBuffer m_dbg_buffer; - -public: - DbgConsole(); - ~DbgConsole(); - void Write(int ch, const std::string& text); - void Clear(); - virtual void Task(); - -private: - void OnQuit(wxCloseEvent& event); - DECLARE_EVENT_TABLE(); -}; \ No newline at end of file diff --git a/rpcs3/Emu/Event.cpp b/rpcs3/Emu/Event.cpp index 528b9703c6..d36bc08bc6 100644 --- a/rpcs3/Emu/Event.cpp +++ b/rpcs3/Emu/Event.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "event.h" diff --git a/rpcs3/Emu/FS/VFS.cpp b/rpcs3/Emu/FS/VFS.cpp index 3a55fc68c1..83da350d73 100644 --- a/rpcs3/Emu/FS/VFS.cpp +++ b/rpcs3/Emu/FS/VFS.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "VFS.h" #include "Emu/HDD/HDD.h" diff --git a/rpcs3/Emu/FS/vfsDir.cpp b/rpcs3/Emu/FS/vfsDir.cpp index 6c567a85de..ae32e0b05f 100644 --- a/rpcs3/Emu/FS/vfsDir.cpp +++ b/rpcs3/Emu/FS/vfsDir.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" diff --git a/rpcs3/Emu/FS/vfsFile.cpp b/rpcs3/Emu/FS/vfsFile.cpp index 6bd1defc95..1a80009ba7 100644 --- a/rpcs3/Emu/FS/vfsFile.cpp +++ b/rpcs3/Emu/FS/vfsFile.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" diff --git a/rpcs3/Emu/FS/vfsLocalFile.cpp b/rpcs3/Emu/FS/vfsLocalFile.cpp index 46e989354f..9c40645808 100644 --- a/rpcs3/Emu/FS/vfsLocalFile.cpp +++ b/rpcs3/Emu/FS/vfsLocalFile.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "vfsLocalFile.h" static const rFile::OpenMode vfs2wx_mode(vfsOpenMode mode) @@ -53,7 +53,7 @@ bool vfsLocalFile::Open(const std::string& path, vfsOpenMode mode) bool vfsLocalFile::Create(const std::string& path) { - ConLog.Warning("vfsLocalFile::Create('%s')", path.c_str()); + LOGF_WARNING(HLE, "vfsLocalFile::Create('%s')", path.c_str()); for(uint p=1; p < path.length() && path[p] != '\0' ; p++) { for(; p < path.length() && path[p] != '\0'; p++) @@ -65,7 +65,7 @@ bool vfsLocalFile::Create(const std::string& path) const std::string& dir = path.substr(0, p); if(!rDirExists(dir)) { - ConLog.Write("create dir: %s", dir.c_str()); + LOGF_NOTICE(HLE, "create dir: %s", dir.c_str()); rMkdir(dir); } } diff --git a/rpcs3/Emu/FS/vfsStreamMemory.cpp b/rpcs3/Emu/FS/vfsStreamMemory.cpp index 7b508a05fb..7f140bf35b 100644 --- a/rpcs3/Emu/FS/vfsStreamMemory.cpp +++ b/rpcs3/Emu/FS/vfsStreamMemory.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "vfsStreamMemory.h" diff --git a/rpcs3/Emu/GS/GL/GLBuffers.cpp b/rpcs3/Emu/GS/GL/GLBuffers.cpp index ae0307796b..41ddddf619 100644 --- a/rpcs3/Emu/GS/GL/GLBuffers.cpp +++ b/rpcs3/Emu/GS/GL/GLBuffers.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "GLBuffers.h" #include "GLGSRender.h" diff --git a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp index 79b8bfedff..710d2678b6 100644 --- a/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp +++ b/rpcs3/Emu/GS/GL/GLFragmentProgram.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "GLFragmentProgram.h" @@ -19,7 +19,7 @@ void GLFragmentDecompilerThread::SetDst(std::string code, bool append_mask) case 7: code = "(" + code + " / 8.0)"; break; default: - ConLog.Error("Bad scale: %d", fmt::by_value(src1.scale)); + LOGF_ERROR(RSX, "Bad scale: %d", fmt::by_value(src1.scale)); Emu.Pause(); break; } @@ -210,7 +210,7 @@ template std::string GLFragmentDecompilerThread::GetSRC(T src) } else { - ConLog.Error("Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num)); + LOGF_ERROR(RSX, "Bad src reg num: %d", fmt::by_value(dst.src_attr_reg_num)); ret += m_parr.AddParam(PARAM_IN, "vec4", "unk"); Emu.Pause(); } @@ -224,7 +224,7 @@ template std::string GLFragmentDecompilerThread::GetSRC(T src) break; default: - ConLog.Error("Bad src type %d", fmt::by_value(src.reg_type)); + LOGF_ERROR(RSX, "Bad src type %d", fmt::by_value(src.reg_type)); Emu.Pause(); break; } @@ -416,7 +416,7 @@ void GLFragmentDecompilerThread::Task() //case 0x45: SetDst("return"); break; //RET default: - ConLog.Error("Unknown fp opcode 0x%x (inst %d)", opcode, m_size / (4 * 4)); + LOGF_ERROR(RSX, "Unknown fp opcode 0x%x (inst %d)", opcode, m_size / (4 * 4)); //Emu.Pause(); break; } @@ -515,12 +515,12 @@ void GLShaderProgram::Compile() char* buf = new char[infoLength]; // Buffer to store infoLog glGetShaderInfoLog(m_id, infoLength, &len, buf); // Retrieve the shader info log into our buffer - ConLog.Error("Failed to compile shader: %s", buf); // Write log to the console + LOGF_ERROR(RSX, "Failed to compile shader: %s", buf); // Write log to the console delete[] buf; } - ConLog.Write(m_shader.c_str()); // Log the text of the shader that failed to compile + LOG_NOTICE(RSX, m_shader.c_str()); // Log the text of the shader that failed to compile Emu.Pause(); // Pause the emulator, we can't really continue from here } } @@ -540,7 +540,7 @@ void GLShaderProgram::Delete() { if (Emu.IsStopped()) { - ConLog.Warning("GLShaderProgram::Delete(): glDeleteShader(%d) avoided", m_id); + LOGF_WARNING(RSX, "GLShaderProgram::Delete(): glDeleteShader(%d) avoided", m_id); } else { diff --git a/rpcs3/Emu/GS/GL/GLGSRender.cpp b/rpcs3/Emu/GS/GL/GLGSRender.cpp index c06a98c5e4..4cb0dcd0a2 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.cpp +++ b/rpcs3/Emu/GS/GL/GLGSRender.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "GLGSRender.h" @@ -9,7 +9,7 @@ #define DUMP_VERTEX_DATA 0 #if CMD_DEBUG - #define CMD_LOG ConLog.Write + #define CMD_LOG(...) LOGF_NOTICE(RSX, __VA_ARGS__) #else #define CMD_LOG(...) #endif @@ -27,7 +27,7 @@ void printGlError(GLenum err, const char* situation) { if(err != GL_NO_ERROR) { - ConLog.Error("%s: opengl error 0x%04x", situation, err); + LOGF_ERROR(RSX, "%s: opengl error 0x%04x", situation, err); Emu.Pause(); } } @@ -180,7 +180,7 @@ void GLGSRender::EnableVertexData(bool indexed_draw) break; default: - ConLog.Error("Bad cv type! %d", m_vertex_data[i].type); + LOGF_ERROR(HLE, "Bad cv type! %d", m_vertex_data[i].type); return; } @@ -309,7 +309,7 @@ void GLGSRender::InitFragmentData() { if(!m_cur_shader_prog) { - ConLog.Error("InitFragmentData: m_cur_shader_prog == NULL"); + LOGF_ERROR(RSX, "InitFragmentData: m_cur_shader_prog == NULL"); return; } @@ -330,20 +330,20 @@ void GLGSRender::InitFragmentData() } //if(m_fragment_constants.GetCount()) - // ConLog.SkipLn(); + // LOG_NOTICE(HLE, ""); } bool GLGSRender::LoadProgram() { if(!m_cur_shader_prog) { - ConLog.Warning("LoadProgram: m_cur_shader_prog == NULL"); + LOGF_WARNING(RSX, "LoadProgram: m_cur_shader_prog == NULL"); return false; } if(!m_cur_vertex_prog) { - ConLog.Warning("LoadProgram: m_cur_vertex_prog == NULL"); + LOGF_WARNING(RSX, "LoadProgram: m_cur_vertex_prog == NULL"); return false; } @@ -354,7 +354,7 @@ bool GLGSRender::LoadProgram() if(m_fp_buf_num == -1) { - ConLog.Warning("FP not found in buffer!"); + LOGF_WARNING(RSX, "FP not found in buffer!"); m_shader_prog.DecompileAsync(*m_cur_shader_prog); m_shader_prog.Wait(); m_shader_prog.Compile(); @@ -366,7 +366,7 @@ bool GLGSRender::LoadProgram() if(m_vp_buf_num == -1) { - ConLog.Warning("VP not found in buffer!"); + LOGF_WARNING(RSX, "VP not found in buffer!"); m_vertex_prog.DecompileAsync(*m_cur_vertex_prog); m_vertex_prog.Wait(); m_vertex_prog.Compile(); @@ -450,7 +450,7 @@ void GLGSRender::WriteDepthBuffer() u32 address = GetAddress(m_surface_offset_z, m_context_dma_z - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - ConLog.Warning("Bad depth address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_z, m_context_dma_z); + LOGF_WARNING(RSX, "Bad depth address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_z, m_context_dma_z); return; } @@ -484,7 +484,7 @@ void GLGSRender::WriteColourBufferA() u32 address = GetAddress(m_surface_offset_a, m_context_dma_color_a - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - ConLog.Warning("Bad colour buffer a address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_a, m_context_dma_color_a); + LOGF_WARNING(RSX, "Bad colour buffer a address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_a, m_context_dma_color_a); return; } @@ -513,7 +513,7 @@ void GLGSRender::WriteColourBufferB() u32 address = GetAddress(m_surface_offset_b, m_context_dma_color_b - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - ConLog.Warning("Bad colour buffer b address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_b, m_context_dma_color_b); + LOGF_WARNING(RSX, "Bad colour buffer b address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_b, m_context_dma_color_b); return; } @@ -543,7 +543,7 @@ void GLGSRender::WriteColourBufferC() u32 address = GetAddress(m_surface_offset_c, m_context_dma_color_c - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - ConLog.Warning("Bad colour buffer c address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_c, m_context_dma_color_c); + LOGF_WARNING(RSX, "Bad colour buffer c address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_c, m_context_dma_color_c); return; } @@ -572,7 +572,7 @@ void GLGSRender::WriteColourBufferD() u32 address = GetAddress(m_surface_offset_d, m_context_dma_color_d - 0xfeed0000); if (!Memory.IsGoodAddr(address)) { - ConLog.Warning("Bad colour buffer d address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_d, m_context_dma_color_d); + LOGF_WARNING(RSX, "Bad colour buffer d address: address=0x%x, offset=0x%x, dma=0x%x", address, m_surface_offset_d, m_context_dma_color_d); return; } @@ -703,14 +703,14 @@ void GLGSRender::ExecCMD() //return; if(!LoadProgram()) { - ConLog.Error("LoadProgram failed."); + LOGF_ERROR(RSX, "LoadProgram failed."); Emu.Pause(); return; } if(!m_fbo.IsCreated() || RSXThread::m_width != last_width || RSXThread::m_height != last_height || last_depth_format != m_surface_depth_format) { - ConLog.Warning("New FBO (%dx%d)", RSXThread::m_width, RSXThread::m_height); + LOGF_WARNING(RSX, "New FBO (%dx%d)", RSXThread::m_width, RSXThread::m_height); last_width = RSXThread::m_width; last_height = RSXThread::m_height; last_depth_format = m_surface_depth_format; @@ -753,7 +753,7 @@ void GLGSRender::ExecCMD() break; default: - ConLog.Error("Bad depth format! (%d)", m_surface_depth_format); + LOGF_ERROR(RSX, "Bad depth format! (%d)", m_surface_depth_format); assert(0); break; } @@ -821,7 +821,7 @@ void GLGSRender::ExecCMD() break; default: - ConLog.Error("Bad surface colour target: %d", m_surface_colour_target); + LOGF_ERROR(RSX, "Bad surface colour target: %d", m_surface_colour_target); break; } @@ -1099,7 +1099,7 @@ void GLGSRender::ExecCMD() if(m_indexed_array.m_count && m_draw_array_count) { - ConLog.Warning("m_indexed_array.m_count && draw_array_count"); + LOGF_WARNING(RSX, "m_indexed_array.m_count && draw_array_count"); } for(u32 i=0; i 15) - ConLog.Error("dst index out of range: %u", d3.dst); + LOGF_ERROR(RSX, "dst index out of range: %u", d3.dst); ret += m_parr.AddParam(PARAM_NONE, "vec4", std::string("dst_reg") + std::to_string(d3.dst), d3.dst == 0 ? "vec4(0.0f, 0.0f, 0.0f, 1.0f)" : "vec4(0.0)"); break; } @@ -83,7 +83,7 @@ std::string GLVertexDecompilerThread::GetSRC(const u32 n) } else { - ConLog.Error("Bad input src num: %d", fmt::by_value(d1.input_src)); + LOGF_ERROR(RSX, "Bad input src num: %d", fmt::by_value(d1.input_src)); ret += m_parr.AddParam(PARAM_IN, "vec4", "in_unk", d1.input_src); } break; @@ -93,7 +93,7 @@ std::string GLVertexDecompilerThread::GetSRC(const u32 n) break; default: - ConLog.Error("Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type)); + LOGF_ERROR(RSX, "Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type)); Emu.Pause(); break; } @@ -510,7 +510,7 @@ void GLVertexDecompilerThread::Task() default: m_body.push_back(fmt::Format("//Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode))); - ConLog.Error("Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode)); + LOGF_ERROR(RSX, "Unknown vp sca_opcode 0x%x", fmt::by_value(d1.sca_opcode)); Emu.Pause(); break; } @@ -543,7 +543,7 @@ void GLVertexDecompilerThread::Task() default: m_body.push_back(fmt::Format("//Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode))); - ConLog.Error("Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode)); + LOGF_ERROR(RSX, "Unknown vp opcode 0x%x", fmt::by_value(d1.vec_opcode)); Emu.Pause(); break; } @@ -553,7 +553,7 @@ void GLVertexDecompilerThread::Task() m_instr_count++; if(i < m_data.size()) - ConLog.Error("Program end before buffer end."); + LOG_ERROR(RSX, "Program end before buffer end."); break; } @@ -647,14 +647,14 @@ void GLVertexProgram::Compile() GLsizei len; memset(buf, 0, r+1); glGetShaderInfoLog(id, r, &len, buf); - ConLog.Error("Failed to compile vertex shader: %s", buf); + LOGF_ERROR(RSX, "Failed to compile vertex shader: %s", buf); delete[] buf; } - ConLog.Write(shader); + LOG_NOTICE(RSX, shader); Emu.Pause(); } - //else ConLog.Write("Vertex shader compiled successfully!"); + //else LOGF_WARNING(RSX, "Vertex shader compiled successfully!"); } @@ -667,7 +667,7 @@ void GLVertexProgram::Delete() { if (Emu.IsStopped()) { - ConLog.Warning("GLVertexProgram::Delete(): glDeleteShader(%d) avoided", id); + LOGF_WARNING(RSX, "GLVertexProgram::Delete(): glDeleteShader(%d) avoided", id); } else { diff --git a/rpcs3/Emu/GS/GL/OpenGL.cpp b/rpcs3/Emu/GS/GL/OpenGL.cpp index bedf302764..d87d7349f6 100644 --- a/rpcs3/Emu/GS/GL/OpenGL.cpp +++ b/rpcs3/Emu/GS/GL/OpenGL.cpp @@ -1,12 +1,12 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "OpenGL.h" void InitProcTable() { #ifdef _WIN32 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n) -#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(gl##n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.") +#define OPENGL_PROC2(p, n, tn) /*if(!gl##n)*/ if(!(gl##n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.") #include "GLProcTable.h" #undef OPENGL_PROC #undef OPENGL_PROC2 @@ -40,7 +40,7 @@ void OpenGL::Init() { #ifdef _WIN32 #define OPENGL_PROC(p, n) OPENGL_PROC2(p, n, gl##n) -#define OPENGL_PROC2(p, n, tn) if(!(n = (p)wglGetProcAddress(#tn))) ConLog.Error("OpenGL: initialization of " #tn " failed.") +#define OPENGL_PROC2(p, n, tn) if(!(n = (p)wglGetProcAddress(#tn))) LOG_ERROR(RSX, "OpenGL: initialization of " #tn " failed.") #include "GLProcTable.h" #undef OPENGL_PROC #undef OPENGL_PROC2 diff --git a/rpcs3/Emu/GS/GSManager.cpp b/rpcs3/Emu/GS/GSManager.cpp index 7774f04978..0e24117f5b 100644 --- a/rpcs3/Emu/GS/GSManager.cpp +++ b/rpcs3/Emu/GS/GSManager.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "rpcs3/Ini.h" diff --git a/rpcs3/Emu/GS/GSRender.cpp b/rpcs3/Emu/GS/GSRender.cpp index 742aed85d0..6290d09893 100644 --- a/rpcs3/Emu/GS/GSRender.cpp +++ b/rpcs3/Emu/GS/GSRender.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" diff --git a/rpcs3/Emu/GS/RSXTexture.cpp b/rpcs3/Emu/GS/RSXTexture.cpp index c4afde8b29..0c4a8a100f 100644 --- a/rpcs3/Emu/GS/RSXTexture.cpp +++ b/rpcs3/Emu/GS/RSXTexture.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "RSXThread.h" #include "RSXThread.h" diff --git a/rpcs3/Emu/GS/RSXThread.cpp b/rpcs3/Emu/GS/RSXThread.cpp index a8b2d853e4..c950dfb2f7 100644 --- a/rpcs3/Emu/GS/RSXThread.cpp +++ b/rpcs3/Emu/GS/RSXThread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "RSXThread.h" @@ -20,7 +20,7 @@ u32 GetAddress(u32 offset, u8 location) return realAddr; } - ConLog.Error("GetAddress(offset=0x%x, location=0x%x)", location); + LOGF_ERROR(RSX, "GetAddress(offset=0x%x, location=0x%x)", location); assert(0); return 0; } @@ -97,14 +97,14 @@ u32 RSXVertexData::GetTypeSize() case 7: return 1; } - ConLog.Error("Bad vertex data type! %d", type); + LOGF_ERROR(RSX, "Bad vertex data type! %d", type); return 1; } #define CMD_DEBUG 0 #if CMD_DEBUG - #define CMD_LOG ConLog.Write + #define CMD_LOG(...) LOG_NOTICE(RSX, __VA_ARGS__) #else #define CMD_LOG(...) #endif @@ -115,7 +115,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count) debug += "("; for(u32 i=0; i> 24) + 1; - //ConLog.Warning("NV4097_DRAW_ARRAYS: %d - %d", first, _count); + //LOGF_WARNING(RSX, "NV4097_DRAW_ARRAYS: %d - %d", first, _count); LoadVertexData(first, _count); @@ -791,7 +791,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 m_indexed_array.m_data.resize(m_indexed_array.m_data.size() + 4); index = Memory.Read32(m_indexed_array.m_addr + i * 4); *(u32*)&m_indexed_array.m_data[pos] = index; - //ConLog.Warning("index 4: %d", *(u32*)&m_indexed_array.m_data[pos]); + //LOGF_WARNING(RSX, "index 4: %d", *(u32*)&m_indexed_array.m_data[pos]); } break; @@ -800,7 +800,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 int pos = m_indexed_array.m_data.size(); m_indexed_array.m_data.resize(m_indexed_array.m_data.size() + 2); index = Memory.Read16(m_indexed_array.m_addr + i * 2); - //ConLog.Warning("index 2: %d", index); + //LOGF_WARNING(RSX, "index 2: %d", index); *(u16*)&m_indexed_array.m_data[pos] = index; } break; @@ -819,7 +819,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { const u32 a0 = ARGS(0); - //ConLog.Warning("NV4097_SET_BEGIN_END: %x", a0); + //LOGF_WARNING(RSX, "NV4097_SET_BEGIN_END: %x", a0); m_read_buffer = false; @@ -850,7 +850,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { if(!m_cur_shader_prog) { - ConLog.Error("NV4097_SET_SHADER_CONTROL: m_cur_shader_prog == NULL"); + LOGF_ERROR(RSX, "NV4097_SET_SHADER_CONTROL: m_cur_shader_prog == NULL"); break; } @@ -877,7 +877,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 // Transform case NV4097_SET_TRANSFORM_PROGRAM_LOAD: { - //ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM_LOAD: prog = %d", ARGS(0)); + //LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: prog = %d", ARGS(0)); m_cur_vertex_prog = &m_vertex_progs[ARGS(0)]; m_cur_vertex_prog->data.clear(); @@ -886,7 +886,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { const u32 start = ARGS(1); if(start) - ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", start); + LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_LOAD: start = %d", start); } } break; @@ -894,17 +894,17 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_TRANSFORM_PROGRAM_START: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM_START: 0x%x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM_START: 0x%x", ARGS(0)); } break; case_32(NV4097_SET_TRANSFORM_PROGRAM, 4): { - //ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM[%d](%d)", index, count); + //LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM[%d](%d)", index, count); if(!m_cur_vertex_prog) { - ConLog.Warning("NV4097_SET_TRANSFORM_PROGRAM: m_cur_vertex_prog == NULL"); + LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_PROGRAM: m_cur_vertex_prog == NULL"); break; } @@ -916,7 +916,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 if(!m_cur_vertex_prog) { - ConLog.Warning("NV4097_SET_TRANSFORM_TIMEOUT: m_cur_vertex_prog == NULL"); + LOGF_WARNING(RSX, "NV4097_SET_TRANSFORM_TIMEOUT: m_cur_vertex_prog == NULL"); break; } @@ -950,28 +950,28 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_INVALIDATE_L2: { if (ARGS(0)) - ConLog.Warning("NV4097_INVALIDATE_L2: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_INVALIDATE_L2: %x", ARGS(0)); } break; case NV4097_INVALIDATE_VERTEX_CACHE_FILE: { if (ARGS(0)) - ConLog.Warning("NV4097_INVALIDATE_VERTEX_CACHE_FILE: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_INVALIDATE_VERTEX_CACHE_FILE: %x", ARGS(0)); } break; case NV4097_INVALIDATE_VERTEX_FILE: { if (ARGS(0)) - ConLog.Warning("NV4097_INVALIDATE_VERTEX_FILE: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_INVALIDATE_VERTEX_FILE: %x", ARGS(0)); } break; case NV4097_INVALIDATE_ZCULL: { if (ARGS(0)) - ConLog.Warning("NV4097_INVALIDATE_ZCULL: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_INVALIDATE_ZCULL: %x", ARGS(0)); } break; @@ -1158,7 +1158,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_POINT_PARAMS_ENABLE: { if (ARGS(0)) - ConLog.Error("NV4097_SET_POINT_PARAMS_ENABLE"); + LOG_ERROR(RSX, "NV4097_SET_POINT_PARAMS_ENABLE"); } break; @@ -1235,7 +1235,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV406E_SEMAPHORE_ACQUIRE: { if (ARGS(0)) - ConLog.Warning("NV406E_SEMAPHORE_ACQUIRE: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV406E_SEMAPHORE_ACQUIRE: %x", ARGS(0)); } break; @@ -1347,7 +1347,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { if (count != 4) { - ConLog.Error("NV4097_SET_SURFACE_PITCH_C: Bad count (%d)", count); + LOGF_WARNING(RSX, "NV4097_SET_SURFACE_PITCH_C: Bad count (%d)", count); break; } @@ -1361,7 +1361,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_SURFACE_PITCH_D: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_SURFACE_PITCH_D: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_SURFACE_PITCH_D: %x", ARGS(0)); } break; @@ -1401,7 +1401,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_CONTEXT_DMA_COLOR_D: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_CONTEXT_DMA_COLOR_D: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_CONTEXT_DMA_COLOR_D: %x", ARGS(0)); } break; @@ -1443,7 +1443,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_ANTI_ALIASING_CONTROL: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_ANTI_ALIASING_CONTROL: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_ANTI_ALIASING_CONTROL: %x", ARGS(0)); } break; @@ -1498,7 +1498,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_ZCULL_CONTROL0: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_ZCULL_CONTROL0: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_ZCULL_CONTROL0: %x", ARGS(0)); //m_set_depth_func = true; //m_depth_func = ARGS(0) >> 4; @@ -1508,7 +1508,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_ZCULL_CONTROL1: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_ZCULL_CONTROL1: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_ZCULL_CONTROL1: %x", ARGS(0)); //m_set_depth_func = true; //m_depth_func = ARGS(0) >> 4; @@ -1531,12 +1531,12 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case CELL_GCM_ZCULL_STATS2: case CELL_GCM_ZCULL_STATS3: value = 0; - ConLog.Warning("NV4097_GET_REPORT: Unimplemented type %d", type); + LOGF_WARNING(RSX, "NV4097_GET_REPORT: Unimplemented type %d", type); break; default: value = 0; - ConLog.Error("NV4097_GET_REPORT: Bad type %d", type); + LOGF_WARNING(RSX, "NV4097_GET_REPORT: Bad type %d", type); break; } @@ -1586,7 +1586,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_ZMIN_MAX_CONTROL: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_ZMIN_MAX_CONTROL: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_ZMIN_MAX_CONTROL: %x", ARGS(0)); } break; @@ -1594,28 +1594,28 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 case NV4097_SET_WINDOW_OFFSET: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_WINDOW_OFFSET: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_WINDOW_OFFSET: %x", ARGS(0)); } break; case NV4097_SET_WINDOW_CLIP_TYPE: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_WINDOW_CLIP_TYPE: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_WINDOW_CLIP_TYPE: %x", ARGS(0)); } break; case NV4097_SET_WINDOW_CLIP_HORIZONTAL: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_WINDOW_CLIP_HORIZONTAL: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_WINDOW_CLIP_HORIZONTAL: %x", ARGS(0)); } break; case NV4097_SET_WINDOW_CLIP_VERTICAL: { if (ARGS(0)) - ConLog.Warning("NV4097_SET_WINDOW_CLIP_VERTICAL: %x", ARGS(0)); + LOGF_WARNING(RSX, "NV4097_SET_WINDOW_CLIP_VERTICAL: %x", ARGS(0)); } break; @@ -1638,7 +1638,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 } else { - ConLog.Warning("NV0039_SET_CONTEXT_DMA_BUFFER_IN: TODO: srcContext=0x%x, dstContext=0x%x", srcContext, dstContext); + LOGF_WARNING(RSX, "NV0039_SET_CONTEXT_DMA_BUFFER_IN: TODO: srcContext=0x%x, dstContext=0x%x", srcContext, dstContext); } } break; @@ -1662,7 +1662,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 } else { - ConLog.Warning("NV0039_OFFSET_IN: TODO: offset(in=0x%x, out=0x%x), pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", + LOGF_WARNING(RSX, "NV0039_OFFSET_IN: TODO: offset(in=0x%x, out=0x%x), pitch(in=0x%x, out=0x%x), line(len=0x%x, cnt=0x%x), fmt(in=0x%x, out=0x%x), notify=0x%x", inOffset, outOffset, inPitch, outPitch, lineLength, lineCount, inFormat, outFormat, notify); } } @@ -1677,7 +1677,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 } else { - ConLog.Warning("NV0039_OFFSET_OUT: TODO: offset=0x%x", offset); + LOGF_WARNING(RSX, "NV0039_OFFSET_OUT: TODO: offset=0x%x", offset); } } break; @@ -1723,10 +1723,10 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 if(count >= 5) { - ConLog.Warning("NV308A_COLOR: count = %d", count); + LOGF_WARNING(RSX, "NV308A_COLOR: count = %d", count); } - //ConLog.Warning("NV308A_COLOR: [%d]: %f, %f, %f, %f", c.id, c.x, c.y, c.z, c.w); + //LOGF_WARNING(RSX, "NV308A_COLOR: [%d]: %f, %f, %f, %f", c.id, c.x, c.y, c.z, c.w); m_fragment_constants.push_back(c); } break; @@ -1810,7 +1810,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 { if (ARGS(0) != CELL_GCM_CONTEXT_SURFACE2D) { - ConLog.Warning("NV3089_SET_CONTEXT_SURFACE: Unsupported surface (0x%x)", ARGS(0)); + LOGF_WARNING(RSX, "NV3089_SET_CONTEXT_SURFACE: Unsupported surface (0x%x)", ARGS(0)); } } break; @@ -1821,7 +1821,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, mem32_ptr_t& args, const u3 log += "("; for(u32 i=0; i lock(m_cs_main); @@ -1912,7 +1912,7 @@ void RSXThread::Task() if(cmd & CELL_GCM_METHOD_FLAG_JUMP) { u32 addr = cmd & ~(CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT); - //ConLog.Warning("rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", addr, m_ioAddress + get, cmd, get, put); + //LOGF_WARNING(RSX, "rsx jump(0x%x) #addr=0x%x, cmd=0x%x, get=0x%x, put=0x%x", addr, m_ioAddress + get, cmd, get, put); m_ctrl->get = addr; continue; } @@ -1921,22 +1921,22 @@ void RSXThread::Task() m_call_stack.push(get + 4); u32 offs = cmd & ~CELL_GCM_METHOD_FLAG_CALL; u32 addr = Memory.RSXIOMem.GetStartAddr() + offs; - //ConLog.Warning("rsx call(0x%x) #0x%x - 0x%x - 0x%x", offs, addr, cmd, get); + //LOGF_WARNING(RSX, "rsx call(0x%x) #0x%x - 0x%x - 0x%x", offs, addr, cmd, get); m_ctrl->get = offs; continue; } if(cmd == CELL_GCM_METHOD_FLAG_RETURN) { - //ConLog.Warning("rsx return!"); + //LOGF_WARNING(RSX, "rsx return!"); u32 get = m_call_stack.top(); m_call_stack.pop(); - //ConLog.Warning("rsx return(0x%x)", get); + //LOGF_WARNING(RSX, "rsx return(0x%x)", get); m_ctrl->get = get; continue; } if(cmd & CELL_GCM_METHOD_FLAG_NON_INCREMENT) { - //ConLog.Warning("non increment cmd! 0x%x", cmd); + //LOGF_WARNING(RSX, "non increment cmd! 0x%x", cmd); inc=0; } @@ -1961,7 +1961,7 @@ void RSXThread::Task() //memset(Memory.GetMemFromAddr(p.m_ioAddress + get), 0, (count + 1) * 4); } - ConLog.Write("RSX thread ended"); + LOGF_NOTICE(RSX, "RSX thread ended"); OnExitThread(); } diff --git a/rpcs3/Emu/HDD/HDD.cpp b/rpcs3/Emu/HDD/HDD.cpp index 9908a36a91..27927c3218 100644 --- a/rpcs3/Emu/HDD/HDD.cpp +++ b/rpcs3/Emu/HDD/HDD.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "HDD.h" vfsDeviceHDD::vfsDeviceHDD(const std::string& hdd_path) : m_hdd_path(hdd_path) diff --git a/rpcs3/Emu/HDD/HDD.h b/rpcs3/Emu/HDD/HDD.h index 4adfd684fc..ab85001815 100644 --- a/rpcs3/Emu/HDD/HDD.h +++ b/rpcs3/Emu/HDD/HDD.h @@ -445,7 +445,7 @@ public: m_cur_dir_block = m_hdd_info.next_block; if(!m_hdd_info.block_size) { - ConLog.Error("Bad block size!"); + LOG_ERROR(HLE, "Bad block size!"); m_hdd_info.block_size = 2048; } m_hdd_file.Seek(m_cur_dir_block * m_hdd_info.block_size); @@ -486,7 +486,7 @@ public: int OpenDir(const std::string& name) { - ConLog.Warning("OpenDir(%s)", name.c_str()); + LOGF_WARNING(HLE, "OpenDir(%s)", name.c_str()); u64 entry_block; if(!SearchEntry(name, entry_block)) return -1; @@ -594,7 +594,7 @@ public: return false; } - ConLog.Write("CREATING ENTRY AT 0x%llx", new_block); + LOGF_NOTICE(HLE, "CREATING ENTRY AT 0x%llx", new_block); WriteBlock(new_block, g_used_block); { @@ -744,7 +744,7 @@ public: return false; } - ConLog.Write("ENTRY FOUND AT 0x%llx", file_block); + LOGF_NOTICE(HLE, "ENTRY FOUND AT 0x%llx", file_block); m_file.Open(file_block); return vfsFileBase::Open(path, mode); @@ -774,7 +774,7 @@ public: if(entry.type == vfsHDD_Entry_Dir && name != "." && name != "..") { - ConLog.Warning("Removing sub folder '%s'", name.c_str()); + LOGF_WARNING(HLE, "Removing sub folder '%s'", name.c_str()); RemoveBlocksDir(entry.data_block); } else if(entry.type == vfsHDD_Entry_File) diff --git a/rpcs3/Emu/Io/Keyboard.cpp b/rpcs3/Emu/Io/Keyboard.cpp index fa8df62eb3..b6c1f2e963 100644 --- a/rpcs3/Emu/Io/Keyboard.cpp +++ b/rpcs3/Emu/Io/Keyboard.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "rpcs3/Ini.h" #include "Keyboard.h" #include "Null/NullKeyboardHandler.h" diff --git a/rpcs3/Emu/Io/Mouse.cpp b/rpcs3/Emu/Io/Mouse.cpp index 8e96c65e95..e938745249 100644 --- a/rpcs3/Emu/Io/Mouse.cpp +++ b/rpcs3/Emu/Io/Mouse.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "rpcs3/Ini.h" #include "Mouse.h" #include "Null/NullMouseHandler.h" diff --git a/rpcs3/Emu/Io/Pad.cpp b/rpcs3/Emu/Io/Pad.cpp index eea1e552c7..0e29f5a85b 100644 --- a/rpcs3/Emu/Io/Pad.cpp +++ b/rpcs3/Emu/Io/Pad.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "rpcs3/Ini.h" #include "Pad.h" #include "Null/NullPadHandler.h" diff --git a/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp b/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp index 3ac16baaff..923377ed96 100644 --- a/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp +++ b/rpcs3/Emu/Io/XInput/XInputPadHandler.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #if defined (_WIN32) #include -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "XInputPadHandler.h" #include @@ -113,7 +113,7 @@ void XInputPadHandler::Close() { active = false; if (WaitForSingleObject(thread, THREAD_TIMEOUT) != WAIT_OBJECT_0) - ConLog.Error("XInput thread could not stop within %d milliseconds", THREAD_TIMEOUT); + LOGF_ERROR(HLE, "XInput thread could not stop within %d milliseconds", THREAD_TIMEOUT); thread = nullptr; } diff --git a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h index fb87f12d81..2bd8435868 100644 --- a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h +++ b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h @@ -212,10 +212,10 @@ bool DynamicMemoryBlockBase::Free(u64 addr) } } - ConLog.Error("DynamicMemoryBlock::Free(addr=0x%llx): failed", addr); + LOGF_ERROR(MEMORY, "DynamicMemoryBlock::Free(addr=0x%llx): failed", addr); for (u32 i = 0; i < m_allocated.size(); i++) { - ConLog.Write("*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size); + LOGF_NOTICE(MEMORY, "*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size); } return false; } @@ -233,7 +233,7 @@ u8* DynamicMemoryBlockBase::GetMem(u64 addr) const // lock-free, addr is fix } } - ConLog.Error("GetMem(%llx) from not allocated address.", addr); + LOGF_ERROR(MEMORY, "GetMem(%llx) from not allocated address.", addr); assert(0); return nullptr; } diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 2bcdbdd215..02899130d3 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Memory.h" #include "MemoryBlock.h" #include "Emu/System.h" @@ -331,7 +331,7 @@ bool MemoryBlockLE::Write128(const u64 addr, const u128 value) //NullMemoryBlock bool NullMemoryBlock::Read8(const u64 addr, u8* ) { - ConLog.Error("Read8 from null block: [%08llx]", addr); + LOGF_ERROR(MEMORY, "Read8 from null block: [%08llx]", addr); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -339,7 +339,7 @@ bool NullMemoryBlock::Read8(const u64 addr, u8* ) bool NullMemoryBlock::Read16(const u64 addr, u16* ) { - ConLog.Error("Read16 from null block: [%08llx]", addr); + LOGF_ERROR(MEMORY, "Read16 from null block: [%08llx]", addr); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -347,7 +347,7 @@ bool NullMemoryBlock::Read16(const u64 addr, u16* ) bool NullMemoryBlock::Read32(const u64 addr, u32* ) { - ConLog.Error("Read32 from null block: [%08llx]", addr); + LOGF_ERROR(MEMORY, "Read32 from null block: [%08llx]", addr); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -355,7 +355,7 @@ bool NullMemoryBlock::Read32(const u64 addr, u32* ) bool NullMemoryBlock::Read64(const u64 addr, u64* ) { - ConLog.Error("Read64 from null block: [%08llx]", addr); + LOGF_ERROR(MEMORY, "Read64 from null block: [%08llx]", addr); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -363,7 +363,7 @@ bool NullMemoryBlock::Read64(const u64 addr, u64* ) bool NullMemoryBlock::Read128(const u64 addr, u128* ) { - ConLog.Error("Read128 from null block: [%08llx]", addr); + LOGF_ERROR(MEMORY, "Read128 from null block: [%08llx]", addr); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -371,7 +371,7 @@ bool NullMemoryBlock::Read128(const u64 addr, u128* ) bool NullMemoryBlock::Write8(const u64 addr, const u8 value) { - ConLog.Error("Write8 to null block: [%08llx]: %x", addr, value); + LOGF_ERROR(MEMORY, "Write8 to null block: [%08llx]: %x", addr, value); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -379,7 +379,7 @@ bool NullMemoryBlock::Write8(const u64 addr, const u8 value) bool NullMemoryBlock::Write16(const u64 addr, const u16 value) { - ConLog.Error("Write16 to null block: [%08llx]: %x", addr, value); + LOGF_ERROR(MEMORY, "Write16 to null block: [%08llx]: %x", addr, value); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -387,7 +387,7 @@ bool NullMemoryBlock::Write16(const u64 addr, const u16 value) bool NullMemoryBlock::Write32(const u64 addr, const u32 value) { - ConLog.Error("Write32 to null block: [%08llx]: %x", addr, value); + LOGF_ERROR(MEMORY, "Write32 to null block: [%08llx]: %x", addr, value); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -395,7 +395,7 @@ bool NullMemoryBlock::Write32(const u64 addr, const u32 value) bool NullMemoryBlock::Write64(const u64 addr, const u64 value) { - ConLog.Error("Write64 to null block: [%08llx]: %llx", addr, value); + LOGF_ERROR(MEMORY, "Write64 to null block: [%08llx]: %llx", addr, value); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; @@ -403,7 +403,7 @@ bool NullMemoryBlock::Write64(const u64 addr, const u64 value) bool NullMemoryBlock::Write128(const u64 addr, const u128 value) { - ConLog.Error("Write128 to null block: [%08llx]: %llx_%llx", addr, value.hi, value.lo); + LOGF_ERROR(MEMORY, "Write128 to null block: [%08llx]: %llx_%llx", addr, value.hi, value.lo); if (!Ini.CPUIgnoreRWErrors.GetValue()) Emu.Pause(); return false; diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index d4821b4b25..ee1a5bb32f 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -211,7 +211,7 @@ public: if(m_inited) return; m_inited = true; - ConLog.Write("Initing memory..."); + LOG_NOTICE(MEMORY, "Initing memory..."); switch(type) { @@ -240,7 +240,7 @@ public: break; } - ConLog.Write("Memory initialized."); + LOG_NOTICE(MEMORY, "Memory initialized."); } bool IsGoodAddr(const u64 addr) @@ -271,7 +271,7 @@ public: if(!m_inited) return; m_inited = false; - ConLog.Write("Closing memory..."); + LOG_NOTICE(MEMORY, "Closing memory..."); for (auto block : MemoryBlocks) { @@ -405,7 +405,7 @@ public: if(mem.IsNULL()) { - ConLog.Error("ReadLeft[%d] from null block (0x%llx)", size, addr); + LOGF_ERROR(MEMORY, "ReadLeft[%d] from null block (0x%llx)", size, addr); return; } @@ -418,7 +418,7 @@ public: if(mem.IsNULL()) { - ConLog.Error("WriteLeft[%d] to null block (0x%llx)", size, addr); + LOGF_ERROR(MEMORY, "WriteLeft[%d] to null block (0x%llx)", size, addr); return; } @@ -431,7 +431,7 @@ public: if(mem.IsNULL()) { - ConLog.Error("ReadRight[%d] from null block (0x%llx)", size, addr); + LOGF_ERROR(MEMORY, "ReadRight[%d] from null block (0x%llx)", size, addr); return; } @@ -444,7 +444,7 @@ public: if(mem.IsNULL()) { - ConLog.Error("WriteRight[%d] to null block (0x%llx)", size, addr); + LOGF_ERROR(MEMORY, "WriteRight[%d] to null block (0x%llx)", size, addr); return; } @@ -477,7 +477,7 @@ public: { if(!IsGoodAddr(addr, str.length())) { - ConLog.Error("Memory::WriteString error: bad address (0x%llx)", addr); + LOGF_ERROR(MEMORY,"Memory::WriteString error: bad address (0x%llx)", addr); return; } @@ -527,7 +527,7 @@ public: } MemoryBlocks.push_back((new MemoryMirror())->SetRange(GetMemFromAddr(src_addr), dst_addr, size)); - ConLog.Warning("memory mapped 0x%llx to 0x%llx size=0x%x", src_addr, dst_addr, size); + LOGF_WARNING(MEMORY, "memory mapped 0x%llx to 0x%llx size=0x%x", src_addr, dst_addr, size); return true; } diff --git a/rpcs3/Emu/Memory/MemoryBlock.h b/rpcs3/Emu/Memory/MemoryBlock.h index 1709214878..e9a6e7c1d1 100644 --- a/rpcs3/Emu/Memory/MemoryBlock.h +++ b/rpcs3/Emu/Memory/MemoryBlock.h @@ -28,7 +28,7 @@ struct MemBlockInfo : public MemInfo { if(!mem) { - ConLog.Error("Not enough free memory."); + LOG_ERROR(MEMORY, "Not enough free memory."); assert(0); } memset(mem, 0, size); diff --git a/rpcs3/Emu/SysCalls/Callback.cpp b/rpcs3/Emu/SysCalls/Callback.cpp index 3fbe1e4227..0c7785fac4 100644 --- a/rpcs3/Emu/SysCalls/Callback.cpp +++ b/rpcs3/Emu/SysCalls/Callback.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Callback.h" @@ -66,7 +66,7 @@ again: { if (Emu.IsStopped()) { - ConLog.Warning("Callback::Branch() aborted"); + LOG_WARNING(HLE, "Callback::Branch() aborted"); return; } Sleep(1); @@ -80,7 +80,7 @@ again: } if (Emu.IsStopped()) { - ConLog.Warning("Callback::Branch() aborted"); + LOG_WARNING(HLE, "Callback::Branch() aborted"); return; } @@ -109,7 +109,7 @@ again: { if (Emu.IsStopped()) { - ConLog.Warning("Callback::Branch(true) aborted (end)"); + LOG_WARNING(HLE, "Callback::Branch(true) aborted (end)"); return; } Sleep(1); diff --git a/rpcs3/Emu/SysCalls/FuncList.cpp b/rpcs3/Emu/SysCalls/FuncList.cpp index fdebc1a05c..c4760519c0 100644 --- a/rpcs3/Emu/SysCalls/FuncList.cpp +++ b/rpcs3/Emu/SysCalls/FuncList.cpp @@ -1,10 +1,10 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "SysCalls.h" -#define FUNC_LOG_ERROR(x) ConLog.Error(x); return 0 +#define FUNC_LOG_ERROR(x) LOG_ERROR(HLE, x); return 0 std::string SysCalls::GetHLEFuncName(const u32 fid) { switch(fid) @@ -3846,4 +3846,4 @@ std::string SysCalls::GetHLEFuncName(const u32 fid) } return fmt::Format("Unknown func id: 0x%08x", fid); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules.cpp b/rpcs3/Emu/SysCalls/Modules.cpp index 590063f397..20a5669c5d 100644 --- a/rpcs3/Emu/SysCalls/Modules.cpp +++ b/rpcs3/Emu/SysCalls/Modules.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -160,7 +160,7 @@ void Module::Log(const u32 id, std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Write(GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list)); + LOG_NOTICE(HLE, GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list)); va_end(list); } } @@ -171,7 +171,7 @@ void Module::Log(std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Write(GetName() + ": " + fmt::FormatV(fmt, list)); + LOG_NOTICE(HLE, GetName() + ": " + fmt::FormatV(fmt, list)); va_end(list); } } @@ -180,7 +180,7 @@ void Module::Warning(const u32 id, std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Warning(GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list)); + LOG_WARNING(HLE, GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list)); va_end(list); } @@ -188,7 +188,7 @@ void Module::Warning(std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Warning(GetName() + " warning: " + fmt::FormatV(fmt, list)); + LOG_WARNING(HLE, GetName() + " warning: " + fmt::FormatV(fmt, list)); va_end(list); } @@ -196,7 +196,7 @@ void Module::Error(const u32 id, std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Error(GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list)); + LOG_ERROR(HLE, GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list)); va_end(list); } @@ -204,7 +204,7 @@ void Module::Error(std::string fmt, ...) { va_list list; va_start(list, fmt); - ConLog.Error(GetName() + " error: " + fmt::FormatV(fmt, list)); + LOG_ERROR(HLE, GetName() + " error: " + fmt::FormatV(fmt, list)); va_end(list); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp index f15d9e1792..2b7d945837 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -36,7 +36,7 @@ next: { if (Emu.IsStopped()) { - ConLog.Warning("adecRawRead(): aborted"); + LOG_WARNING(HLE, "adecRawRead(): aborted"); return 0; } Sleep(1); @@ -53,7 +53,7 @@ next: { if (!Memory.CopyToReal(buf, adec.reader.addr, adec.reader.size)) { - ConLog.Error("adecRawRead(): data reading failed (reader.size=0x%x)", adec.reader.size); + LOGF_ERROR(HLE, "adecRawRead(): data reading failed (reader.size=0x%x)", adec.reader.size); Emu.Pause(); return 0; } @@ -68,11 +68,11 @@ next: adec.reader.addr = adec.task.au.addr; adec.reader.size = adec.task.au.size; - //ConLog.Write("Audio AU: size = 0x%x, pts = 0x%llx", adec.task.au.size, adec.task.au.pts); + //LOGF_NOTICE(HLE, "Audio AU: size = 0x%x, pts = 0x%llx", adec.task.au.size, adec.task.au.pts); } break; default: - ConLog.Error("adecRawRead(): sequence error (task %d)", adec.job.Peek().type); + LOGF_ERROR(HLE, "adecRawRead(): sequence error (task %d)", adec.job.Peek().type); return -1; } @@ -89,7 +89,7 @@ next: } else if (!Memory.CopyToReal(buf, adec.reader.addr, buf_size)) { - ConLog.Error("adecRawRead(): data reading failed (buf_size=0x%x)", buf_size); + LOGF_ERROR(HLE, "adecRawRead(): data reading failed (buf_size=0x%x)", buf_size); Emu.Pause(); return 0; } @@ -111,7 +111,7 @@ int adecRead(void* opaque, u8* buf, int buf_size) { if (buf_size < (int)adec.reader.rem_size) { - ConLog.Error("adecRead(): too small buf_size (rem_size = %d, buf_size = %d)", adec.reader.rem_size, buf_size); + LOGF_ERROR(HLE, "adecRead(): too small buf_size (rem_size = %d, buf_size = %d)", adec.reader.rem_size, buf_size); Emu.Pause(); return 0; } @@ -131,7 +131,7 @@ int adecRead(void* opaque, u8* buf, int buf_size) if (adecRawRead(opaque, header, 8) < 8) break; if (header[0] != 0x0f || header[1] != 0xd0) { - ConLog.Error("adecRead(): 0x0FD0 header not found"); + LOGF_ERROR(HLE, "adecRead(): 0x0FD0 header not found"); Emu.Pause(); return -1; } @@ -141,7 +141,7 @@ int adecRead(void* opaque, u8* buf, int buf_size) OMAHeader oma(1 /* atrac3p id */, header[2], header[3]); if (buf_size < sizeof(oma) + 8) { - ConLog.Error("adecRead(): OMAHeader writing failed"); + LOGF_ERROR(HLE, "adecRead(): OMAHeader writing failed"); Emu.Pause(); return 0; } @@ -159,7 +159,7 @@ int adecRead(void* opaque, u8* buf, int buf_size) u32 size = (((header[2] & 0x3) << 8) | header[3]) * 8 + 8; // data to be read before next header - //ConLog.Write("*** audio block read: size = 0x%x", size); + //LOGF_NOTICE(HLE, "*** audio block read: size = 0x%x", size); if (buf_size < (int)size) { @@ -198,7 +198,7 @@ u32 adecOpen(AudioDecoder* data) thread t("Audio Decoder[" + std::to_string(adec_id) + "] Thread", [&]() { - ConLog.Write("Audio Decoder thread started"); + LOGF_NOTICE(HLE, "Audio Decoder thread started"); AdecTask& task = adec.task; @@ -231,7 +231,7 @@ u32 adecOpen(AudioDecoder* data) case adecStartSeq: { // TODO: reset data - ConLog.Warning("adecStartSeq:"); + LOGF_WARNING(HLE, "adecStartSeq:"); adec.reader.addr = 0; adec.reader.size = 0; @@ -247,7 +247,7 @@ u32 adecOpen(AudioDecoder* data) case adecEndSeq: { // TODO: finalize - ConLog.Warning("adecEndSeq:"); + LOGF_WARNING(HLE, "adecEndSeq:"); /*Callback cb; cb.SetAddr(adec.cbFunc); @@ -268,7 +268,7 @@ u32 adecOpen(AudioDecoder* data) adec.reader.addr = task.au.addr; adec.reader.size = task.au.size; - //ConLog.Write("Audio AU: size = 0x%x, pts = 0x%llx", task.au.size, task.au.pts); + //LOGF_NOTICE(HLE, "Audio AU: size = 0x%x, pts = 0x%llx", task.au.size, task.au.pts); if (adec.just_started) { @@ -317,33 +317,33 @@ u32 adecOpen(AudioDecoder* data) err = avformat_open_input(&adec.fmt, NULL, av_find_input_format("oma"), NULL); if (err) { - ConLog.Error("adecDecodeAu: avformat_open_input() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: avformat_open_input() failed"); Emu.Pause(); break; } AVCodec* codec = avcodec_find_decoder(AV_CODEC_ID_ATRAC3P); // ??? if (!codec) { - ConLog.Error("adecDecodeAu: avcodec_find_decoder() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: avcodec_find_decoder() failed"); Emu.Pause(); break; } /*err = avformat_find_stream_info(adec.fmt, NULL); if (err) { - ConLog.Error("adecDecodeAu: avformat_find_stream_info() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: avformat_find_stream_info() failed"); Emu.Pause(); break; } if (!adec.fmt->nb_streams) { - ConLog.Error("adecDecodeAu: no stream found"); + LOGF_ERROR(HLE, "adecDecodeAu: no stream found"); Emu.Pause(); break; }*/ if (!avformat_new_stream(adec.fmt, codec)) { - ConLog.Error("adecDecodeAu: avformat_new_stream() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: avformat_new_stream() failed"); Emu.Pause(); break; } @@ -358,7 +358,7 @@ u32 adecOpen(AudioDecoder* data) } if (err) { - ConLog.Error("adecDecodeAu: avcodec_open2() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: avcodec_open2() failed"); Emu.Pause(); break; } @@ -371,7 +371,7 @@ u32 adecOpen(AudioDecoder* data) { if (Emu.IsStopped()) { - ConLog.Warning("adecDecodeAu: aborted"); + LOGF_WARNING(HLE, "adecDecodeAu: aborted"); return; } @@ -420,7 +420,7 @@ u32 adecOpen(AudioDecoder* data) if (!frame.data) { - ConLog.Error("adecDecodeAu: av_frame_alloc() failed"); + LOGF_ERROR(HLE, "adecDecodeAu: av_frame_alloc() failed"); Emu.Pause(); break; } @@ -433,7 +433,7 @@ u32 adecOpen(AudioDecoder* data) { if (!last_frame && decode < 0) { - ConLog.Error("adecDecodeAu: AU decoding error(0x%x)", decode); + LOGF_ERROR(HLE, "adecDecodeAu: AU decoding error(0x%x)", decode); } if (!got_frame && adec.reader.size == 0) break; } @@ -460,18 +460,18 @@ u32 adecOpen(AudioDecoder* data) if (frame.data->format != AV_SAMPLE_FMT_FLTP) { - ConLog.Error("adecDecodeaAu: unsupported frame format(%d)", frame.data->format); + LOGF_ERROR(HLE, "adecDecodeaAu: unsupported frame format(%d)", frame.data->format); Emu.Pause(); break; } if (frame.data->channels != 2) { - ConLog.Error("adecDecodeAu: unsupported channel count (%d)", frame.data->channels); + LOGF_ERROR(HLE, "adecDecodeAu: unsupported channel count (%d)", frame.data->channels); Emu.Pause(); break; } - //ConLog.Write("got audio frame (pts=0x%llx, nb_samples=%d, ch=%d, sample_rate=%d, nbps=%d)", + //LOGF_NOTICE(HLE, "got audio frame (pts=0x%llx, nb_samples=%d, ch=%d, sample_rate=%d, nbps=%d)", //frame.pts, frame.data->nb_samples, frame.data->channels, frame.data->sample_rate, //av_get_bytes_per_sample((AVSampleFormat)frame.data->format)); @@ -497,16 +497,16 @@ u32 adecOpen(AudioDecoder* data) case adecClose: { adec.is_finished = true; - ConLog.Write("Audio Decoder thread ended"); + LOGF_NOTICE(HLE, "Audio Decoder thread ended"); return; } default: - ConLog.Error("Audio Decoder thread error: unknown task(%d)", task.type); + LOGF_ERROR(HLE, "Audio Decoder thread error: unknown task(%d)", task.type); } } adec.is_finished = true; - ConLog.Warning("Audio Decoder thread aborted"); + LOGF_WARNING(HLE, "Audio Decoder thread aborted"); }); t.detach(); @@ -518,8 +518,8 @@ bool adecCheckType(AudioCodecType type) { switch (type) { - case CELL_ADEC_TYPE_ATRACX: ConLog.Write("*** (?) type: ATRAC3plus"); break; - case CELL_ADEC_TYPE_ATRACX_2CH: ConLog.Write("*** type: ATRAC3plus 2ch"); break; + case CELL_ADEC_TYPE_ATRACX: LOGF_NOTICE(HLE, "*** (?) type: ATRAC3plus"); break; + case CELL_ADEC_TYPE_ATRACX_2CH: LOGF_NOTICE(HLE, "*** type: ATRAC3plus 2ch"); break; case CELL_ADEC_TYPE_ATRACX_6CH: case CELL_ADEC_TYPE_ATRACX_8CH: @@ -609,7 +609,7 @@ int cellAdecClose(u32 handle) { if (Emu.IsStopped()) { - ConLog.Warning("cellAdecClose(%d) aborted", handle); + LOGF_WARNING(HLE, "cellAdecClose(%d) aborted", handle); break; } Sleep(1); @@ -732,7 +732,7 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) if (!swr) { - ConLog.Error("cellAdecGetPcm(%d): swr_alloc_set_opts() failed", handle); + LOGF_ERROR(HLE, "cellAdecGetPcm(%d): swr_alloc_set_opts() failed", handle); Emu.Pause(); free(out); if (af.data) @@ -759,7 +759,7 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr) if (!Memory.CopyFromReal(outBuffer_addr, out, af.size)) { - ConLog.Error("cellAdecGetPcm(%d): data copying failed (addr=0x%x)", handle, outBuffer_addr); + LOGF_ERROR(HLE, "cellAdecGetPcm(%d): data copying failed (addr=0x%x)", handle, outBuffer_addr); Emu.Pause(); } diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.h b/rpcs3/Emu/SysCalls/Modules/cellAdec.h index 385d2486c4..9c27cd09bf 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.h @@ -1133,14 +1133,14 @@ public: AVCodec* codec = avcodec_find_decoder(AV_CODEC_ID_ATRAC3P); if (!codec) { - ConLog.Error("AudioDecoder(): avcodec_find_decoder(ATRAC3P) failed"); + LOGF_ERROR(HLE, "AudioDecoder(): avcodec_find_decoder(ATRAC3P) failed"); Emu.Pause(); return; } fmt = avformat_alloc_context(); if (!fmt) { - ConLog.Error("AudioDecoder(): avformat_alloc_context failed"); + LOGF_ERROR(HLE, "AudioDecoder(): avformat_alloc_context failed"); Emu.Pause(); return; } @@ -1148,7 +1148,7 @@ public: fmt->pb = avio_alloc_context(io_buf, 4096, 0, this, adecRead, NULL, NULL); if (!fmt->pb) { - ConLog.Error("AudioDecoder(): avio_alloc_context failed"); + LOGF_ERROR(HLE, "AudioDecoder(): avio_alloc_context failed"); Emu.Pause(); return; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp index b170e3073e..f0b2ac8206 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAtrac.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp index 4538f042a0..dab64ff67a 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAudio.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -50,11 +50,11 @@ int cellAudioInit() if (do_dump && !m_dump.Init()) { - ConLog.Error("cellAudioInit(): AudioDumper::Init() failed"); + LOGF_ERROR(HLE, "cellAudioInit(): AudioDumper::Init() failed"); return; } - ConLog.Write("Audio thread started"); + LOGF_NOTICE(HLE, "Audio thread started"); if (Ini.AudioDumpToFile.GetValue()) m_dump.WriteHeader(); @@ -146,7 +146,7 @@ int cellAudioInit() { if (Emu.IsStopped()) { - ConLog.Warning("Audio thread aborted"); + LOGF_WARNING(HLE, "Audio thread aborted"); goto abort; } @@ -426,7 +426,7 @@ int cellAudioInit() { if (m_dump.WriteData(&buf8ch, sizeof(buf8ch)) != sizeof(buf8ch)) // write file data { - ConLog.Error("cellAudioInit(): AudioDumper::WriteData() failed"); + LOGF_ERROR(HLE, "cellAudioInit(): AudioDumper::WriteData() failed"); goto abort; } } @@ -434,21 +434,21 @@ int cellAudioInit() { if (m_dump.WriteData(&buf2ch, sizeof(buf2ch)) != sizeof(buf2ch)) // write file data { - ConLog.Error("cellAudioInit(): AudioDumper::WriteData() failed"); + LOGF_ERROR(HLE, "cellAudioInit(): AudioDumper::WriteData() failed"); goto abort; } } else { - ConLog.Error("cellAudioInit(): unknown AudioDumper::GetCh() value (%d)", m_dump.GetCh()); + LOGF_ERROR(HLE, "cellAudioInit(): unknown AudioDumper::GetCh() value (%d)", m_dump.GetCh()); goto abort; } } - //ConLog.Write("Audio perf: start=%d (access=%d, AddData=%d, events=%d, dump=%d)", + //LOGF_NOTICE(HLE, "Audio perf: start=%d (access=%d, AddData=%d, events=%d, dump=%d)", //stamp0 - m_config.start_time, stamp1 - stamp0, stamp2 - stamp1, stamp3 - stamp2, get_system_time() - stamp3); } - ConLog.Write("Audio thread ended"); + LOGF_NOTICE(HLE, "Audio thread ended"); abort: queue.Push(nullptr); queue_float.Push(nullptr); @@ -480,7 +480,7 @@ abort: { if (Emu.IsStopped()) { - ConLog.Warning("cellAudioInit() aborted"); + LOGF_WARNING(HLE, "cellAudioInit() aborted"); return CELL_OK; } Sleep(1); @@ -505,7 +505,7 @@ int cellAudioQuit() Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("cellAudioQuit(): aborted"); + LOGF_WARNING(HLE, "cellAudioQuit(): aborted"); return CELL_OK; } } diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index ccada21244..b3722229e4 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -47,7 +47,7 @@ u32 dmuxOpen(Demuxer* data) thread t("Demuxer[" + std::to_string(dmux_id) + "] Thread", [&]() { - ConLog.Write("Demuxer thread started (mem=0x%x, size=0x%x, cb=0x%x, arg=0x%x)", dmux.memAddr, dmux.memSize, dmux.cbFunc, dmux.cbArg); + LOGF_NOTICE(HLE, "Demuxer thread started (mem=0x%x, size=0x%x, cb=0x%x, arg=0x%x)", dmux.memAddr, dmux.memSize, dmux.cbFunc, dmux.cbArg); DemuxerTask task; DemuxerStream stream; @@ -134,7 +134,7 @@ u32 dmuxOpen(Demuxer* data) if (!pes.new_au) // temporarily { - ConLog.Error("No pts info found"); + LOGF_ERROR(HLE, "No pts info found"); } // read additional header: @@ -149,7 +149,7 @@ u32 dmuxOpen(Demuxer* data) { if (Emu.IsStopped()) { - ConLog.Warning("esATX[%d] was full, waiting aborted", ch); + LOGF_WARNING(HLE, "esATX[%d] was full, waiting aborted", ch); return; } Sleep(1); @@ -166,7 +166,7 @@ u32 dmuxOpen(Demuxer* data) es.push(stream, len - pes.size - 3, pes); es.finish(stream); - //ConLog.Write("*** AT3+ AU sent (len=0x%x, pts=0x%llx)", len - pes.size - 3, pes.pts); + //LOGF_NOTICE(HLE, "*** AT3+ AU sent (len=0x%x, pts=0x%llx)", len - pes.size - 3, pes.pts); mem_ptr_t esMsg(a128(dmux.memAddr) + (cb_add ^= 16)); esMsg->msgType = CELL_DMUX_ES_MSG_TYPE_AU_FOUND; @@ -198,7 +198,7 @@ u32 dmuxOpen(Demuxer* data) { if (Emu.IsStopped()) { - ConLog.Warning("esAVC[%d] was full, waiting aborted", ch); + LOGF_WARNING(HLE, "esAVC[%d] was full, waiting aborted", ch); return; } Sleep(1); @@ -236,7 +236,7 @@ u32 dmuxOpen(Demuxer* data) if (pes.new_au) { - //ConLog.Write("*** AVC AU detected (pts=0x%llx, dts=0x%llx)", pes.pts, pes.dts); + //LOGF_NOTICE(HLE, "*** AVC AU detected (pts=0x%llx, dts=0x%llx)", pes.pts, pes.dts); } if (es.isfull()) @@ -268,7 +268,7 @@ u32 dmuxOpen(Demuxer* data) case 0x1dc: case 0x1dd: case 0x1de: case 0x1df: { // unknown - ConLog.Warning("Unknown MPEG stream found"); + LOGF_WARNING(HLE, "Unknown MPEG stream found"); stream.skip(4); stream.get(len); stream.skip(len); @@ -277,7 +277,7 @@ u32 dmuxOpen(Demuxer* data) case USER_DATA_START_CODE: { - ConLog.Error("USER_DATA_START_CODE found"); + LOGF_ERROR(HLE, "USER_DATA_START_CODE found"); return; } @@ -304,7 +304,7 @@ u32 dmuxOpen(Demuxer* data) { if (task.stream.discontinuity) { - ConLog.Warning("dmuxSetStream (beginning)"); + LOGF_WARNING(HLE, "dmuxSetStream (beginning)"); for (u32 i = 0; i < 192; i++) { if (esALL[i]) @@ -318,13 +318,13 @@ u32 dmuxOpen(Demuxer* data) if (updates_count != updates_signaled) { - ConLog.Error("dmuxSetStream: stream update inconsistency (input=%d, signaled=%d)", updates_count, updates_signaled); + LOGF_ERROR(HLE, "dmuxSetStream: stream update inconsistency (input=%d, signaled=%d)", updates_count, updates_signaled); return; } updates_count++; stream = task.stream; - //ConLog.Write("*** stream updated(addr=0x%x, size=0x%x, discont=%d, userdata=0x%llx)", + //LOGF_NOTICE(HLE, "*** stream updated(addr=0x%x, size=0x%x, discont=%d, userdata=0x%llx)", //stream.addr, stream.size, stream.discontinuity, stream.userdata); dmux.is_running = true; @@ -357,7 +357,7 @@ u32 dmuxOpen(Demuxer* data) case dmuxClose: { dmux.is_finished = true; - ConLog.Write("Demuxer thread ended"); + LOGF_NOTICE(HLE, "Demuxer thread ended"); return; } @@ -381,7 +381,7 @@ u32 dmuxOpen(Demuxer* data) } else { - ConLog.Warning("dmuxEnableEs: (TODO) unsupported filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2); + LOGF_WARNING(HLE, "dmuxEnableEs: (TODO) unsupported filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2); } es.dmux = &dmux; } @@ -392,7 +392,7 @@ u32 dmuxOpen(Demuxer* data) ElementaryStream& es = *task.es.es_ptr; if (es.dmux != &dmux) { - ConLog.Warning("dmuxDisableEs: invalid elementary stream"); + LOGF_WARNING(HLE, "dmuxDisableEs: invalid elementary stream"); break; } for (u32 i = 0; i < 192; i++) @@ -450,11 +450,11 @@ u32 dmuxOpen(Demuxer* data) break; default: - ConLog.Error("Demuxer thread error: unknown task(%d)", task.type); + LOGF_ERROR(HLE, "Demuxer thread error: unknown task(%d)", task.type); return; } } - ConLog.Warning("Demuxer thread aborted"); + LOGF_WARNING(HLE, "Demuxer thread aborted"); }); t.detach(); @@ -598,7 +598,7 @@ int cellDmuxClose(u32 demuxerHandle) { if (Emu.IsStopped()) { - ConLog.Warning("cellDmuxClose(%d) aborted", demuxerHandle); + LOGF_WARNING(HLE, "cellDmuxClose(%d) aborted", demuxerHandle); return CELL_OK; } @@ -630,7 +630,7 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize { if (Emu.IsStopped()) { - ConLog.Warning("cellDmuxSetStream(%d) aborted (waiting)", demuxerHandle); + LOGF_WARNING(HLE, "cellDmuxSetStream(%d) aborted (waiting)", demuxerHandle); return CELL_OK; } Sleep(1); @@ -649,12 +649,12 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize u32 addr; if (!dmux->fbSetStream.Pop(addr)) { - ConLog.Warning("cellDmuxSetStream(%d) aborted (fbSetStream.Pop())", demuxerHandle); + LOGF_WARNING(HLE, "cellDmuxSetStream(%d) aborted (fbSetStream.Pop())", demuxerHandle); return CELL_OK; } if (addr != info.addr) { - ConLog.Error("cellDmuxSetStream(%d): wrong stream queued (right=0x%x, queued=0x%x)", demuxerHandle, info.addr, addr); + LOGF_ERROR(HLE, "cellDmuxSetStream(%d): wrong stream queued (right=0x%x, queued=0x%x)", demuxerHandle, info.addr, addr); Emu.Pause(); } return CELL_OK; @@ -690,12 +690,12 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) u32 addr; if (!dmux->fbSetStream.Pop(addr)) { - ConLog.Warning("cellDmuxResetStreamAndWaitDone(%d) aborted (fbSetStream.Pop())", demuxerHandle); + LOGF_WARNING(HLE, "cellDmuxResetStreamAndWaitDone(%d) aborted (fbSetStream.Pop())", demuxerHandle); return CELL_OK; } if (addr != 0) { - ConLog.Error("cellDmuxResetStreamAndWaitDone(%d): wrong stream queued (0x%x)", demuxerHandle, addr); + LOGF_ERROR(HLE, "cellDmuxResetStreamAndWaitDone(%d): wrong stream queued (0x%x)", demuxerHandle, addr); Emu.Pause(); } return CELL_OK; @@ -1013,4 +1013,4 @@ void cellDmux_init() cellDmux->AddFunc(0x002e8da2, cellDmuxPeekAuEx); cellDmux->AddFunc(0x24ea6474, cellDmuxReleaseAu); cellDmux->AddFunc(0xebb3b2bd, cellDmuxFlushEs); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.h b/rpcs3/Emu/SysCalls/Modules/cellDmux.h index 7d2f8082a7..48f4775bab 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.h +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.h @@ -394,14 +394,14 @@ struct PesHeader new_au = true; if ((v & 0xF0) != 0x30 || (size - empty) < 10) { - ConLog.Error("PesHeader(): pts not found"); + LOGF_ERROR(HLE, "PesHeader(): pts not found"); Emu.Pause(); } pts = stream.get_ts(v); stream.get(v); if ((v & 0xF0) != 0x10) { - ConLog.Error("PesHeader(): dts not found"); + LOGF_ERROR(HLE, "PesHeader(): dts not found"); Emu.Pause(); } dts = stream.get_ts(v); @@ -557,7 +557,7 @@ public: { if (size > GetMaxAU()) { - ConLog.Error("es::freespace(): last_size too big (size=0x%x, max_au=0x%x)", size, GetMaxAU()); + LOGF_ERROR(HLE, "es::freespace(): last_size too big (size=0x%x, max_au=0x%x)", size, GetMaxAU()); Emu.Pause(); return 0; } @@ -587,7 +587,7 @@ public: u32 addr; { std::lock_guard lock(m_mutex); - //if (fidMajor != 0xbd) ConLog.Write(">>> es::finish(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, ">>> es::finish(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); addr = put; /*if (!first) @@ -600,7 +600,7 @@ public: }*/ mem_ptr_t info(put); - //if (fidMajor != 0xbd) ConLog.Warning("es::finish(): (%s) size = 0x%x, info_addr=0x%x, pts = 0x%x", + //if (fidMajor != 0xbd) LOGF_WARNING(HLE, "es::finish(): (%s) size = 0x%x, info_addr=0x%x, pts = 0x%x", //wxString(fidMajor == 0xbd ? "ATRAC3P Audio" : "Video AVC").wx_str(), //(u32)info->auSize, put, (u32)info->ptsLower); @@ -611,11 +611,11 @@ public: size = 0; put_count++; - //if (fidMajor != 0xbd) ConLog.Write("<<< es::finish(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, "<<< es::finish(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); } if (!entries.Push(addr)) { - ConLog.Error("es::finish() aborted (no space)"); + LOGF_ERROR(HLE, "es::finish() aborted (no space)"); } } @@ -625,7 +625,7 @@ public: if (is_full()) { - ConLog.Error("es::push(): buffer is full"); + LOGF_ERROR(HLE, "es::push(): buffer is full"); Emu.Pause(); return; } @@ -634,7 +634,7 @@ public: size += sz; if (!Memory.Copy(data_addr, stream.addr, sz)) { - ConLog.Error("es::push(): data copying failed"); + LOGF_ERROR(HLE, "es::push(): data copying failed"); Emu.Pause(); return; } @@ -674,22 +674,22 @@ public: bool release() { std::lock_guard lock(m_mutex); - //if (fidMajor != 0xbd) ConLog.Write(">>> es::release(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, ">>> es::release(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); if (released >= put_count) { - ConLog.Error("es::release(): buffer is empty"); + LOGF_ERROR(HLE, "es::release(): buffer is empty"); return false; } u32 addr = entries.Peek(); mem_ptr_t info(addr); - //if (fidMajor != 0xbd) ConLog.Warning("es::release(): (%s) size = 0x%x, info = 0x%x, pts = 0x%x", + //if (fidMajor != 0xbd) LOGF_WARNING(HLE, "es::release(): (%s) size = 0x%x, info = 0x%x, pts = 0x%x", //wxString(fidMajor == 0xbd ? "ATRAC3P Audio" : "Video AVC").wx_str(), (u32)info->auSize, first, (u32)info->ptsLower); if (released >= peek_count) { - ConLog.Error("es::release(): buffer has not been seen yet"); + LOGF_ERROR(HLE, "es::release(): buffer has not been seen yet"); return false; } @@ -711,30 +711,30 @@ public: released++; if (!entries.Pop(addr)) { - ConLog.Error("es::release(): entries.Pop() aborted (no entries found)"); + LOGF_ERROR(HLE, "es::release(): entries.Pop() aborted (no entries found)"); return false; } - //if (fidMajor != 0xbd) ConLog.Write("<<< es::release(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, "<<< es::release(): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", peek, first, put, size); return true; } bool peek(u32& out_data, bool no_ex, u32& out_spec, bool update_index) { std::lock_guard lock(m_mutex); - //if (fidMajor != 0xbd) ConLog.Write(">>> es::peek(%sAu%s): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", wxString(update_index ? "Get" : "Peek").wx_str(), + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, ">>> es::peek(%sAu%s): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", wxString(update_index ? "Get" : "Peek").wx_str(), //wxString(no_ex ? "" : "Ex").wx_str(), peek, first, put, size); if (peek_count >= put_count) return false; if (peek_count < released) { - ConLog.Error("es::peek(): sequence error: peek_count < released (peek_count=%d, released=%d)", peek_count, released); + LOGF_ERROR(HLE, "es::peek(): sequence error: peek_count < released (peek_count=%d, released=%d)", peek_count, released); Emu.Pause(); return false; } u32 addr = entries.Peek(peek_count - released); mem_ptr_t info(addr); - //if (fidMajor != 0xbd) ConLog.Warning("es::peek(%sAu(Ex)): (%s) size = 0x%x, info = 0x%x, pts = 0x%x", + //if (fidMajor != 0xbd) LOGF_WARNING(HLE, "es::peek(%sAu(Ex)): (%s) size = 0x%x, info = 0x%x, pts = 0x%x", //wxString(update_index ? "Get" : "Peek").wx_str(), //wxString(fidMajor == 0xbd ? "ATRAC3P Audio" : "Video AVC").wx_str(), (u32)info->auSize, peek, (u32)info->ptsLower); @@ -760,7 +760,7 @@ public: peek_count++; } - //if (fidMajor != 0xbd) ConLog.Write("<<< es::peek(%sAu%s): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", wxString(update_index ? "Get" : "Peek").wx_str(), + //if (fidMajor != 0xbd) LOGF_NOTICE(HLE, "<<< es::peek(%sAu%s): peek=0x%x, first=0x%x, put=0x%x, size=0x%x", wxString(update_index ? "Get" : "Peek").wx_str(), //wxString(no_ex ? "" : "Ex").wx_str(), peek, first, put, size); return true; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index a20329da74..3692abbcdd 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp index 317a318242..92361c370f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFontFT.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 200894c3b9..02af4d083c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index 2ecab1dab9..2133bac53f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -478,7 +478,7 @@ int cellGcmSetPrepareFlip(mem_ptr_t ctxt, u32 id) if(current + 8 >= end) { - ConLog.Warning("bad flip!"); + LOG_WARNING(HLE, "bad flip!"); //cellGcmCallback(ctxt.GetAddr(), current + 8 - end); //copied: diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index bdfdc72dbb..1aeb261a14 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index 74105d0c53..dc7a4b53a6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index d09464ba5a..571a332fe9 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp index 2874a0b3d4..611979dbb8 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp index 66c31b128a..53cc3f5c62 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPamf.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index eb7537f3d8..4ffcc7d04f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 7ba35d2e92..ea9047f1b3 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index 9ac5b8462b..2d62e82d8d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index ea3541be23..79d330909d 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp index 2181a6b09e..57e166334c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSync.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSync.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -93,7 +93,7 @@ int cellSyncMutexLock(mem_ptr_t mutex) Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("cellSyncMutexLock(mutex=0x%x) aborted", mutex.GetAddr()); + LOGF_WARNING(HLE, "cellSyncMutexLock(mutex=0x%x) aborted", mutex.GetAddr()); break; } } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp index 6ff960e848..50c75daa24 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysmodule.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp index 317a927b23..ebad56ef57 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -350,7 +350,7 @@ int cellSysutilCheckCallback() Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("cellSysutilCheckCallback() aborted"); + LOG_WARNING(HLE, "cellSysutilCheckCallback() aborted"); break; } } diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp index 79552479e6..834871b5d5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutilAp.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp index af747c1f6c..96936a39ff 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -230,7 +230,7 @@ s32 modifySaveDataFiles(mem_func_ptr_t& funcFile, mem_ { funcFile(result.GetAddr(), fileGet.GetAddr(), fileSet.GetAddr()); if (result->result < 0) { - ConLog.Error("modifySaveDataFiles: CellSaveDataFileCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "modifySaveDataFiles: CellSaveDataFileCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } if (result->result == CELL_SAVEDATA_CBRESULT_OK_LAST) { @@ -251,7 +251,7 @@ s32 modifySaveDataFiles(mem_func_ptr_t& funcFile, mem_ case CELL_SAVEDATA_FILETYPE_CONTENT_SND0: filepath += "SND0.AT3"; break; default: - ConLog.Error("modifySaveDataFiles: Unknown fileType! Aborting..."); + LOGF_ERROR(HLE, "modifySaveDataFiles: Unknown fileType! Aborting..."); return CELL_SAVEDATA_ERROR_PARAM; } @@ -274,11 +274,11 @@ s32 modifySaveDataFiles(mem_func_ptr_t& funcFile, mem_ break; case CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC: - ConLog.Warning("modifySaveDataFiles: File operation CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC not yet implemented"); + LOGF_WARNING(HLE, "modifySaveDataFiles: File operation CELL_SAVEDATA_FILEOP_WRITE_NOTRUNC not yet implemented"); break; default: - ConLog.Error("modifySaveDataFiles: Unknown fileOperation! Aborting..."); + LOGF_ERROR(HLE, "modifySaveDataFiles: Unknown fileOperation! Aborting..."); return CELL_SAVEDATA_ERROR_PARAM; } @@ -339,7 +339,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t setList, m funcList(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataListSave2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } if (!listSet->fixedList.IsGood()) @@ -349,7 +349,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t setList, m if (listSet->newData.IsGood()) addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); if (saveEntries.size() == 0) { - ConLog.Warning("cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error + LOGF_WARNING(HLE, "cellSaveDataListSave2: No save entries found!"); // TODO: Find a better way to handle this error return CELL_SAVEDATA_RET_OK; } @@ -362,7 +362,7 @@ int cellSaveDataListSave2(u32 version, mem_ptr_t setList, m funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) @@ -424,7 +424,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, m funcList(result.GetAddr(), listGet.GetAddr(), listSet.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataListCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } if (!listSet->fixedList.IsGood()) @@ -434,7 +434,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, m if (listSet->newData.IsGood()) addNewSaveDataEntry(saveEntries, (u32)listSet->newData.GetAddr()); if (saveEntries.size() == 0) { - ConLog.Warning("cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error + LOGF_WARNING(HLE, "cellSaveDataListLoad2: No save entries found!"); // TODO: Find a better way to handle this error return CELL_SAVEDATA_RET_OK; } @@ -447,7 +447,7 @@ int cellSaveDataListLoad2(u32 version, mem_ptr_t setList, m funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataListLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) @@ -508,7 +508,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t setList, } funcFixed(result.GetAddr(), listGet.GetAddr(), fixedSet.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataFixedSave2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataFixedSave2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } setSaveDataFixed(saveEntries, fixedSet.GetAddr()); @@ -519,7 +519,7 @@ int cellSaveDataFixedSave2(u32 version, mem_ptr_t setList, funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataFixedSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) @@ -580,7 +580,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t setList, } funcFixed(result.GetAddr(), listGet.GetAddr(), fixedSet.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataFixedLoad2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataFixedLoad2: CellSaveDataFixedCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } setSaveDataFixed(saveEntries, fixedSet.GetAddr()); @@ -591,7 +591,7 @@ int cellSaveDataFixedLoad2(u32 version, mem_ptr_t setList, funcStat(result.GetAddr(), statGet.GetAddr(), statSet.GetAddr()); Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataFixedLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) @@ -647,7 +647,7 @@ int cellSaveDataAutoSave2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_ Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataAutoSave2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) @@ -690,7 +690,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_ // The target entry does not exist if (saveEntries.size() == 0) { - ConLog.Warning("cellSaveDataAutoLoad2: Couldn't find save entry (%s)", dirName.c_str()); + LOGF_WARNING(HLE, "cellSaveDataAutoLoad2: Couldn't find save entry (%s)", dirName.c_str()); return CELL_OK; // TODO: Can anyone check the actual behaviour of a PS3 when saves are not found? } @@ -700,7 +700,7 @@ int cellSaveDataAutoLoad2(u32 version, u32 dirName_addr, u32 errDialog, mem_ptr_ Memory.Free(statGet->fileList.GetAddr()); if (result->result < 0) { - ConLog.Error("cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. + LOGF_ERROR(HLE, "cellSaveDataAutoLoad2: CellSaveDataStatCallback failed."); // TODO: Once we verify that the entire SysCall is working, delete this debug error message. return CELL_SAVEDATA_ERROR_CBRESULT; } /*if (statSet->setParam.IsGood()) diff --git a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp index 5f7a08c10d..a148c957b5 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellUserInfo.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index be6d1f6e96..94bd9c0be6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -35,7 +35,7 @@ next: { if (Emu.IsStopped()) { - ConLog.Warning("vdecRead(): aborted"); + LOGF_WARNING(HLE, "vdecRead(): aborted"); return 0; } Sleep(1); @@ -52,7 +52,7 @@ next: { if (!Memory.CopyToReal(buf, vdec.reader.addr, vdec.reader.size)) { - ConLog.Error("vdecRead(): data reading failed (reader.size=0x%x)", vdec.reader.size); + LOGF_ERROR(HLE, "vdecRead(): data reading failed (reader.size=0x%x)", vdec.reader.size); Emu.Pause(); return 0; } @@ -71,11 +71,11 @@ next: vdec.reader.addr = vdec.task.addr; vdec.reader.size = vdec.task.size; - //ConLog.Write("Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", vdec.task.size, vdec.task.pts, vdec.task.dts); + //LOGF_NOTICE(HLE, "Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", vdec.task.size, vdec.task.pts, vdec.task.dts); } break; default: - ConLog.Error("vdecRead(): sequence error (task %d)", vdec.job.Peek().type); + LOGF_ERROR(HLE, "vdecRead(): sequence error (task %d)", vdec.job.Peek().type); return 0; } @@ -92,7 +92,7 @@ next: } else if (!Memory.CopyToReal(buf, vdec.reader.addr, buf_size)) { - ConLog.Error("vdecRead(): data reading failed (buf_size=0x%x)", buf_size); + LOGF_ERROR(HLE, "vdecRead(): data reading failed (buf_size=0x%x)", buf_size); Emu.Pause(); return 0; } @@ -136,7 +136,7 @@ u32 vdecOpen(VideoDecoder* data) thread t("Video Decoder[" + std::to_string(vdec_id) + "] Thread", [&]() { - ConLog.Write("Video Decoder thread started"); + LOGF_NOTICE(HLE, "Video Decoder thread started"); VdecTask& task = vdec.task; @@ -169,7 +169,7 @@ u32 vdecOpen(VideoDecoder* data) case vdecStartSeq: { // TODO: reset data - ConLog.Warning("vdecStartSeq:"); + LOGF_WARNING(HLE, "vdecStartSeq:"); vdec.reader.addr = 0; vdec.reader.size = 0; @@ -181,7 +181,7 @@ u32 vdecOpen(VideoDecoder* data) case vdecEndSeq: { // TODO: finalize - ConLog.Warning("vdecEndSeq:"); + LOGF_WARNING(HLE, "vdecEndSeq:"); vdec.vdecCb->ExecAsCallback(vdec.cbFunc, false, vdec.id, CELL_VDEC_MSG_TYPE_SEQDONE, CELL_OK, vdec.cbArg); /*Callback cb; @@ -202,13 +202,13 @@ u32 vdecOpen(VideoDecoder* data) if (task.mode != CELL_VDEC_DEC_MODE_NORMAL) { - ConLog.Error("vdecDecodeAu: unsupported decoding mode(%d)", task.mode); + LOGF_ERROR(HLE, "vdecDecodeAu: unsupported decoding mode(%d)", task.mode); break; } vdec.reader.addr = task.addr; vdec.reader.size = task.size; - //ConLog.Write("Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", task.size, task.pts, task.dts); + //LOGF_NOTICE(HLE, "Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", task.size, task.pts, task.dts); if (vdec.just_started) { @@ -249,33 +249,33 @@ u32 vdecOpen(VideoDecoder* data) err = avformat_open_input(&vdec.fmt, NULL, av_find_input_format("mpeg"), NULL); if (err) { - ConLog.Error("vdecDecodeAu: avformat_open_input() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: avformat_open_input() failed"); Emu.Pause(); break; } AVCodec* codec = avcodec_find_decoder(AV_CODEC_ID_H264); // ??? if (!codec) { - ConLog.Error("vdecDecodeAu: avcodec_find_decoder() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: avcodec_find_decoder() failed"); Emu.Pause(); break; } /*err = avformat_find_stream_info(vdec.fmt, NULL); if (err) { - ConLog.Error("vdecDecodeAu: avformat_find_stream_info() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: avformat_find_stream_info() failed"); Emu.Pause(); break; } if (!vdec.fmt->nb_streams) { - ConLog.Error("vdecDecodeAu: no stream found"); + LOGF_ERROR(HLE, "vdecDecodeAu: no stream found"); Emu.Pause(); break; }*/ if (!avformat_new_stream(vdec.fmt, codec)) { - ConLog.Error("vdecDecodeAu: avformat_new_stream() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: avformat_new_stream() failed"); Emu.Pause(); break; } @@ -290,7 +290,7 @@ u32 vdecOpen(VideoDecoder* data) } if (err) { - ConLog.Error("vdecDecodeAu: avcodec_open2() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: avcodec_open2() failed"); Emu.Pause(); break; } @@ -305,7 +305,7 @@ u32 vdecOpen(VideoDecoder* data) { if (Emu.IsStopped()) { - ConLog.Warning("vdecDecodeAu: aborted"); + LOGF_WARNING(HLE, "vdecDecodeAu: aborted"); return; } @@ -338,7 +338,7 @@ u32 vdecOpen(VideoDecoder* data) if (!frame.data) { - ConLog.Error("vdecDecodeAu: av_frame_alloc() failed"); + LOGF_ERROR(HLE, "vdecDecodeAu: av_frame_alloc() failed"); Emu.Pause(); break; } @@ -351,7 +351,7 @@ u32 vdecOpen(VideoDecoder* data) { if (!last_frame && decode < 0) { - ConLog.Error("vdecDecodeAu: AU decoding error(0x%x)", decode); + LOGF_ERROR(HLE, "vdecDecodeAu: AU decoding error(0x%x)", decode); } if (!got_picture && vdec.reader.size == 0) break; // video end? } @@ -374,7 +374,7 @@ u32 vdecOpen(VideoDecoder* data) frame.dts = (frame.pts - vdec.first_pts) + vdec.first_dts; frame.userdata = task.userData; - //ConLog.Write("got picture (pts=0x%llx, dts=0x%llx)", frame.pts, frame.dts); + //LOGF_NOTICE(HLE, "got picture (pts=0x%llx, dts=0x%llx)", frame.pts, frame.dts); vdec.frames.Push(frame); // !!!!!!!! frame.data = nullptr; // to prevent destruction @@ -398,23 +398,23 @@ u32 vdecOpen(VideoDecoder* data) case vdecClose: { vdec.is_finished = true; - ConLog.Write("Video Decoder thread ended"); + LOGF_NOTICE(HLE, "Video Decoder thread ended"); return; } case vdecSetFrameRate: { - ConLog.Error("TODO: vdecSetFrameRate(%d)", task.frc); + LOGF_ERROR(HLE, "TODO: vdecSetFrameRate(%d)", task.frc); } break; default: - ConLog.Error("Video Decoder thread error: unknown task(%d)", task.type); + LOGF_ERROR(HLE, "Video Decoder thread error: unknown task(%d)", task.type); } } vdec.is_finished = true; - ConLog.Warning("Video Decoder thread aborted"); + LOGF_WARNING(HLE, "Video Decoder thread aborted"); }); t.detach(); @@ -502,7 +502,7 @@ int cellVdecClose(u32 handle) { if (Emu.IsStopped()) { - ConLog.Warning("cellVdecClose(%d) aborted", handle); + LOGF_WARNING(HLE, "cellVdecClose(%d) aborted", handle); break; } Sleep(1); @@ -553,7 +553,7 @@ int cellVdecEndSeq(u32 handle) { if (Emu.IsStopped()) { - ConLog.Warning("cellVdecEndSeq(%d) aborted", handle); + LOGF_WARNING(HLE, "cellVdecEndSeq(%d) aborted", handle); return CELL_OK; } Sleep(1); @@ -751,13 +751,13 @@ int cellVdecGetPicItem(u32 handle, mem32_t picItem_ptr) } else { - ConLog.Error("cellVdecGetPicItem: unsupported time_base.den (%d)", vdec->ctx->time_base.den); + LOGF_ERROR(HLE, "cellVdecGetPicItem: unsupported time_base.den (%d)", vdec->ctx->time_base.den); Emu.Pause(); } } else { - ConLog.Error("cellVdecGetPicItem: unsupported time_base.num (%d)", vdec->ctx->time_base.num); + LOGF_ERROR(HLE, "cellVdecGetPicItem: unsupported time_base.num (%d)", vdec->ctx->time_base.num); Emu.Pause(); } avc->fixed_frame_rate_flag = true; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.h b/rpcs3/Emu/SysCalls/Modules/cellVdec.h index b0cc5cee54..2e7133fdc3 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.h @@ -741,14 +741,14 @@ public: AVCodec* codec = avcodec_find_decoder(AV_CODEC_ID_H264); if (!codec) { - ConLog.Error("VideoDecoder(): avcodec_find_decoder(H264) failed"); + LOGF_ERROR(HLE, "VideoDecoder(): avcodec_find_decoder(H264) failed"); Emu.Pause(); return; } fmt = avformat_alloc_context(); if (!fmt) { - ConLog.Error("VideoDecoder(): avformat_alloc_context failed"); + LOGF_ERROR(HLE, "VideoDecoder(): avformat_alloc_context failed"); Emu.Pause(); return; } @@ -756,7 +756,7 @@ public: fmt->pb = avio_alloc_context(io_buf, 4096, 0, this, vdecRead, NULL, NULL); if (!fmt->pb) { - ConLog.Error("VideoDecoder(): avio_alloc_context failed"); + LOGF_ERROR(HLE, "VideoDecoder(): avio_alloc_context failed"); Emu.Pause(); return; } @@ -785,4 +785,4 @@ public: avformat_free_context(fmt); } } -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp index ce91fbf3e4..0fbab6924b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVpost.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -38,7 +38,7 @@ u32 vpostOpen(VpostInstance* data) { u32 id = cellVpost->GetNewId(data); - ConLog.Write("*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id); + LOGF_NOTICE(HLE, "*** Vpost instance created (to_rgba=%d): id = %d", data->to_rgba, id); return id; } @@ -123,15 +123,15 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const mem_ptr_tinWindow; // ignored - if (ctrlParam->inWindow.x) ConLog.Warning("*** inWindow.x = %d", (u32)ctrlParam->inWindow.x); - if (ctrlParam->inWindow.y) ConLog.Warning("*** inWindow.y = %d", (u32)ctrlParam->inWindow.y); - if (ctrlParam->inWindow.width != w) ConLog.Warning("*** inWindow.width = %d", (u32)ctrlParam->inWindow.width); - if (ctrlParam->inWindow.height != h) ConLog.Warning("*** inWindow.height = %d", (u32)ctrlParam->inWindow.height); + if (ctrlParam->inWindow.x) LOGF_WARNING(HLE, "*** inWindow.x = %d", (u32)ctrlParam->inWindow.x); + if (ctrlParam->inWindow.y) LOGF_WARNING(HLE, "*** inWindow.y = %d", (u32)ctrlParam->inWindow.y); + if (ctrlParam->inWindow.width != w) LOGF_WARNING(HLE, "*** inWindow.width = %d", (u32)ctrlParam->inWindow.width); + if (ctrlParam->inWindow.height != h) LOGF_WARNING(HLE, "*** inWindow.height = %d", (u32)ctrlParam->inWindow.height); ctrlParam->outWindow; // ignored - if (ctrlParam->outWindow.x) ConLog.Warning("*** outWindow.x = %d", (u32)ctrlParam->outWindow.x); - if (ctrlParam->outWindow.y) ConLog.Warning("*** outWindow.y = %d", (u32)ctrlParam->outWindow.y); - if (ctrlParam->outWindow.width != ow) ConLog.Warning("*** outWindow.width = %d", (u32)ctrlParam->outWindow.width); - if (ctrlParam->outWindow.height != oh) ConLog.Warning("*** outWindow.height = %d", (u32)ctrlParam->outWindow.height); + if (ctrlParam->outWindow.x) LOGF_WARNING(HLE, "*** outWindow.x = %d", (u32)ctrlParam->outWindow.x); + if (ctrlParam->outWindow.y) LOGF_WARNING(HLE, "*** outWindow.y = %d", (u32)ctrlParam->outWindow.y); + if (ctrlParam->outWindow.width != ow) LOGF_WARNING(HLE, "*** outWindow.width = %d", (u32)ctrlParam->outWindow.width); + if (ctrlParam->outWindow.height != oh) LOGF_WARNING(HLE, "*** outWindow.height = %d", (u32)ctrlParam->outWindow.height); ctrlParam->execType; // ignored ctrlParam->scalerType; // ignored ctrlParam->ipcType; // ignored diff --git a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp index a159e0eec1..18618ff190 100644 --- a/rpcs3/Emu/SysCalls/Modules/libmixer.cpp +++ b/rpcs3/Emu/SysCalls/Modules/libmixer.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -241,7 +241,7 @@ int cellSurMixerStart() { if (Emu.IsStopped()) { - ConLog.Warning("Surmixer aborted"); + LOG_WARNING(HLE, "Surmixer aborted"); return; } @@ -953,4 +953,4 @@ void libmixer_init() REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDB); REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilGetLevelFromDBIndex); REG_SUB_EMPTY(libmixer, "surmxUti", cellSurMixerUtilNoteToRatio); -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp index eef93a06e0..aaff7e08b1 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNp.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNp.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index 0897f5ab61..3f4c4f82c4 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -361,7 +361,7 @@ int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, mem_ptr_tGetTrophiesCount(); if (count.GetValue() > 128) - ConLog.Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!"); + LOG_WARNING(HLE, "sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!"); // Pack up to 128 bools in u32 flag_bits[4] for (u32 id=0; id aio, int xid, mem_func_ptr_t aio, int xid, mem_func_ptr_toffset, buf_addr, (u64)aio->size, error, res, xid, orig_file->GetPath().c_str()); if (func) // start callback thread @@ -223,7 +223,7 @@ fin: Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("fsAioRead() aborted"); + LOGF_WARNING(HLE, "fsAioRead() aborted"); break; } }*/ diff --git a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp index 031dc065a2..e2343a02bf 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_io.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_io.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index af0c53c620..7885312aae 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/Static.cpp b/rpcs3/Emu/SysCalls/Static.cpp index 21d70269d3..02c8a679c0 100644 --- a/rpcs3/Emu/SysCalls/Static.cpp +++ b/rpcs3/Emu/SysCalls/Static.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -54,14 +54,14 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) k--; if (can_skip) // cannot define this behaviour properly { - ConLog.Warning("StaticAnalyse(): can_skip = %d (unchanged)", can_skip); + LOGF_WARNING(LOADER, "StaticAnalyse(): can_skip = %d (unchanged)", can_skip); } } else { if (can_skip) // cannot define this behaviour properly { - ConLog.Warning("StaticAnalyse(): can_skip = %d (set to 0)", can_skip); + LOGF_WARNING(LOADER, "StaticAnalyse(): can_skip = %d (set to 0)", can_skip); can_skip = 0; } } @@ -85,7 +85,7 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) } if (found) { - ConLog.Write("Function '%s' hooked (addr=0x%x)", m_static_funcs_list[j]->name, i * 4 + base); + LOGF_NOTICE(LOADER, "Function '%s' hooked (addr=0x%x)", m_static_funcs_list[j]->name, i * 4 + base); m_static_funcs_list[j]->found++; data[i+0] = re32(0x39600000 | j); // li r11, j data[i+1] = se32(0x44000003); // sc 3 @@ -129,7 +129,7 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) if (count == 0) { res |= GSR_MISSING; - ConLog.Error("Function '%s' not found", m_static_funcs_list[j]->name); + LOGF_ERROR(LOADER, "Function '%s' not found", m_static_funcs_list[j]->name); } else if (count > 1) { @@ -146,7 +146,7 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) if (m_static_funcs_list[k]->found) { res |= GSR_EXCESS; - ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name); + LOGF_ERROR(LOADER, "Function '%s' hooked twice", m_static_funcs_list[j]->name); } } } @@ -154,7 +154,7 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) else { res |= GSR_EXCESS; - ConLog.Error("Function '%s' hooked twice", m_static_funcs_list[j]->name); + LOGF_ERROR(LOADER, "Function '%s' hooked twice", m_static_funcs_list[j]->name); } } @@ -170,11 +170,11 @@ void StaticFuncManager::StaticAnalyse(void* ptr, u32 size, u32 base) if (res == GSR_SUCCESS) { - ConLog.Success("Function group [%s] successfully hooked", std::string(name, 9).c_str()); + LOGF_SUCCESS(LOADER, "Function group [%s] successfully hooked", std::string(name, 9).c_str()); } else { - ConLog.Error("Function group [%s] failed:%s%s", std::string(name, 9).c_str(), + LOGF_ERROR(LOADER, "Function group [%s] failed:%s%s", std::string(name, 9).c_str(), (res & GSR_MISSING ? " missing;" : ""), (res & GSR_EXCESS ? " excess;" : "")); } @@ -190,7 +190,7 @@ void StaticFuncManager::StaticExecute(u32 code) } else { - ConLog.Error("StaticExecute(%d): unknown function or illegal opcode", code); + LOGF_ERROR(LOADER, "StaticExecute(%d): unknown function or illegal opcode", code); } } diff --git a/rpcs3/Emu/SysCalls/SysCalls.cpp b/rpcs3/Emu/SysCalls/SysCalls.cpp index 1c502457c5..7a3bb4a787 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.cpp +++ b/rpcs3/Emu/SysCalls/SysCalls.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -553,7 +553,7 @@ void default_syscall() { //tty case 988: - ConLog.Warning("SysCall 988! r3: 0x%llx, r4: 0x%llx, pc: 0x%llx", + LOGF_WARNING(HLE, "SysCall 988! r3: 0x%llx, r4: 0x%llx, pc: 0x%llx", CPU.GPR[3], CPU.GPR[4], CPU.PC); RESULT(0); return; @@ -561,16 +561,16 @@ void default_syscall() case 999: dump_enable = !dump_enable; Emu.Pause(); - ConLog.Warning("Dump %s", (dump_enable ? "enabled" : "disabled")); + LOGF_WARNING(HLE, "Dump %s", (dump_enable ? "enabled" : "disabled")); return; case 1000: Ini.HLELogging.SetValue(!Ini.HLELogging.GetValue()); - ConLog.Warning("Log %s", (Ini.HLELogging.GetValue() ? "enabled" : "disabled")); + LOGF_WARNING(HLE, "Log %s", (Ini.HLELogging.GetValue() ? "enabled" : "disabled")); return; } - ConLog.Error("Unknown syscall: %d - %08x", code, code); + LOGF_ERROR(HLE, "Unknown syscall: %d - %08x", code, code); RESULT(0); return; } @@ -589,7 +589,7 @@ void SysCalls::DoSyscall(u32 code) } - ConLog.Error("TODO: %s", GetHLEFuncName(code).c_str()); + LOGF_ERROR(HLE, "TODO: %s", GetHLEFuncName(code).c_str()); declCPU(); RESULT(0); } diff --git a/rpcs3/Emu/SysCalls/SysCalls.h b/rpcs3/Emu/SysCalls/SysCalls.h index 47ec3c25b7..d470b5a720 100644 --- a/rpcs3/Emu/SysCalls/SysCalls.h +++ b/rpcs3/Emu/SysCalls/SysCalls.h @@ -54,7 +54,7 @@ public: { va_list list; va_start(list, fmt); - ConLog.Write(GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list)); + LOG_NOTICE(HLE, GetName() + fmt::Format("[%d]: ", id) + fmt::FormatV(fmt, list)); va_end(list); } } @@ -65,7 +65,7 @@ public: { va_list list; va_start(list, fmt); - ConLog.Write(GetName() + ": " + fmt::FormatV(fmt, list)); + LOG_NOTICE(HLE, GetName() + ": " + fmt::FormatV(fmt, list)); va_end(list); } } @@ -75,7 +75,7 @@ public: //#ifdef SYSCALLS_DEBUG va_list list; va_start(list, fmt); - ConLog.Warning(GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list)); + LOG_WARNING(HLE, GetName() + fmt::Format("[%d] warning: ", id) + fmt::FormatV(fmt, list)); va_end(list); //#endif } @@ -85,7 +85,7 @@ public: //#ifdef SYSCALLS_DEBUG va_list list; va_start(list, fmt); - ConLog.Warning(GetName() + " warning: " + fmt::FormatV(fmt, list)); + LOG_WARNING(HLE, GetName() + " warning: " + fmt::FormatV(fmt, list)); va_end(list); //#endif } @@ -94,7 +94,7 @@ public: { va_list list; va_start(list, fmt); - ConLog.Error(GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list)); + LOG_ERROR(HLE, GetName() + fmt::Format("[%d] error: ", id) + fmt::FormatV(fmt, list)); va_end(list); } @@ -102,7 +102,7 @@ public: { va_list list; va_start(list, fmt); - ConLog.Error(GetName() + " error: " + fmt::FormatV(fmt, list)); + LOG_ERROR(HLE, GetName() + " error: " + fmt::FormatV(fmt, list)); va_end(list); } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Condition.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Condition.cpp index f759f3f1b4..dfd7312a2e 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Condition.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Condition.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -85,7 +85,7 @@ int sys_cond_signal(u32 cond_id) if (Emu.IsStopped()) { - ConLog.Warning("sys_cond_signal(id=%d) aborted", cond_id); + LOGF_WARNING(HLE, "sys_cond_signal(id=%d) aborted", cond_id); } } @@ -113,7 +113,7 @@ int sys_cond_signal_all(u32 cond_id) if (Emu.IsStopped()) { - ConLog.Warning("sys_cond_signal_all(id=%d) aborted", cond_id); + LOGF_WARNING(HLE, "sys_cond_signal_all(id=%d) aborted", cond_id); break; } } @@ -153,7 +153,7 @@ int sys_cond_signal_to(u32 cond_id, u32 thread_id) if (Emu.IsStopped()) { - ConLog.Warning("sys_cond_signal_to(id=%d, to=%d) aborted", cond_id, thread_id); + LOGF_WARNING(HLE, "sys_cond_signal_to(id=%d, to=%d) aborted", cond_id, thread_id); } return CELL_OK; @@ -236,6 +236,6 @@ int sys_cond_wait(u32 cond_id, u64 timeout) } abort: - ConLog.Warning("sys_cond_wait(id=%d) aborted", cond_id); + LOGF_WARNING(HLE, "sys_cond_wait(id=%d) aborted", cond_id); return CELL_OK; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Event.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Event.cpp index b755a4d16a..fdf409b0d3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Event.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Event.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -95,7 +95,7 @@ int sys_event_queue_destroy(u32 equeue_id, int mode) Sleep(1); if (Emu.IsStopped()) { - ConLog.Warning("sys_event_queue_destroy(equeue=%d) aborted", equeue_id); + LOGF_WARNING(HLE, "sys_event_queue_destroy(equeue=%d) aborted", equeue_id); break; } } @@ -223,7 +223,7 @@ int sys_event_queue_receive(u32 equeue_id, mem_ptr_t event, u64 Sleep(1); if (counter++ > timeout || Emu.IsStopped()) { - if (Emu.IsStopped()) ConLog.Warning("sys_event_queue_receive(equeue=%d) aborted", equeue_id); + if (Emu.IsStopped()) LOGF_WARNING(HLE, "sys_event_queue_receive(equeue=%d) aborted", equeue_id); eq->sq.invalidate(tid); return CELL_ETIMEDOUT; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Event_flag.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Event_flag.cpp index 02d551dbab..8244fdf672 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Event_flag.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Event_flag.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -197,7 +197,7 @@ int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 } if (Emu.IsStopped()) { - ConLog.Warning("sys_event_flag_wait(id=%d) aborted", eflag_id); + LOGF_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id); return CELL_OK; } } @@ -324,7 +324,7 @@ int sys_event_flag_cancel(u32 eflag_id, mem32_t num) if (Emu.IsStopped()) { - ConLog.Warning("sys_event_flag_cancel(id=%d) aborted", eflag_id); + LOGF_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp index 841b9651cf..0e16de98d2 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -126,7 +126,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size) } fd = sys_fs->GetNewId(stream, IDFlag_File); - ConLog.Warning("*** cellFsOpen(path=\"%s\"): fd = %d", path.c_str(), fd.GetValue()); + LOGF_WARNING(HLE, "*** cellFsOpen(path=\"%s\"): fd = %d", path.c_str(), fd.GetValue()); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_GCM.cpp b/rpcs3/Emu/SysCalls/lv2/SC_GCM.cpp index c81b3e9e45..d0f80fcc90 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_GCM.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_GCM.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Heap.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Heap.cpp index 2065564d4a..ca0d633251 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Heap.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Heap.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Interrupt.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Interrupt.cpp index 95573ba690..0914d8e39c 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Interrupt.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Interrupt.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp index 2a88871912..af657d37de 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Keyboard.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp index 66342bc9fd..5bbb02e92e 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Lwcond.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -95,7 +95,7 @@ int sys_lwcond_signal(mem_ptr_t lwcond) if (Emu.IsStopped()) { - ConLog.Warning("sys_lwcond_signal(id=%d) aborted", (u32)lwcond->lwcond_queue); + LOGF_WARNING(HLE, "sys_lwcond_signal(id=%d) aborted", (u32)lwcond->lwcond_queue); return CELL_OK; } } @@ -126,7 +126,7 @@ int sys_lwcond_signal_all(mem_ptr_t lwcond) if (Emu.IsStopped()) { - ConLog.Warning("sys_lwcond_signal_all(id=%d) aborted", (u32)lwcond->lwcond_queue); + LOGF_WARNING(HLE, "sys_lwcond_signal_all(id=%d) aborted", (u32)lwcond->lwcond_queue); return CELL_OK; } } @@ -165,7 +165,7 @@ int sys_lwcond_signal_to(mem_ptr_t lwcond, u32 ppu_thread_id) if (Emu.IsStopped()) { - ConLog.Warning("sys_lwcond_signal_to(id=%d, to=%d) aborted", (u32)lwcond->lwcond_queue, ppu_thread_id); + LOGF_WARNING(HLE, "sys_lwcond_signal_to(id=%d, to=%d) aborted", (u32)lwcond->lwcond_queue, ppu_thread_id); return CELL_OK; } } @@ -260,6 +260,6 @@ int sys_lwcond_wait(mem_ptr_t lwcond, u64 timeout) } abort: - ConLog.Warning("sys_lwcond_wait(id=%d) aborted", (u32)lwcond->lwcond_queue); + LOGF_WARNING(HLE, "sys_lwcond_wait(id=%d) aborted", (u32)lwcond->lwcond_queue); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp index c1650a6efa..8af57345a6 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Lwmutex.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -169,7 +169,7 @@ u32 SleepQueue::pop_prio() // SYS_SYNC_PRIORITY u32 SleepQueue::pop_prio_inherit() // (TODO) { - ConLog.Error("TODO: SleepQueue::pop_prio_inherit()"); + LOG_ERROR(HLE, "TODO: SleepQueue::pop_prio_inherit()"); Emu.Pause(); return 0; } @@ -251,7 +251,7 @@ int sys_lwmutex_t::trylock(be_t tid) { if (Emu.IsStopped()) { - ConLog.Warning("(hack) sys_lwmutex_t::(try)lock aborted (waiting for recursive attribute, attr=0x%x)", (u32)attribute); + LOGF_WARNING(HLE, "(hack) sys_lwmutex_t::(try)lock aborted (waiting for recursive attribute, attr=0x%x)", (u32)attribute); return CELL_ESRCH; } Sleep(1); @@ -340,7 +340,7 @@ int sys_lwmutex_t::lock(be_t tid, u64 timeout) case SMR_TIMEOUT: sq->invalidate(tid); return CELL_ETIMEDOUT; case SMR_ABORT: - if (Emu.IsStopped()) ConLog.Warning("sys_lwmutex_t::lock(sq=%d) aborted", (u32)sleep_queue); + if (Emu.IsStopped()) LOGF_WARNING(HLE, "sys_lwmutex_t::lock(sq=%d) aborted", (u32)sleep_queue); default: sq->invalidate(tid); return CELL_EINVAL; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp index c1aa7e562e..b82ab31570 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Memory.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp index bf409e6748..374b3dc3cc 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Mouse.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp index c176dcc8fa..635f3cbaa0 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.h b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.h index 0c30fe3e66..0345d1ee97 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Mutex.h +++ b/rpcs3/Emu/SysCalls/lv2/SC_Mutex.h @@ -39,14 +39,14 @@ struct Mutex { if (u32 owner = m_mutex.GetOwner()) { - ConLog.Write("Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive); + LOGF_NOTICE(HLE, "Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive); } if (!m_queue.m_mutex.try_lock()) return; for (u32 i = 0; i < m_queue.list.size(); i++) { - if (u32 owner = m_queue.list[i]) ConLog.Write("Mutex(%d) was waited by thread %d", id, owner); + if (u32 owner = m_queue.list[i]) LOGF_NOTICE(HLE, "Mutex(%d) was waited by thread %d", id, owner); } m_queue.m_mutex.unlock(); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp index 5e37196bd8..f30705c430 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PPU_Thread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -32,7 +32,7 @@ void sys_ppu_thread_exit(u64 errorcode) if (thr.owned_mutexes) { - ConLog.Error("Owned mutexes found (%d)", thr.owned_mutexes); + LOGF_ERROR(PPU, "Owned mutexes found (%d)", thr.owned_mutexes); thr.owned_mutexes = 0; } @@ -58,7 +58,7 @@ int sys_ppu_thread_join(u64 thread_id, mem64_t vptr) { if (Emu.IsStopped()) { - ConLog.Warning("sys_ppu_thread_join(%d) aborted", thread_id); + LOGF_WARNING(PPU, "sys_ppu_thread_join(%d) aborted", thread_id); return CELL_OK; } Sleep(1); @@ -204,7 +204,7 @@ int sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, int prio, u32 s new_thread.m_is_interrupt = is_interrupt; new_thread.SetName(threadname); - ConLog.Write("*** New PPU Thread [%s] (flags=0x%llx, entry=0x%x): id = %d", new_thread.GetName().c_str(), flags, entry, new_thread.GetId()); + LOGF_NOTICE(PPU, "*** New PPU Thread [%s] (flags=0x%llx, entry=0x%x): id = %d", new_thread.GetName().c_str(), flags, entry, new_thread.GetId()); if (!is_interrupt) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_PRX.cpp b/rpcs3/Emu/SysCalls/lv2/SC_PRX.cpp index 962d67fb37..40075871ad 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_PRX.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_PRX.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp index 79467d519e..639c7efa84 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Pad.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp index d0bf322846..007bd5b8f8 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Process.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" @@ -24,7 +24,7 @@ int sys_process_exit(s32 errorcode) { sc_p.Warning("sys_process_exit(%d)", errorcode); Emu.Pause(); // Emu.Stop() does crash - ConLog.Success("Process finished"); + LOG_SUCCESS(HLE, "Process finished"); if (Ini.HLEExitOnStop.GetValue()) { diff --git a/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp b/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp index 1fce0dc7d0..d36e96f846 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_RSX.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp index 88922f07e7..4db7ed85b5 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Rwlock.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -69,7 +69,7 @@ int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout) { if (Emu.IsStopped()) { - ConLog.Warning("sys_rwlock_rlock(rw_lock_id=%d, ...) aborted", rw_lock_id); + LOGF_WARNING(HLE, "sys_rwlock_rlock(rw_lock_id=%d, ...) aborted", rw_lock_id); return CELL_ETIMEDOUT; } Sleep(1); @@ -132,7 +132,7 @@ int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout) { if (Emu.IsStopped()) { - ConLog.Warning("sys_rwlock_wlock(rw_lock_id=%d, ...) aborted", rw_lock_id); + LOGF_WARNING(HLE, "sys_rwlock_wlock(rw_lock_id=%d, ...) aborted", rw_lock_id); return CELL_ETIMEDOUT; } Sleep(1); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp index c734990b63..9f876ccd42 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -346,7 +346,7 @@ int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status) } if (Emu.IsStopped()) { - ConLog.Warning("sys_spu_thread_group_join(id=%d, ...) aborted", id); + LOGF_WARNING(Log::SPU, "sys_spu_thread_group_join(id=%d, ...) aborted", id); return CELL_OK; } Sleep(1); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp index b256e1c380..3c7e85032a 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Semaphore.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" @@ -39,7 +39,7 @@ int sys_semaphore_create(mem32_t sem, mem_ptr_t attr, i } sem = sys_sem.GetNewId(new Semaphore(initial_count, max_count, attr->protocol, attr->name_u64)); - ConLog.Write("*** semaphore created [%s] (protocol=0x%x): id = %d", + LOGF_NOTICE(HLE, "*** semaphore created [%s] (protocol=0x%x): id = %d", std::string(attr->name, 8).c_str(), (u32)attr->protocol, sem.GetValue()); return CELL_OK; @@ -91,7 +91,7 @@ int sys_semaphore_wait(u32 sem_id, u64 timeout) { if (Emu.IsStopped()) { - ConLog.Warning("sys_semaphore_wait(%d) aborted", sem_id); + LOGF_WARNING(HLE, "sys_semaphore_wait(%d) aborted", sem_id); return CELL_OK; } @@ -165,7 +165,7 @@ int sys_semaphore_post(u32 sem_id, int count) { if (Emu.IsStopped()) { - ConLog.Warning("sys_semaphore_post(%d) aborted", sem_id); + LOGF_WARNING(HLE, "sys_semaphore_post(%d) aborted", sem_id); return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Spinlock.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Spinlock.cpp index c7a9bfd8aa..ba9b50239f 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Spinlock.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Spinlock.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -22,8 +22,8 @@ void sys_spinlock_lock(mem_ptr_t lock) be_t tid = GetCurrentPPUThread().GetId(); switch (lock->mutex.lock(tid)) { - case SMR_ABORT: ConLog.Warning("sys_spinlock_lock(0x%x) aborted", lock.GetAddr()); break; - case SMR_DEADLOCK: ConLog.Error("sys_spinlock_lock(0x%x) reached deadlock", lock.GetAddr()); break; // ??? + case SMR_ABORT: LOGF_WARNING(HLE, "sys_spinlock_lock(0x%x) aborted", lock.GetAddr()); break; + case SMR_DEADLOCK: LOGF_ERROR(HLE, "sys_spinlock_lock(0x%x) reached deadlock", lock.GetAddr()); break; // ??? default: break; } } @@ -36,8 +36,8 @@ int sys_spinlock_trylock(mem_ptr_t lock) switch (lock->mutex.trylock(tid)) { case SMR_FAILED: return CELL_EBUSY; - case SMR_ABORT: ConLog.Warning("sys_spinlock_trylock(0x%x) aborted", lock.GetAddr()); break; - case SMR_DEADLOCK: ConLog.Error("sys_spinlock_trylock(0x%x) reached deadlock", lock.GetAddr()); break; + case SMR_ABORT: LOGF_WARNING(HLE, "sys_spinlock_trylock(0x%x) aborted", lock.GetAddr()); break; + case SMR_DEADLOCK: LOGF_ERROR(HLE, "sys_spinlock_trylock(0x%x) reached deadlock", lock.GetAddr()); break; default: break; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_TTY.cpp b/rpcs3/Emu/SysCalls/lv2/SC_TTY.cpp index 634075de82..b043c54529 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_TTY.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_TTY.cpp @@ -1,12 +1,13 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" int sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr) { - ConLog.Warning("sys_tty_read: ch: %d, buf addr: %llx, len: %d", ch, buf_addr, len); + //we currently do not support reading from the Console + LOGF_WARNING(HLE, "sys_tty_read: ch: %d, buf addr: %llx, len: %d", ch, buf_addr, len); Memory.Write32NN(preadlen_addr, len); Emu.Pause(); @@ -18,11 +19,16 @@ int sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr) if(ch > 15 || (s32)len <= 0) return CELL_EINVAL; if(!Memory.IsGoodAddr(buf_addr)) return CELL_EFAULT; - if (!Ini.HLEHideDebugConsole.GetValue()) + //ch 0 seems to be stdout and ch 1 stderr + if (ch == 1) { - Emu.GetDbgCon().Write(ch, Memory.ReadString(buf_addr, len)); + LOG_ERROR(TTY, Memory.ReadString(buf_addr, len)); } - + else + { + LOG_NOTICE(TTY, Memory.ReadString(buf_addr, len)); + } + if(!Memory.IsGoodAddr(pwritelen_addr)) return CELL_EFAULT; Memory.Write32(pwritelen_addr, len); diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp index 12c4d3881d..5b14c233b3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Time.cpp @@ -6,7 +6,7 @@ * GNU LGPL 2.1 license * */ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp index 9d2e410fa3..3a212ad74d 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Timer.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "SC_Timer.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp b/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp index 6361e880ca..190e3b1d7d 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_Trace.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/SysCalls/lv2/SC_VM.cpp b/rpcs3/Emu/SysCalls/lv2/SC_VM.cpp index c761abf6e1..d7c9f58d40 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_VM.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_VM.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SysCalls.h" diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index e599ceb217..68bba82a55 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Ini.h" @@ -31,7 +31,6 @@ ModuleInitializer::ModuleInitializer() Emulator::Emulator() : m_status(Stopped) , m_mode(DisAsm) - , m_dbg_console(nullptr) , m_rsx_callback(0) , m_ppu_callback_thr(0) , m_event_manager(new EventManager()) @@ -154,17 +153,17 @@ void Emulator::Load() m_path = elf_path; } - ConLog.Write("Loading '%s'...", m_path.c_str()); + LOGF_NOTICE(LOADER, "Loading '%s'...", m_path.c_str()); GetInfo().Reset(); m_vfs.Init(m_path); - ConLog.SkipLn(); - ConLog.Write("Mount info:"); + LOG_NOTICE(LOADER, " "); //used to be skip_line + LOG_NOTICE(LOADER, "Mount info:"); for(uint i=0; i %s", m_vfs.m_devices[i]->GetPs3Path().c_str(), m_vfs.m_devices[i]->GetLocalPath().c_str()); + LOGF_NOTICE(LOADER, "%s -> %s", m_vfs.m_devices[i]->GetPs3Path().c_str(), m_vfs.m_devices[i]->GetLocalPath().c_str()); } - ConLog.SkipLn(); + LOG_NOTICE(LOADER, " ");//used to be skip_line if(m_elf_path.empty()) { @@ -175,7 +174,7 @@ void Emulator::Load() if(!f.IsOpened()) { - ConLog.Error("Elf not found! (%s - %s)", m_path.c_str(), m_elf_path.c_str()); + LOGF_ERROR(LOADER, "Elf not found! (%s - %s)", m_path.c_str(), m_elf_path.c_str()); return; } @@ -208,12 +207,12 @@ void Emulator::Load() } catch(const std::string& e) { - ConLog.Error(e); + LOG_ERROR(LOADER, e); is_error = true; } catch(...) { - ConLog.Error("Unhandled loader error."); + LOG_ERROR(LOADER, "Unhandled loader error."); is_error = true; } @@ -228,7 +227,7 @@ void Emulator::Load() case MACHINE_ARM: thread_type = CPU_THREAD_ARMv7; break; default: - ConLog.Error("Unimplemented thread type for machine."); + LOG_ERROR(LOADER, "Unimplemented thread type for machine."); is_error = true; break; } @@ -248,8 +247,8 @@ void Emulator::Load() switch(l.GetMachine()) { case MACHINE_SPU: - ConLog.Write("offset = 0x%llx", Memory.MainMem.GetStartAddr()); - ConLog.Write("max addr = 0x%x", l.GetMaxAddr()); + LOGF_NOTICE(LOADER, "offset = 0x%llx", Memory.MainMem.GetStartAddr()); + LOGF_NOTICE(LOADER, "max addr = 0x%x", l.GetMaxAddr()); thread.SetOffset(Memory.MainMem.GetStartAddr()); Memory.MainMem.AllocFixed(Memory.MainMem.GetStartAddr() + l.GetMaxAddr(), 0xFFFFED - l.GetMaxAddr()); thread.SetEntry(l.GetEntry() - Memory.MainMem.GetStartAddr()); @@ -290,16 +289,6 @@ void Emulator::Load() break; } - if(!m_dbg_console) - { - m_dbg_console = new DbgConsole(); - } - else - { - GetDbgCon().Close(); - GetDbgCon().Clear(); - } - GetGSManager().Init(); GetCallbackManager().Init(); GetAudioManager().Init(); @@ -313,6 +302,7 @@ void Emulator::Load() void Emulator::Run() { + if(!IsReady()) { Load(); @@ -373,19 +363,19 @@ void Emulator::Stop() SendDbgCommand(DID_STOP_EMU); m_status = Stopped; - u32 uncounted = 0 + (u32)(bool)m_dbg_console; + u32 uncounted = 0; u32 counter = 0; while (true) { if (g_thread_count <= uncounted) { - ConLog.Write("All threads stopped..."); + LOG_NOTICE(HLE, "All threads stopped..."); break; } Sleep(1); if (counter++ > 3000) { - ConLog.Error("%d threads not stopped (timeout)", (u32)(g_thread_count - uncounted)); + LOGF_ERROR(HLE, "%d threads not stopped (timeout)", (u32)(g_thread_count - uncounted)); break; } } @@ -458,7 +448,7 @@ void Emulator::LoadPoints(const std::string& path) if(version != bpdb_version || (sizeof(u16) + break_count * sizeof(u64) + sizeof(u32) + marked_count * sizeof(u64) + sizeof(u32)) != length) { - ConLog.Error("'%s' is broken", path.c_str()); + LOGF_ERROR(LOADER, "'%s' is broken", path.c_str()); return; } diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index ad43f078ac..8f99e5b284 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -83,7 +83,6 @@ class Emulator KeyboardManager m_keyboard_manager; MouseManager m_mouse_manager; IdManager m_id_manager; - DbgConsole* m_dbg_console; GSManager m_gs_manager; AudioManager m_audio_manager; CallbackManager m_callback_manager; @@ -112,7 +111,6 @@ public: KeyboardManager& GetKeyboardManager() { return m_keyboard_manager; } MouseManager& GetMouseManager() { return m_mouse_manager; } IdManager& GetIdManager() { return m_id_manager; } - DbgConsole& GetDbgCon() { return *m_dbg_console; } GSManager& GetGSManager() { return m_gs_manager; } AudioManager& GetAudioManager() { return m_audio_manager; } CallbackManager& GetCallbackManager() { return m_callback_manager; } diff --git a/rpcs3/Gui/CompilerELF.cpp b/rpcs3/Gui/CompilerELF.cpp index cbf283df6e..b2141c4794 100644 --- a/rpcs3/Gui/CompilerELF.cpp +++ b/rpcs3/Gui/CompilerELF.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "CompilerELF.h" diff --git a/rpcs3/Gui/ConLog.cpp b/rpcs3/Gui/ConLog.cpp index 210600bd4a..e62927bef6 100644 --- a/rpcs3/Gui/ConLog.cpp +++ b/rpcs3/Gui/ConLog.cpp @@ -8,169 +8,119 @@ #include "Ini.h" #include "Utilities/Thread.h" #include "Utilities/StrFmt.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" +#include "Utilities/Log.h" #include "Gui/ConLogFrame.h" #include "Utilities/BEType.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" -LogWriter ConLog; -class LogFrame; -extern LogFrame* ConLogFrame; +wxDEFINE_EVENT(EVT_LOG_COMMAND, wxCommandEvent); -std::mutex g_cs_conlog; +//amount of memory in bytes used to buffer log messages for the gui +const int BUFFER_MAX_SIZE = 1024 * 1024; -const uint max_item_count = 500; -const uint buffer_size = 1024 * 64; +//amount of characters in the TextCtrl text-buffer for the emulation log +const int GUI_BUFFER_MAX_SIZE = 1024 * 1024; -static const std::string g_log_colors[] = +struct wxWriter : Log::LogListener { - "Black", "Green", "White", "Yellow", "Red", -}; + wxTextCtrl *m_log; + wxTextCtrl *m_tty; + wxTextAttr m_color_white; + wxTextAttr m_color_yellow; + wxTextAttr m_color_red; + MTRingbuffer messages; + std::atomic newLog; + bool inited; - -struct LogPacket -{ - const std::string m_prefix; - const std::string m_text; - const std::string m_colour; - - LogPacket(const std::string& prefix, const std::string& text, const std::string& colour) - : m_prefix(prefix) - , m_text(text) - , m_colour(colour) - { - - } -}; - -struct _LogBuffer : public MTPacketBuffer -{ - _LogBuffer() : MTPacketBuffer(buffer_size) + wxWriter(wxTextCtrl* p_log, wxTextCtrl* p_tty) : + m_color_white(wxColour(255, 255, 255)) , + m_color_yellow(wxColour(255, 255, 0)) , + m_color_red(wxColour(255, 0, 0)) , + m_log(p_log), + m_tty(p_tty), + newLog(false), + inited(false) { + m_log->Bind(EVT_LOG_COMMAND, [this](wxCommandEvent &evt){this->write(evt);}); } - void _push(const LogPacket& data) + wxWriter(wxWriter &other) = delete; + + //read messages from buffer and write them to the screen + void write(wxCommandEvent &) { - const u32 sprefix = data.m_prefix.length(); - const u32 stext = data.m_text.length(); - const u32 scolour = data.m_colour.length(); - - m_buffer.resize(m_buffer.size() + - sizeof(u32) + sprefix + - sizeof(u32) + stext + - sizeof(u32) + scolour); - - u32 c_put = m_put; - - memcpy(&m_buffer[c_put], &sprefix, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_prefix.c_str(), sprefix); - c_put += sprefix; - - memcpy(&m_buffer[c_put], &stext, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_text.c_str(), stext); - c_put += stext; - - memcpy(&m_buffer[c_put], &scolour, sizeof(u32)); - c_put += sizeof(u32); - memcpy(&m_buffer[c_put], data.m_colour.c_str(), scolour); - c_put += scolour; - - m_put = c_put; - CheckBusy(); - } - - LogPacket _pop() - { - u32 c_get = m_get; - - const u32& sprefix = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string prefix((const char*)&m_buffer[c_get], sprefix); - c_get += sprefix; - - const u32& stext = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string text((const char*)&m_buffer[c_get], stext); - c_get += stext; - - const u32& scolour = *(u32*)&m_buffer[c_get]; - c_get += sizeof(u32); - const std::string colour((const char*)&m_buffer[c_get], scolour); - c_get += scolour; - - m_get = c_get; - if (!HasNewPacket()) Flush(); - - return LogPacket(prefix, text, colour); - } -}; - -_LogBuffer LogBuffer; - -LogWriter::LogWriter() -{ - if (!m_logfile.Open(_PRGNAME_ ".log", rFile::write)) - { - rMessageBox("Can't create log file! (" _PRGNAME_ ".log)", rMessageBoxCaptionStr, rICON_ERROR); - } -} - -void LogWriter::WriteToLog(const std::string& prefix, const std::string& value, u8 lvl/*, wxColour bgcolour*/) -{ - std::string new_prefix = prefix; - if (!prefix.empty()) - { - if (NamedThreadBase* thr = GetCurrentNamedThread()) + if (messages.size() > 0) { - new_prefix += " : " + thr->GetThreadName(); - } - } + messages.lockGet(); + size_t size = messages.size(); + std::vector local_messages(size); + messages.popN(&local_messages.front(), size); + messages.unlockGet(); - if (m_logfile.IsOpened() && !new_prefix.empty()) - m_logfile.Write("[" + new_prefix + "]: " + value + "\n"); - - if (!ConLogFrame || Ini.HLELogLvl.GetValue() == 4 || (lvl != 0 && lvl <= Ini.HLELogLvl.GetValue())) - return; - - std::lock_guard lock(g_cs_conlog); - - // TODO: Use ThreadBase instead, track main thread id - if (rThread::IsMain()) - { - while (LogBuffer.IsBusy()) - { - // need extra break condition? - rYieldIfNeeded(); - } - } - else - { - while (LogBuffer.IsBusy()) - { - if (Emu.IsStopped()) + u32 cursor = 0; + u32 removed = 0; + while (cursor < local_messages.size()) { - break; + Log::LogMessage msg = Log::LogMessage::deserialize(local_messages.data() + cursor, &removed); + cursor += removed; + if (removed <= 0) + { + break; + } + wxTextCtrl *llogcon = (msg.mType == Log::TTY) ? m_tty : m_log; + if (llogcon) + { + switch (msg.mServerity) + { + case Log::Notice: + llogcon->SetDefaultStyle(m_color_white); + break; + case Log::Warning: + llogcon->SetDefaultStyle(m_color_yellow); + break; + case Log::Error: + llogcon->SetDefaultStyle(m_color_red); + break; + default: + break; + } + llogcon->AppendText(wxString(msg.mText)); + } + } + if (m_log->GetLastPosition() > GUI_BUFFER_MAX_SIZE) + { + m_log->Remove(0, m_log->GetLastPosition() - (GUI_BUFFER_MAX_SIZE/2)); } - Sleep(1); } + newLog = false; } - //if(LogBuffer.put == LogBuffer.get) LogBuffer.Flush(); + //put message into the log buffer + void log(Log::LogMessage msg) + { + u8 logLevel = Ini.HLELogLvl.GetValue(); + if (msg.mType != Log::TTY && logLevel != 0) + { + if (logLevel > static_cast(msg.mServerity)) + { + return; + } + } - LogBuffer.Push(LogPacket(new_prefix, value, g_log_colors[lvl])); -} - - -void LogWriter::SkipLn() -{ - WriteToLog("", "", 0); -} - -LogFrame* ConLogFrame; + size_t size = msg.size(); + std::vector temp_buffer(size); + msg.serialize(temp_buffer.data()); + messages.pushRange(temp_buffer.begin(), temp_buffer.end()); + if (!newLog.load(std::memory_order_relaxed)) + { + newLog = true; + m_log->GetEventHandler()->QueueEvent(new wxCommandEvent(EVT_LOG_COMMAND)); + } + } +}; BEGIN_EVENT_TABLE(LogFrame, wxPanel) EVT_CLOSE(LogFrame::OnQuit) @@ -178,79 +128,52 @@ END_EVENT_TABLE() LogFrame::LogFrame(wxWindow* parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(600, 500)) -, ThreadBase("LogThread") -, m_log(*new wxListView(this)) +, m_tabs(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS) +, m_log(new wxTextCtrl(&m_tabs, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2)) +, m_tty(new wxTextCtrl(&m_tabs, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY | wxTE_RICH2)) { - m_log.InsertColumn(0, "Thread"); - m_log.InsertColumn(1, "Log"); - m_log.SetBackgroundColour(wxColour("Black")); + listener.reset(new wxWriter(m_log,m_tty)); + m_tty->SetBackgroundColour(wxColour("Black")); + m_log->SetBackgroundColour(wxColour("Black")); + m_tty->SetFont(wxFont(8, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); + m_tabs.AddPage(m_log, "Log"); + m_tabs.AddPage(m_tty, "TTY"); + + Log::LogManager::getInstance().getChannel(Log::GENERAL).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::LOADER).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::MEMORY).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::RSX).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::HLE).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::PPU).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::SPU).addListener(listener); + Log::LogManager::getInstance().getChannel(Log::TTY).addListener(listener); wxBoxSizer* s_main = new wxBoxSizer(wxVERTICAL); - s_main->Add(&m_log, 1, wxEXPAND); + s_main->Add(&m_tabs, 1, wxEXPAND); SetSizer(s_main); Layout(); Show(); - ThreadBase::Start(); } LogFrame::~LogFrame() { + Log::LogManager::getInstance().getChannel(Log::GENERAL).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::LOADER).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::MEMORY).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::RSX).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::HLE).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::PPU).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::SPU).removeListener(listener); + Log::LogManager::getInstance().getChannel(Log::TTY).removeListener(listener); } bool LogFrame::Close(bool force) { - Stop(false); - ConLogFrame = nullptr; return wxWindowBase::Close(force); } -void LogFrame::Task() -{ - while (!TestDestroy()) - { - if (!LogBuffer.HasNewPacket()) - { - Sleep(1); - continue; - } - else - { - wxThread::Yield(); - } - - const LogPacket item = LogBuffer.Pop(); - - wxListView& m_log = this->m_log; //makes m_log capturable by the lambda - //queue adding the log message to the gui element in the main thread - wxTheApp->GetTopWindow()->GetEventHandler()->CallAfter([item, &m_log]() - { - while (m_log.GetItemCount() > max_item_count) - { - m_log.DeleteItem(0); - wxThread::Yield(); - } - - const int cur_item = m_log.GetItemCount(); - - m_log.InsertItem(cur_item, fmt::FromUTF8(item.m_prefix)); - m_log.SetItem(cur_item, 1, fmt::FromUTF8(item.m_text)); - m_log.SetItemTextColour(cur_item, fmt::FromUTF8(item.m_colour)); - m_log.SetColumnWidth(0, -1); - m_log.SetColumnWidth(1, -1); - }); - -#ifdef _WIN32 - ::SendMessage((HWND)m_log.GetHWND(), WM_VSCROLL, SB_BOTTOM, 0); -#endif - } - - LogBuffer.Flush(); -} - void LogFrame::OnQuit(wxCloseEvent& event) { - Stop(false); - ConLogFrame = nullptr; event.Skip(); } \ No newline at end of file diff --git a/rpcs3/Gui/ConLogFrame.h b/rpcs3/Gui/ConLogFrame.h index 2919a5cbae..df5e4d25ff 100644 --- a/rpcs3/Gui/ConLogFrame.h +++ b/rpcs3/Gui/ConLogFrame.h @@ -1,25 +1,26 @@ #pragma once -#include "Emu/ConLog.h" +#include "Utilities/Log.h" class LogFrame : public wxPanel - , public ThreadBase { - wxListView& m_log; + std::shared_ptr listener; + wxAuiNotebook m_tabs; + wxTextCtrl *m_log; + wxTextCtrl *m_tty; public: LogFrame(wxWindow* parent); + LogFrame(LogFrame &other) = delete; ~LogFrame(); bool Close(bool force = false); private: - virtual void Task(); + virtual void Task(){}; void OnQuit(wxCloseEvent& event); DECLARE_EVENT_TABLE(); -}; - -extern LogFrame* ConLogFrame; \ No newline at end of file +}; \ No newline at end of file diff --git a/rpcs3/Gui/Debugger.cpp b/rpcs3/Gui/Debugger.cpp index 8f85cf4311..904ba7ad45 100644 --- a/rpcs3/Gui/Debugger.cpp +++ b/rpcs3/Gui/Debugger.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3.h" diff --git a/rpcs3/Gui/DisAsmFrame.cpp b/rpcs3/Gui/DisAsmFrame.cpp index 993fa74091..5dca67bbd8 100644 --- a/rpcs3/Gui/DisAsmFrame.cpp +++ b/rpcs3/Gui/DisAsmFrame.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/lv2/SC_Lwmutex.h" @@ -152,7 +152,7 @@ public: virtual void Task() { - ConLog.Write("Start dump in thread %d!", (int)id); + LOGF_NOTICE(HLE, "Start dump in thread %d!", (int)id); const u32 max_value = prog_dial->GetMaxValue(id); const u32 shdr_count = ElfType64 ? shdr_arr_64->size() : shdr_arr_32->size(); @@ -180,14 +180,14 @@ public: } } - ConLog.Write("Finish dump in thread %d!", (int)id); + LOGF_NOTICE(HLE, "Finish dump in thread %d!", (int)id); *done = true; } void OnExit() { - ConLog.Write("CleanUp dump thread (%d)!", (int)id); + LOGF_NOTICE(HLE, "CleanUp dump thread (%d)!", (int)id); safe_delete(decoder); } }; @@ -223,7 +223,7 @@ struct WaitDumperThread : public ThreadBase while(done[i] == false) Sleep(1); } - ConLog.Write("Saving dump is started!"); + LOGF_NOTICE(HLE, "Saving dump is started!"); const uint length_for_core = prog_dial.GetMaxValue(0); const uint length = length_for_core * cores; prog_dial.Close(); @@ -266,7 +266,7 @@ struct WaitDumperThread : public ThreadBase fd.Write(wxString::Format("End of section header %d\n\n", sh)); } - ConLog.Write("CleanUp dump saving!"); + LOGF_NOTICE(HLE, "CleanUp dump saving!"); for(uint c=0; c name_arr; @@ -338,7 +338,7 @@ void DisAsmFrame::Dump(wxCommandEvent& WXUNUSED(event)) if(l_elf32->shdr_arr.size() <= 0) return; break; - default: ConLog.Error("Corrupted ELF!"); return; + default: LOGF_ERROR(HLE, "Corrupted ELF!"); return; } PPCDisAsm* disasm; diff --git a/rpcs3/Gui/FnIdGenerator.cpp b/rpcs3/Gui/FnIdGenerator.cpp index 927f178eaf..810315f0cd 100644 --- a/rpcs3/Gui/FnIdGenerator.cpp +++ b/rpcs3/Gui/FnIdGenerator.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "FnIdGenerator.h" @@ -82,7 +82,7 @@ void FnIdGenerator::PrintId() m_func_name.push_back(func_name); m_func_id.push_back(result); - ConLog.Write("Function: %s, Id: 0x%08x ", func_name.c_str(), result); + LOGF_NOTICE(HLE, "Function: %s, Id: 0x%08x ", func_name.c_str(), result); UpdateInformation(); } @@ -99,4 +99,4 @@ void FnIdGenerator::UpdateInformation() m_list->SetItem(i, 0, m_func_name[i]); m_list->SetItem(i, 1, wxString::Format("0x%08x", re(m_func_id[i]))); } -} \ No newline at end of file +} diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index 0f9732b912..8be1f47ba6 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/FS/vfsDir.h" @@ -39,7 +39,7 @@ public: virtual wxDirTraverseResult OnFile(const wxString& filename) { if (!wxRemoveFile(filename)){ - ConLog.Error("Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); + LOGF_ERROR(HLE, "Couldn't delete File: %s", fmt::ToUTF8(filename).c_str()); } return wxDIR_CONTINUE; } @@ -103,7 +103,7 @@ void GameViewer::OnColClick(wxListEvent& event) void GameViewer::LoadGames() { vfsDir dir(m_path); - ConLog.Write("path: %s", m_path.c_str()); + LOGF_NOTICE(HLE, "path: %s", m_path.c_str()); if(!dir.IsOpened()) return; m_games.clear(); @@ -207,7 +207,7 @@ void GameViewer::DClick(wxListEvent& event) std::string local_path; if(Emu.GetVFS().GetDevice(path, local_path) && !Emu.BootGame(local_path)) { - ConLog.Error("Boot error: elf not found! [%s]", path.c_str()); + LOGF_ERROR(HLE, "Boot error: elf not found! [%s]", path.c_str()); return; } Emu.Run(); diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index 99ecd8fe95..8a240243d2 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -134,7 +134,7 @@ public: if(!col) { - ConLog.Error("Columns loaded with error!"); + LOGF_ERROR(HLE, "Columns loaded with error!"); return; } @@ -191,7 +191,7 @@ public: { if(m_columns[c1].pos == m_columns[c2].pos) { - ConLog.Error("Columns loaded with error!"); + LOGF_ERROR(HLE, "Columns loaded with error!"); Init(); return; } @@ -210,7 +210,7 @@ public: if(!ishas) { - ConLog.Error("Columns loaded with error!"); + LOGF_ERROR(HLE, "Columns loaded with error!"); Init(); return; } diff --git a/rpcs3/Gui/InterpreterDisAsm.cpp b/rpcs3/Gui/InterpreterDisAsm.cpp index 75d1016bc7..170fe8a915 100644 --- a/rpcs3/Gui/InterpreterDisAsm.cpp +++ b/rpcs3/Gui/InterpreterDisAsm.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3.h" diff --git a/rpcs3/Gui/MainFrame.cpp b/rpcs3/Gui/MainFrame.cpp index 65f026e024..0da12e6462 100644 --- a/rpcs3/Gui/MainFrame.cpp +++ b/rpcs3/Gui/MainFrame.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Gui/ConLogFrame.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" @@ -109,10 +109,10 @@ MainFrame::MainFrame() // Panels m_game_viewer = new GameViewer(this); m_debugger_frame = new DebuggerPanel(this); - ConLogFrame = new LogFrame(this); + m_log_frame = new LogFrame(this); AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE); - AddPane(ConLogFrame, "Log", wxAUI_DOCK_BOTTOM); + AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM); AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT); // Events @@ -192,7 +192,7 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event)) if(Emu.BootGame(ctrl.GetPath().ToStdString())) { - ConLog.Success("Game: boot done."); + LOG_SUCCESS(HLE, "Game: boot done."); if (Ini.HLEAlwaysStart.GetValue() && Emu.IsReady()) { @@ -201,7 +201,7 @@ void MainFrame::BootGame(wxCommandEvent& WXUNUSED(event)) } else { - ConLog.Error("PS3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); + LOGF_ERROR(HLE, "PS3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); } } @@ -227,11 +227,11 @@ void MainFrame::BootGameAndRun(wxCommandEvent& WXUNUSED(event)) if (Emu.BootGame(ctrl.GetPath().ToStdString())) { - ConLog.Success("Game: boot done."); + LOG_SUCCESS(HLE, "Game: boot done."); } else { - ConLog.Error("PS3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); + LOGF_ERROR(HLE, "PS3 executable not found in selected folder (%s)", ctrl.GetPath().wx_str()); } if (Emu.IsReady()) @@ -300,14 +300,14 @@ void MainFrame::BootElf(wxCommandEvent& WXUNUSED(event)) return; } - ConLog.Write("(S)ELF: booting..."); + LOG_NOTICE(HLE, "(S)ELF: booting..."); Emu.Stop(); Emu.SetPath(fmt::ToUTF8(ctrl.GetPath())); Emu.Load(); - ConLog.Success("(S)ELF: boot done."); + LOG_SUCCESS(HLE, "(S)ELF: boot done."); } void MainFrame::Pause(wxCommandEvent& WXUNUSED(event)) diff --git a/rpcs3/Gui/MainFrame.h b/rpcs3/Gui/MainFrame.h index a7b0341de1..932087fe30 100644 --- a/rpcs3/Gui/MainFrame.h +++ b/rpcs3/Gui/MainFrame.h @@ -10,6 +10,7 @@ class MainFrame : public FrameBase { DebuggerPanel* m_debugger_frame; GameViewer* m_game_viewer; + LogFrame * m_log_frame; wxAuiManager m_aui_mgr; bool m_sys_menu_opened; diff --git a/rpcs3/Gui/MemoryViewer.cpp b/rpcs3/Gui/MemoryViewer.cpp index 407f9b7407..fad7023fa6 100644 --- a/rpcs3/Gui/MemoryViewer.cpp +++ b/rpcs3/Gui/MemoryViewer.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "MemoryViewer.h" diff --git a/rpcs3/Gui/PADManager.cpp b/rpcs3/Gui/PADManager.cpp index 925400aa04..d36cc70535 100644 --- a/rpcs3/Gui/PADManager.cpp +++ b/rpcs3/Gui/PADManager.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3.h" @@ -289,7 +289,7 @@ void PADManager::OnKeyDown(wxKeyEvent &keyEvent) case id_pad_rstick_up: Ini.PadHandlerRStickUp.SetValue(keyEvent.GetKeyCode()); break; case 0: break; - default: ConLog.Error("Unknown button ID: %d", m_button_id); break; + default: LOGF_ERROR(HLE, "Unknown button ID: %d", m_button_id); break; } UpdateLabel(); @@ -323,7 +323,7 @@ void PADManager::OnButtonClicked(wxCommandEvent &event) case wxID_OK: Ini.Save(); break; case wxID_CANCEL: break; - default: ConLog.Error("Unknown button ID: %d", event.GetId()); break; + default: LOGF_ERROR(HLE, "Unknown button ID: %d", event.GetId()); break; } } @@ -336,7 +336,7 @@ const wxString PADManager::GetKeyName(const u32 keyCode) switch(keyCode) { - case WXK_NONE: ConLog.Error("Invalid key code"); keyName = "ERROR!"; break; + case WXK_NONE: LOG_ERROR(HLE, "Invalid key code"); keyName = "ERROR!"; break; case WXK_BACK: keyName = "BackSpace"; break; case WXK_TAB: keyName = "Tab"; break; case WXK_RETURN: keyName = "Enter"; break; @@ -509,7 +509,7 @@ void PADManager::UpdateTimerLabel(const u32 id) case id_pad_rstick_right: b_right_rstick->SetLabel(static_cast(m_seconds + 47)); break; case id_pad_rstick_up: b_up_rstick->SetLabel(static_cast(m_seconds + 47)); break; - default: ConLog.Error("Unknown button ID: %d", id); break; + default: LOGF_ERROR(HLE, "Unknown button ID: %d", id); break; } } diff --git a/rpcs3/Gui/Plugins.h b/rpcs3/Gui/Plugins.h index b527a5c139..c6900c2d67 100644 --- a/rpcs3/Gui/Plugins.h +++ b/rpcs3/Gui/Plugins.h @@ -314,7 +314,7 @@ struct PluginsManager for(u32 i=0; i @@ -33,7 +33,7 @@ wxDragResult VHDDListDropTarget::OnData(wxCoord x, wxCoord y, wxDragResult def) { int flags = 0; int dst_indx = m_parent->HitTest(wxPoint(x, y), flags); - ConLog.Write("OnData(%d -> %d)", m_src_indx, dst_indx); + LOGF_NOTICE(HLE, "OnData(%d -> %d)", m_src_indx, dst_indx); return def; } @@ -189,7 +189,7 @@ void VHDDExplorer::OnDropFiles(wxDropFilesEvent& event) for(int i=0; i= entry && entry < phdr_arr[i].p_paddr + phdr_arr[i].p_memsz) { entry += phdr_arr[i].p_vaddr; - ConLog.Warning("virtual entry = 0x%x", entry); + LOGF_WARNING(LOADER, "virtual entry = 0x%x", entry); break; } } @@ -173,7 +173,7 @@ bool ELF32Loader::LoadShdrInfo() if(ehdr.e_shstrndx >= shdr_arr.size()) { - ConLog.Warning("LoadShdr32 error: shstrndx too big!"); + LOG_WARNING(LOADER, "LoadShdr32 error: shstrndx too big!"); return true; } @@ -197,9 +197,9 @@ bool ELF32Loader::LoadShdrInfo() bool ELF32Loader::LoadEhdrData(u64 offset) { #ifdef LOADER_DEBUG - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); ehdr.Show(); - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); #endif return true; } @@ -226,8 +226,9 @@ bool ELF32Loader::LoadPhdrData(u64 _offset) if(phdr_arr[i].p_vaddr != phdr_arr[i].p_paddr) { - ConLog.Warning - ( + LOGF_WARNING + ( + LOADER, "LoadPhdr32 different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x", phdr_arr[i].p_paddr, phdr_arr[i].p_vaddr ); @@ -255,41 +256,41 @@ bool ELF32Loader::LoadPhdrData(u64 _offset) if(note.type != 1) { - ConLog.Error("ELF32: Bad NOTE type (%d)", note.type); + LOGF_ERROR(LOADER, "ELF32: Bad NOTE type (%d)", note.type); break; } if(note.namesz != sizeof(note.name)) { - ConLog.Error("ELF32: Bad NOTE namesz (%d)", note.namesz); + LOGF_ERROR(LOADER, "ELF32: Bad NOTE namesz (%d)", note.namesz); break; } if(note.descsz != sizeof(note.desc) && note.descsz != 32) { - ConLog.Error("ELF32: Bad NOTE descsz (%d)", note.descsz); + LOGF_ERROR(LOADER, "ELF32: Bad NOTE descsz (%d)", note.descsz); break; } //if(note.desc.flags) //{ - // ConLog.Error("ELF32: Bad NOTE flags (0x%x)", note.desc.flags); + // LOG_ERROR(LOADER, "ELF32: Bad NOTE flags (0x%x)", note.desc.flags); // break; //} if(note.descsz == sizeof(note.desc)) { - ConLog.Warning("name = %s", std::string((const char *)note.name, 8).c_str()); - ConLog.Warning("ls_size = %d", note.desc.ls_size); - ConLog.Warning("stack_size = %d", note.desc.stack_size); + LOGF_WARNING(LOADER, "name = %s", std::string((const char *)note.name, 8).c_str()); + LOGF_WARNING(LOADER, "ls_size = %d", note.desc.ls_size); + LOGF_WARNING(LOADER, "stack_size = %d", note.desc.stack_size); } else { - ConLog.Warning("desc = '%s'", std::string(note.desc_text, 32).c_str()); + LOGF_WARNING(LOADER, "desc = '%s'", std::string(note.desc_text, 32).c_str()); } } #ifdef LOADER_DEBUG - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); #endif } @@ -303,13 +304,13 @@ bool ELF32Loader::LoadShdrData(u64 offset) Elf32_Shdr& shdr = shdr_arr[i]; #ifdef LOADER_DEBUG - if(i < shdr_name_arr.size()) ConLog.Write("Name: %s", shdr_name_arr[i].c_str()); + if(i < shdr_name_arr.size()) LOGF_NOTICE(LOADER, "Name: %s", shdr_name_arr[i].c_str()); shdr.Show(); - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); #endif if((shdr.sh_type == SHT_RELA) || (shdr.sh_type == SHT_REL)) { - ConLog.Error("ELF32 ERROR: Relocation"); + LOG_ERROR(LOADER, "ELF32 ERROR: Relocation"); continue; } if((shdr.sh_flags & SHF_ALLOC) != SHF_ALLOC) continue; diff --git a/rpcs3/Loader/ELF32.h b/rpcs3/Loader/ELF32.h index c69d467585..3ebe601061 100644 --- a/rpcs3/Loader/ELF32.h +++ b/rpcs3/Loader/ELF32.h @@ -26,25 +26,25 @@ struct Elf32_Ehdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Magic: %08x", e_magic); - ConLog.Write("Class: %s", "ELF32"); - ConLog.Write("Data: %s", Ehdr_DataToString(e_data).c_str()); - ConLog.Write("Current Version: %d", e_curver); - ConLog.Write("OS/ABI: %s", Ehdr_OS_ABIToString(e_os_abi).c_str()); - ConLog.Write("ABI version: %lld", e_abi_ver); - ConLog.Write("Type: %s", Ehdr_TypeToString(e_type).c_str()); - ConLog.Write("Machine: %s", Ehdr_MachineToString(e_machine).c_str()); - ConLog.Write("Version: %d", e_version); - ConLog.Write("Entry point address: 0x%x", e_entry); - ConLog.Write("Program headers offset: 0x%08x", e_phoff); - ConLog.Write("Section headers offset: 0x%08x", e_shoff); - ConLog.Write("Flags: 0x%x", e_flags); - ConLog.Write("Size of this header: %d", e_ehsize); - ConLog.Write("Size of program headers: %d", e_phentsize); - ConLog.Write("Number of program headers: %d", e_phnum); - ConLog.Write("Size of section headers: %d", e_shentsize); - ConLog.Write("Number of section headers: %d", e_shnum); - ConLog.Write("Section header string table index: %d", e_shstrndx); + LOGF_NOTICE(LOADER, "Magic: %08x", e_magic); + LOGF_NOTICE(LOADER, "Class: %s", "ELF32"); + LOGF_NOTICE(LOADER, "Data: %s", Ehdr_DataToString(e_data).c_str()); + LOGF_NOTICE(LOADER, "Current Version: %d", e_curver); + LOGF_NOTICE(LOADER, "OS/ABI: %s", Ehdr_OS_ABIToString(e_os_abi).c_str()); + LOGF_NOTICE(LOADER, "ABI version: %lld", e_abi_ver); + LOGF_NOTICE(LOADER, "Type: %s", Ehdr_TypeToString(e_type).c_str()); + LOGF_NOTICE(LOADER, "Machine: %s", Ehdr_MachineToString(e_machine).c_str()); + LOGF_NOTICE(LOADER, "Version: %d", e_version); + LOGF_NOTICE(LOADER, "Entry point address: 0x%x", e_entry); + LOGF_NOTICE(LOADER, "Program headers offset: 0x%08x", e_phoff); + LOGF_NOTICE(LOADER, "Section headers offset: 0x%08x", e_shoff); + LOGF_NOTICE(LOADER, "Flags: 0x%x", e_flags); + LOGF_NOTICE(LOADER, "Size of this header: %d", e_ehsize); + LOGF_NOTICE(LOADER, "Size of program headers: %d", e_phentsize); + LOGF_NOTICE(LOADER, "Number of program headers: %d", e_phnum); + LOGF_NOTICE(LOADER, "Size of section headers: %d", e_shentsize); + LOGF_NOTICE(LOADER, "Number of section headers: %d", e_shnum); + LOGF_NOTICE(LOADER, "Section header string table index: %d", e_shstrndx); #endif } @@ -216,16 +216,16 @@ struct Elf32_Shdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Name offset: %x", sh_name); - ConLog.Write("Type: %d", sh_type); - ConLog.Write("Addr: %x", sh_addr); - ConLog.Write("Offset: %x", sh_offset); - ConLog.Write("Size: %x", sh_size); - ConLog.Write("EntSize: %d", sh_entsize); - ConLog.Write("Flags: %x", sh_flags); - ConLog.Write("Link: %x", sh_link); - ConLog.Write("Info: %d", sh_info); - ConLog.Write("Address align: %x", sh_addralign); + LOGF_NOTICE(LOADER, "Name offset: %x", sh_name); + LOGF_NOTICE(LOADER, "Type: %d", sh_type); + LOGF_NOTICE(LOADER, "Addr: %x", sh_addr); + LOGF_NOTICE(LOADER, "Offset: %x", sh_offset); + LOGF_NOTICE(LOADER, "Size: %x", sh_size); + LOGF_NOTICE(LOADER, "EntSize: %d", sh_entsize); + LOGF_NOTICE(LOADER, "Flags: %x", sh_flags); + LOGF_NOTICE(LOADER, "Link: %x", sh_link); + LOGF_NOTICE(LOADER, "Info: %d", sh_info); + LOGF_NOTICE(LOADER, "Address align: %x", sh_addralign); #endif } }; @@ -268,14 +268,14 @@ struct Elf32_Phdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Type: %s", Phdr_TypeToString(p_type).c_str()); - ConLog.Write("Offset: 0x%08x", p_offset); - ConLog.Write("Virtual address: 0x%08x", p_vaddr); - ConLog.Write("Physical address: 0x%08x", p_paddr); - ConLog.Write("File size: 0x%08x", p_filesz); - ConLog.Write("Memory size: 0x%08x", p_memsz); - ConLog.Write("Flags: %s", Phdr_FlagsToString(p_flags).c_str()); - ConLog.Write("Align: 0x%x", p_align); + LOGF_NOTICE(LOADER, "Type: %s", Phdr_TypeToString(p_type).c_str()); + LOGF_NOTICE(LOADER, "Offset: 0x%08x", p_offset); + LOGF_NOTICE(LOADER, "Virtual address: 0x%08x", p_vaddr); + LOGF_NOTICE(LOADER, "Physical address: 0x%08x", p_paddr); + LOGF_NOTICE(LOADER, "File size: 0x%08x", p_filesz); + LOGF_NOTICE(LOADER, "Memory size: 0x%08x", p_memsz); + LOGF_NOTICE(LOADER, "Flags: %s", Phdr_FlagsToString(p_flags).c_str()); + LOGF_NOTICE(LOADER, "Align: 0x%x", p_align); #endif } }; diff --git a/rpcs3/Loader/ELF64.cpp b/rpcs3/Loader/ELF64.cpp index 63e9852770..818ad13306 100644 --- a/rpcs3/Loader/ELF64.cpp +++ b/rpcs3/Loader/ELF64.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/Cell/PPUThread.h" @@ -104,13 +104,13 @@ bool ELF64Loader::LoadEhdrInfo(s64 offset) if(ehdr.e_phentsize != sizeof(Elf64_Phdr)) { - ConLog.Error("elf64 error: e_phentsize[0x%x] != sizeof(Elf64_Phdr)[0x%x]", ehdr.e_phentsize, sizeof(Elf64_Phdr)); + LOGF_ERROR(LOADER, "elf64 error: e_phentsize[0x%x] != sizeof(Elf64_Phdr)[0x%x]", ehdr.e_phentsize, sizeof(Elf64_Phdr)); return false; } if(ehdr.e_shentsize != sizeof(Elf64_Shdr)) { - ConLog.Error("elf64 error: e_shentsize[0x%x] != sizeof(Elf64_Shdr)[0x%x]", ehdr.e_shentsize, sizeof(Elf64_Shdr)); + LOGF_ERROR(LOADER, "elf64 error: e_shentsize[0x%x] != sizeof(Elf64_Shdr)[0x%x]", ehdr.e_shentsize, sizeof(Elf64_Shdr)); return false; } @@ -123,14 +123,14 @@ bool ELF64Loader::LoadEhdrInfo(s64 offset) default: machine = MACHINE_Unknown; - ConLog.Error("Unknown elf64 type: 0x%x", ehdr.e_machine); + LOGF_ERROR(LOADER, "Unknown elf64 type: 0x%x", ehdr.e_machine); return false; } entry = ehdr.GetEntry(); if(entry == 0) { - ConLog.Error("elf64 error: entry is null!"); + LOG_ERROR(LOADER, "elf64 error: entry is null!"); return false; } @@ -143,7 +143,7 @@ bool ELF64Loader::LoadPhdrInfo(s64 offset) if(ehdr.e_phoff == 0 && ehdr.e_phnum) { - ConLog.Error("LoadPhdr64 error: Program header offset is null!"); + LOG_ERROR(LOADER, "LoadPhdr64 error: Program header offset is null!"); return false; } @@ -164,7 +164,7 @@ bool ELF64Loader::LoadShdrInfo(s64 offset) shdr_name_arr.clear(); if(ehdr.e_shoff == 0 && ehdr.e_shnum) { - ConLog.Warning("LoadShdr64 error: Section header offset is null!"); + LOG_NOTICE(LOADER, "LoadShdr64 error: Section header offset is null!"); return true; } @@ -177,7 +177,7 @@ bool ELF64Loader::LoadShdrInfo(s64 offset) if(ehdr.e_shstrndx >= shdr_arr.size()) { - ConLog.Warning("LoadShdr64 error: shstrndx too big!"); + LOG_WARNING(LOADER, "LoadShdr64 error: shstrndx too big!"); return true; } @@ -201,9 +201,9 @@ bool ELF64Loader::LoadShdrInfo(s64 offset) bool ELF64Loader::LoadEhdrData(u64 offset) { #ifdef LOADER_DEBUG - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); ehdr.Show(); - ConLog.SkipLn(); + LOG_NOTICE(LOADER, ""); #endif return true; } @@ -226,8 +226,9 @@ bool ELF64Loader::LoadPhdrData(u64 offset) if(phdr_arr[i].p_vaddr != phdr_arr[i].p_paddr) { - ConLog.Warning - ( + LOGF_WARNING + ( + LOADER, "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x", phdr_arr[i].p_paddr, phdr_arr[i].p_vaddr ); @@ -236,8 +237,8 @@ bool ELF64Loader::LoadPhdrData(u64 offset) if(!Memory.MainMem.IsInMyRange(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_memsz)) { #ifdef LOADER_DEBUG - ConLog.Warning("Skipping..."); - ConLog.SkipLn(); + LOG_WARNING(LOADER, "Skipping..."); + LOG_WARNING(LOADER, ""); #endif continue; } @@ -270,12 +271,12 @@ bool ELF64Loader::LoadPhdrData(u64 offset) if(re(proc_param.size) < sizeof(sys_process_param)) { - ConLog.Warning("Bad proc param size! [0x%x : 0x%x]", re(proc_param.size), sizeof(sys_process_param)); + LOGF_WARNING(LOADER, "Bad proc param size! [0x%x : 0x%x]", re(proc_param.size), sizeof(sys_process_param)); } if(re(proc_param.magic) != 0x13bcc5f6) { - ConLog.Error("Bad magic! [0x%x]", Memory.Reverse32(proc_param.magic)); + LOGF_ERROR(LOADER, "Bad magic! [0x%x]", Memory.Reverse32(proc_param.magic)); } else { @@ -287,12 +288,12 @@ bool ELF64Loader::LoadPhdrData(u64 offset) info.ppc_seg = re(proc_param.info.ppc_seg); //info.crash_dump_param_addr = re(proc_param.info.crash_dump_param_addr); #ifdef LOADER_DEBUG - ConLog.Write("*** sdk version: 0x%x", info.sdk_version); - ConLog.Write("*** primary prio: %d", info.primary_prio); - ConLog.Write("*** primary stacksize: 0x%x", info.primary_stacksize); - ConLog.Write("*** malloc pagesize: 0x%x", info.malloc_pagesize); - ConLog.Write("*** ppc seg: 0x%x", info.ppc_seg); - //ConLog.Write("*** crash dump param addr: 0x%x", info.crash_dump_param_addr); + LOGF_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version); + LOGF_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio); + LOGF_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize); + LOGF_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize); + LOGF_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg); + //LOGF_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr); #endif } } @@ -314,19 +315,19 @@ bool ELF64Loader::LoadPhdrData(u64 offset) proc_prx_param.ver = re(proc_prx_param.ver); #ifdef LOADER_DEBUG - ConLog.Write("*** size: 0x%x", proc_prx_param.size); - ConLog.Write("*** magic: 0x%x", proc_prx_param.magic); - ConLog.Write("*** version: 0x%x", proc_prx_param.version); - ConLog.Write("*** libentstart: 0x%x", proc_prx_param.libentstart); - ConLog.Write("*** libentend: 0x%x", proc_prx_param.libentend); - ConLog.Write("*** libstubstart: 0x%x", proc_prx_param.libstubstart); - ConLog.Write("*** libstubend: 0x%x", proc_prx_param.libstubend); - ConLog.Write("*** ver: 0x%x", proc_prx_param.ver); + LOGF_NOTICE(LOADER, "*** size: 0x%x", proc_prx_param.size); + LOGF_NOTICE(LOADER, "*** magic: 0x%x", proc_prx_param.magic); + LOGF_NOTICE(LOADER, "*** version: 0x%x", proc_prx_param.version); + LOGF_NOTICE(LOADER, "*** libentstart: 0x%x", proc_prx_param.libentstart); + LOGF_NOTICE(LOADER, "*** libentend: 0x%x", proc_prx_param.libentend); + LOGF_NOTICE(LOADER, "*** libstubstart: 0x%x", proc_prx_param.libstubstart); + LOGF_NOTICE(LOADER, "*** libstubend: 0x%x", proc_prx_param.libstubend); + LOGF_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver); #endif if(proc_prx_param.magic != 0x1b434cec) { - ConLog.Error("Bad magic! (0x%x)", proc_prx_param.magic); + LOGF_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic); } else { @@ -351,19 +352,19 @@ bool ELF64Loader::LoadPhdrData(u64 offset) } else { - ConLog.Warning("Unknown module '%s'", module_name.c_str()); + LOGF_WARNING(LOADER, "Unknown module '%s'", module_name.c_str()); } #ifdef LOADER_DEBUG - ConLog.SkipLn(); - ConLog.Write("*** size: 0x%x", stub.s_size); - ConLog.Write("*** version: 0x%x", stub.s_version); - ConLog.Write("*** unk0: 0x%x", stub.s_unk0); - ConLog.Write("*** unk1: 0x%x", stub.s_unk1); - ConLog.Write("*** imports: %d", stub.s_imports); - ConLog.Write("*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename); - ConLog.Write("*** nid: 0x%x", stub.s_nid); - ConLog.Write("*** text: 0x%x", stub.s_text); + LOG_NOTICE(LOADER, ""); + LOGF_NOTICE(LOADER, "*** size: 0x%x", stub.s_size); + LOGF_NOTICE(LOADER, "*** version: 0x%x", stub.s_version); + LOGF_NOTICE(LOADER, "*** unk0: 0x%x", stub.s_unk0); + LOGF_NOTICE(LOADER, "*** unk1: 0x%x", stub.s_unk1); + LOGF_NOTICE(LOADER, "*** imports: %d", stub.s_imports); + LOGF_NOTICE(LOADER, "*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename); + LOGF_NOTICE(LOADER, "*** nid: 0x%x", stub.s_nid); + LOGF_NOTICE(LOADER, "*** text: 0x%x", stub.s_text); #endif static const u32 section = 4 * 3; u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2); @@ -378,13 +379,13 @@ bool ELF64Loader::LoadPhdrData(u64 offset) { if(!module->Load(nid)) { - ConLog.Warning("Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str()); + LOGF_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str()); } } #ifdef LOADER_DEBUG - ConLog.Write("import %d:", i+1); - ConLog.Write("*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4); - ConLog.Write("*** text: 0x%x (0x%x)", text, stub.s_text + i*4); + LOGF_NOTICE(LOADER, "import %d:", i+1); + LOGF_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4); + LOGF_NOTICE(LOADER, "*** text: 0x%x (0x%x)", text, stub.s_text + i*4); #endif Memory.Write32(stub.s_text + i*4, tbl + i*8); @@ -399,14 +400,14 @@ bool ELF64Loader::LoadPhdrData(u64 offset) } } #ifdef LOADER_DEBUG - ConLog.SkipLn(); + LOG_NOTICE(LOADER, " "); #endif } } break; } #ifdef LOADER_DEBUG - ConLog.SkipLn(); + LOGF_NOTICE(LOADER, " "); #endif } @@ -424,13 +425,13 @@ bool ELF64Loader::LoadShdrData(u64 offset) if(i < shdr_name_arr.size()) { #ifdef LOADER_DEBUG - ConLog.Write("Name: %s", shdr_name_arr[i].c_str()); + LOGF_NOTICE(LOADER, "Name: %s", shdr_name_arr[i].c_str()); #endif } #ifdef LOADER_DEBUG shdr.Show(); - ConLog.SkipLn(); + LOGF_NOTICE(LOADER, " "); #endif if(shdr.sh_addr + shdr.sh_size > max_addr) max_addr = shdr.sh_addr + shdr.sh_size; @@ -453,7 +454,7 @@ bool ELF64Loader::LoadShdrData(u64 offset) if((shdr.sh_type == SHT_RELA) || (shdr.sh_type == SHT_REL)) { - ConLog.Error("ELF64 ERROR: Relocation"); + LOG_ERROR(LOADER, "ELF64 ERROR: Relocation"); continue; } diff --git a/rpcs3/Loader/ELF64.h b/rpcs3/Loader/ELF64.h index 4a54a08232..68aa47bbf8 100644 --- a/rpcs3/Loader/ELF64.h +++ b/rpcs3/Loader/ELF64.h @@ -49,25 +49,25 @@ struct Elf64_Ehdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Magic: %08x", e_magic); - ConLog.Write("Class: %s", "ELF64"); - ConLog.Write("Data: %s", Ehdr_DataToString(e_data).c_str()); - ConLog.Write("Current Version: %d", e_curver); - ConLog.Write("OS/ABI: %s", Ehdr_OS_ABIToString(e_os_abi).c_str()); - ConLog.Write("ABI version: %lld", e_abi_ver); - ConLog.Write("Type: %s", Ehdr_TypeToString(e_type).c_str()); - ConLog.Write("Machine: %s", Ehdr_MachineToString(e_machine).c_str()); - ConLog.Write("Version: %d", e_version); - ConLog.Write("Entry point address: 0x%08llx", e_entry); - ConLog.Write("Program headers offset: 0x%08llx", e_phoff); - ConLog.Write("Section headers offset: 0x%08llx", e_shoff); - ConLog.Write("Flags: 0x%x", e_flags); - ConLog.Write("Size of this header: %d", e_ehsize); - ConLog.Write("Size of program headers: %d", e_phentsize); - ConLog.Write("Number of program headers: %d", e_phnum); - ConLog.Write("Size of section headers: %d", e_shentsize); - ConLog.Write("Number of section headers: %d", e_shnum); - ConLog.Write("Section header string table index: %d", e_shstrndx); + LOGF_NOTICE(LOADER, "Magic: %08x", e_magic); + LOGF_NOTICE(LOADER, "Class: %s", "ELF64"); + LOGF_NOTICE(LOADER, "Data: %s", Ehdr_DataToString(e_data).c_str()); + LOGF_NOTICE(LOADER, "Current Version: %d", e_curver); + LOGF_NOTICE(LOADER, "OS/ABI: %s", Ehdr_OS_ABIToString(e_os_abi).c_str()); + LOGF_NOTICE(LOADER, "ABI version: %lld", e_abi_ver); + LOGF_NOTICE(LOADER, "Type: %s", Ehdr_TypeToString(e_type).c_str()); + LOGF_NOTICE(LOADER, "Machine: %s", Ehdr_MachineToString(e_machine).c_str()); + LOGF_NOTICE(LOADER, "Version: %d", e_version); + LOGF_NOTICE(LOADER, "Entry point address: 0x%08llx", e_entry); + LOGF_NOTICE(LOADER, "Program headers offset: 0x%08llx", e_phoff); + LOGF_NOTICE(LOADER, "Section headers offset: 0x%08llx", e_shoff); + LOGF_NOTICE(LOADER, "Flags: 0x%x", e_flags); + LOGF_NOTICE(LOADER, "Size of this header: %d", e_ehsize); + LOGF_NOTICE(LOADER, "Size of program headers: %d", e_phentsize); + LOGF_NOTICE(LOADER, "Number of program headers: %d", e_phnum); + LOGF_NOTICE(LOADER, "Size of section headers: %d", e_shentsize); + LOGF_NOTICE(LOADER, "Number of section headers: %d", e_shnum); + LOGF_NOTICE(LOADER, "Section header string table index: %d", e_shstrndx); #endif } @@ -105,16 +105,16 @@ struct Elf64_Shdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Name offset: %x", sh_name); - ConLog.Write("Type: %d", sh_type); - ConLog.Write("Addr: %llx", sh_addr); - ConLog.Write("Offset: %llx", sh_offset); - ConLog.Write("Size: %llx", sh_size); - ConLog.Write("EntSize: %lld", sh_entsize); - ConLog.Write("Flags: %llx", sh_flags); - ConLog.Write("Link: %x", sh_link); - ConLog.Write("Info: %x", sh_info); - ConLog.Write("Address align: %llx", sh_addralign); + LOGF_NOTICE(LOADER, "Name offset: %x", sh_name); + LOGF_NOTICE(LOADER, "Type: %d", sh_type); + LOGF_NOTICE(LOADER, "Addr: %llx", sh_addr); + LOGF_NOTICE(LOADER, "Offset: %llx", sh_offset); + LOGF_NOTICE(LOADER, "Size: %llx", sh_size); + LOGF_NOTICE(LOADER, "EntSize: %lld", sh_entsize); + LOGF_NOTICE(LOADER, "Flags: %llx", sh_flags); + LOGF_NOTICE(LOADER, "Link: %x", sh_link); + LOGF_NOTICE(LOADER, "Info: %x", sh_info); + LOGF_NOTICE(LOADER, "Address align: %llx", sh_addralign); #endif } }; @@ -145,14 +145,14 @@ struct Elf64_Phdr void Show() { #ifdef LOADER_DEBUG - ConLog.Write("Type: %s", Phdr_TypeToString(p_type).c_str()); - ConLog.Write("Offset: 0x%08llx", p_offset); - ConLog.Write("Virtual address: 0x%08llx", p_vaddr); - ConLog.Write("Physical address: 0x%08llx", p_paddr); - ConLog.Write("File size: 0x%08llx", p_filesz); - ConLog.Write("Memory size: 0x%08llx", p_memsz); - ConLog.Write("Flags: %s", Phdr_FlagsToString(p_flags).c_str()); - ConLog.Write("Align: 0x%llx", p_align); + LOGF_NOTICE(LOADER, "Type: %s", Phdr_TypeToString(p_type).c_str()); + LOGF_NOTICE(LOADER, "Offset: 0x%08llx", p_offset); + LOGF_NOTICE(LOADER, "Virtual address: 0x%08llx", p_vaddr); + LOGF_NOTICE(LOADER, "Physical address: 0x%08llx", p_paddr); + LOGF_NOTICE(LOADER, "File size: 0x%08llx", p_filesz); + LOGF_NOTICE(LOADER, "Memory size: 0x%08llx", p_memsz); + LOGF_NOTICE(LOADER, "Flags: %s", Phdr_FlagsToString(p_flags).c_str()); + LOGF_NOTICE(LOADER, "Align: 0x%llx", p_align); #endif } }; diff --git a/rpcs3/Loader/Loader.cpp b/rpcs3/Loader/Loader.cpp index 54c41330b2..4fb4b1cec4 100644 --- a/rpcs3/Loader/Loader.cpp +++ b/rpcs3/Loader/Loader.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Loader.h" #include "ELF.h" #include "SELF.h" @@ -142,7 +142,7 @@ bool Loader::Analyze() if(!m_loader) { - ConLog.Error("Unknown file type"); + LOG_ERROR(LOADER, "Unknown file type"); return false; } @@ -159,7 +159,7 @@ bool Loader::Load() if(!m_loader->LoadData(m_loader->GetMachine() == MACHINE_SPU ? g_spu_offset : 0)) { - ConLog.Error("Broken file"); + LOG_ERROR(LOADER, "Broken file"); return false; } diff --git a/rpcs3/Loader/PKG.cpp b/rpcs3/Loader/PKG.cpp index f634b179a8..3223509a48 100644 --- a/rpcs3/Loader/PKG.cpp +++ b/rpcs3/Loader/PKG.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "PKG.h" #include "../Crypto/unpkg.h" @@ -27,27 +27,27 @@ bool PKGLoader::Install(std::string dest) if (rDirExists(dest+titleID)) { rMessageDialog d_overwrite(NULL, "Another installation was found. Do you want to overwrite it?", "PKG Decrypter / Installer", rYES_NO|rCENTRE); if (d_overwrite.ShowModal() != rID_YES) { - ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str()); + LOGF_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str()); return false; } // TODO: Remove the following two lines and remove the folder dest+titleID - ConLog.Error("PKG Loader: Another installation found in: %s", titleID.c_str()); + LOGF_ERROR(LOADER, "PKG Loader: Another installation found in: %s", titleID.c_str()); return false; } if (!rMkdir(dest+titleID)) { - ConLog.Error("PKG Loader: Could not make the installation directory: %s", titleID.c_str()); + LOGF_ERROR(LOADER, "PKG Loader: Could not make the installation directory: %s", titleID.c_str()); return false; } // Decrypt and unpack the PKG file. if (Unpack(pkg_f, titleID, dest) < 0) { - ConLog.Error("PKG Loader: Failed to install package!"); + LOG_ERROR(LOADER, "PKG Loader: Failed to install package!"); return false; } else { - ConLog.Write("PKG Loader: Package successfully installed in: /dev_hdd0/game/%s", titleID.c_str()); + LOGF_NOTICE(LOADER, "PKG Loader: Package successfully installed in: /dev_hdd0/game/%s", titleID.c_str()); return true; } } diff --git a/rpcs3/Loader/PSF.cpp b/rpcs3/Loader/PSF.cpp index 6d4890756d..970c29ac88 100644 --- a/rpcs3/Loader/PSF.cpp +++ b/rpcs3/Loader/PSF.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "PSF.h" PSFLoader::PSFLoader(vfsStream& f) : psf_f(f) @@ -43,7 +43,7 @@ bool PSFLoader::LoadHeader() if(!m_header.CheckMagic()) return false; - if(m_show_log) ConLog.Write("PSF version: %x", m_header.psf_version); + if(m_show_log) LOGF_NOTICE(LOADER, "PSF version: %x", m_header.psf_version); m_psfindxs.clear(); m_entries.clear(); diff --git a/rpcs3/Loader/SELF.cpp b/rpcs3/Loader/SELF.cpp index 6a95db6a2b..b614267bb2 100644 --- a/rpcs3/Loader/SELF.cpp +++ b/rpcs3/Loader/SELF.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "SELF.h" #include "ELF64.h" @@ -33,7 +33,7 @@ bool SELFLoader::LoadData(u64 offset) !l.LoadShdrInfo(self_hdr.se_shdroff) || !l.LoadData(self_hdr.se_appinfooff) ) { - ConLog.Error("Broken SELF file."); + LOG_ERROR(LOADER, "Broken SELF file."); return false; } @@ -43,6 +43,6 @@ bool SELFLoader::LoadData(u64 offset) return true; - ConLog.Error("Boot SELF not supported yet!"); + LOG_ERROR(LOADER, "Boot SELF not supported yet!"); return false; } \ No newline at end of file diff --git a/rpcs3/Loader/SELF.h b/rpcs3/Loader/SELF.h index 5a312e4e44..7756b7c011 100644 --- a/rpcs3/Loader/SELF.h +++ b/rpcs3/Loader/SELF.h @@ -24,14 +24,14 @@ struct SceHeader void Show() { - ConLog.Write("Magic: %08x", se_magic); - ConLog.Write("Class: %s", "SELF"); - ConLog.Write("hver: 0x%08x", se_hver); - ConLog.Write("flags: 0x%04x", se_flags); - ConLog.Write("type: 0x%04x", se_type); - ConLog.Write("meta: 0x%08x", se_meta); - ConLog.Write("hsize: 0x%llx", se_hsize); - ConLog.Write("esize: 0x%llx", se_esize); + LOGF_NOTICE(LOADER, "Magic: %08x", se_magic); + LOGF_NOTICE(LOADER, "Class: %s", "SELF"); + LOGF_NOTICE(LOADER, "hver: 0x%08x", se_hver); + LOGF_NOTICE(LOADER, "flags: 0x%04x", se_flags); + LOGF_NOTICE(LOADER, "type: 0x%04x", se_type); + LOGF_NOTICE(LOADER, "meta: 0x%08x", se_meta); + LOGF_NOTICE(LOADER, "hsize: 0x%llx", se_hsize); + LOGF_NOTICE(LOADER, "esize: 0x%llx", se_esize); } bool CheckMagic() const { return se_magic == 0x53434500; } @@ -66,15 +66,15 @@ struct SelfHeader void Show() { - ConLog.Write("header type: 0x%llx", se_htype); - ConLog.Write("app info offset: 0x%llx", se_appinfooff); - ConLog.Write("elf offset: 0x%llx", se_elfoff); - ConLog.Write("program header offset: 0x%llx", se_phdroff); - ConLog.Write("section header offset: 0x%llx", se_shdroff); - ConLog.Write("section info offset: 0x%llx", se_secinfoff); - ConLog.Write("sce version offset: 0x%llx", se_sceveroff); - ConLog.Write("control info offset: 0x%llx", se_controloff); - ConLog.Write("control info size: 0x%llx", se_controlsize); + LOGF_NOTICE(LOADER, "header type: 0x%llx", se_htype); + LOGF_NOTICE(LOADER, "app info offset: 0x%llx", se_appinfooff); + LOGF_NOTICE(LOADER, "elf offset: 0x%llx", se_elfoff); + LOGF_NOTICE(LOADER, "program header offset: 0x%llx", se_phdroff); + LOGF_NOTICE(LOADER, "section header offset: 0x%llx", se_shdroff); + LOGF_NOTICE(LOADER, "section info offset: 0x%llx", se_secinfoff); + LOGF_NOTICE(LOADER, "sce version offset: 0x%llx", se_sceveroff); + LOGF_NOTICE(LOADER, "control info offset: 0x%llx", se_controloff); + LOGF_NOTICE(LOADER, "control info size: 0x%llx", se_controlsize); } }; diff --git a/rpcs3/Loader/TROPUSR.cpp b/rpcs3/Loader/TROPUSR.cpp index d15e8f00b4..1bc5c5cbab 100644 --- a/rpcs3/Loader/TROPUSR.cpp +++ b/rpcs3/Loader/TROPUSR.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "TROPUSR.h" @@ -177,7 +177,7 @@ u32 TROPUSRLoader::GetTrophiesCount() u32 TROPUSRLoader::GetTrophyUnlockState(u32 id) { if (id >= m_table6.size()) - ConLog.Warning("TROPUSRLoader::GetUnlockState: Invalid id=%d", id); + LOGF_WARNING(LOADER, "TROPUSRLoader::GetUnlockState: Invalid id=%d", id); return m_table6[id].trophy_state; // Let's assume the trophies are stored ordered } @@ -185,7 +185,7 @@ u32 TROPUSRLoader::GetTrophyUnlockState(u32 id) u32 TROPUSRLoader::GetTrophyTimestamp(u32 id) { if (id >= m_table6.size()) - ConLog.Warning("TROPUSRLoader::GetTrophyTimestamp: Invalid id=%d", id); + LOGF_WARNING(LOADER, "TROPUSRLoader::GetTrophyTimestamp: Invalid id=%d", id); // TODO: What timestamp does sceNpTrophyGetTrophyInfo want, timestamp1 or timestamp2? return m_table6[id].timestamp2; // Let's assume the trophies are stored ordered diff --git a/rpcs3/Loader/TRP.cpp b/rpcs3/Loader/TRP.cpp index 7ba04aa82c..1fd2f2167a 100644 --- a/rpcs3/Loader/TRP.cpp +++ b/rpcs3/Loader/TRP.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/FS/vfsFile.h" @@ -51,7 +51,7 @@ bool TRPLoader::LoadHeader(bool show) return false; if (show) - ConLog.Write("TRP version: %x", m_header.trp_version); + LOGF_NOTICE(LOADER, "TRP version: %x", m_header.trp_version); m_entries.clear(); m_entries.resize(m_header.trp_files_count); @@ -62,7 +62,7 @@ bool TRPLoader::LoadHeader(bool show) return false; if (show) - ConLog.Write("TRP entry #%d: %s", m_entries[i].name); + LOGF_NOTICE(LOADER, "TRP entry #%d: %s", m_entries[i].name); } return true; diff --git a/rpcs3/emucore.vcxproj b/rpcs3/emucore.vcxproj index fde02246a6..02e2f292b5 100644 --- a/rpcs3/emucore.vcxproj +++ b/rpcs3/emucore.vcxproj @@ -27,6 +27,7 @@ + @@ -213,8 +214,10 @@ + + diff --git a/rpcs3/emucore.vcxproj.filters b/rpcs3/emucore.vcxproj.filters index 398e3f933e..03b8528f49 100644 --- a/rpcs3/emucore.vcxproj.filters +++ b/rpcs3/emucore.vcxproj.filters @@ -584,6 +584,9 @@ Emu\SysCalls\lv2 + + Utilities + @@ -1063,5 +1066,11 @@ Emu\SysCalls\lv2 + + Header Files + + + Utilities + \ No newline at end of file diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index ac0bec64b9..2997ca698a 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -1,5 +1,5 @@ #include "stdafx.h" -#include "Emu/ConLog.h" +#include "Utilities/Log.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3.h" @@ -62,8 +62,6 @@ void Rpcs3App::Exit() Emu.Stop(); Ini.Save(); - if(ConLogFrame && !ConLogFrame->IsBeingDeleted()) ConLogFrame->Close(); - wxApp::Exit(); } diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index d243fdc91a..3ccc472ea0 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -163,7 +163,6 @@ - @@ -196,6 +195,7 @@ + @@ -207,8 +207,6 @@ - - diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index a9707872ef..97c4e34c61 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -102,9 +102,6 @@ Emu - - Emu - @@ -191,9 +188,6 @@ Gui - - Emu - Utilities @@ -221,8 +215,8 @@ Gui - - Emu + + Utilities \ No newline at end of file diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 16c34d9301..77a9cac9b3 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -38,7 +38,7 @@ #include "wx/app.h" #include #include - +#include #endif #ifdef MSVC_CRT_MEMLEAK_DETECTION @@ -268,6 +268,8 @@ enum Status Ready, }; +#include "Utilities/StrFmt.h" +#include "Utilities/Log.h" #include "Utilities/BEType.h" #include "Utilities/rFile.h" #include "Utilities/rTime.h" @@ -279,13 +281,10 @@ enum Status #include "Utilities/Array.h" #include "Utilities/Timer.h" #include "Utilities/IdManager.h" -#include "Utilities/StrFmt.h" #include "rpcs3/Ini.h" #include "Gui/FrameBase.h" #include "Gui/ConLogFrame.h" -#include "Emu/ConLog.h" -#include "Emu/DbgConsole.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/Callback.h"