diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 60396a6e27..d7fac46d39 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -302,7 +302,9 @@ void LogManager::RemoveListener(LogListener *listener) { } FileLogListener::FileLogListener(const char *filename) { - fp_ = File::OpenCFile(Path(std::string(filename)), "at"); + if (strlen(filename) > 0) { + fp_ = File::OpenCFile(Path(std::string(filename)), "at"); + } SetEnabled(fp_ != nullptr); } diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index b6453bcf85..62eb407dac 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -422,7 +422,7 @@ bool OutputSink::Empty() const { return valid_ == 0; } -int OutputSink::BytesRemaining() const { +size_t OutputSink::BytesRemaining() const { return valid_; } diff --git a/Common/Net/Sinks.h b/Common/Net/Sinks.h index b997abf342..b42c441eb7 100644 --- a/Common/Net/Sinks.h +++ b/Common/Net/Sinks.h @@ -55,7 +55,7 @@ public: void Discard(); bool Empty() const; - int BytesRemaining() const; + size_t BytesRemaining() const; private: void Drain(); diff --git a/Core/FileLoaders/DiskCachingFileLoader.cpp b/Core/FileLoaders/DiskCachingFileLoader.cpp index 9ee0fcabf6..dee0d5a70a 100644 --- a/Core/FileLoaders/DiskCachingFileLoader.cpp +++ b/Core/FileLoaders/DiskCachingFileLoader.cpp @@ -692,7 +692,7 @@ bool DiskCachingFileLoaderCache::LockCacheFile(bool lockStatus) { // TODO: Also use flock where supported? if (lockStatus) { if ((flags_ & FLAG_LOCKED) != 0) { - ERROR_LOG(LOADER, "Could not lock disk cache file for %s", origPath_.c_str()); + ERROR_LOG(LOADER, "Could not lock disk cache file for %s (already locked)", origPath_.c_str()); return false; } flags_ |= FLAG_LOCKED; diff --git a/Core/FileSystems/BlockDevices.cpp b/Core/FileSystems/BlockDevices.cpp index 03fca8d221..e0f1847979 100644 --- a/Core/FileSystems/BlockDevices.cpp +++ b/Core/FileSystems/BlockDevices.cpp @@ -621,7 +621,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader) CHDFileBlockDevice::~CHDFileBlockDevice() { - if (numBlocks > 0) { + if (impl_->chd) { chd_close(impl_->chd); delete[] readBuffer; } @@ -629,6 +629,10 @@ CHDFileBlockDevice::~CHDFileBlockDevice() bool CHDFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) { + if (!impl_->chd) { + ERROR_LOG(LOADER, "ReadBlock: CHD not open. %s", fileLoader_->GetPath().c_str()); + return false; + } if ((u32)blockNumber >= numBlocks) { memset(outPtr, 0, GetBlockSize()); return false; diff --git a/Core/FileSystems/BlockDevices.h b/Core/FileSystems/BlockDevices.h index 9dca25e8eb..e5f01767c9 100644 --- a/Core/FileSystems/BlockDevices.h +++ b/Core/FileSystems/BlockDevices.h @@ -147,10 +147,10 @@ public: private: std::unique_ptr impl_; - u8 *readBuffer; - u32 currentHunk; - u32 blocksPerHunk; - u32 numBlocks; + u8 *readBuffer = nullptr; + u32 currentHunk = 0; + u32 blocksPerHunk = 0; + u32 numBlocks = 0; }; BlockDevice *constructBlockDevice(FileLoader *fileLoader); diff --git a/Core/System.cpp b/Core/System.cpp index 8421cb297e..7b157e7fa3 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -190,6 +190,12 @@ static bool LoadSymbolsIfSupported() { if (!g_symbolMap) return false; + if (PSP_CoreParameter().fileToStart.Type() == PathType::HTTP) { + // We don't support loading symbols over HTTP. + g_symbolMap->Clear(); + return true; + } + bool result1 = g_symbolMap->LoadSymbolMap(SymbolMapFilename(PSP_CoreParameter().fileToStart, ".ppmap")); // Load the old-style map file. if (!result1) diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index abb03555b9..0310837872 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -113,7 +113,9 @@ static bool RegisterServer(int port) { bool RemoteISOFileSupported(const std::string &filename) { // Disc-like files. - if (endsWithNoCase(filename, ".cso") || endsWithNoCase(filename, ".iso") || endsWithNoCase(filename, ".chd")) { + // NOTE: chd is temporarily disabled until we can make it use the FileLoader instead of + // trying to re-open the file, since otherwise won't work over HTTP. + if (endsWithNoCase(filename, ".cso") || endsWithNoCase(filename, ".iso")) { return true; } // May work - but won't have supporting files.