From 9a37181fe7273ecee49f72ef9ef8680dcc9b4d9c Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Mon, 26 Aug 2024 09:20:41 -0400 Subject: [PATCH] JS: Fix seeking to end on large files. --- Source/Js_DiscImageDeviceStream.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Js_DiscImageDeviceStream.cpp b/Source/Js_DiscImageDeviceStream.cpp index b1ca108cc3..fb4c84f73e 100644 --- a/Source/Js_DiscImageDeviceStream.cpp +++ b/Source/Js_DiscImageDeviceStream.cpp @@ -15,7 +15,11 @@ void CJsDiscImageDeviceStream::Seek(int64 position, Framework::STREAM_SEEK_DIREC m_position += position; break; case Framework::STREAM_SEEK_END: - m_position = MAIN_THREAD_EM_ASM_INT({return Module.discImageDevice.getFileSize()}); + { + uint32 positionLo = MAIN_THREAD_EM_ASM_INT({return Module.discImageDevice.getFileSize()}); + uint32 positionHi = MAIN_THREAD_EM_ASM_INT({return Module.discImageDevice.getFileSize() / 4294967296}); + m_position = static_cast(positionLo) | (static_cast(positionHi) << 32); + } break; } }