mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
* 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.
35 lines
1.1 KiB
C++
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)));
|
|
}
|
|
///////////////////////////////////////////////////////////////////////////////
|