From 8276ca3b218664201065212c905d6de95d8e4d54 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 22 Feb 2009 12:40:38 +0000 Subject: [PATCH] Attempt to fix 64-bit seeks in DriveReader. Please test. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2363 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DiscIO/Src/DriveBlob.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/DiscIO/Src/DriveBlob.cpp b/Source/Core/DiscIO/Src/DriveBlob.cpp index ce7bd4d752..61a253548c 100644 --- a/Source/Core/DiscIO/Src/DriveBlob.cpp +++ b/Source/Core/DiscIO/Src/DriveBlob.cpp @@ -114,9 +114,11 @@ namespace DiscIO u32 NotUsed; u8 * lpSector = new u8[m_blocksize]; #ifdef _WIN32 - // TODO: Fix for 64bit block_num, SetFilePointer uses LONG - SetFilePointer (hDisc, m_blocksize*block_num, NULL, FILE_BEGIN); - if(!ReadFile(hDisc, lpSector, m_blocksize, (LPDWORD)&NotUsed, NULL)) + u64 offset = m_blocksize * block_num; + LONG off_low = (LONG)offset & 0xFFFFFFFF; + LONG off_high = (LONG)(offset >> 32); + SetFilePointer(hDisc, off_low, &off_high, FILE_BEGIN); + if (!ReadFile(hDisc, lpSector, m_blocksize, (LPDWORD)&NotUsed, NULL)) PanicAlert("DRE"); #else fseek(file_, m_blocksize*block_num, SEEK_SET);