Fix the display of uncompressed size of things that aren't ISO and CSO

This commit is contained in:
Henrik Rydgård 2023-12-02 23:40:56 +01:00
parent d584162e06
commit 5a972be7ef
2 changed files with 11 additions and 5 deletions

View file

@ -46,7 +46,7 @@ public:
}
int GetBlockSize() const { return 2048;} // forced, it cannot be changed by subclasses
virtual u32 GetNumBlocks() const = 0;
u64 GetUncompressedSize() const {
virtual u64 GetUncompressedSize() const {
return (u64)GetNumBlocks() * (u64)GetBlockSize();
}
virtual bool IsDisc() const = 0;
@ -89,7 +89,9 @@ public:
bool ReadBlocks(u32 minBlock, int count, u8 *outPtr) override;
u32 GetNumBlocks() const override {return (u32)(filesize_ / GetBlockSize());}
bool IsDisc() const override { return true; }
u64 GetUncompressedSize() const override {
return filesize_;
}
private:
u64 filesize_;
};

View file

@ -131,9 +131,13 @@ u64 GameInfo::GetGameSizeUncompressedInBytes() {
default:
{
BlockDevice *blockDevice = constructBlockDevice(GetFileLoader().get());
if (blockDevice) {
u64 size = blockDevice->GetUncompressedSize();
delete blockDevice;
return size;
} else {
return GetFileLoader()->FileSize();
}
}
}
}