//
// NewsPopup::refreshFromManager from 0x14049e4c0 to 0x14049e6b6 (502 bytes)
//
// 3 xrefs:
// > NewsPopup::init @ 0x14049e484
// > NewsPopup::musicActionFinished @ 0x1404a041c
// > ??> @ 0x1409293b4
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:32:55 +0000
//
// Hidden C++ exception states: #wind=5
__int64 __fastcall NewsPopup::refreshFromManager(__int64 a1)
{
__int64 v2; // rbx
__int64 v3; // rbp
__int64 v4; // rdx
int v5; // r8d
void *v7; // [rsp+40h] [rbp+8h]
void *v8; // [rsp+40h] [rbp+8h]
void *v9; // [rsp+40h] [rbp+8h]
void *v10; // [rsp+40h] [rbp+8h]
void *v11; // [rsp+40h] [rbp+8h]
v2 = qword_14090C070;
if ( !qword_14090C070 )
{
v7 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v7);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v2 = qword_14090C070;
}
if ( a1 + 680 != v2 + 936 )
{
sub_1404A08F0(a1 + 680, *(_QWORD *)(v2 + 936), (*(_QWORD *)(v2 + 944) - *(_QWORD *)(v2 + 936)) / 96LL);
v2 = qword_14090C070;
}
if ( !v2 )
{
v8 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v8);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v2 = qword_14090C070;
}
v3 = v2;
v4 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v9 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v2 = qword_14090C070;
v4 = qword_14090BFD0;
}
if ( *(_DWORD *)(v3 + 964) > *(_DWORD *)(v4 + 1176) )
{
if ( !v2 )
{
v10 = operator new(0x3D0u);
qword_14090C070 = MusicDownloadManager::MusicDownloadManager((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090C070 + 72LL))(qword_14090C070);
v2 = qword_14090C070;
v4 = qword_14090BFD0;
}
if ( !v4 )
{
v11 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v4 = qword_14090BFD0;
}
*(_DWORD *)(v4 + 1176) = *(_DWORD *)(v2 + 964);
}
v5 = *(_DWORD *)(a1 + 704);
if ( v5 >= (int)((*(_QWORD *)(a1 + 688) - *(_QWORD *)(a1 + 680)) / 96LL) )
{
v5 = 0;
*(_DWORD *)(a1 + 704) = 0;
}
return NewsPopup::rebuildPage(a1, (unsigned int)v5);
}