Skip to content

Commit

Permalink
Fix the display of uncompressed size of things that aren't ISO and CSO
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Dec 2, 2023
1 parent d584162 commit 5a972be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions Core/FileSystems/BlockDevices.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BlockDevice {
}
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;
Expand Down Expand Up @@ -89,7 +89,9 @@ class FileBlockDevice : public BlockDevice {
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_;
};
Expand Down
10 changes: 7 additions & 3 deletions UI/GameInfoCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ u64 GameInfo::GetGameSizeUncompressedInBytes() {
default:
{
BlockDevice *blockDevice = constructBlockDevice(GetFileLoader().get());
u64 size = blockDevice->GetUncompressedSize();
delete blockDevice;
return size;
if (blockDevice) {
u64 size = blockDevice->GetUncompressedSize();
delete blockDevice;
return size;
} else {
return GetFileLoader()->FileSize();
}
}
}
}
Expand Down

0 comments on commit 5a972be

Please sign in to comment.