diff --git a/SAFix/Shaders.rc b/SAFix/Shaders.rc index be9fe6e..7de812c 100644 Binary files a/SAFix/Shaders.rc and b/SAFix/Shaders.rc differ diff --git a/SAFix/SilentPatchSA.cpp b/SAFix/SilentPatchSA.cpp index 3419845..6e19b99 100644 --- a/SAFix/SilentPatchSA.cpp +++ b/SAFix/SilentPatchSA.cpp @@ -240,95 +240,6 @@ static struct { ".m4a", DECODER_QUICKTIME }, { ".mov", DECODER_QUICKTIME }, { ".fla", DECODER_FLAC }, { ".flac", DECODER_FLAC } }; -// lunar.png -static const BYTE gMoonMaskPNG[] = { - 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, - 0x08, 0x06, 0x00, 0x00, 0x00, 0xAA, 0x69, 0x71, 0xDE, 0x00, 0x00, 0x03, - 0xC1, 0x49, 0x44, 0x41, 0x54, 0x78, 0xDA, 0xED, 0x9B, 0xD7, 0x6B, 0x54, - 0x51, 0x10, 0xC6, 0x27, 0x96, 0x68, 0xEC, 0xA2, 0x41, 0x09, 0x16, 0xAC, - 0x60, 0x50, 0x51, 0xAC, 0xB1, 0xF7, 0x8A, 0x3E, 0xC4, 0x06, 0xBE, 0x08, - 0x3E, 0xE8, 0x83, 0x82, 0xE8, 0x1F, 0xA2, 0x08, 0xFA, 0xA0, 0x0F, 0x82, - 0x2F, 0x82, 0xF5, 0xC1, 0x10, 0x7B, 0x8F, 0x5D, 0x83, 0xA2, 0xA2, 0x60, - 0xC5, 0x42, 0x50, 0x54, 0xEC, 0xC6, 0x12, 0xCB, 0xF7, 0x31, 0xB3, 0x70, - 0x73, 0xD9, 0x9B, 0xCD, 0x66, 0xDB, 0xBD, 0x39, 0xFB, 0xC1, 0x8F, 0x90, - 0x6C, 0x58, 0x76, 0xBE, 0x33, 0x67, 0x66, 0xCE, 0xDD, 0x7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 0x26, 0x89, 0xFE, 0xFC, 0x1F, 0x24, 0x9E, 0x0B, - 0x36, 0x8B, 0x16, 0xC3, 0x8A, 0xBC, 0x01, 0x92, 0xDF, 0x02, 0xF9, 0x22, - 0x98, 0x6F, 0x83, 0x9E, 0x17, 0x9D, 0x1F, 0x84, 0x9C, 0x1F, 0x85, 0x9D, - 0x3F, 0x0C, 0x39, 0x7F, 0x1C, 0xA6, 0x9C, 0xBE, 0x20, 0x42, 0x39, 0x7F, - 0x49, 0xCC, 0xF9, 0x8B, 0xA2, 0x94, 0xD3, 0x97, 0xC5, 0x29, 0xE7, 0xBF, - 0x18, 0xA1, 0x9C, 0xFE, 0x6A, 0x8C, 0x72, 0xFE, 0xCB, 0x51, 0xCA, 0xE9, - 0xAF, 0xC7, 0x29, 0xE7, 0x6F, 0x90, 0xA0, 0x9C, 0xBE, 0x45, 0x26, 0x26, - 0xA7, 0x6F, 0x92, 0x8A, 0xC9, 0xE9, 0xDB, 0xE4, 0x28, 0xE7, 0x6F, 0x94, - 0xA4, 0x9C, 0xBE, 0x55, 0x36, 0x26, 0xA7, 0x6F, 0x96, 0xF6, 0xCA, 0xD9, - 0xDB, 0xE5, 0xBD, 0x72, 0xFA, 0x81, 0x89, 0x98, 0x9C, 0x7E, 0x64, 0xC6, - 0x2B, 0x67, 0x1F, 0x9A, 0x8A, 0x67, 0x84, 0x93, 0x8F, 0xCD, 0xF9, 0xE5, - 0xEC, 0x83, 0x93, 0xF1, 0xE4, 0xE4, 0xA3, 0xB3, 0x91, 0x91, 0xF3, 0x06, - 0xFC, 0x07, 0x2A, 0x0D, 0x50, 0x50, 0xCC, 0xB6, 0x51, 0x67, 0x00, 0x00, - 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 -}; - // Regular functions static RpMaterial* AlphaTest(RpMaterial* pMaterial, void* pData) @@ -362,11 +273,12 @@ RpAtomic* OnePassAlphaRender(RpAtomic* atomic) RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending); - if ( nAlphaBlending != TRUE ) - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE)); + // RW caches those anyway, no need to duplicate caching + //if ( nAlphaBlending != TRUE ) + // RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE)); atomic = AtomicDefaultRenderCallBack(atomic); - if ( nAlphaBlending != TRUE ) + //if ( nAlphaBlending != TRUE ) RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending)); return atomic; @@ -654,7 +566,17 @@ bool GetCurrentZoneLockedOrUnlocked(float fPosX, float fPosY) void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float sizeY) { if ( !gpMoonMask ) - gpMoonMask = CPNGFile::ReadFromMemory(gMoonMaskPNG, sizeof(gMoonMaskPNG)); + { + HMODULE thisModule; + GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)DrawMoonWithPhases, &thisModule); + + HRSRC resource = FindResource(thisModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA); + void* pMoonMask = static_cast(LoadResource(thisModule, resource)); + + gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(thisModule, resource)); + + FreeResource(pMoonMask); + } //D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon"); float currentDayFraction = nGameClockDays / 31.0f; diff --git a/SAFix/lunar64.png b/SAFix/lunar64.png new file mode 100644 index 0000000..4dd9dee Binary files /dev/null and b/SAFix/lunar64.png differ diff --git a/SAFix/resource.h b/SAFix/resource.h index b26528c..5448397 100644 --- a/SAFix/resource.h +++ b/SAFix/resource.h @@ -1 +1,2 @@ #define IDR_NVCSHADER 101 +#define IDR_LUNAR64 102