From 758186aa50d166016a9c0ffa5185f228ee5913a8 Mon Sep 17 00:00:00 2001 From: Silent Date: Wed, 12 Apr 2017 00:47:27 +0200 Subject: [PATCH] Simplified resource loading --- SilentPatchSA/SilentPatchSA.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 0cb9eb6..3175a9b 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -720,13 +720,10 @@ void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float size else { // Load from memory - HMODULE thisModule; - GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)DrawMoonWithPhases, &thisModule); + HRSRC resource = FindResourceW(hDLLModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA); + void* pMoonMask = LockResource( LoadResource(hDLLModule, resource) ); - HRSRC resource = FindResourceW(thisModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA); - void* pMoonMask = LockResource( LoadResource(thisModule, resource) ); - - gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(thisModule, resource)); + gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(hDLLModule, resource)); } } //D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon"); @@ -1250,11 +1247,8 @@ bool ShaderAttach() // CGame::InitialiseRenderWare if ( InitialiseRenderWare() ) { - HMODULE thisModule; - GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)ShaderAttach, &thisModule); - - HRSRC resource = FindResourceW(thisModule, MAKEINTRESOURCE(IDR_NVCSHADER), RT_RCDATA); - RwUInt32* shader = static_cast(LockResource( LoadResource(thisModule, resource) )); + HRSRC resource = FindResourceW(hDLLModule, MAKEINTRESOURCE(IDR_NVCSHADER), RT_RCDATA); + RwUInt32* shader = static_cast(LockResource( LoadResource(hDLLModule, resource) )); RwD3D9CreateVertexShader(shader, reinterpret_cast(&pNVCShader));