Skip to content

Commit

Permalink
Merge branch 'develop' into pooling_uint8_error
Browse files Browse the repository at this point in the history
  • Loading branch information
causten authored Apr 24, 2024
2 parents a1bf49b + a19fdf6 commit 9f5d573
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions cmake/Embed.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,23 @@ ${RC_FILE_MAPPING}
namespace resource {
std::string_view read(int id)
{
HMODULE handle = GetModuleHandle(nullptr);
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(id), MAKEINTRESOURCE(TEXTFILE));
HGLOBAL data = LoadResource(handle, rc);
return {static_cast<const char*>(LockResource(data)), SizeofResource(handle, rc)};
HMODULE handle;
if(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCSTR>(${EMBED_NAME}),
&handle) != 0)
{
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(id), MAKEINTRESOURCE(TEXTFILE));
if(rc != nullptr)
{
HGLOBAL data = LoadResource(handle, rc);
if(data != nullptr)
{
return {static_cast<const char*>(LockResource(data)), SizeofResource(handle, rc)};
}
}
}
return std::string_view{};
}
}
")
Expand Down
2 changes: 1 addition & 1 deletion src/driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ struct loader
std::ofstream fs;
if(not output.empty())
{
fs.open(output);
fs.open(output, std::ios::binary);
os = &fs;
}

Expand Down

0 comments on commit 9f5d573

Please sign in to comment.