r5sdk/r5dev/windows/resource.cpp
Kawe Mazidjatari c0511fa8e4 See description
* Add ConVar to allow user to set/unset FCVAR_DEVELOPMENTONLY ConVar's (default behavior would never be hit without this ConVar).
* Add icons to display the flags of a certain CommandBase.
* Fixed Dear ImGui not displaying images correctly (descriptor needs DXGI_FORMAT_R8G8B8A8_UNORM_SRGB due to the nature of this game).
* Dynamically obtain buffer sizes of resources taken from modules.
* Light SDK cleanup.
2022-04-26 20:24:51 +02:00

35 lines
1.1 KiB
C++

#include "core/stdafx.h"
#include "core/resource.h"
#include "windows/resource.h"
/*-----------------------------------------------------------------------------
* _resource.cpp
*-----------------------------------------------------------------------------*/
//#############################################################################
//
//#############################################################################
MODULERESOURCE GetModuleResource(int iResource)
{
static HGLOBAL rcData = NULL;
HMODULE handle;
GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)"unnamed", &handle);
HRSRC rc = FindResource(handle, MAKEINTRESOURCE(iResource), MAKEINTRESOURCE(PNG));
if (!rc)
{
assert(rc == NULL);
return MODULERESOURCE();
}
rcData = LoadResource(handle, rc);
if (!rcData)
{
assert(rcData == NULL);
return MODULERESOURCE();
}
return (MODULERESOURCE(LockResource(rcData), SizeofResource(handle, rc)));
}
///////////////////////////////////////////////////////////////////////////////