diff options
| author | Jordan Woyak <jordan.woyak@gmail.com> | 2013-02-07 19:42:01 -0600 |
|---|---|---|
| committer | Jordan Woyak <jordan.woyak@gmail.com> | 2013-02-07 20:22:06 -0600 |
| commit | c4df69a342bd37420b61ebe6df6a0c6af915c877 (patch) | |
| tree | d00451f654656768c1b24c94f2a99e5eb206a096 /Source/Core/DiscIO | |
| parent | a2ca76ebd9c3300735c438b5ddc7bc726001b41a (diff) | |
| parent | 95d08db46fd54b37cb375980f97e1c0e11676419 (diff) | |
Merge branch 'master' into real-wiimote-scanning
Conflicts:
Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp
Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp
Diffstat (limited to 'Source/Core/DiscIO')
| -rw-r--r-- | Source/Core/DiscIO/Src/CompressedBlob.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DiscScrubber.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DiscScrubber.h | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/FileSystemGCWii.cpp | 15 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/FileSystemGCWii.h | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/Filesystem.h | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/Volume.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/VolumeGC.cpp | 7 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/VolumeGC.h | 1 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/VolumeWad.cpp | 6 |
10 files changed, 35 insertions, 9 deletions
diff --git a/Source/Core/DiscIO/Src/CompressedBlob.cpp b/Source/Core/DiscIO/Src/CompressedBlob.cpp index 48ce8f10f3..c4b1aa1385 100644 --- a/Source/Core/DiscIO/Src/CompressedBlob.cpp +++ b/Source/Core/DiscIO/Src/CompressedBlob.cpp @@ -222,7 +222,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type, // u64 size = header.block_size; std::fill(in_buf, in_buf + header.block_size, 0); if (scrubbing) - DiscScrubber::GetNextBlock(inf.GetHandle(), in_buf); + DiscScrubber::GetNextBlock(inf, in_buf); else inf.ReadBytes(in_buf, header.block_size); z_stream z; diff --git a/Source/Core/DiscIO/Src/DiscScrubber.cpp b/Source/Core/DiscIO/Src/DiscScrubber.cpp index 841c8283cc..9ea4a1911d 100644 --- a/Source/Core/DiscIO/Src/DiscScrubber.cpp +++ b/Source/Core/DiscIO/Src/DiscScrubber.cpp @@ -127,7 +127,7 @@ bool SetupScrub(const char* filename, int block_size) return success; } -void GetNextBlock(FILE* in, u8* buffer) +void GetNextBlock(File::IOFile& in, u8* buffer) { u64 CurrentOffset = m_BlockCount * m_BlockSize; u64 i = CurrentOffset / CLUSTER_SIZE; @@ -136,12 +136,12 @@ void GetNextBlock(FILE* in, u8* buffer) { DEBUG_LOG(DISCIO, "Freeing 0x%016llx", CurrentOffset); std::fill(buffer, buffer + m_BlockSize, 0xFF); - fseeko(in, m_BlockSize, SEEK_CUR); + in.Seek(m_BlockSize, SEEK_CUR); } else { DEBUG_LOG(DISCIO, "Used 0x%016llx", CurrentOffset); - fread(buffer, m_BlockSize, 1, in); + in.ReadBytes(buffer, m_BlockSize); } m_BlockCount++; diff --git a/Source/Core/DiscIO/Src/DiscScrubber.h b/Source/Core/DiscIO/Src/DiscScrubber.h index 2b17c7b2f4..d1d053f734 100644 --- a/Source/Core/DiscIO/Src/DiscScrubber.h +++ b/Source/Core/DiscIO/Src/DiscScrubber.h @@ -38,7 +38,7 @@ namespace DiscScrubber { bool SetupScrub(const char* filename, int block_size); -void GetNextBlock(FILE* in, u8* buffer); +void GetNextBlock(File::IOFile& in, u8* buffer); void Cleanup(); } // namespace DiscScrubber diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp index 6103f53e67..47651e2f23 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.cpp @@ -153,7 +153,7 @@ bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const return false; } -bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const +u32 CFileSystemGCWii::GetBootDOLSize() const { u32 DolOffset = Read32(0x420) << m_OffsetShift; u32 DolSize = 0, offset = 0, size = 0; @@ -175,6 +175,19 @@ bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const if (offset + size > DolSize) DolSize = offset + size; } + return DolSize; +} + +bool CFileSystemGCWii::GetBootDOL(u8* &buffer, u32 DolSize) const +{ + u32 DolOffset = Read32(0x420) << m_OffsetShift; + return m_rVolume->Read(DolOffset, DolSize, buffer); +} + +bool CFileSystemGCWii::ExportDOL(const char* _rExportFolder) const +{ + u32 DolOffset = Read32(0x420) << m_OffsetShift; + u32 DolSize = GetBootDOLSize(); std::vector<u8> buffer(DolSize); if (m_rVolume->Read(DolOffset, DolSize, &buffer[0])) diff --git a/Source/Core/DiscIO/Src/FileSystemGCWii.h b/Source/Core/DiscIO/Src/FileSystemGCWii.h index 38e5f181f9..0e7d836d75 100644 --- a/Source/Core/DiscIO/Src/FileSystemGCWii.h +++ b/Source/Core/DiscIO/Src/FileSystemGCWii.h @@ -38,6 +38,8 @@ public: virtual bool ExportFile(const char* _rFullPath, const char* _rExportFilename); virtual bool ExportApploader(const char* _rExportFolder) const; virtual bool ExportDOL(const char* _rExportFolder) const; + virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const; + virtual u32 GetBootDOLSize() const; private: bool m_Initialized; diff --git a/Source/Core/DiscIO/Src/Filesystem.h b/Source/Core/DiscIO/Src/Filesystem.h index 71be4293e3..8bc98e6a77 100644 --- a/Source/Core/DiscIO/Src/Filesystem.h +++ b/Source/Core/DiscIO/Src/Filesystem.h @@ -57,6 +57,8 @@ public: virtual bool ExportApploader(const char* _rExportFolder) const = 0; virtual bool ExportDOL(const char* _rExportFolder) const = 0; virtual const char* GetFileName(u64 _Address) = 0; + virtual bool GetBootDOL(u8* &buffer, u32 DolSize) const = 0; + virtual u32 GetBootDOLSize() const = 0; virtual const IVolume *GetVolume() const { return m_rVolume; } protected: diff --git a/Source/Core/DiscIO/Src/Volume.h b/Source/Core/DiscIO/Src/Volume.h index c90ee4a381..557c71c31f 100644 --- a/Source/Core/DiscIO/Src/Volume.h +++ b/Source/Core/DiscIO/Src/Volume.h @@ -43,6 +43,7 @@ public: virtual std::string GetApploaderDate() const = 0; virtual bool SupportsIntegrityCheck() const { return false; } virtual bool CheckIntegrity() const { return false; } + virtual bool IsDiscTwo() const { return false; } enum ECountry { diff --git a/Source/Core/DiscIO/Src/VolumeGC.cpp b/Source/Core/DiscIO/Src/VolumeGC.cpp index 51fac285fc..09e2c5eaa9 100644 --- a/Source/Core/DiscIO/Src/VolumeGC.cpp +++ b/Source/Core/DiscIO/Src/VolumeGC.cpp @@ -137,4 +137,11 @@ u64 CVolumeGC::GetSize() const return 0; } +bool CVolumeGC::IsDiscTwo() const +{ + bool discTwo; + Read(6,1, (u8*) &discTwo); + return discTwo; +} + } // namespace diff --git a/Source/Core/DiscIO/Src/VolumeGC.h b/Source/Core/DiscIO/Src/VolumeGC.h index 5fd18ea96a..4221df9493 100644 --- a/Source/Core/DiscIO/Src/VolumeGC.h +++ b/Source/Core/DiscIO/Src/VolumeGC.h @@ -39,6 +39,7 @@ public: std::string GetApploaderDate() const; ECountry GetCountry() const; u64 GetSize() const; + bool IsDiscTwo() const; private: IBlobReader* m_pReader; diff --git a/Source/Core/DiscIO/Src/VolumeWad.cpp b/Source/Core/DiscIO/Src/VolumeWad.cpp index 0cdfc85925..2f9f0ef961 100644 --- a/Source/Core/DiscIO/Src/VolumeWad.cpp +++ b/Source/Core/DiscIO/Src/VolumeWad.cpp @@ -129,10 +129,10 @@ bool CVolumeWAD::GetWName(std::vector<std::wstring>& _rwNames) const _rwNames.push_back(L""); continue; } - for (int i = 0; i < 42; ++i) + for (int j = 0; j < 42; ++j) { - u16 t = Common::swap16(temp[i]); - if (t == 0 && i > 0) + u16 t = Common::swap16(temp[j]); + if (t == 0 && j > 0) { if (out_temp.at(out_temp.size()-1) != ' ') out_temp.push_back(' '); |
