Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
BotW nnMain 1.5.0 vs 1.6.0
void nnMain()
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
sead::system::Print("0000002d\n"); // version number. 0x10 in 1.0.0
Profiler::Push("起動時間");
Profiler::Push("main");
_WriteStatusReg(FPCR, _ReadStatusReg(FPCR) | 0x1000000);
nn::oe::Initialize();
nn::oe::SetPerformanceConfiguration(0, 0x92220008);
argc = nn::os::GetHostArgc();
argv = nn::os::GetHostArgv();
parseOptions(argc, argv);
sead::ExceptionHandler::initialize();
sead::Framework::InitializeArg::InitializeArg(&_.frameworkInitArg);
_.frameworkInitArg.arenaSize = 0xC1000000LL;
sead::GameFrameworkNx::initialize(&_.frameworkInitArg);
if ( sead::HeapMgr::sRootHeaps.size )
heap = *sead::HeapMgr::sRootHeaps.ptrs;
else
heap = 0LL;
_.str.vptr = &sead::SafeString::vt;
_.str.cstr = "GameConfig";
v3 = getDebugHeap();
if ( v3 )
heap = getDebugHeap();
gameConfigHeap = sead::ExpHeap::create(0LL, (sead::SafeStringBase *)&_, heap, 8LL, 1LL, 0);
GameConfig::createInstance(gameConfigHeap);
GameConfig::initStubbed(GameConfig::sInstance, gameConfigHeap);
gameConfigHeap->vtable->adjust(gameConfigHeap);
Struct30::createInstance(heap);
_.frameworkCreateArg.field_0 = 1;
sead::TaskClassID::sStringTaskCreator = (__int64 (__fastcall *)(_QWORD))sub_710092132C;
_.frameworkCreateArg.field_C = 0x3F8000003F000000LL;
_.frameworkCreateArg.field_14 = 0x500;
_.frameworkCreateArg.field_18 = 0x1000002D0LL;
_.frameworkCreateArg.field_4 = 0x3F0000003F000000LL;
_.frameworkCreateArg.field_20 = 0x8000000080000LL;
_.frameworkCreateArg.field_28 = 0x80000000001000LL;
_.frameworkCreateArg.field_30 = 0xFFFFFFFF00000000LL;
_.frameworkCreateArg.field_38 = 0xFFFFFFFFFFFFFFFFLL;
_.frameworkCreateArg.field_40 = 0x212C00000000LL;
_.frameworkCreateArg.field_48 = 2;
_.frameworkCreateArg.field_14 = *(_DWORD *)sub_7100F2A6BC((unsigned __int8 *)2);
LODWORD(_.taskCreateArg.field_18) = *((_DWORD *)sub_7100F2A6BC((unsigned __int8 *)(unsigned int)_.frameworkCreateArg.field_14)
+ 1);
*(__int64 *)((char *)&_.taskCreateArg.field_28 + 4) = 0x1000000LL;
_.frameworkCreateArg.field_0 = 1;
BYTE4(_.taskCreateArg.field_18) = 0;
BYTE6(_.taskCreateArg.field_18) = 0;
_.frameworkCreateArg.field_20 = 0x10000000030000LL;
HIDWORD(_.taskCreateArg.field_40) = 0x812C;
_.frameworkCreateArg.field_38 = 0x4000000080000LL;
framework = (GameFramework *)operator new(0x288uLL, heap, 8);
GameFramework::ctor(framework, (const sead::GameFrameworkNx::CreateArg *)&_);
name.vptr = &sead::SafeString::vt;
name.cstr = "GraphicsSystem";
gfxHeap = sead::ExpHeap::create(0x3000000uLL, &name, heap, 8LL, 1LL, 0);
if ( getDebugHeap() )
{
v8 = getDebugHeap();
LABEL_10:
heap_1 = v8;
goto LABEL_11;
}
if ( getDebugHeap2() )
{
v8 = getDebugHeap2();
goto LABEL_10;
}
heap_1 = 0LL;
LABEL_11:
v11 = (signed int *)sub_7100F2A708(v9);
v12 = (float)v11[1];
*(float *)&name.vptr = (float)*v11;
*((float *)&name.vptr + 1) = v12;
sead::GameFrameworkNx::initializeGraphicsSystem(framework, gfxHeap, &name, v13, v14);
if ( heap_1 )
{
sead::PrimitiveRenderer::createInstance((sead::PrimitiveRenderer *)heap_1, v15);
name.vptr = &sead::SafeString::vt;
name.cstr = "System/Sead/primitive_drawer_nvn_shader.bin";
sead::PrimitiveRenderer::x(sead::PrimitiveRenderer::sInstance, heap_1);
sead::DebugFontMgrNvn::createInstance(heap_1);
sead::DebugFontMgrNvn::initialize(
sead::DebugFontMgrNvn::sInstance,
heap_1,
"System/font/nvn_font/nvn_font_shader.bin",
"System/font/nvn_font/nvn_font.ntx",
0x32000u);
sead::DebugFontMgrJis1Nvn::createInstance(heap_1);
sead::DebugFontMgrJis1Nvn::initialize(
sead::DebugFontMgrJis1Nvn::sInstance,
heap_1,
"System/font/nvn_font/nvn_font_shader_jis1.bin",
"System/font/nvn_font/nvn_font_jis1.ntx",
"System/font/nvn_font/nvn_font_jis1_tbl.bin",
0x100000u);
sead::DebugFontMgrJis1Nvn::setInstance(sead::DebugFontMgrJis1Nvn::sInstance);
}
Framework::setFlag214_1iftrue_else_2(framework, 0);
gfxHeap->vtable->adjust(gfxHeap);
Profiler::Pop("main");
Profiler::Push("RootTask");
LODWORD(name.vptr) = 3;
name.cstr = "RootTask";
sead::TaskBase::CreateArg::CreateArg((sead::TaskBase::CreateArg *)&_, (__int64 *)&name);
_.taskCreateArg.field_AC = 1;
LODWORD(_.taskCreateArg.field_0) = 2;
_.taskCreateArg.taskCtor = (sead::TaskBase *(__fastcall *)(const struct sead::TaskConstructArg *))sead::TTaskFactory<RootTask>;
sead::Framework::RunArg::RunArg((__int64)&name);
HIDWORD(name.vptr) = sead::ThreadUtil::ConvertPrioritySeadToPlatform(0x14);
framework->vtable->_._.b.run(framework, heap, (sead::TaskBase::CreateArg *)&_, (int *)&name);
if ( sead::AudioMgr::sInstance )
sead::AudioMgr::exit(sead::AudioMgr::sInstance);
}
void __cdecl nnMain()
{
// [COLLAPSED LOCAL DECLARATIONS. PRESS KEYPAD CTRL-"+" TO EXPAND]
v0 = (nn::os *)sead::system::Print("0000002e\n");
if ( dword_7102CE0F20 >= dword_7102CE0F38 )
{
v1 = 0LL;
}
else
{
v1 = (nn::os **)qword_7102CE0F28;
if ( qword_7102CE0F28 )
qword_7102CE0F28 = *(_QWORD *)qword_7102CE0F28;
*v1 = 0LL;
v1[1] = 0LL;
v0 = (nn::os *)nn::os::GetSystemTick(v0);
*v1 = v0;
v1[3] = 0LL;
v1[2] = 0LL;
v2 = (__int64 *)(v1 + 2);
v3 = qword_7102CE0F10;
qword_7102CE0F10 = (__int64)v2;
*v2 = v3;
v1[3] = (nn::os *)&qword_7102CE0F10;
if ( v3 )
*(_QWORD *)(v3 + 8) = v2;
++dword_7102CE0F20;
}
v4 = (nn::os *)nn::os::GetSystemTick(v0);
*v1 = v4;
v1[1] = (nn::os *)"起動時間";
if ( dword_7102CE0F20 >= dword_7102CE0F38 )
{
v5 = 0LL;
}
else
{
v5 = (nn::os **)qword_7102CE0F28;
if ( qword_7102CE0F28 )
qword_7102CE0F28 = *(_QWORD *)qword_7102CE0F28;
*v5 = 0LL;
v5[1] = 0LL;
v4 = (nn::os *)nn::os::GetSystemTick(v4);
*v5 = v4;
v5[3] = 0LL;
v5[2] = 0LL;
v6 = (__int64 *)(v5 + 2);
v7 = qword_7102CE0F10;
qword_7102CE0F10 = (__int64)v6;
*v6 = v7;
v5[3] = (nn::os *)&qword_7102CE0F10;
if ( v7 )
*(_QWORD *)(v7 + 8) = v6;
++dword_7102CE0F20;
}
v8 = (nn::oe *)nn::os::GetSystemTick(v4);
*v5 = v8;
v5[1] = (nn::os *)"main";
_WriteStatusReg(ARM64_SYSREG(3, 3, 4, 4, 0), _ReadStatusReg(ARM64_SYSREG(3, 3, 4, 4, 0)) | 0x1000000);
nn::oe::Initialize(v8);
nn::oe::SetPerformanceConfiguration(0LL, 2451701768LL);
LODWORD(v9) = 1;
v10 = (nn::os *)nn::oe::SetCpuBoostMode(1LL);
v11 = (nn::os *)nn::os::GetHostArgc(v10);
v12 = (signed int)v11;
v13 = (const char *)nn::os::GetHostArgv(v11);
word_7102CE0DF8 = 0;
qword_7102CE0E08 = 0LL;
qword_7102CE0E10 = 0LL;
qword_7102CE0E00 = 0LL;
if ( v12 < 1 )
goto LABEL_158;
v14 = v13;
LODWORD(v329) = v12;
LOBYTE(v333) = 1;
v330 = v13;
v331 = &off_7102A6E6C0;
v15 = 5LL;
v332 = "l:r:";
HIDWORD(v333) = 1;
LOBYTE(v334) = 0;
v335 = 0LL;
LODWORD(v336) = 1;
while ( (_DWORD)v9 != 1 )
{
v16 = *(char **)&v330[8 * SHIDWORD(v333)];
LABEL_29:
LOBYTE(v334) = v16[(signed int)v9];
v20 = (unsigned __int8)v334;
LOWORD(v354) = (unsigned __int8)v334;
if ( (unsigned __int8)v334 == 58 )
goto LABEL_83;
v355 = (unsigned __int64)&off_7102A6E6C0;
v356 = &v354;
((void (__fastcall *)(__int64 (__fastcall ***)()))v331[3])(&v331);
v21 = 0;
for ( i = v15; ; i += 6LL )
{
v23 = (__int64)&v332[i];
if ( !v332[i - 5] )
break;
if ( !*(_BYTE *)(v23 - 4) )
{
v21 |= 1u;
break;
}
if ( !*(_BYTE *)(v23 - 3) )
{
v21 = i - 3;
break;
}
if ( (unsigned __int64)(i - 3) >> 19 )
{
v21 = 0;
break;
}
if ( !*(_BYTE *)(v23 - 2) )
{
v21 += 3;
break;
}
if ( !*(_BYTE *)(v23 - 1) )
{
v21 += 4;
break;
}
if ( !v332[i] )
{
v21 += 5;
break;
}
v21 += 6;
}
(*(void (__fastcall **)(unsigned __int64 *))(v355 + 24))(&v355);
v24 = 0;
for ( j = v15; ; j += 6LL )
{
v26 = (__int64)v356 + j;
if ( !*((_BYTE *)v356 + j - 5) )
goto LABEL_55;
if ( !*(_BYTE *)(v26 - 4) )
{
v24 |= 1u;
v28 = v21 - v24;
if ( v21 - v24 < 0 )
goto LABEL_83;
goto LABEL_56;
}
v27 = j - 3;
if ( !*(_BYTE *)(v26 - 3) )
{
v24 = j - 3;
v28 = v21 - v27;
if ( v21 - (signed int)v27 < 0 )
goto LABEL_83;
goto LABEL_56;
}
if ( v27 >> 19 )
{
v24 = 0;
v28 = v21;
if ( v21 < 0 )
goto LABEL_83;
goto LABEL_56;
}
if ( !*(_BYTE *)(v26 - 2) )
{
v24 += 3;
v28 = v21 - v24;
if ( v21 - v24 < 0 )
goto LABEL_83;
goto LABEL_56;
}
if ( !*(_BYTE *)(v26 - 1) )
break;
if ( !*((_BYTE *)v356 + j) )
{
v24 += 5;
LABEL_55:
v28 = v21 - v24;
if ( v21 - v24 < 0 )
goto LABEL_83;
goto LABEL_56;
}
v24 += 6;
}
v24 += 4;
v28 = v21 - v24;
if ( v21 - v24 < 0 )
goto LABEL_83;
LABEL_56:
if ( v24 >= 0x80000 )
v29 = 0x80000;
else
v29 = v24;
if ( v24 < 1 )
{
(*(void (__fastcall **)(unsigned __int64 *))(v355 + 24))(&v355);
v36 = 1;
LABEL_72:
((void (__fastcall *)(__int64 (__fastcall ***)()))v331[3])(&v331);
v37 = 0;
for ( k = v15; ; k += 6LL )
{
v39 = (__int64)&v332[k];
if ( !v332[k - 5] )
break;
if ( !*(_BYTE *)(v39 - 4) )
{
v37 |= 1u;
break;
}
if ( !*(_BYTE *)(v39 - 3) )
{
v37 = k - 3;
break;
}
if ( (unsigned __int64)(k - 3) >> 19 )
{
v37 = 0;
break;
}
if ( !*(_BYTE *)(v39 - 2) )
{
v37 += 3;
break;
}
if ( !*(_BYTE *)(v39 - 1) )
{
v37 += 4;
break;
}
if ( !v332[k] )
{
v37 += 5;
break;
}
v37 += 6;
}
v41 = (char *)&v332[v36];
if ( v37 >= v36 )
v42 = v36 < 0;
else
v42 = 1;
if ( v42 )
v41 = &byte_71026C7744;
v43 = (unsigned __int8)*v41;
v44 = SHIDWORD(v333);
v9 = (signed int)v336 + 1LL;
v45 = *(_QWORD *)&v330[8 * SHIDWORD(v333)];
if ( v43 == 58 )
{
v46 = *(unsigned __int8 *)(v45 + v9);
v47 = HIDWORD(v333)++ + 1;
if ( v46 )
{
v48 = *(_QWORD *)&v330[8 * v44] + v9;
goto LABEL_117;
}
if ( v47 >= (signed int)v329 )
{
if ( (_BYTE)v333 )
sead::system::Print("%s%s%c\n", *(_QWORD *)v330, ": option requires an argument -- ", v20);
LABEL_17:
LODWORD(v9) = 1;
LODWORD(v336) = 1;
}
else
{
HIDWORD(v333) = v44 + 2;
v48 = *(_QWORD *)&v330[8 * v47];
LABEL_117:
LODWORD(v9) = 1;
v335 = v48;
LODWORD(v336) = 1;
if ( v20 == 108 )
goto LABEL_118;
LABEL_111:
if ( v20 == 114 )
{
qword_7102CE0E08 = v48;
}
else if ( v20 == 255 )
{
goto LABEL_123;
}
}
}
else
{
LODWORD(v336) = v336 + 1;
if ( !*(_BYTE *)(v45 + v9) )
{
LODWORD(v9) = 1;
LODWORD(v336) = 1;
++HIDWORD(v333);
}
v48 = 0LL;
v335 = 0LL;
if ( v20 != 108 )
goto LABEL_111;
LABEL_118:
qword_7102CE0E10 = v48;
}
}
else
{
v30 = 0LL;
v31 = v29;
v327 = v28;
while ( 1 )
{
v32 = v15;
v33 = (__int64)&v332[v30];
(*(void (__fastcall **)(unsigned __int64 *))(v355 + 24))(&v355);
if ( (unsigned int *)v33 == v356 )
break;
v34 = 0LL;
while ( *(unsigned __int8 *)(v33 + v34) == *((unsigned __int8 *)v356 + v34) )
{
if ( *(_BYTE *)(v33 + v34) )
{
if ( ++v34 < v31 )
continue;
}
goto LABEL_69;
}
v35 = __OFSUB__(v30, v327);
v42 = v30++ - v327 < 0;
v15 = v32;
if ( !(v42 ^ v35) )
goto LABEL_83;
}
LABEL_69:
v15 = v32;
if ( (_DWORD)v30 != -1 )
{
v36 = v30 + 1;
goto LABEL_72;
}
LABEL_83:
if ( (_BYTE)v333 )
sead::system::Print("%s%s%c\n", *(_QWORD *)v330, ": illegal option -- ", v20);
v9 = (signed int)v336 + 1LL;
v40 = *(_QWORD *)&v330[8 * SHIDWORD(v333)];
LODWORD(v336) = v336 + 1;
if ( !*(_BYTE *)(v40 + v9) )
{
++HIDWORD(v333);
goto LABEL_17;
}
}
}
if ( SHIDWORD(v333) < (signed int)v329 )
{
v16 = *(char **)&v330[8 * SHIDWORD(v333)];
if ( *v16 == 45 )
{
if ( v16[1] )
{
if ( v16 != "--" )
{
v17 = 1LL;
LOBYTE(v18) = 45;
while ( (_BYTE)v18 )
{
if ( v17 < 0x80001 )
{
v18 = (unsigned __int8)v16[v17];
v19 = (unsigned __int8)asc_71026B1B35[v17++];
if ( v18 == v19 )
continue;
}
goto LABEL_29;
}
}
++HIDWORD(v333);
}
}
}
LOBYTE(v334) = -1;
LABEL_123:
v49 = 0;
do
{
v50 = *(char **)&v14[8 * v49];
v51 = v49;
if ( v50 == "-fhd" )
{
LABEL_134:
HIBYTE(word_7102CE0DF8) = 1;
v50 = *(char **)&v14[8 * v49];
}
else
{
v52 = 1LL;
do
{
if ( v50[v52 - 1] != aFhd[v52 - 1] )
break;
if ( !v50[v52 - 1] )
goto LABEL_134;
if ( v50[v52] != aFhd[v52] )
break;
if ( !v50[v52] )
goto LABEL_134;
if ( v50[v52 + 1] != aFhd[v52 + 1] )
break;
if ( !v50[v52 + 1] )
goto LABEL_134;
v53 = v52 + 2;
v52 += 3LL;
}
while ( v53 < 0x80001 );
}
if ( v50 == "-no_sead_log" )
{
LABEL_145:
LOBYTE(word_7102CE0DF8) = 1;
v50 = *(char **)&v14[8 * v49];
}
else
{
v54 = 1LL;
do
{
if ( v50[v54 - 1] != aNoSeadLog[v54 - 1] )
break;
if ( !v50[v54 - 1] )
goto LABEL_145;
if ( v50[v54] != aNoSeadLog[v54] )
break;
if ( !v50[v54] )
goto LABEL_145;
if ( v50[v54 + 1] != aNoSeadLog[v54 + 1] )
break;
if ( !v50[v54 + 1] )
goto LABEL_145;
v55 = v54 + 2;
v54 += 3LL;
}
while ( v55 < 0x80001 );
}
if ( v50 == "-out" )
{
LABEL_156:
++v49;
qword_7102CE0E00 = *(_QWORD *)&v14[8 * (v51 + 1)];
}
else
{
v56 = 0LL;
do
{
if ( v50[v56] != aOut[v56] )
break;
if ( !v50[v56] )
goto LABEL_156;
if ( v50[v56 + 1] != aOut[v56 + 1] )
break;
if ( !v50[v56 + 1] )
goto LABEL_156;
if ( v50[v56 + 2] != aOut[v56 + 2] )
break;
if ( !v50[v56 + 2] )
goto LABEL_156;
v56 += 3LL;
}
while ( v56 < 0x80001 );
}
++v49;
}
while ( v49 < v12 );
LABEL_158:
nn::os::SetUserExceptionHandler(sub_7101A450F0, 0LL, 0LL, 0LL);
nn::diag::InitializeAbortObserverHolder(&unk_7102CE0E58, sub_7101A45C80);
nn::diag::RegisterAbortObserver(&unk_7102CE0E58);
nn::oe::SetResumeNotificationEnabled((nn::oe *)1, v57);
nn::oe::SetOperationModeChangedNotificationEnabled((nn::oe *)1, v58);
nn::oe::SetPerformanceModeChangedNotificationEnabled((nn::oe *)1, v59);
nn::oe::SetFocusHandlingMode(2LL);
nn::os::LockMutex(&unk_7102CBEFE8);
qword_7102CBF010 = (__int64)&unk_7102CBEF50;
nn::os::AllocateMemoryBlock((nn::os *)&unk_7102CBEF50, (unsigned __int64 *)0xC1000000LL, v60);
qword_7102CBEF48 = 0LL;
qword_7102D22078 = ((signed __int64)((unsigned __int128)(qword_7102CBFBA8 * (signed __int128)3022314549036572937LL) >> 64) >> 14)
+ ((unsigned __int64)((unsigned __int128)(qword_7102CBFBA8 * (signed __int128)3022314549036572937LL) >> 64) >> 63);
qword_7102CBEF58 = 3238002688LL;
v61 = *(_QWORD *)qword_7102CBF010;
v62 = *(_QWORD *)(qword_7102CBF010 + 8);
v329 = &off_7102A6E6C0;
v330 = "RootHeap";
v63 = sub_710125D030(v61, v62, &v329);
if ( dword_7102CBEF68 < *(_DWORD *)algn_7102CBEF6C )
*(_QWORD *)(qword_7102CBEF70 + 8LL * dword_7102CBEF68++) = v63;
qword_7102CBF018 = (__int64)&qword_7102CBEF38;
nn::os::UnlockMutex(&unk_7102CBEFE8);
if ( dword_7102CBEF68 )
v64 = *(_QWORD *)qword_7102CBEF70;
else
v64 = 0LL;
v329 = &off_7102A6E6C0;
v330 = "sead::ThreadMgr";
v65 = (nn::os *)sub_710125CD50(0LL, &v329, v64, 8LL, 1LL, 0LL);
v66 = qword_7102CBF648;
v67 = v65;
if ( !qword_7102CBF648 )
{
v68 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
if ( v65 )
goto LABEL_493;
v69 = nn::os::GetTlsValue(MEMORY[0x88]);
v70 = (nn::os **)(v69 + 176);
if ( !v69 )
v70 = (nn::os **)(v68 + 8);
v65 = *v70;
if ( *v70 )
{
LABEL_493:
v71 = (*(__int64 (**)(void))(*(_QWORD *)v65 + 48LL))();
goto LABEL_171;
}
v66 = 0LL;
}
else
{
v71 = malloc(0x90uLL);
LABEL_171:
v66 = v71;
}
sub_710125A550(v66 + 8, v67, 3LL);
*(_QWORD *)(v66 + 8) = &off_7102BB4720;
qword_7102CBF650 = v66 + 8;
*(_QWORD *)v66 = off_7102BB48E0;
*(_DWORD *)(v66 + 56) = 0;
*(_QWORD *)(v66 + 40) = v66 + 40;
*(_QWORD *)(v66 + 48) = v66 + 40;
sub_710126C630(v66 + 64);
*(_QWORD *)(v66 + 128) = 0LL;
v65 = (nn::os *)nn::os::AllocateTlsSlot(v66 + 136, 0LL);
qword_7102CBF648 = v66;
}
v72 = (nn::os *)nn::os::GetCurrentThread(v65);
v73 = v72;
v74 = nn::os::GetCurrentThread(v72);
nn::os::ChangeThreadPriority(v74, 16LL);
v75 = nn::os::GetThreadId(v73);
v76 = qword_7102CBF018;
v77 = v75;
if ( qword_7102CBF018 )
{
v78 = v67;
if ( v67 )
goto LABEL_494;
v79 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v80 = (nn::os **)(v79 + 176);
if ( !v79 )
v80 = (nn::os **)(v76 + 8);
v78 = *v80;
if ( *v80 )
LABEL_494:
v81 = (*(__int64 (**)(void))(*(_QWORD *)v78 + 48LL))();
else
v81 = 0LL;
v82 = qword_7102CBF018;
*(_QWORD *)(v81 + 16) = 0LL;
*(_QWORD *)(v81 + 24) = 0LL;
*(_QWORD *)v81 = &off_7102BB3CD8;
*(_QWORD *)(v81 + 8) = 0LL;
if ( v82 )
{
v83 = sub_710125F180(v81);
*(_QWORD *)(v81 + 8) = v83;
if ( v83 )
{
v84 = v83;
if ( *(_BYTE *)(v83 + 216) & 1 )
{
v85 = v83 + 152;
nn::os::LockMutex(v83 + 184);
}
else
{
v85 = 0LL;
}
v86 = *(_QWORD *)(v84 + 120);
v87 = (_QWORD *)(*(signed int *)(v84 + 140) + v81);
*(_QWORD *)(v84 + 120) = v87;
*v87 = v86;
v87[1] = v84 + 120;
if ( v86 )
*(_QWORD *)(v86 + 8) = v87;
++*(_DWORD *)(v84 + 136);
if ( v85 )
nn::os::UnlockMutex(v85 + 32);
}
}
}
else
{
v81 = malloc(0x100uLL);
*(_QWORD *)(v81 + 16) = 0LL;
*(_QWORD *)(v81 + 24) = 0LL;
*(_QWORD *)v81 = &off_7102BB3CD8;
*(_QWORD *)(v81 + 8) = 0LL;
}
*(_QWORD *)v81 = &off_7102BB4660;
*(_QWORD *)(v81 + 128) = 0LL;
*(_QWORD *)(v81 + 32) = &off_7102A6E6C0;
*(_QWORD *)(v81 + 40) = "sead::MainThread";
*(_QWORD *)(v81 + 48) = &off_7102BB4708;
v88 = *((_QWORD *)v73 + 11);
*(_QWORD *)(v81 + 168) = 0LL;
*(_QWORD *)(v81 + 176) = 0LL;
*(_DWORD *)(v81 + 136) = v88;
*(_QWORD *)(v81 + 152) = 0LL;
*(_QWORD *)(v81 + 160) = 0LL;
*(_QWORD *)(v81 + 144) = 0LL;
*(_QWORD *)(v81 + 184) = 0LL;
*(_DWORD *)(v81 + 192) = 1;
*(_QWORD *)(v81 + 200) = 0x7FFFFFFFLL;
*(_DWORD *)(v81 + 208) = v77;
*(_DWORD *)(v81 + 212) = 1;
LODWORD(v329) = 0;
*(_DWORD *)(v81 + 216) = 1;
*(_QWORD *)(v81 + 224) = v73;
*(_QWORD *)(v81 + 232) = 0LL;
*(_QWORD *)(v81 + 240) = 0LL;
*(_DWORD *)(v81 + 248) = nn::os::GetThreadPriority(v73);
*(_QWORD *)(v81 + 160) = v81;
v89 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v90 = v67;
if ( v67 )
goto LABEL_495;
v91 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v92 = (nn::os **)(v91 + 176);
if ( !v91 )
v92 = (nn::os **)(v89 + 8);
v90 = *v92;
if ( *v92 )
{
LABEL_495:
v93 = (*(__int64 (**)(void))(*(_QWORD *)v90 + 48LL))();
goto LABEL_196;
}
v94 = 0LL;
}
else
{
v93 = malloc(0x100uLL);
LABEL_196:
v94 = v93;
}
*(_QWORD *)(v81 + 128) = v94;
nn::os::InitializeMessageQueue(v81 + 56);
v96 = (nn::os *)nn::os::GetCurrentStackInfo((nn::os *)&v329, &v355, v95);
*(_QWORD *)(v81 + 240) = v329;
*(_DWORD *)(v81 + 136) = v355;
v97 = *(unsigned int *)(v81 + 216);
nn::os::GetThreadAvailableCoreMask(v96);
nn::os::SetThreadCoreMask(*(_QWORD *)(v81 + 224), 0xFFFFFFFFLL, v97);
*(_QWORD *)v81 = off_7102BB4740;
*(_QWORD *)(v81 + 48) = &off_7102BB47E8;
v98 = *(unsigned int *)(v66 + 136);
*(_QWORD *)(v66 + 128) = v81;
v99 = (nn::os *)nn::os::SetTlsValue(v98, v81);
v100 = (unsigned int)dword_7102CBFC34;
v101 = nn::os::GetCurrentCoreNumber(v99);
nn::os::SetTlsValue(v100, v101 + 1);
(*(void (__fastcall **)(nn::os *))(*(_QWORD *)v67 + 40LL))(v67);
if ( !qword_7102CBF798 )
{
v102 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v103 = v64;
if ( v64 )
goto LABEL_496;
v104 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v105 = (__int64 *)(v104 + 176);
if ( !v104 )
v105 = (__int64 *)(v102 + 8);
v103 = *v105;
if ( *v105 )
{
LABEL_496:
v106 = (*(__int64 (**)(void))(*(_QWORD *)v103 + 48LL))();
goto LABEL_205;
}
v107 = 0LL;
}
else
{
v106 = malloc(0x30uLL);
LABEL_205:
v107 = v106;
}
v108 = (nn::os *)sub_710125A550(v107 + 16, v64, 3LL);
*(_QWORD *)(v107 + 16) = &off_7102BB4F88;
qword_7102CBF790 = v107 + 16;
v109 = nn::os::GetSystemTick(v108);
v110 = 1812433253 * (v109 ^ (v109 >> 30)) + 1;
v111 = 1812433253 * (v110 ^ (v110 >> 30)) + 2;
v112 = 1812433253 * (v111 ^ (v111 >> 30)) + 3;
*(_DWORD *)v107 = v110;
*(_DWORD *)(v107 + 4) = v111;
*(_DWORD *)(v107 + 8) = v112;
*(_DWORD *)(v107 + 12) = 1812433253 * (v112 ^ (v112 >> 30)) + 4;
qword_7102CBF798 = v107;
}
v113 = (_QWORD **)&unk_7102CBE000;
v114 = *(_QWORD *)qword_7102CBEF70;
v115 = (*(__int64 (__fastcall **)(_QWORD, signed __int64))(**(_QWORD **)qword_7102CBEF70 + 128LL))(
*(_QWORD *)qword_7102CBEF70,
8LL);
v329 = &off_7102A6E6C0;
v330 = "sead::SystemManagers";
v116 = 1LL;
v117 = sub_710125CD50(v115, &v329, v114, 8LL, 1LL, 0LL);
v118 = v117;
v119 = (*(__int64 (**)(void))(*(_QWORD *)v117 + 128LL))();
v329 = &off_7102A6E6C0;
v330 = "sead::ResourceMgr";
v120 = sub_710125CD50(v119, &v329, v118, 8LL, 1LL, 0LL);
if ( v120 )
{
v121 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v116 = *(_QWORD *)(v121 + 176);
*(_QWORD *)(v121 + 176) = v120;
}
if ( !qword_7102CBF138 )
{
v122 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v123 = v120;
if ( v120 )
goto LABEL_497;
v124 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v125 = (__int64 *)(v124 + 176);
if ( !v124 )
v125 = (__int64 *)(v122 + 8);
v123 = *v125;
if ( *v125 )
{
LABEL_497:
v126 = (*(__int64 (**)(void))(*(_QWORD *)v123 + 48LL))();
goto LABEL_217;
}
v127 = 0LL;
}
else
{
v126 = malloc(0x60uLL);
LABEL_217:
v127 = v126;
}
sub_710125A550(v127, v120, 3LL);
*(_QWORD *)v127 = &off_7102BB4208;
qword_7102CBF130 = v127;
v128 = (__int64 *)(v127 + 32);
*(_DWORD *)(v127 + 48) = 0;
*(_DWORD *)(v127 + 72) = 0;
*(_QWORD *)(v127 + 32) = v127 + 32;
*(_QWORD *)(v127 + 40) = v127 + 32;
*(_QWORD *)(v127 + 56) = v127 + 56;
*(_QWORD *)(v127 + 64) = v127 + 56;
*(_QWORD *)(v127 + 80) = 0LL;
*(_QWORD *)(v127 + 88) = 0LL;
if ( qword_7102CBF018 )
{
v129 = sub_710125F180(v127);
v130 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
if ( v129 )
goto LABEL_498;
v131 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v132 = (__int64 *)(v131 + 176);
if ( !v131 )
v132 = (__int64 *)(v130 + 8);
v129 = *v132;
if ( *v132 )
{
LABEL_498:
v133 = (*(__int64 (**)(void))(*(_QWORD *)v129 + 48LL))();
goto LABEL_228;
}
v134 = 0LL;
}
else
{
v133 = malloc(0x78uLL);
LABEL_228:
v134 = v133;
}
*(_QWORD *)(v134 + 32) = 0LL;
v135 = (__int64 *)(v134 + 32);
*(_QWORD *)(v134 + 40) = 0LL;
*(_QWORD *)(v134 + 48) = v134;
*(_QWORD *)(v134 + 56) = 0LL;
*(_QWORD *)(v134 + 16) = 0LL;
*(_QWORD *)(v134 + 24) = 0LL;
*(_QWORD *)v134 = &off_7102BB3CD8;
*(_QWORD *)(v134 + 8) = 0LL;
if ( qword_7102CBF018 )
{
v136 = sub_710125F180(v134);
*(_QWORD *)(v134 + 8) = v136;
if ( v136 )
{
v137 = v136;
if ( *(_BYTE *)(v136 + 216) & 1 )
{
v138 = v136 + 152;
nn::os::LockMutex(v136 + 184);
}
else
{
v138 = 0LL;
}
v139 = *(_QWORD *)(v137 + 120);
v140 = (_QWORD *)(*(signed int *)(v137 + 140) + v134);
*(_QWORD *)(v137 + 120) = v140;
*v140 = v139;
v140[1] = v137 + 120;
if ( v139 )
*(_QWORD *)(v139 + 8) = v140;
++*(_DWORD *)(v137 + 136);
if ( v138 )
nn::os::UnlockMutex(v138 + 32);
}
}
*(_BYTE *)(v134 + 84) = 0;
*(_QWORD *)(v134 + 64) = &off_7102A701C8;
*(_QWORD *)(v134 + 72) = v134 + 84;
*(_DWORD *)(v134 + 80) = 32;
*(_BYTE *)(v134 + 115) = 0;
*(_QWORD *)v134 = off_7102BB4228;
*(_QWORD *)(v127 + 80) = v134;
*(_QWORD *)(v127 + 88) = v134;
v141 = *(__int16 **)(v134 + 72);
if ( v141 != &word_7102711714 )
{
v142 = *(_DWORD *)(v134 + 80);
if ( v142 <= 0 )
v143 = v142 - 1;
else
v143 = 0;
v144 = v143;
memset_0(*(_QWORD *)(v134 + 72), 0LL, v143);
*((_BYTE *)v141 + v144) = 0;
}
v145 = *(_QWORD *)(v134 + 56);
if ( v145 )
{
v146 = *(_QWORD *)(v134 + 32);
v147 = (__int64 **)(v134 + 40);
*(_QWORD *)(v134 + 56) = 0LL;
if ( v146 )
*(_QWORD *)(v146 + 8) = *v147;
if ( *v147 )
**v147 = *v135;
*v135 = 0LL;
*(_QWORD *)(v134 + 40) = 0LL;
--*(_DWORD *)(v145 + 16);
}
else
{
v147 = (__int64 **)(v134 + 40);
}
*(_QWORD *)(v134 + 56) = v128;
v148 = *v128;
*v128 = (__int64)v135;
*(_QWORD *)(v134 + 32) = v148;
*v147 = v128;
if ( v148 )
*(_QWORD *)(v148 + 8) = v135;
v113 = (_QWORD **)&unk_7102CBE000;
++*(_DWORD *)(v127 + 48);
}
qword_7102CBF138 = v127;
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v120 + 40LL))(v120);
if ( v116 != 1 )
*(_QWORD *)(nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136)) + 176) = v116;
v149 = (*(__int64 (__fastcall **)(__int64, signed __int64))(*(_QWORD *)v118 + 128LL))(v118, 8LL);
v329 = &off_7102A6E6C0;
v330 = "sead::FileDeviceMgr";
v150 = 1LL;
v151 = sub_710125CD50(v149, &v329, v118, 8LL, 1LL, 0LL);
if ( v151 )
{
v152 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v150 = *(_QWORD *)(v152 + 176);
*(_QWORD *)(v152 + 176) = v151;
}
if ( !qword_7102CBEE58 )
{
v153 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v154 = v151;
if ( v151 )
goto LABEL_499;
v155 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v156 = (__int64 *)(v155 + 176);
if ( !v155 )
v156 = (__int64 *)(v153 + 8);
v154 = *v156;
if ( *v156 )
{
LABEL_499:
v157 = (*(__int64 (**)(void))(*(_QWORD *)v154 + 48LL))();
goto LABEL_266;
}
v158 = 0LL;
}
else
{
v157 = malloc(0x58uLL);
LABEL_266:
v158 = v157;
}
sub_710125A550(v158, v151, 3LL);
*(_QWORD *)v158 = &off_7102BB2E28;
qword_7102CBEE50 = v158;
*(_DWORD *)(v158 + 48) = 0;
*(_QWORD *)(v158 + 32) = v158 + 32;
*(_QWORD *)(v158 + 40) = v158 + 32;
*(_WORD *)(v158 + 80) = 0;
*(_QWORD *)(v158 + 56) = 0LL;
*(_QWORD *)(v158 + 64) = 0LL;
*(_QWORD *)(v158 + 72) = 0LL;
if ( qword_7102CBF018 )
{
v159 = sub_710125F180(v158);
v329 = 0LL;
nn::fs::QueryMountRomCacheSize((nn::fs *)&v329, v160);
v161 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v162 = v159;
if ( v159 )
goto LABEL_500;
v163 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v165 = (__int64 *)(v163 + 176);
if ( !v163 )
v165 = (__int64 *)(v161 + 8);
v162 = *v165;
if ( *v165 )
{
LABEL_500:
v166 = (*(__int64 (**)(void))(*(_QWORD *)v162 + 48LL))();
goto LABEL_275;
}
v167 = 0LL;
}
else
{
v166 = malloc((unsigned __int64)v329);
LABEL_275:
v167 = (const char *)v166;
}
*(_QWORD *)(v158 + 72) = v167;
nn::fs::MountRom((nn::fs *)"content", v167, v329, v164);
v168 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v169 = v159;
if ( v159 )
goto LABEL_501;
v170 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v171 = (__int64 *)(v170 + 176);
if ( !v170 )
v171 = (__int64 *)(v168 + 8);
v169 = *v171;
if ( *v171 )
{
LABEL_501:
v172 = (*(__int64 (**)(void))(*(_QWORD *)v169 + 48LL))();
goto LABEL_283;
}
v173 = 0LL;
}
else
{
v172 = malloc(0x88uLL);
LABEL_283:
v173 = v172;
}
sub_710124C770(v173, v159);
*(_QWORD *)(v158 + 64) = v173;
sub_710124C290(v158, v173, &off_7102BB4150);
*(_QWORD *)(v158 + 56) = *(_QWORD *)(v158 + 64);
}
v113 = (_QWORD **)&unk_7102CBE000;
qword_7102CBEE58 = v158;
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v151 + 40LL))(v151);
if ( v150 != 1 )
*(_QWORD *)(nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136)) + 176) = v150;
v174 = (nn::oe *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v118 + 40LL))(v118);
nn::oe::Initialize(v174);
nn::oe::SetPerformanceConfiguration(0LL, 2451701768LL);
if ( dword_7102CBEF68 )
v175 = (nn::os *)*v113[494];
else
v175 = 0LL;
v329 = &off_7102A6E6C0;
v330 = "GameConfig";
v176 = sub_710125CD50(0LL, &v329, v175, 8LL, 1LL, 0LL);
v177 = v176;
if ( !qword_7102CA47A8 )
{
v178 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
if ( v176 )
goto LABEL_502;
v179 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v180 = (__int64 *)(v179 + 176);
if ( !v179 )
v180 = (__int64 *)(v178 + 8);
v176 = *v180;
if ( *v180 )
{
LABEL_502:
v181 = (*(__int64 (**)(void))(*(_QWORD *)v176 + 48LL))();
goto LABEL_299;
}
v182 = 0LL;
}
else
{
v181 = malloc(0x840uLL);
LABEL_299:
v182 = v181;
}
sub_710125A550(v182 + 1696, v177, 3LL);
*(_QWORD *)(v182 + 1696) = &off_7102B7DDC0;
qword_7102CA47A0 = v182 + 1696;
memset_0(v182 + 40, 0LL, 312LL);
*(_QWORD *)v182 = off_7102BFFC28;
*(_QWORD *)(v182 + 408) = &off_7102A7A300;
*(_QWORD *)(v182 + 416) = v182 + 428;
*(_QWORD *)(v182 + 688) = 0x1000000000000LL;
*(_QWORD *)(v182 + 704) = v182 + 716;
*(_DWORD *)(v182 + 980) = -1;
*(_QWORD *)(v182 + 1000) = v182 + 1012;
*(_DWORD *)(v182 + 1008) = 32;
*(_QWORD *)(v182 + 992) = &off_7102A701C8;
*(_QWORD *)(v182 + 1064) = v182 + 1076;
*(_QWORD *)(v182 + 1344) = v182 + 1356;
*(_QWORD *)(v182 + 1624) = v182 + 1636;
*(_DWORD *)(v182 + 1632) = 16;
*(_QWORD *)(v182 + 384) = &off_7102BFFC70;
*(_QWORD *)(v182 + 392) = 0LL;
*(_BYTE *)(v182 + 400) = 0;
*(_DWORD *)(v182 + 424) = 256;
*(_BYTE *)(v182 + 683) = 0;
*(_QWORD *)(v182 + 1616) = &off_7102A70140;
*(_BYTE *)(v182 + 428) = 0;
*(_DWORD *)(v182 + 712) = 256;
*(_BYTE *)(v182 + 971) = 0;
*(_BYTE *)(v182 + 716) = 0;
*(_QWORD *)(v182 + 696) = &off_7102A7A300;
*(_BYTE *)(v182 + 976) = 0;
*(_WORD *)(v182 + 988) = 0;
*(_DWORD *)(v182 + 984) = 0;
*(_BYTE *)(v182 + 1043) = 0;
*(_BYTE *)(v182 + 1012) = 0;
*(_WORD *)(v182 + 1048) = 0;
*(_DWORD *)(v182 + 1072) = 256;
*(_BYTE *)(v182 + 1331) = 0;
*(_BYTE *)(v182 + 1076) = 0;
*(_QWORD *)(v182 + 1056) = &off_7102A7A300;
*(_DWORD *)(v182 + 1352) = 256;
*(_BYTE *)(v182 + 1611) = 0;
*(_BYTE *)(v182 + 1356) = 0;
*(_QWORD *)(v182 + 1336) = &off_7102A7A300;
*(_BYTE *)(v182 + 1651) = 0;
*(_BYTE *)(v182 + 1636) = 0;
*(_WORD *)(v182 + 1656) = 0;
qword_7102CE0E78 = v182;
*(_BYTE *)(v182 + 985) = 1;
*(_BYTE *)(v182 + 977) = 0;
*(_QWORD *)(v182 + 1664) = &off_7102BB3CD8;
*(_QWORD *)(v182 + 1688) = 0LL;
*(_QWORD *)(v182 + 1680) = 0LL;
*(_QWORD *)(v182 + 1672) = 0LL;
if ( qword_7102CBF018 )
{
v183 = sub_710125F180(v182 + 1664);
*(_QWORD *)(v182 + 1672) = v183;
if ( v183 )
{
v184 = v183;
if ( *(_BYTE *)(v183 + 216) & 1 )
{
v185 = v183 + 152;
nn::os::LockMutex(v183 + 184);
}
else
{
v185 = 0LL;
}
v186 = *(_QWORD *)(v184 + 120);
v187 = (_QWORD *)(*(signed int *)(v184 + 140) + v182 + 1664);
*(_QWORD *)(v184 + 120) = v187;
*v187 = v186;
v187[1] = v184 + 120;
if ( v186 )
*(_QWORD *)(v186 + 8) = v187;
++*(_DWORD *)(v184 + 136);
if ( v185 )
nn::os::UnlockMutex(v185 + 32);
}
}
*(_QWORD *)v182 = off_7102B7DDE0;
*(_QWORD *)(v182 + 1664) = off_7102B7DE28;
*(_DWORD *)(v182 + 1728) = 0;
*(_BYTE *)(v182 + 1732) = 0;
*(_QWORD *)(v182 + 1744) = v182 + 1756;
*(_DWORD *)(v182 + 1752) = 256;
*(_BYTE *)(v182 + 2011) = 0;
*(_BYTE *)(v182 + 1756) = 0;
*(_QWORD *)(v182 + 1736) = &off_7102A7A300;
*(_BYTE *)(v182 + 2016) = 0;
*(_QWORD *)(v182 + 2025) = 0LL;
*(_QWORD *)(v182 + 2020) = 0LL;
*(_QWORD *)(v182 + 2043) = 0LL;
*(_QWORD *)(v182 + 2036) = 0LL;
*(_QWORD *)(v182 + 2052) = 0xFFFFFFFFLL;
*(_WORD *)(v182 + 2060) = 257;
*(_QWORD *)(v182 + 2104) = 0LL;
*(_QWORD *)(v182 + 2069) = 0LL;
*(_QWORD *)(v182 + 2062) = 0LL;
*(_QWORD *)(v182 + 2095) = 0LL;
*(_QWORD *)(v182 + 2088) = 0LL;
*(_QWORD *)(v182 + 2080) = 0LL;
qword_7102CA47A8 = v182;
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v177 + 40LL))(v177);
if ( !qword_7102CA49B8 )
{
v188 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v189 = v175;
if ( v175 )
goto LABEL_503;
v190 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v191 = (nn::os **)(v190 + 176);
if ( !v190 )
v191 = (nn::os **)(v188 + 8);
v189 = *v191;
if ( *v191 )
{
LABEL_503:
v192 = (*(__int64 (**)(void))(*(_QWORD *)v189 + 48LL))();
goto LABEL_318;
}
v193 = 0LL;
}
else
{
v192 = malloc(0x30uLL);
LABEL_318:
v193 = v192;
}
sub_710125A550(v193 + 8, v175, 3LL);
*(_QWORD *)(v193 + 8) = &off_7102B7E2D8;
qword_7102CA49B0 = v193 + 8;
*(_QWORD *)v193 = &off_7102B7E2F8;
*(_DWORD *)(v193 + 40) = 0x10000;
*(_BYTE *)(v193 + 44) = 0;
qword_7102CA49B8 = v193;
}
qword_7102CBEED0 = (__int64)sub_71010719C0;
v194 = __ldar((unsigned __int8 *)&unk_7102CBE000);
if ( !((unsigned __int64)&unk_7102CBE000 & 1) && (unsigned int)_cxa_guard_acquire_0(&unk_7102CCEB08) )
{
qword_7102CCEB10 = 4638564681600LL;
_cxa_guard_release_0(&unk_7102CCEB08);
}
v195 = qword_7102CCEB10;
v196 = __ldar((unsigned __int8 *)&qword_7102CCDFFC + 4);
if ( !(((unsigned __int64)&qword_7102CCDFFC + 4) & 1) && (unsigned int)_cxa_guard_acquire_0(&unk_7102CCEB08) )
{
qword_7102CCEB10 = 4638564681600LL;
_cxa_guard_release_0(&unk_7102CCEB08);
}
v197 = HIDWORD(qword_7102CCEB10);
v198 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v199 = v175;
if ( v175 )
goto LABEL_504;
v200 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v201 = (nn::os **)(v200 + 176);
if ( !v200 )
v201 = (nn::os **)(v198 + 8);
v199 = *v201;
if ( *v201 )
{
LABEL_504:
v199 = (nn::os *)(*(__int64 (**)(void))(*(_QWORD *)v199 + 48LL))();
goto LABEL_329;
}
v202 = 0LL;
}
else
{
v199 = (nn::os *)malloc(0x288uLL);
LABEL_329:
v202 = v199;
}
*((_QWORD *)v202 + 2) = 0LL;
*((_QWORD *)v202 + 3) = &off_7102BB33C0;
*((_QWORD *)v202 + 19) = sub_7101250EA0;
*((_BYTE *)v202 + 8) = 0;
*((_DWORD *)v202 + 12) = 0;
*((_QWORD *)v202 + 4) = (char *)v202 + 32;
*((_QWORD *)v202 + 5) = (char *)v202 + 32;
*((_QWORD *)v202 + 7) = 0LL;
*((_DWORD *)v202 + 20) = 0;
*(_QWORD *)v202 = off_7102BB3060;
*((_DWORD *)v202 + 40) = 1;
*((_QWORD *)v202 + 8) = 0LL;
*((_QWORD *)v202 + 9) = 0LL;
*((_QWORD *)v202 + 11) = &off_7102A6E6C0;
*((_QWORD *)v202 + 12) = &word_7102711714;
*((_QWORD *)v202 + 13) = &off_7102A6E6C0;
*((_QWORD *)v202 + 14) = &word_7102711714;
*((_QWORD *)v202 + 15) = &off_7102A6E6C0;
*((_QWORD *)v202 + 16) = &word_7102711714;
*((_QWORD *)v202 + 17) = 0LL;
*((_QWORD *)v202 + 18) = 0LL;
*(_QWORD *)((char *)v202 + 172) = 4575657222465388544LL;
*(_QWORD *)((char *)v202 + 188) = 844424930131968LL;
*(_QWORD *)((char *)v202 + 196) = 17592187092992LL;
*(_QWORD *)((char *)v202 + 204) = 0x1000000LL;
*(_QWORD *)((char *)v202 + 212) = 2251804108652543LL;
*(_QWORD *)((char *)v202 + 220) = 0x40000LL;
*(_QWORD *)((char *)v202 + 164) = 4539628425446424576LL;
*((_DWORD *)v202 + 45) = v195;
*((_DWORD *)v202 + 46) = v197;
*(_QWORD *)((char *)v202 + 228) = 8589967660LL;
*((_QWORD *)v202 + 30) = 0LL;
v203 = (nn::os *)nn::os::GetSystemTick(v199);
*((_QWORD *)v202 + 33) = off_7102BB3198;
*((_QWORD *)v202 + 34) = 4575657222473777152LL;
*((_DWORD *)v202 + 132) = 16777217;
*(_QWORD *)v202 = off_7102BD0108;
*((_QWORD *)v202 + 67) = off_7102BD0270;
*((_DWORD *)v202 + 138) = 2;
*((_QWORD *)v202 + 35) = 0LL;
*((_QWORD *)v202 + 36) = 4575657222473777152LL;
*((_DWORD *)v202 + 94) = 0;
*((_BYTE *)v202 + 532) = 0;
*((_QWORD *)v202 + 19) = 0LL;
*((_QWORD *)v202 + 68) = &off_7102BD02C8;
*((_DWORD *)v202 + 139) = 3;
*((_QWORD *)v202 + 31) = v203;
*((_QWORD *)v202 + 32) = 0LL;
*((_QWORD *)v202 + 45) = 0LL;
*((_QWORD *)v202 + 46) = 0LL;
*((_QWORD *)v202 + 43) = 0LL;
*((_QWORD *)v202 + 44) = 0LL;
*((_QWORD *)v202 + 41) = 0LL;
*((_QWORD *)v202 + 42) = 0LL;
*((_QWORD *)v202 + 39) = 0LL;
*((_QWORD *)v202 + 40) = 0LL;
*((_QWORD *)v202 + 37) = 0LL;
*((_QWORD *)v202 + 38) = 0LL;
*((_QWORD *)v202 + 54) = 0LL;
*((_QWORD *)v202 + 55) = 0LL;
*((_QWORD *)v202 + 52) = 0LL;
*((_QWORD *)v202 + 53) = 0LL;
*((_QWORD *)v202 + 50) = 0LL;
*((_QWORD *)v202 + 51) = 0LL;
*((_QWORD *)v202 + 48) = 0LL;
*((_QWORD *)v202 + 49) = 0LL;
*((_QWORD *)v202 + 56) = 0LL;
*((_QWORD *)v202 + 57) = &off_7102A6E6C0;
*((_QWORD *)v202 + 58) = &word_7102711714;
*((_QWORD *)v202 + 59) = 0LL;
v204 = (nn::oe *)nn::os::GetSystemTick(v203);
*((_QWORD *)v202 + 74) = 0LL;
*((_QWORD *)v202 + 73) = 0LL;
*((_BYTE *)v202 + 604) = 1;
*((_QWORD *)v202 + 72) = v204;
*((_DWORD *)v202 + 150) = 0x40000000;
*(_DWORD *)((char *)v202 + 605) = 0;
v205 = *((_DWORD *)v202 + 138);
*((_DWORD *)v202 + 140) = v205;
*((_DWORD *)v202 + 141) = v205;
*((_DWORD *)v202 + 142) = v205;
*((_QWORD *)v202 + 77) = 8589934594LL;
*((_QWORD *)v202 + 78) = 0LL;
v206 = (nn::oe *)nn::oe::GetOperationMode(v204);
*((_DWORD *)v202 + 158) = (_DWORD)v206;
*((_DWORD *)v202 + 159) = nn::oe::GetPerformanceMode(v206);
*((_BYTE *)v202 + 640) = 0;
v329 = &off_7102A6E6C0;
v330 = "GraphicsSystem";
v207 = sub_710125CD50(50331648LL, &v329, v175, 8LL, 1LL, 0LL);
v209 = __ldar((unsigned __int8 *)&unk_7102CCEB18);
v210 = v207;
if ( !((unsigned __int64)&unk_7102CCEB18 & 1) && (unsigned int)_cxa_guard_acquire_0(&unk_7102CCEB18) )
{
qword_7102CCEB20 = 3092376454400LL;
_cxa_guard_release_0(&unk_7102CCEB18);
}
v211 = (float)SHIDWORD(qword_7102CCEB20);
v212 = (float)(signed int)qword_7102CCEB20;
nv::SetGraphicsAllocator(
(nv *)&sub_710124F3F0,
(void *(__cdecl *)(unsigned __int64, unsigned __int64, void *))j_free,
(void (__cdecl *)(void *, void *))j_realloc,
0LL,
v208);
v213 = (nv *)(*(__int64 (__fastcall **)(__int64, _QWORD, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
*((unsigned int *)v202 + 51),
4096LL);
v215 = (nn::vi *)nv::InitializeGraphics(v213, (void *)*((unsigned int *)v202 + 51), v214);
if ( *((_DWORD *)v202 + 52) )
{
v216 = (void *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v210 + 48LL))(v210);
if ( qword_7102CBF018 )
v217 = (nn::mem::StandardAllocator *)(*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
72LL,
8LL);
else
v217 = (nn::mem::StandardAllocator *)malloc(0x48uLL);
v218 = (void *(__cdecl *)(void *, unsigned __int64, void *))v217;
nn::mem::StandardAllocator::StandardAllocator(v217, v216, *((unsigned int *)v202 + 52));
*((_QWORD *)v202 + 48) = v218;
v215 = (nn::vi *)nv::SetGraphicsDevtoolsAllocator(
(nv *)sub_710124F420,
(void *(__cdecl *)(unsigned __int64, unsigned __int64, void *))sub_710124F440,
(void (__cdecl *)(void *, void *))sub_710124F450,
v218,
v219);
}
nn::vi::Initialize(v215);
nn::vi::OpenDefaultDisplay((nn::os *)((char *)v202 + 424), v220);
nn::vi::CreateLayer((char *)v202 + 432, *((_QWORD *)v202 + 53));
nn::vi::SetLayerScalingMode(*((_QWORD *)v202 + 54), 2LL);
nn::vi::GetDisplayVsyncEvent((char *)v202 + 480, *((_QWORD *)v202 + 53));
v221 = (float)*((unsigned int *)v202 + 46);
v222 = (float)*((unsigned int *)v202 + 45);
*((float *)v202 + 68) = v212;
*((float *)v202 + 69) = v211;
*((_QWORD *)v202 + 35) = 0LL;
*((float *)v202 + 73) = v221;
*((float *)v202 + 72) = v222;
v223 = (unsigned __int8 (*)(void))nvnBootstrapLoader_0("nvnDeviceInitialize");
v224 = nvnBootstrapLoader_0("nvnDeviceGetProcAddress");
if ( !v223 )
goto LABEL_460;
v225 = v224;
if ( !v224 )
goto LABEL_460;
sub_7101D3ABA0(0LL, v224);
qword_7102D2EE50(&v329);
if ( *((_BYTE *)v202 + 190) )
{
v226 = *((_DWORD *)v202 + 56) - 1;
v227 = v226 > 3 ? 32LL : (unsigned __int64)dword_710260EEB0[v226];
}
else
{
v227 = 0LL;
}
qword_7102D2EE58(&v329, v227);
v228 = qword_7102CBF018 ? (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
12288LL,
8LL) : malloc(0x3000uLL);
v229 = v228;
if ( !v223() )
goto LABEL_460;
sub_7101D3ABA0(v229, v225);
qword_7102D2EE88(v229, 0LL, &v329);
qword_7102D2EE88(v229, 1LL, &v355);
if ( (_DWORD)v329 != 53 || (signed int)v355 < 311 )
goto LABEL_460;
if ( *((_BYTE *)v202 + 190) || *((_BYTE *)v202 + 191) )
{
qword_7102D2EEB8(v229, sub_710125A0A0, 0LL, 1LL);
v230 = *((_BYTE *)v202 + 191);
if ( *((_BYTE *)v202 + 190) )
v231 = 1;
else
v231 = *((_BYTE *)v202 + 191);
}
else
{
v231 = 0;
v230 = 0;
}
v232 = *((_DWORD *)v202 + 57);
if ( qword_7102CBF018 )
{
v233 = (_QWORD *)(*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
520LL,
8LL);
v234 = qword_7102CBF018;
v235 = (__int64)v233;
v233[2] = 0LL;
v233[3] = 0LL;
*v233 = &off_7102BB3CD8;
v233[1] = 0LL;
if ( v234 )
{
v236 = sub_710125F180(v233);
*(_QWORD *)(v235 + 8) = v236;
if ( v236 )
{
v237 = v236;
if ( *(_BYTE *)(v236 + 216) & 1 )
{
v238 = v236 + 152;
nn::os::LockMutex(v236 + 184);
}
else
{
v238 = 0LL;
}
v239 = *(_QWORD *)(v237 + 120);
v240 = (_QWORD *)(*(signed int *)(v237 + 140) + v235);
*(_QWORD *)(v237 + 120) = v240;
*v240 = v239;
v240[1] = v237 + 120;
if ( v239 )
*(_QWORD *)(v239 + 8) = v240;
++*(_DWORD *)(v237 + 136);
if ( v238 )
nn::os::UnlockMutex(v238 + 32);
}
}
}
else
{
v235 = malloc(0x208uLL);
*(_QWORD *)(v235 + 16) = 0LL;
*(_QWORD *)(v235 + 24) = 0LL;
*(_QWORD *)v235 = &off_7102BB3CD8;
*(_QWORD *)(v235 + 8) = 0LL;
}
*(_QWORD *)v235 = off_7102BB3B48;
*(_QWORD *)(v235 + 248) = 0LL;
*(_QWORD *)(v235 + 32) = 0LL;
*(_QWORD *)(v235 + 40) = 0LL;
*(_QWORD *)(v235 + 48) = v229;
*(_QWORD *)(v235 + 72) = 0LL;
*(_QWORD *)(v235 + 80) = 0LL;
*(_QWORD *)(v235 + 56) = 0LL;
*(_QWORD *)(v235 + 64) = 0LL;
*(_DWORD *)(v235 + 264) = 0;
*(_DWORD *)(v235 + 268) = 0;
*(_DWORD *)(v235 + 272) = v232;
*(_DWORD *)(v235 + 276) = 4096;
sub_710126C630(v235 + 280);
sub_710126C630(v235 + 344);
sub_710126C630(v235 + 408);
*(_QWORD *)(v235 + 472) = off_7102BB3C38;
*(_QWORD *)(v235 + 480) = v235;
*(_QWORD *)(v235 + 488) = nullsub_5714;
*(_QWORD *)(v235 + 496) = 0LL;
*(_QWORD *)(v235 + 504) = v235 + 472;
v241 = *(_QWORD *)(v235 + 48);
*(_BYTE *)(v235 + 512) = 0;
*(_BYTE *)(v235 + 513) = v230;
*(_BYTE *)(v235 + 514) = v231;
qword_7102D2EEC8(v241, 1LL);
qword_7102CBF6E0 = v235;
if ( qword_7102CBF018 )
v242 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
96LL,
8LL);
else
v242 = malloc(0x60uLL);
v243 = v242;
*(_QWORD *)v242 = &off_7102BB4D30;
*(_DWORD *)(v242 + 8) = 0;
v244 = (_QWORD *)&unk_7102CBF000;
sub_710126C630(v242 + 16);
v245 = *(_QWORD *)v235;
*(_QWORD *)(v235 + 40) = v243;
(*(void (__fastcall **)(__int64, __int64))(v245 + 16))(v235, v210);
nn::os::LockMutex(*(_QWORD *)(v235 + 40) + 48LL);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v235 + 24LL))(v235, v210);
nn::os::UnlockMutex(*(_QWORD *)(v235 + 40) + 48LL);
qword_7102D2EF70(&v329);
qword_7102D2EF78(&v329, 1LL);
qword_7102D2EF68(&v329, *(_QWORD *)(qword_7102CBF6E0 + 48));
LODWORD(v355) = *((_DWORD *)v202 + 53);
v246 = v355;
if ( (_DWORD)v355 == -1 )
{
qword_7102D2EE88(v229, 85LL, &v355);
v246 = v355;
}
qword_7102D2EF88(&v329, v246);
LODWORD(v355) = *((_DWORD *)v202 + 54);
v247 = v355;
if ( (_DWORD)v355 == -1 )
{
qword_7102D2EE88(v229, 82LL, &v355);
v247 = v355;
}
qword_7102D2EF80(&v329, v247);
LODWORD(v355) = *((_DWORD *)v202 + 55);
v248 = v355;
if ( (_DWORD)v355 == -1 )
{
qword_7102D2EE88(v229, 92LL, &v355);
v248 = v355;
}
qword_7102D2EF90(&v329, v248);
v249 = qword_7102D2EF98(&v329);
v250 = v249;
v251 = (*(__int64 (__fastcall **)(__int64, __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(v210, v249, 4096LL);
qword_7102D2EFA0(&v329, v251, v250);
if ( qword_7102CBF018 )
v252 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
0x2000LL,
8LL);
else
v252 = malloc(0x2000uLL);
*((_QWORD *)v202 + 51) = v252;
qword_7102D2F000();
*(_QWORD *)(qword_7102CBF6E0 + 56) = *((_QWORD *)v202 + 51);
if ( qword_7102CBF018 )
v253 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
96LL,
8LL);
else
v253 = malloc(0x60uLL);
*(_DWORD *)(v253 + 32) = 0;
*(_QWORD *)v253 = off_7102BB3B08;
*(_QWORD *)(v253 + 8) = 0LL;
*(_QWORD *)(v253 + 56) = 0LL;
*(_QWORD *)(v253 + 64) = 0LL;
*(_WORD *)(v253 + 72) = 513;
*(_BYTE *)(v253 + 74) = 0;
*(_QWORD *)(v253 + 84) = 0LL;
*(_QWORD *)(v253 + 76) = 0LL;
*(_QWORD *)(v253 + 16) = 0LL;
*(_QWORD *)(v253 + 24) = 0LL;
*(_QWORD *)(v253 + 40) = 0LL;
*(_QWORD *)(v253 + 48) = 0LL;
v254 = *((_QWORD *)v202 + 54);
*((_QWORD *)v202 + 38) = v253;
nn::vi::GetNativeWindow(&v329, v254);
*(_QWORD *)(*((_QWORD *)v202 + 38) + 64LL) = v329;
v255 = *((_QWORD *)v202 + 38);
v256 = *(_QWORD *)(v255 + 16);
*(_BYTE *)(v255 + 72) = *((_DWORD *)v202 + 40);
if ( v256 )
qword_7102D2F0D0();
if ( *((_BYTE *)v202 + 189) )
v257 = 3;
else
v257 = 2;
*(_BYTE *)(*((_QWORD *)v202 + 38) + 73LL) = v257;
v258 = (float)*((unsigned int *)v202 + 46);
v259 = (float *)*((_QWORD *)v202 + 38);
v260 = *(_QWORD *)v259;
v259[2] = (float)*((unsigned int *)v202 + 45);
v259[3] = v258;
(*(void (**)(void))(v260 + 16))();
v261 = *((_DWORD *)v202 + 40);
if ( v261 )
*((_QWORD *)v202 + 37) = (signed __int64)(float)((float)((float)((float)v261 + 0.02) / 60.0)
* (float)qword_7102CBFBA8);
*(_QWORD *)(qword_7102CBF6E0 + 80) = *((_QWORD *)v202 + 38);
v262 = __ldar((unsigned __int8 *)&unk_7102CBEEA0);
if ( !((unsigned __int64)&unk_7102CBEEA0 & 1) && (unsigned int)_cxa_guard_acquire_0(&unk_7102CBEEA0) )
{
qword_7102CBEEA8 = (unsigned int)(*((_DWORD *)v202 + 48) + 32) + 4095LL - ((*((_DWORD *)v202 + 48) + 31) & 0xFFF);
_cxa_guard_release_0(&unk_7102CBEEA0);
}
v263 = *(_QWORD *)(qword_7102CBF6E0 + 48);
if ( qword_7102CBF018 )
v264 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
160LL,
8LL);
else
v264 = malloc(0xA0uLL);
*((_QWORD *)v202 + 43) = v264;
qword_7102D2F950();
if ( qword_7102CBF018 )
v265 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
256LL,
8LL);
else
v265 = malloc(0x100uLL);
*((_QWORD *)v202 + 41) = v265;
qword_7102D2F138(&v329);
qword_7102D2F130(&v329, v263);
qword_7102D2F148(&v329, 18LL);
v266 = qword_7102CBEEA8;
if ( qword_7102CBF018 )
{
v267 = (*(__int64 (__fastcall **)(__int64, __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
qword_7102CBEEA8,
4096LL);
v266 = qword_7102CBEEA8;
}
else
{
v267 = malloc(qword_7102CBEEA8);
}
qword_7102D2F140(&v329, v267, v266);
qword_7102D2F170(*((_QWORD *)v202 + 41), &v329);
LODWORD(v355) = 0;
qword_7102D2EE88(v263, 20LL, &v355);
*((_QWORD *)v202 + 42) = (*(__int64 (__fastcall **)(__int64, _QWORD, _QWORD))(*(_QWORD *)v210 + 48LL))(
v210,
*((unsigned int *)v202 + 49),
(unsigned int)v355);
qword_7102D2F968(*((_QWORD *)v202 + 43), nullsub_5715);
v268 = *((_QWORD *)v202 + 43);
qword_7102D2F970();
*(_QWORD *)(qword_7102CBF6E0 + 64) = *((_QWORD *)v202 + 43);
qword_7102D2EE88(v229, 25LL, &v355);
qword_7102D2EE88(v229, 26LL, &v354);
qword_7102D2EE88(v229, 24LL, &v353);
v269 = v355 + v353 * *((_DWORD *)v202 + 50) - 1;
*((_DWORD *)v202 + 94) = ((v269 + ~(v269 - v269 / (unsigned int)v355 * (_DWORD)v355) + v354) / v354 * v354 + 4095) & 0xFFFFF000;
if ( qword_7102CBF018 )
v270 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
256LL,
8LL);
else
v270 = malloc(0x100uLL);
*((_QWORD *)v202 + 46) = v270;
qword_7102D2F138(&v329);
qword_7102D2F130(&v329, *(_QWORD *)(qword_7102CBF6E0 + 48));
qword_7102D2F148(&v329, 33LL);
if ( qword_7102CBF018 )
v271 = (*(__int64 (__fastcall **)(__int64, _QWORD, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
*((unsigned int *)v202 + 94),
4096LL);
else
v271 = malloc(*((unsigned int *)v202 + 94));
qword_7102D2F140(&v329, v271, *((unsigned int *)v202 + 94));
qword_7102D2F170(*((_QWORD *)v202 + 46), &v329);
qword_7102D2F240(&v329, *(_QWORD *)(qword_7102CBF6E0 + 48));
qword_7102D2F248(&v329);
qword_7102D2F250(&v329, *((_QWORD *)v202 + 41), *((unsigned int *)v202 + 48), 32LL);
if ( qword_7102CBF018 )
v272 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
48LL,
8LL);
else
v272 = malloc(0x30uLL);
*((_QWORD *)v202 + 44) = v272;
qword_7102D2F278();
*((_QWORD *)v202 + 45) = qword_7102D2F290(*((_QWORD *)v202 + 44));
if ( qword_7102CBF018 )
v273 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
64LL,
8LL);
else
v273 = malloc(0x40uLL);
*((_QWORD *)v202 + 56) = v273;
qword_7102D2FDC0();
if ( !*((_BYTE *)v202 + 188) )
goto LABEL_443;
v275 = *((_DWORD *)v202 + 45);
v274 = *((_DWORD *)v202 + 46);
v276 = *(_QWORD *)(qword_7102CBF6E0 + 48);
qword_7102D2F2D0(&v329, *(_QWORD *)(qword_7102CBF6E0 + 48));
qword_7102D2F2D8(&v329);
v326 = v275;
v328 = v274;
qword_7102D2F310(&v329, v275, v274);
qword_7102D2F2E8(&v329, 1LL);
qword_7102D2F328(&v329, 37LL);
qword_7102D2F2E0(&v329, 8LL);
v358 = v332;
v357 = v331;
v356 = (unsigned int *)v330;
v355 = (unsigned __int64)v329;
v362 = v336;
v361 = v335;
v360 = v334;
v359 = v333;
v366 = v340;
v365 = v339;
v364 = v338;
v363 = v337;
v370 = v344;
v369 = v343;
v368 = v342;
v367 = v341;
qword_7102D2F328(&v355, 53LL);
if ( !qword_7102CBF018 )
{
v277 = malloc(0x100uLL);
goto LABEL_426;
}
v277 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(v210, 256LL, 8LL);
if ( !qword_7102CBF018 )
{
LABEL_426:
v278 = malloc(0xC0uLL);
goto LABEL_427;
}
v278 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(v210, 192LL, 8LL);
if ( qword_7102CBF018 )
{
v279 = (*(__int64 (__fastcall **)(__int64, signed __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
192LL,
8LL);
goto LABEL_428;
}
LABEL_427:
v279 = malloc(0xC0uLL);
LABEL_428:
v325 = v279;
v280 = qword_7102D2F348(&v329);
v281 = (signed int)qword_7102D2F350(&v355);
v282 = (qword_7102D2F348(&v355) + (v280 + v281 - 1) / v281 * v281 + 4095) & 0xFFFFFFFFFFFFF000LL;
qword_7102D2F138(&v354);
qword_7102D2F130(&v354, v276);
qword_7102D2F148(&v354, 161LL);
if ( qword_7102CBF018 )
v283 = (*(__int64 (__fastcall **)(__int64, unsigned __int64, signed __int64))(*(_QWORD *)v210 + 48LL))(
v210,
v282,
4096LL);
else
v283 = malloc(v282);
qword_7102D2F140(&v354, v283, v282);
qword_7102D2F170(v277, &v354);
qword_7102D2F358(&v329, v277, 0LL);
v284 = qword_7102D2F348(&v329);
v285 = qword_7102D2F350(&v355);
v286 = v284 + v285 - 1;
v287 = v286 - v286 / v285 * v285;
qword_7102D2F498(v278, &v329);
v288 = qword_7102CBF6E0 + 376;
nn::os::LockMutex(qword_7102CBF6E0 + 376);
v290 = qword_7102CBF6E0;
do
v291 = __ldxr(v289);
while ( __stxr((_DWORD)v289 + 1, (unsigned int *)(v290 + 268)) );
qword_7102D2F1D8(v290 + 88);
nn::os::UnlockMutex(v288);
qword_7102D2F358(&v355, v277, v286 - v287);
qword_7102D2F498(v325, &v355);
v292 = qword_7102CBF6E0 + 376;
nn::os::LockMutex(qword_7102CBF6E0 + 376);
v294 = qword_7102CBF6E0;
do
v295 = __ldxr(v293);
while ( __stxr((_DWORD)v293 + 1, (unsigned int *)(v294 + 268)) );
qword_7102D2F1D8(v294 + 88);
nn::os::UnlockMutex(v292);
v296 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v297 = v210;
if ( v210 )
goto LABEL_505;
v298 = nn::os::GetTlsValue(*(unsigned int *)(qword_7102CBF648 + 136));
v299 = (__int64 *)(v298 + 176);
if ( !v298 )
v299 = (__int64 *)(v296 + 8);
v297 = *v299;
if ( *v299 )
LABEL_505:
v297 = (*(__int64 (**)(void))(*(_QWORD *)v297 + 48LL))();
}
else
{
v297 = malloc(0x30uLL);
}
*(float *)(v297 + 8) = v212;
*(float *)(v297 + 12) = v211;
*(_QWORD *)(v297 + 16) = 0LL;
*(_QWORD *)(v297 + 32) = v278;
*(_QWORD *)(v297 + 40) = v325;
v244 = &unk_7102CBF000;
*(_QWORD *)v297 = off_7102BB3A88;
*(float *)(v297 + 24) = (float)v326;
*(float *)(v297 + 28) = (float)v328;
*((_QWORD *)v202 + 32) = v297;
LABEL_443:
v300 = qword_7102CBF018;
if ( qword_7102CBF018 )
{
v301 = v210;
if ( v210 )
goto LABEL_506;
v302 = nn::os::GetTlsValue(*(unsigned int *)(v244[201] + 136LL));
v303 = (__int64 *)(v302 + 176);
if ( !v302 )
v303 = (__int64 *)(v300 + 8);
v301 = *v303;
if ( *v303 )
{
LABEL_506:
v304 = (*(__int64 (**)(void))(*(_QWORD *)v301 + 48LL))();
goto LABEL_450;
}
v305 = 0LL;
}
else
{
v304 = malloc(0x108uLL);
LABEL_450:
v305 = v304;
}
v306 = qword_7102CBF018;
v329 = &off_7102A6E6C0;
v330 = "Presentation Thread";
if ( qword_7102CBF018 )
{
v307 = v210;
if ( v210 )
goto LABEL_507;
v308 = nn::os::GetTlsValue(*(unsigned int *)(v244[201] + 136LL));
v309 = (__int64 *)(v308 + 176);
if ( !v308 )
v309 = (__int64 *)(v306 + 8);
v307 = *v309;
if ( *v309 )
{
LABEL_507:
v310 = (*(__int64 (**)(void))(*(_QWORD *)v307 + 48LL))();
goto LABEL_458;
}
v311 = 0LL;
}
else
{
v310 = malloc(0x20uLL);
LABEL_458:
v311 = (_QWORD *)v310;
}
*v311 = off_7102BB31C8;
v311[1] = v202;
v311[2] = sub_710124F480;
v311[3] = 0LL;
v312 = (nn::os *)sub_710126CB30(v305, &v329, v210, *((unsigned int *)v202 + 58), 0LL, 0x7FFFFFFFLL, 0x4000LL, 32LL);
*(_QWORD *)v305 = off_7102BB4800;
*(_QWORD *)(v305 + 48) = &off_7102BB48A8;
*(_QWORD *)(v305 + 256) = v311;
*((_QWORD *)v202 + 55) = v305;
LODWORD(v329) = 1;
*(_DWORD *)(v305 + 216) = 2;
v313 = *(unsigned int *)(v305 + 216);
nn::os::GetThreadAvailableCoreMask(v312);
nn::os::SetThreadCoreMask(*(_QWORD *)(v305 + 224), 0xFFFFFFFFLL, v313);
(*(void (**)(void))(**((_QWORD **)v202 + 55) + 48LL))();
LABEL_460:
*((_BYTE *)v202 + 532) = 2;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v210 + 40LL))(v210);
v314 = sub_7101A4ED50((nn::os *)"main");
if ( dword_7102CE0F20 >= dword_7102CE0F38 )
{
v315 = 0LL;
}
else
{
v315 = (nn::os **)qword_7102CE0F28;
if ( qword_7102CE0F28 )
qword_7102CE0F28 = *(_QWORD *)qword_7102CE0F28;
*v315 = 0LL;
v315[1] = 0LL;
v314 = (nn::os *)nn::os::GetSystemTick(v314);
*v315 = v314;
v315[3] = 0LL;
v315[2] = 0LL;
v316 = (__int64 *)(v315 + 2);
v317 = qword_7102CE0F10;
qword_7102CE0F10 = (__int64)v316;
*v316 = v317;
v315[3] = (nn::os *)&qword_7102CE0F10;
if ( v317 )
*(_QWORD *)(v317 + 8) = v316;
++dword_7102CE0F20;
}
*v315 = (nn::os *)nn::os::GetSystemTick(v314);
v315[1] = (nn::os *)"RootTask";
v350 = -1;
v351 = 1;
*(const char **)((char *)&v332 + 7) = 0LL;
v331 = 0LL;
v332 = 0LL;
*(__int64 *)((char *)&v335 + 7) = 0LL;
*(__int64 *)((char *)&v338 + 7) = 0LL;
*(__int64 *)((char *)&v341 + 7) = 0LL;
LODWORD(v343) = 0;
v352 = 0LL;
LODWORD(v329) = 2;
v330 = (const char *)sub_7100E46850;
v355 = 85899345920LL;
v334 = 0LL;
v335 = 0LL;
v337 = 0LL;
v338 = 0LL;
v340 = 0LL;
v341 = 0LL;
v348 = 0LL;
v349 = 0LL;
v346 = 0LL;
v347 = 0LL;
v344 = 0LL;
v345 = 0LL;
(*(void (__fastcall **)(nn::os *, nn::os *, void **, unsigned __int64 *))(*(_QWORD *)v202 + 40LL))(
v202,
v175,
&v329,
&v355);
v318 = qword_7102CC1F90;
if ( qword_7102CC1F90 && *(_BYTE *)(qword_7102CC1F90 + 104) )
{
v319 = *(_QWORD *)(qword_7102CC1F90 + 56);
if ( v319 )
(*(void (**)(void))(*(_QWORD *)v319 + 40LL))();
v320 = *(_QWORD *)(v318 + 64);
if ( v320 )
(*(void (**)(void))(*(_QWORD *)v320 + 48LL))();
if ( *(_DWORD *)(v318 + 88) )
{
v321 = *(_QWORD *)(v318 + 80);
if ( v321 != v318 + 72 )
{
v322 = *(signed int *)(v318 + 92);
v323 = v321 - v322;
do
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v323 + 48LL))(v323);
v323 = *(_QWORD *)(v323 + v322 + 8) - v322;
}
while ( v323 != v318 + 72 - *(signed int *)(v318 + 92) );
}
}
v324 = *(_QWORD *)(v318 + 40);
if ( v324 )
(*(void (**)(void))(*(_QWORD *)v324 + 40LL))();
*(_BYTE *)(v318 + 104) = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment