From 03ab0efdfb42ce8ab83d6793d806c3e49da2cf1c Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 19:53:25 +0000 Subject: [PATCH] Decompile 2 functions in Source/UI/Window/UIMessageBox.cpp Batch #16417 by eAthena: 0 byte-identical, 2 confirmed by peer review. - fn_11714 UIMessageBoxAutoreturn::Configure: logic confirmed by peer review - fn_11822 UIReplayControlWnd::RefreshInfo: logic confirmed by peer review Peer-reviewed-by: Yommy, kyoshi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). --- Source/UI/Window/UIMessageBox.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index 537d59294..f7e233da8 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -2807,12 +2807,15 @@ int UIReplayControlWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg // OFFSET: 0x008C3110 // FUNCTION: fn_11822 bool UIReplayControlWnd::RefreshInfo() { - const int seconds = static_cast(Replay::Instance().elapsed) / 1000; - const int minutes = seconds / 60; + const int elapsed = static_cast(Replay::Instance().elapsed) / 1000; + const int totalMinutes = elapsed / 60; + const int seconds = elapsed % 60; + const int hours = totalMinutes / 60; + const int minutes = totalMinutes % 60; const ReplayTime duration = Replay::Instance().Duration(); char text[100]; std::memset(text, 0, sizeof(text)); - std::sprintf(text, LookupMessage(MSI_REPLAY_ELAPSEDTIME), minutes / 60, minutes % 60, seconds % 60, duration.hours, duration.minutes, duration.seconds); + std::sprintf(text, LookupMessage(MSI_REPLAY_ELAPSEDTIME), hours, minutes, seconds, duration.hours, duration.minutes, duration.seconds); this->m_texts[0]->SetTextFitted(text); std::memset(text, 0, sizeof(text)); @@ -4145,8 +4148,8 @@ void UIMessageBoxAutoreturn::Configure(const char* text, int timeout) { this->format = text; this->started = timeGetTime(); this->deadline = timeGetTime() + static_cast(timeout); - const unsigned interval = this->deadline - this->started; - const unsigned seconds = interval / 1000 + (interval % 1000 != 0); + const unsigned fraction = (this->deadline - this->started) % 1000 ? 1 : 0; + const unsigned seconds = (this->deadline - this->started) / 1000 + fraction; this->remaining = seconds; this->seconds = seconds;