mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
lunar loads from an embedded PNG
Fixed cbuildings fadein with a shader
This commit is contained in:
parent
c706013ee8
commit
4bdbdb5a6c
8 changed files with 218 additions and 93 deletions
|
@ -93,6 +93,7 @@
|
||||||
<ClCompile Include="..\SilentPatch\dllmain.cpp" />
|
<ClCompile Include="..\SilentPatch\dllmain.cpp" />
|
||||||
<ClCompile Include="..\SilentPatch\General.cpp" />
|
<ClCompile Include="..\SilentPatch\General.cpp" />
|
||||||
<ClCompile Include="..\SilentPatch\ModelInfoSA.cpp" />
|
<ClCompile Include="..\SilentPatch\ModelInfoSA.cpp" />
|
||||||
|
<ClCompile Include="..\SilentPatch\PNGFile.cpp" />
|
||||||
<ClCompile Include="..\SilentPatch\StdAfx.cpp">
|
<ClCompile Include="..\SilentPatch\StdAfx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
@ -118,6 +119,7 @@
|
||||||
<ClInclude Include="..\SilentPatch\Maths.h" />
|
<ClInclude Include="..\SilentPatch\Maths.h" />
|
||||||
<ClInclude Include="..\SilentPatch\MemoryMgr.h" />
|
<ClInclude Include="..\SilentPatch\MemoryMgr.h" />
|
||||||
<ClInclude Include="..\SilentPatch\ModelInfoSA.h" />
|
<ClInclude Include="..\SilentPatch\ModelInfoSA.h" />
|
||||||
|
<ClInclude Include="..\SilentPatch\PNGFile.h" />
|
||||||
<ClInclude Include="..\SilentPatch\StdAfx.h" />
|
<ClInclude Include="..\SilentPatch\StdAfx.h" />
|
||||||
<ClInclude Include="..\SilentPatch\Timer.h" />
|
<ClInclude Include="..\SilentPatch\Timer.h" />
|
||||||
<ClInclude Include="..\SilentPatch\Vehicle.h" />
|
<ClInclude Include="..\SilentPatch\Vehicle.h" />
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Shaders">
|
||||||
|
<UniqueIdentifier>{729e19b1-4747-44c3-b99e-1ecc383d1cad}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\SilentPatch\dllmain.cpp">
|
<ClCompile Include="..\SilentPatch\dllmain.cpp">
|
||||||
|
@ -33,6 +36,9 @@
|
||||||
<ClCompile Include="..\SilentPatch\ModelInfoSA.cpp">
|
<ClCompile Include="..\SilentPatch\ModelInfoSA.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\SilentPatch\PNGFile.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\SilentPatch\win2000.asm">
|
<None Include="..\SilentPatch\win2000.asm">
|
||||||
|
@ -64,8 +70,13 @@
|
||||||
<ClInclude Include="..\SilentPatch\ModelInfoSA.h">
|
<ClInclude Include="..\SilentPatch\ModelInfoSA.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\SilentPatch\PNGFile.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CustomBuild Include="..\SilentPatch\nvc.fx" />
|
<CustomBuild Include="..\SilentPatch\nvc.fx">
|
||||||
|
<Filter>Shaders</Filter>
|
||||||
|
</CustomBuild>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
54
SilentPatch/PNGFile.cpp
Normal file
54
SilentPatch/PNGFile.cpp
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
#include "StdAfx.h"
|
||||||
|
#include "PNGFile.h"
|
||||||
|
|
||||||
|
RwTexture* CPNGFile::ReadFromFile(const char* pFileName)
|
||||||
|
{
|
||||||
|
RwTexture* pTexture = nullptr;
|
||||||
|
|
||||||
|
if ( RwImage* pImage = RtPNGImageRead(pFileName) )
|
||||||
|
{
|
||||||
|
RwInt32 dwWidth, dwHeight, dwDepth, dwFlags;
|
||||||
|
RwImageFindRasterFormat(pImage, rwRASTERTYPETEXTURE, &dwWidth, &dwHeight, &dwDepth, &dwFlags);
|
||||||
|
if ( RwRaster* pRaster = RwRasterCreate(dwWidth, dwHeight, dwDepth, dwFlags) )
|
||||||
|
{
|
||||||
|
RwRasterSetFromImage(pRaster, pImage);
|
||||||
|
|
||||||
|
pTexture = RwTextureCreate(pRaster);
|
||||||
|
//if ( pTexture )
|
||||||
|
// RwTextureSetName(pTexture, pFileName);
|
||||||
|
}
|
||||||
|
RwImageDestroy(pImage);
|
||||||
|
}
|
||||||
|
return pTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
RwTexture* CPNGFile::ReadFromMemory(const void* pMemory, unsigned int nLen)
|
||||||
|
{
|
||||||
|
RwTexture* pTexture = nullptr;
|
||||||
|
|
||||||
|
// TOOO: EXEs
|
||||||
|
MemoryVP::Patch<BYTE>(0x7CF9CA, rwSTREAMMEMORY);
|
||||||
|
|
||||||
|
RwMemory PNGMemory;
|
||||||
|
PNGMemory.start = const_cast<RwUInt8*>(static_cast<const RwUInt8*>(pMemory));
|
||||||
|
PNGMemory.length = nLen;
|
||||||
|
|
||||||
|
if ( RwImage* pImage = RtPNGImageRead(reinterpret_cast<RwChar*>(&PNGMemory)) )
|
||||||
|
{
|
||||||
|
RwInt32 dwWidth, dwHeight, dwDepth, dwFlags;
|
||||||
|
RwImageFindRasterFormat(pImage, rwRASTERTYPETEXTURE, &dwWidth, &dwHeight, &dwDepth, &dwFlags);
|
||||||
|
if ( RwRaster* pRaster = RwRasterCreate(dwWidth, dwHeight, dwDepth, dwFlags) )
|
||||||
|
{
|
||||||
|
RwRasterSetFromImage(pRaster, pImage);
|
||||||
|
|
||||||
|
pTexture = RwTextureCreate(pRaster);
|
||||||
|
//if ( pTexture )
|
||||||
|
// RwTextureSetName(pTexture, pFileName);
|
||||||
|
}
|
||||||
|
RwImageDestroy(pImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryVP::Patch<BYTE>(0x7CF9CA, rwSTREAMFILENAME);
|
||||||
|
|
||||||
|
return pTexture;
|
||||||
|
}
|
11
SilentPatch/PNGFile.h
Normal file
11
SilentPatch/PNGFile.h
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#ifndef __PNGFILE
|
||||||
|
#define __PNGFILE
|
||||||
|
|
||||||
|
class CPNGFile
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static RwTexture* ReadFromFile(const char* pFileName);
|
||||||
|
static RwTexture* ReadFromMemory(const void* pMemory, unsigned int nLen);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include <rwcore.h>
|
#include <rwcore.h>
|
||||||
#include <rpworld.h>
|
#include <rpworld.h>
|
||||||
|
#include <rtpng.h>
|
||||||
|
|
||||||
#include "MemoryMgr.h"
|
#include "MemoryMgr.h"
|
||||||
#include "Maths.h"
|
#include "Maths.h"
|
||||||
|
|
|
@ -36,6 +36,14 @@ WRAPPER RwFrame* RwFrameForAllObjects(RwFrame* frame, RwObjectCallBack callBack,
|
||||||
WRAPPER RpClump* RpClumpForAllAtomics(RpClump* clump, RpAtomicCallBack callback, void* pData) { WRAPARG(clump); WRAPARG(callback); WRAPARG(pData); EAXJMP(0x749B70); }
|
WRAPPER RpClump* RpClumpForAllAtomics(RpClump* clump, RpAtomicCallBack callback, void* pData) { WRAPARG(clump); WRAPARG(callback); WRAPARG(pData); EAXJMP(0x749B70); }
|
||||||
WRAPPER RpGeometry* RpGeometryForAllMaterials(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData) { WRAPARG(geometry); WRAPARG(fpCallBack); WRAPARG(pData); EAXJMP(0x74C790); }
|
WRAPPER RpGeometry* RpGeometryForAllMaterials(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData) { WRAPARG(geometry); WRAPARG(fpCallBack); WRAPARG(pData); EAXJMP(0x74C790); }
|
||||||
WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { WRAPARG(atomic); EAXJMP(0x7491C0); }
|
WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { WRAPARG(atomic); EAXJMP(0x7491C0); }
|
||||||
|
WRAPPER RwImage* RtPNGImageRead(const RwChar* imageName) { WRAPARG(imageName); EAXJMP(0x7CF9B0); }
|
||||||
|
WRAPPER RwTexture* RwTextureCreate(RwRaster* raster) { WRAPARG(raster); EAXJMP(0x7F37C0); }
|
||||||
|
WRAPPER RwRaster* RwRasterCreate(RwInt32 width, RwInt32 height, RwInt32 depth, RwInt32 flags) { WRAPARG(width); WRAPARG(height); WRAPARG(depth); WRAPARG(flags); EAXJMP(0x7FB230); }
|
||||||
|
WRAPPER RwRaster* RwRasterSetFromImage(RwRaster* raster, RwImage* image) { WRAPARG(raster); WRAPARG(image); EAXJMP(0x804290); }
|
||||||
|
WRAPPER RwBool RwImageDestroy(RwImage* image) { WRAPARG(image); EAXJMP(0x802740); }
|
||||||
|
WRAPPER RwImage* RwImageFindRasterFormat(RwImage* ipImage, RwInt32 nRasterType, RwInt32* npWidth, RwInt32* npHeight, RwInt32* npDepth, RwInt32* npFormat) { WRAPARG(ipImage); WRAPARG(nRasterType); WRAPARG(npWidth); WRAPARG(npHeight); WRAPARG(npDepth); WRAPARG(npFormat); EAXJMP(0x8042C0); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SA_STEAM_TEST
|
#ifndef SA_STEAM_TEST
|
||||||
|
|
||||||
|
@ -959,6 +967,41 @@ void RenderVehicleHiDetailAlphaCB_HunterDoor(RpAtomic* pAtomic)
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
#include "PNGFile.h"
|
||||||
|
|
||||||
|
// 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, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7A, 0x7A, 0xF4, 0x00, 0x00, 0x00,
|
||||||
|
0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4B, 0x47, 0x44,
|
||||||
|
0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xA0, 0xBD, 0xA7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73,
|
||||||
|
0x00, 0x00, 0x0B, 0x13, 0x00, 0x00, 0x0B, 0x13, 0x01, 0x00, 0x9A, 0x9C, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74,
|
||||||
|
0x49, 0x4D, 0x45, 0x07, 0xDE, 0x05, 0x1D, 0x12, 0x19, 0x1B, 0x80, 0xB4, 0xC0, 0x27, 0x00, 0x00, 0x01, 0x9D,
|
||||||
|
0x49, 0x44, 0x41, 0x54, 0x58, 0xC3, 0xED, 0x97, 0x3F, 0x4B, 0x82, 0x51, 0x14, 0x87, 0x9F, 0x12, 0xB2, 0x96,
|
||||||
|
0x17, 0x84, 0x0A, 0x87, 0x77, 0x8A, 0x10, 0x5A, 0x9B, 0x1C, 0x44, 0x9A, 0x1D, 0xFC, 0x20, 0x7E, 0x16, 0xC7,
|
||||||
|
0x3E, 0x42, 0xF8, 0x01, 0x84, 0xA2, 0x39, 0x1C, 0x9A, 0x9A, 0xE2, 0x0D, 0x42, 0x9C, 0x84, 0xA4, 0xC1, 0xC0,
|
||||||
|
0x21, 0x54, 0x0C, 0x5B, 0x7E, 0x57, 0x6E, 0xF6, 0xA6, 0xEF, 0xDF, 0xEB, 0xD2, 0x81, 0x33, 0x79, 0xF5, 0x3C,
|
||||||
|
0xE7, 0x5C, 0xCF, 0xB9, 0xBF, 0x03, 0x3B, 0xB6, 0xBD, 0x98, 0xE7, 0x3D, 0xF9, 0x29, 0xE0, 0xAF, 0x7D, 0x36,
|
||||||
|
0x04, 0xDE, 0x81, 0x89, 0x3C, 0x33, 0x80, 0x43, 0xE0, 0x18, 0xB8, 0x04, 0xEA, 0x40, 0x05, 0xA8, 0x85, 0x9C,
|
||||||
|
0x1B, 0x01, 0x7D, 0xE0, 0x15, 0x78, 0x00, 0x9E, 0x04, 0x95, 0xCA, 0x7C, 0xA0, 0x05, 0x74, 0x81, 0x31, 0xB0,
|
||||||
|
0x8C, 0xE0, 0x0B, 0x20, 0xD0, 0x77, 0x9A, 0xAA, 0x58, 0x22, 0xBB, 0x04, 0xDA, 0x31, 0x02, 0x87, 0x79, 0xA0,
|
||||||
|
0xDF, 0xF0, 0x93, 0x04, 0xEF, 0x2A, 0x9B, 0x65, 0x4A, 0x1F, 0xC7, 0x85, 0xC8, 0x32, 0x78, 0x6C, 0x88, 0x3C,
|
||||||
|
0x82, 0x47, 0x86, 0xF0, 0x74, 0x60, 0x9A, 0x43, 0x70, 0x1B, 0xA2, 0xA5, 0xCE, 0xFA, 0x65, 0x4D, 0xFD, 0x69,
|
||||||
|
0x96, 0x39, 0x7B, 0x57, 0x95, 0x06, 0x60, 0xDF, 0xCA, 0xDE, 0xF4, 0x78, 0xDE, 0x56, 0x03, 0xAA, 0x61, 0x77,
|
||||||
|
0xEF, 0x22, 0x7B, 0xBB, 0x0A, 0xBE, 0x5D, 0x01, 0x1F, 0x28, 0x3B, 0x7C, 0x02, 0xCE, 0x35, 0xCE, 0x57, 0x00,
|
||||||
|
0xF5, 0x34, 0x13, 0x2B, 0x81, 0x95, 0xCD, 0x35, 0x18, 0x80, 0x0A, 0x50, 0x70, 0x08, 0x50, 0x02, 0xCE, 0x6C,
|
||||||
|
0x80, 0x9D, 0xD9, 0x3F, 0xC0, 0xAE, 0x00, 0xBE, 0xD6, 0x01, 0xEE, 0x81, 0x99, 0x43, 0x80, 0x89, 0x44, 0xCB,
|
||||||
|
0x0A, 0x60, 0x08, 0x7C, 0x3A, 0x04, 0x18, 0x19, 0xB5, 0x64, 0x03, 0xF4, 0x1C, 0x02, 0xDC, 0x49, 0x3F, 0xAE,
|
||||||
|
0x00, 0x9E, 0x1D, 0x5E, 0xC3, 0x87, 0xCA, 0xFF, 0xA3, 0x02, 0x73, 0xE0, 0x11, 0x18, 0x38, 0x00, 0xE8, 0x49,
|
||||||
|
0xB0, 0x86, 0xAA, 0xDF, 0x56, 0x4A, 0x0D, 0x18, 0x45, 0x23, 0x36, 0xED, 0xA0, 0xF6, 0xF8, 0x5D, 0x00, 0x6F,
|
||||||
|
0x40, 0x11, 0xB8, 0x00, 0x8E, 0x32, 0xCE, 0xFC, 0x05, 0xB8, 0xD6, 0x4B, 0x38, 0xDB, 0x26, 0xC5, 0xDB, 0x19,
|
||||||
|
0x57, 0x22, 0x50, 0x75, 0x23, 0x3F, 0x78, 0x59, 0x42, 0x6C, 0x0C, 0x5E, 0xD8, 0x30, 0x28, 0x02, 0x5D, 0x47,
|
||||||
|
0x09, 0x38, 0x49, 0x38, 0xED, 0x6E, 0x81, 0x0E, 0x70, 0xF3, 0xD7, 0xBA, 0xB6, 0x6D, 0x35, 0xF3, 0x80, 0x2B,
|
||||||
|
0xE9, 0x85, 0x86, 0x9E, 0xD0, 0x62, 0x84, 0x36, 0xEB, 0x69, 0x45, 0xEB, 0xA8, 0xC5, 0xE7, 0x69, 0x97, 0x53,
|
||||||
|
0x4F, 0x2A, 0xA6, 0x2A, 0x88, 0x46, 0xC8, 0x19, 0xB3, 0x17, 0x0E, 0xD4, 0xD2, 0xFD, 0x28, 0x4B, 0x6A, 0xDC,
|
||||||
|
0xED, 0xF8, 0x40, 0xED, 0x6A, 0x36, 0x64, 0xDB, 0xCC, 0x66, 0x3C, 0xDD, 0x94, 0xF1, 0xBA, 0x7D, 0x03, 0x9B,
|
||||||
|
0xCB, 0x2A, 0x13, 0x6A, 0x96, 0x59, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE, 0x42, 0x60,
|
||||||
|
0x82 };
|
||||||
|
|
||||||
// TODO: EXEs
|
// TODO: EXEs
|
||||||
#ifndef SA_STEAM_TEST
|
#ifndef SA_STEAM_TEST
|
||||||
|
@ -969,7 +1012,7 @@ static RwTexture** const gpCoronaTexture = *(RwTexture***)0x6FAA8C;
|
||||||
static int& MoonSize = **(int**)0x713B0C;
|
static int& MoonSize = **(int**)0x713B0C;
|
||||||
|
|
||||||
// TODO: Load it from an embedded PNG
|
// TODO: Load it from an embedded PNG
|
||||||
static RwTexture*& gpMoonMask = *(RwTexture**)0xC6AA74;
|
static RwTexture* gpMoonMask = nullptr;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -986,6 +1029,8 @@ static RwTexture*& gpMoonMask = *(RwTexture**)0xCC9874;
|
||||||
// By NTAuthority
|
// By NTAuthority
|
||||||
void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float sizeY)
|
void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float sizeY)
|
||||||
{
|
{
|
||||||
|
if ( !gpMoonMask )
|
||||||
|
gpMoonMask = CPNGFile::ReadFromMemory(gMoonMaskPNG, sizeof(gMoonMaskPNG));
|
||||||
//D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon");
|
//D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon");
|
||||||
|
|
||||||
float currentDayFraction = nGameClockDays / 31.0f;
|
float currentDayFraction = nGameClockDays / 31.0f;
|
||||||
|
@ -1570,28 +1615,26 @@ void ShaderDetach()
|
||||||
((void(*)())0x53BB80)();
|
((void(*)())0x53BB80)();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetShader(void* shader)
|
void SetShader(RxD3D9InstanceData* pInstData)
|
||||||
{
|
{
|
||||||
if ( bRenderNVC )
|
if ( bRenderNVC )
|
||||||
{
|
{
|
||||||
// TODO: Daynight balance var
|
// TODO: Daynight balance var
|
||||||
D3DMATRIX outMat;
|
D3DMATRIX outMat;
|
||||||
float fDayNightBalance = *(float*)0x8D12C0;
|
float fEnvVars[2] = { *(float*)0x8D12C0, RpMaterialGetColor(pInstData->material)->alpha * (1.0f/255.0f) };
|
||||||
RwRGBAReal* AmbientLight = RpLightGetColor(*(RpLight**)0xC886E8);
|
RwRGBAReal* AmbientLight = RpLightGetColor(*(RpLight**)0xC886E8);
|
||||||
|
|
||||||
assert(!shader);
|
|
||||||
|
|
||||||
RwD3D9SetVertexShader(pNVCShader);
|
RwD3D9SetVertexShader(pNVCShader);
|
||||||
|
|
||||||
_rwD3D9VSSetActiveWorldMatrix(RwFrameGetLTM(RpAtomicGetFrame(pRenderedAtomic)));
|
_rwD3D9VSSetActiveWorldMatrix(RwFrameGetLTM(RpAtomicGetFrame(pRenderedAtomic)));
|
||||||
_rwD3D9VSGetComposedTransformMatrix(&outMat);
|
_rwD3D9VSGetComposedTransformMatrix(&outMat);
|
||||||
|
|
||||||
RwD3D9SetVertexShaderConstant(0, &outMat, 4);
|
RwD3D9SetVertexShaderConstant(0, &outMat, 4);
|
||||||
RwD3D9SetVertexShaderConstant(4, &fDayNightBalance, 1);
|
RwD3D9SetVertexShaderConstant(4, fEnvVars, 1);
|
||||||
RwD3D9SetVertexShaderConstant(5, AmbientLight, 1);
|
RwD3D9SetVertexShaderConstant(5, AmbientLight, 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RwD3D9SetVertexShader(shader);
|
RwD3D9SetVertexShader(pInstData->vertexShader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) SetShader2()
|
void __declspec(naked) SetShader2()
|
||||||
|
@ -1731,6 +1774,7 @@ __forceinline void Patch_SA_10()
|
||||||
Patch<WORD>(0x5D67D7, 0x6890);
|
Patch<WORD>(0x5D67D7, 0x6890);
|
||||||
Patch<DWORD>(0x5D67BD, 0x5D5FE0);
|
Patch<DWORD>(0x5D67BD, 0x5D5FE0);
|
||||||
Patch<DWORD>(0x5D67D9, 0x5D5FE0);
|
Patch<DWORD>(0x5D67D9, 0x5D5FE0);
|
||||||
|
Patch<DWORD>(0x5DA73F, 0x90909056);
|
||||||
|
|
||||||
Patch<BYTE>(0x5D60D9, D3DDECLTYPE_D3DCOLOR);
|
Patch<BYTE>(0x5D60D9, D3DDECLTYPE_D3DCOLOR);
|
||||||
Patch<BYTE>(0x5D60E2, D3DDECLUSAGE_COLOR);
|
Patch<BYTE>(0x5D60E2, D3DDECLUSAGE_COLOR);
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct VS_OUTPUT
|
||||||
};
|
};
|
||||||
|
|
||||||
float4x4 viewProjMatrix : register(c0);
|
float4x4 viewProjMatrix : register(c0);
|
||||||
float fDayNightBalance : register(c4);
|
float2 fEnvVars : register(c4);
|
||||||
float4 AmbientLight : register(c5);
|
float4 AmbientLight : register(c5);
|
||||||
|
|
||||||
VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
|
VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
|
||||||
|
@ -24,8 +24,8 @@ VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
|
||||||
Out.Position = mul(In.Position, viewProjMatrix);
|
Out.Position = mul(In.Position, viewProjMatrix);
|
||||||
Out.Texture = In.Texture;
|
Out.Texture = In.Texture;
|
||||||
|
|
||||||
Out.Color = (In.DayColor * (1.0-fDayNightBalance) + In.NightColor * fDayNightBalance);
|
Out.Color.rgb = (In.DayColor.rgb * (1.0-fEnvVars[0]) + In.NightColor.rgb * fEnvVars[0]) + (AmbientLight.rgb * AmbientLight.a);
|
||||||
Out.Color.rgb += AmbientLight.rgb * AmbientLight.a;
|
Out.Color.a = fEnvVars[1];
|
||||||
Out.Color = saturate(Out.Color);
|
Out.Color = saturate(Out.Color);
|
||||||
|
|
||||||
return Out;
|
return Out;
|
||||||
|
|
|
@ -9,17 +9,17 @@
|
||||||
// Parameters:
|
// Parameters:
|
||||||
//
|
//
|
||||||
// float4 AmbientLight;
|
// float4 AmbientLight;
|
||||||
// float fDayNightBalance;
|
// float2 fEnvVars;
|
||||||
// float4x4 viewProjMatrix;
|
// float4x4 viewProjMatrix;
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Registers:
|
// Registers:
|
||||||
//
|
//
|
||||||
// Name Reg Size
|
// Name Reg Size
|
||||||
// ---------------- ----- ----
|
// -------------- ----- ----
|
||||||
// viewProjMatrix c0 4
|
// viewProjMatrix c0 4
|
||||||
// fDayNightBalance c4 1
|
// fEnvVars c4 1
|
||||||
// AmbientLight c5 1
|
// AmbientLight c5 1
|
||||||
//
|
//
|
||||||
|
|
||||||
vs_2_0
|
vs_2_0
|
||||||
|
@ -32,106 +32,108 @@
|
||||||
dp4 oPos.y, v0, c1
|
dp4 oPos.y, v0, c1
|
||||||
dp4 oPos.z, v0, c2
|
dp4 oPos.z, v0, c2
|
||||||
dp4 oPos.w, v0, c3
|
dp4 oPos.w, v0, c3
|
||||||
mov r0.x, c6.x
|
mov r0.xy, c6
|
||||||
add r0.x, r0.x, -c4.x
|
add r0.x, r0.x, -c4.x
|
||||||
mul r1, v2, c4.x
|
mul r1.xyz, v2, c4.x
|
||||||
mad r0, v3, r0.x, r1
|
mad r0.xzw, v3.xyyz, r0.x, r1.xyyz
|
||||||
mad r0.xyz, c5, c5.w, r0
|
mad r0.xzw, c5.xyyz, c5.w, r0
|
||||||
max r0, r0, c6.y
|
max r1.xyz, r0.xzww, c6.y
|
||||||
min oD0, r0, c6.x
|
max r1.w, r0.y, c4.y
|
||||||
|
min oD0, r1, c6.x
|
||||||
mov oT0.xy, v1
|
mov oT0.xy, v1
|
||||||
|
|
||||||
// approximately 12 instruction slots used
|
// approximately 13 instruction slots used
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE g_vs20_NVC_vertex_shader[] =
|
const BYTE g_vs20_NVC_vertex_shader[] =
|
||||||
{
|
{
|
||||||
0, 2, 254, 255, 254, 255,
|
0, 2, 254, 255, 254, 255,
|
||||||
62, 0, 67, 84, 65, 66,
|
60, 0, 67, 84, 65, 66,
|
||||||
28, 0, 0, 0, 195, 0,
|
28, 0, 0, 0, 187, 0,
|
||||||
0, 0, 0, 2, 254, 255,
|
0, 0, 0, 2, 254, 255,
|
||||||
3, 0, 0, 0, 28, 0,
|
3, 0, 0, 0, 28, 0,
|
||||||
0, 0, 0, 1, 0, 0,
|
0, 0, 0, 1, 0, 0,
|
||||||
188, 0, 0, 0, 88, 0,
|
180, 0, 0, 0, 88, 0,
|
||||||
0, 0, 2, 0, 5, 0,
|
0, 0, 2, 0, 5, 0,
|
||||||
1, 0, 22, 0, 104, 0,
|
1, 0, 22, 0, 104, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
120, 0, 0, 0, 2, 0,
|
120, 0, 0, 0, 2, 0,
|
||||||
4, 0, 1, 0, 18, 0,
|
4, 0, 1, 0, 18, 0,
|
||||||
140, 0, 0, 0, 0, 0,
|
132, 0, 0, 0, 0, 0,
|
||||||
0, 0, 156, 0, 0, 0,
|
0, 0, 148, 0, 0, 0,
|
||||||
2, 0, 0, 0, 4, 0,
|
2, 0, 0, 0, 4, 0,
|
||||||
2, 0, 172, 0, 0, 0,
|
2, 0, 164, 0, 0, 0,
|
||||||
0, 0, 0, 0, 65, 109,
|
0, 0, 0, 0, 65, 109,
|
||||||
98, 105, 101, 110, 116, 76,
|
98, 105, 101, 110, 116, 76,
|
||||||
105, 103, 104, 116, 0, 171,
|
105, 103, 104, 116, 0, 171,
|
||||||
171, 171, 1, 0, 3, 0,
|
171, 171, 1, 0, 3, 0,
|
||||||
1, 0, 4, 0, 1, 0,
|
1, 0, 4, 0, 1, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
102, 68, 97, 121, 78, 105,
|
102, 69, 110, 118, 86, 97,
|
||||||
103, 104, 116, 66, 97, 108,
|
114, 115, 0, 171, 171, 171,
|
||||||
97, 110, 99, 101, 0, 171,
|
1, 0, 3, 0, 1, 0,
|
||||||
171, 171, 0, 0, 3, 0,
|
2, 0, 1, 0, 0, 0,
|
||||||
1, 0, 1, 0, 1, 0,
|
0, 0, 0, 0, 118, 105,
|
||||||
|
101, 119, 80, 114, 111, 106,
|
||||||
|
77, 97, 116, 114, 105, 120,
|
||||||
|
0, 171, 3, 0, 3, 0,
|
||||||
|
4, 0, 4, 0, 1, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
118, 105, 101, 119, 80, 114,
|
118, 115, 95, 50, 95, 48,
|
||||||
111, 106, 77, 97, 116, 114,
|
0, 77, 105, 99, 114, 111,
|
||||||
105, 120, 0, 171, 3, 0,
|
115, 111, 102, 116, 32, 40,
|
||||||
3, 0, 4, 0, 4, 0,
|
82, 41, 32, 72, 76, 83,
|
||||||
1, 0, 0, 0, 0, 0,
|
76, 32, 83, 104, 97, 100,
|
||||||
0, 0, 118, 115, 95, 50,
|
101, 114, 32, 67, 111, 109,
|
||||||
95, 48, 0, 77, 105, 99,
|
112, 105, 108, 101, 114, 32,
|
||||||
114, 111, 115, 111, 102, 116,
|
57, 46, 50, 57, 46, 57,
|
||||||
32, 40, 82, 41, 32, 72,
|
53, 50, 46, 51, 49, 49,
|
||||||
76, 83, 76, 32, 83, 104,
|
49, 0, 81, 0, 0, 5,
|
||||||
97, 100, 101, 114, 32, 67,
|
6, 0, 15, 160, 0, 0,
|
||||||
111, 109, 112, 105, 108, 101,
|
128, 63, 0, 0, 0, 0,
|
||||||
114, 32, 57, 46, 50, 57,
|
|
||||||
46, 57, 53, 50, 46, 51,
|
|
||||||
49, 49, 49, 0, 81, 0,
|
|
||||||
0, 5, 6, 0, 15, 160,
|
|
||||||
0, 0, 128, 63, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 31, 0,
|
0, 0, 31, 0, 0, 2,
|
||||||
0, 2, 0, 0, 0, 128,
|
0, 0, 0, 128, 0, 0,
|
||||||
0, 0, 15, 144, 31, 0,
|
15, 144, 31, 0, 0, 2,
|
||||||
0, 2, 5, 0, 0, 128,
|
5, 0, 0, 128, 1, 0,
|
||||||
1, 0, 15, 144, 31, 0,
|
15, 144, 31, 0, 0, 2,
|
||||||
0, 2, 10, 0, 0, 128,
|
10, 0, 0, 128, 2, 0,
|
||||||
2, 0, 15, 144, 31, 0,
|
15, 144, 31, 0, 0, 2,
|
||||||
0, 2, 10, 0, 1, 128,
|
10, 0, 1, 128, 3, 0,
|
||||||
3, 0, 15, 144, 9, 0,
|
15, 144, 9, 0, 0, 3,
|
||||||
0, 3, 0, 0, 1, 192,
|
0, 0, 1, 192, 0, 0,
|
||||||
0, 0, 228, 144, 0, 0,
|
228, 144, 0, 0, 228, 160,
|
||||||
228, 160, 9, 0, 0, 3,
|
|
||||||
0, 0, 2, 192, 0, 0,
|
|
||||||
228, 144, 1, 0, 228, 160,
|
|
||||||
9, 0, 0, 3, 0, 0,
|
9, 0, 0, 3, 0, 0,
|
||||||
4, 192, 0, 0, 228, 144,
|
2, 192, 0, 0, 228, 144,
|
||||||
2, 0, 228, 160, 9, 0,
|
1, 0, 228, 160, 9, 0,
|
||||||
0, 3, 0, 0, 8, 192,
|
0, 3, 0, 0, 4, 192,
|
||||||
0, 0, 228, 144, 3, 0,
|
0, 0, 228, 144, 2, 0,
|
||||||
228, 160, 1, 0, 0, 2,
|
228, 160, 9, 0, 0, 3,
|
||||||
0, 0, 1, 128, 6, 0,
|
0, 0, 8, 192, 0, 0,
|
||||||
0, 160, 2, 0, 0, 3,
|
228, 144, 3, 0, 228, 160,
|
||||||
0, 0, 1, 128, 0, 0,
|
1, 0, 0, 2, 0, 0,
|
||||||
0, 128, 4, 0, 0, 161,
|
3, 128, 6, 0, 228, 160,
|
||||||
5, 0, 0, 3, 1, 0,
|
2, 0, 0, 3, 0, 0,
|
||||||
15, 128, 2, 0, 228, 144,
|
1, 128, 0, 0, 0, 128,
|
||||||
4, 0, 0, 160, 4, 0,
|
4, 0, 0, 161, 5, 0,
|
||||||
0, 4, 0, 0, 15, 128,
|
0, 3, 1, 0, 7, 128,
|
||||||
3, 0, 228, 144, 0, 0,
|
2, 0, 228, 144, 4, 0,
|
||||||
0, 128, 1, 0, 228, 128,
|
0, 160, 4, 0, 0, 4,
|
||||||
4, 0, 0, 4, 0, 0,
|
0, 0, 13, 128, 3, 0,
|
||||||
7, 128, 5, 0, 228, 160,
|
148, 144, 0, 0, 0, 128,
|
||||||
5, 0, 255, 160, 0, 0,
|
1, 0, 148, 128, 4, 0,
|
||||||
228, 128, 11, 0, 0, 3,
|
0, 4, 0, 0, 13, 128,
|
||||||
0, 0, 15, 128, 0, 0,
|
5, 0, 148, 160, 5, 0,
|
||||||
228, 128, 6, 0, 85, 160,
|
255, 160, 0, 0, 228, 128,
|
||||||
10, 0, 0, 3, 0, 0,
|
11, 0, 0, 3, 1, 0,
|
||||||
15, 208, 0, 0, 228, 128,
|
7, 128, 0, 0, 248, 128,
|
||||||
6, 0, 0, 160, 1, 0,
|
6, 0, 85, 160, 11, 0,
|
||||||
0, 2, 0, 0, 3, 224,
|
0, 3, 1, 0, 8, 128,
|
||||||
1, 0, 228, 144, 255, 255,
|
0, 0, 85, 128, 4, 0,
|
||||||
0, 0
|
85, 160, 10, 0, 0, 3,
|
||||||
|
0, 0, 15, 208, 1, 0,
|
||||||
|
228, 128, 6, 0, 0, 160,
|
||||||
|
1, 0, 0, 2, 0, 0,
|
||||||
|
3, 224, 1, 0, 228, 144,
|
||||||
|
255, 255, 0, 0
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue