42#if defined(SESE_PLATFORM_WINDOWS)
48 std::map<BinaryIds, RC> binariesMap;
51#elif defined(SESE_PLATFORM_APPLE)
56#if defined(SESE_PLATFORM_WINDOWS)
68 if (
auto iter = binariesMap.find(
id); iter != binariesMap.end()) {
69 return std::make_unique<ResourceStream>(iter->second.pResData, iter->second.dwSize);
71 HRSRC hResInfo = FindResource(hInstance, MAKEINTRESOURCE(
static_cast<int>(
id)), RT_RCDATA);
73 HGLOBAL hGlobal = LoadResource(hInstance, hResInfo);
74 DWORD dwSize = SizeofResource(hInstance, hResInfo);
75 LPVOID _RESOURCE_HEADER = LockResource(hResInfo);
76 binariesMap[id] = {hResInfo, hGlobal, dwSize};
77 return std::make_unique<ResourceStream>(
static_cast<const char *
>(hGlobal), dwSize);
80#elif defined(SESE_PLATFORM_LINUX)
90 auto res = R::syms[
static_cast<int>(id)];
91 return std::make_unique<ResourceStream>(res.start, res.size);
94#elif defined(SESE_PLATFORM_APPLE)
96static int rcs_addr_handle = 0;
100 auto index = dladdr(&rcs_addr_handle, &img_info);
109 auto name = R::syms[
static_cast<int>(id)];
110 auto header =
static_cast<struct mach_header_64 *
>(img_info.dli_fbase);
112 auto start = getsectiondata(header,
"__DATA", name, &size);
113 return std::make_unique<ResourceStream>(start, size);