From 98fb037dee4b4e98b601686c44ba30fdaf99f0f2 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sun, 14 Aug 2016 17:11:39 +0200 Subject: [PATCH] DVDInterface: Handle DTK beyond 4 GiB Might as well do this while I'm already breaking savestate compatibility. --- Source/Core/Core/HW/DVDInterface.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/HW/DVDInterface.cpp b/Source/Core/Core/HW/DVDInterface.cpp index 45bdd249ff..f47e99220e 100644 --- a/Source/Core/Core/HW/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVDInterface.cpp @@ -228,10 +228,10 @@ static UDICR s_DICR; static UDIIMMBUF s_DIIMMBUF; static UDICFG s_DICFG; -static u32 s_audio_position; -static u32 s_current_start; +static u64 s_audio_position; +static u64 s_current_start; static u32 s_current_length; -static u32 s_next_start; +static u64 s_next_start; static u32 s_next_length; static u32 s_pending_samples; @@ -977,9 +977,7 @@ void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_addr } else if (!s_stop_at_track_end) { - // Setting s_next_start (a u32) like this discards two bits, - // but GC games can't be 4 GiB big, so it shouldn't matter - s_next_start = command_1 << 2; + s_next_start = static_cast(command_1) << 2; s_next_length = command_2; if (!s_stream) { @@ -1012,17 +1010,17 @@ void ExecuteCommand(u32 command_0, u32 command_1, u32 command_2, u32 output_addr case 0x01: // Returns the current offset INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status AudioPos:%08x", s_audio_position); - WriteImmediate(s_audio_position >> 2, output_address, reply_to_ios); + WriteImmediate(static_cast(s_audio_position >> 2), output_address, reply_to_ios); break; case 0x02: // Returns the start offset INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status CurrentStart:%08x", s_current_start); - WriteImmediate(s_current_start >> 2, output_address, reply_to_ios); + WriteImmediate(static_cast(s_current_start >> 2), output_address, reply_to_ios); break; case 0x03: // Returns the total length INFO_LOG(DVDINTERFACE, "(Audio): Stream Status: Request Audio status CurrentLength:%08x", s_current_length); - WriteImmediate(s_current_length >> 2, output_address, reply_to_ios); + WriteImmediate(static_cast(s_current_length >> 2), output_address, reply_to_ios); break; default: INFO_LOG(DVDINTERFACE, "(Audio): Subcommand: %02x Request Audio status %s",