//
// sub_1004BE990 from 0x1004be990 to 0x1004beb0f (383 bytes)
//
// 1 xrefs:
// > sub_1004BE900 @ 0x1004be93b
//
// 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 12:31:04 +0000
//
std::string *__fastcall sub_1004BE990(__int64 a1)
{
NSOpenPanel *v1; // r14
id v2; // rax
NSString *v3; // rax
NSString *v4; // r15
id v5; // rax
id v6; // rax
std::string *result; // rax
NSArray *v8; // rax
id v9; // rax
const std::string::value_type *v10; // rax
v1 = +[NSOpenPanel openPanel](&OBJC_CLASS___NSOpenPanel, "openPanel");
v2 = sub_1004BE490(*(char **)(a1 + 32));
-[NSOpenPanel setAllowedFileTypes:](v1, "setAllowedFileTypes:", v2);
-[NSOpenPanel setCanChooseFiles:](v1, "setCanChooseFiles:", 1);
-[NSOpenPanel setCanChooseDirectories:](v1, "setCanChooseDirectories:", 0);
-[NSOpenPanel setAllowsMultipleSelection:](v1, "setAllowsMultipleSelection:", 0);
if ( *(_QWORD *)(a1 + 40) )
{
v3 = +[NSString stringWithUTF8String:](&OBJC_CLASS___NSString, "stringWithUTF8String:");
if ( v3 )
{
v4 = v3;
-[NSOpenPanel setTitle:](v1, "setTitle:", v3);
-[NSOpenPanel setMessage:](v1, "setMessage:", v4);
}
}
v5 = +[EAGLView sharedEGLView](&OBJC_CLASS___EAGLView, "sharedEGLView");
v6 = objc_msgSend(v5, "window");
if ( v6 )
{
-[NSOpenPanel beginSheetModalForWindow:completionHandler:](
v1,
"beginSheetModalForWindow:completionHandler:",
v6,
&stru_100B5AA78);
result = (std::string *)objc_msgSend(NSApp, "runModalForWindow:", v1);
if ( result != (std::string *)1 )
return result;
}
else
{
result = (std::string *)-[NSOpenPanel runModal](v1, "runModal");
if ( result != (std::string *)1 )
return result;
}
v8 = -[NSOpenPanel URLs](v1, "URLs");
v9 = -[NSArray firstObject](v8, "firstObject");
result = (std::string *)objc_msgSend(v9, "path");
if ( result )
{
v10 = (const std::string::value_type *)unk_100BEA350(result, "UTF8String");
return std::string::assign(*(std::string **)(a1 + 48), v10);
}
return result;
}