Skip to content

Commit

Permalink
CHD over http wasn't actually working, disable again until it can be …
Browse files Browse the repository at this point in the history
…fixed
  • Loading branch information
hrydgard committed Dec 29, 2023
1 parent 1e65841 commit a416d94
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Common/LogManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion Common/Net/Sinks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ bool OutputSink::Empty() const {
return valid_ == 0;
}

int OutputSink::BytesRemaining() const {
size_t OutputSink::BytesRemaining() const {
return valid_;
}

Expand Down
2 changes: 1 addition & 1 deletion Common/Net/Sinks.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class OutputSink {
void Discard();

bool Empty() const;
int BytesRemaining() const;
size_t BytesRemaining() const;

private:
void Drain();
Expand Down
2 changes: 1 addition & 1 deletion Core/FileLoaders/DiskCachingFileLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion Core/FileSystems/BlockDevices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,18 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader)

CHDFileBlockDevice::~CHDFileBlockDevice()
{
if (numBlocks > 0) {
if (impl_->chd) {
chd_close(impl_->chd);
delete[] readBuffer;
}
}

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;
Expand Down
8 changes: 4 additions & 4 deletions Core/FileSystems/BlockDevices.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ class CHDFileBlockDevice : public BlockDevice {

private:
std::unique_ptr<CHDImpl> 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);
6 changes: 6 additions & 0 deletions Core/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion Core/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a416d94

Please sign in to comment.