mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Optional lunar.png loading from file
This commit is contained in:
parent
70e449fed0
commit
7d4e85b1dc
1 changed files with 17 additions and 6 deletions
|
@ -567,15 +567,26 @@ void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float size
|
|||
{
|
||||
if ( !gpMoonMask )
|
||||
{
|
||||
HMODULE thisModule;
|
||||
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)DrawMoonWithPhases, &thisModule);
|
||||
|
||||
if ( GetFileAttributes("lunar.png") != INVALID_FILE_ATTRIBUTES )
|
||||
{
|
||||
// load from file
|
||||
gpMoonMask = CPNGFile::ReadFromFile("lunar.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load from memory
|
||||
|
||||
HRSRC resource = FindResource(thisModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA);
|
||||
void* pMoonMask = static_cast<void*>(LoadResource(thisModule, resource));
|
||||
HMODULE thisModule;
|
||||
GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)DrawMoonWithPhases, &thisModule);
|
||||
|
||||
gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(thisModule, resource));
|
||||
HRSRC resource = FindResource(thisModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA);
|
||||
void* pMoonMask = static_cast<void*>(LoadResource(thisModule, resource));
|
||||
|
||||
FreeResource(pMoonMask);
|
||||
gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(thisModule, resource));
|
||||
|
||||
FreeResource(pMoonMask);
|
||||
}
|
||||
}
|
||||
//D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon");
|
||||
|
||||
|
|
Loading…
Reference in a new issue