mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-11 15:13:37 +02:00
Merge pull request #14039 from unknownbrackets/ge-frame-dump
Core: Maintain frame dump disc ID in SFO
This commit is contained in:
@@ -98,6 +98,10 @@ size_t DiskCachingFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data,
|
||||
// While in case the cache size is too small for the entire read.
|
||||
while (readSize < bytes) {
|
||||
readSize += cache_->SaveIntoCache(backend_, absolutePos + readSize, bytes - readSize, (u8 *)data + readSize, flags);
|
||||
// We're done, nothing more to read.
|
||||
if (readSize == bytes) {
|
||||
break;
|
||||
}
|
||||
// If there are already-cached blocks afterward, we have to read them.
|
||||
size_t bytesFromCache = cache_->ReadFromCache(absolutePos + readSize, bytes - readSize, (u8 *)data + readSize);
|
||||
readSize += bytesFromCache;
|
||||
@@ -441,6 +445,9 @@ bool DiskCachingFileLoaderCache::ReadBlockData(u8 *dest, BlockInfo &info, size_t
|
||||
if (!f_) {
|
||||
return false;
|
||||
}
|
||||
if (size == 0) {
|
||||
return true;
|
||||
}
|
||||
s64 blockOffset = GetBlockOffset(info.block);
|
||||
|
||||
// Before we read, make sure the buffers are flushed.
|
||||
|
||||
@@ -119,6 +119,9 @@ std::string LocalFileLoader::Path() const {
|
||||
}
|
||||
|
||||
size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void *data, Flags flags) {
|
||||
if (bytes == 0)
|
||||
return 0;
|
||||
|
||||
#if PPSSPP_PLATFORM(SWITCH)
|
||||
// Toolchain has no fancy IO API. We must lock.
|
||||
std::lock_guard<std::mutex> guard(readLock_);
|
||||
|
||||
+10
-13
@@ -245,51 +245,48 @@ bool CPU_Init() {
|
||||
MIPSAnalyst::Reset();
|
||||
Replacement_Init();
|
||||
|
||||
std::string discID;
|
||||
bool allowPlugins = true;
|
||||
std::string geDumpDiscID;
|
||||
|
||||
switch (type) {
|
||||
case IdentifiedFileType::PSP_ISO:
|
||||
case IdentifiedFileType::PSP_ISO_NP:
|
||||
case IdentifiedFileType::PSP_DISC_DIRECTORY:
|
||||
InitMemoryForGameISO(loadedFile);
|
||||
discID = g_paramSFO.GetDiscID();
|
||||
break;
|
||||
case IdentifiedFileType::PSP_PBP:
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
// This is normal for homebrew.
|
||||
// ERROR_LOG(LOADER, "PBP directory resolution failed.");
|
||||
InitMemoryForGamePBP(loadedFile);
|
||||
discID = g_paramSFO.GetDiscID();
|
||||
break;
|
||||
case IdentifiedFileType::PSP_ELF:
|
||||
if (Memory::g_PSPModel != PSP_MODEL_FAT) {
|
||||
INFO_LOG(LOADER, "ELF, using full PSP-2000 memory access");
|
||||
Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE;
|
||||
}
|
||||
discID = g_paramSFO.GetDiscID();
|
||||
break;
|
||||
case IdentifiedFileType::PPSSPP_GE_DUMP:
|
||||
// Try to grab the disc ID from the filename, since unfortunately, we don't store
|
||||
// it in the GE dump. This should probably be fixed, but as long as you don't rename the dumps,
|
||||
// this will do the trick.
|
||||
if (!DiscIDFromGEDumpPath(filename, loadedFile, &discID)) {
|
||||
// Failed? Let the param SFO autogen a fake disc ID.
|
||||
discID = g_paramSFO.GetDiscID();
|
||||
// Try to grab the disc ID from the filenameor GE dump.
|
||||
if (DiscIDFromGEDumpPath(filename, loadedFile, &geDumpDiscID)) {
|
||||
// Store in SFO, otherwise it'll generate a fake disc ID.
|
||||
g_paramSFO.SetValue("DISC_ID", geDumpDiscID, 16);
|
||||
}
|
||||
allowPlugins = false;
|
||||
break;
|
||||
default:
|
||||
discID = g_paramSFO.GetDiscID();
|
||||
break;
|
||||
}
|
||||
|
||||
// Here we have read the PARAM.SFO, let's see if we need any compatibility overrides.
|
||||
// Homebrew usually has an empty discID, and even if they do have a disc id, it's not
|
||||
// likely to collide with any commercial ones.
|
||||
coreParameter.compat.Load(discID);
|
||||
coreParameter.compat.Load(g_paramSFO.GetDiscID());
|
||||
|
||||
InitVFPUSinCos(coreParameter.compat.flags().DoublePrecisionSinCos);
|
||||
|
||||
HLEPlugins::Init();
|
||||
if (allowPlugins)
|
||||
HLEPlugins::Init();
|
||||
if (!Memory::Init()) {
|
||||
// We're screwed.
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user