Skip to content

Commit

Permalink
C++ compliance, reallow NVR
Browse files Browse the repository at this point in the history
  • Loading branch information
llde committed Feb 18, 2024
1 parent 7bab5de commit e256825
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 33 deletions.
11 changes: 11 additions & 0 deletions NewVegasReloaded/NewVegasReloaded.dll.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
name="NewVegasReloaded"
/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Configurator" version="11.0" processorArchitecture="x86" language="*" />
</dependentAssembly>
</dependency>
</assembly>
24 changes: 22 additions & 2 deletions NewVegasReloaded/NewVegasReloaded.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<OutDir>$(SolutionDir)$(ProjectName)\$(Configuration)\</OutDir>
<EmbedManifest>true</EmbedManifest>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand All @@ -68,14 +69,22 @@
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)TESReloaded\Core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>$(SolutionDir)TESReloaded\Framework\NewVegas\Framework.h</ForcedIncludeFiles>
<LanguageStandard>stdcpp17</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<EnableModules>true</EnableModules>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<AdditionalDependencies>dxguid.lib;version.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Nvidia\x86\nvapi.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Bink\binkw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dxguid.lib;version.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Nvidia\x86\nvapi.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Bink\binkw32.lib;$(SolutionDir)Configurator\target\release\Configurator.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<AssemblyIdentity>NewVegasReloaded</AssemblyIdentity>
<AdditionalManifestFiles>$(MSBuildProjectDirectory)/NewVegasReloaded.dll.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -91,6 +100,12 @@
</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>$(SolutionDir)TESReloaded\Core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ForcedIncludeFiles>$(SolutionDir)TESReloaded\Framework\NewVegas\Framework.h</ForcedIncludeFiles>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<EnableModules>true</EnableModules>
<ConformanceMode>false</ConformanceMode>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand All @@ -99,8 +114,13 @@
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Exports.def</ModuleDefinitionFile>
<AdditionalDependencies>dxguid.lib;version.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Nvidia\x86\nvapi.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Bink\binkw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>dxguid.lib;version.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Nvidia\x86\nvapi.lib;$(SolutionDir)TESReloaded\Framework\Common\Lib\Bink\binkw32.lib;$(SolutionDir)Configurator\target\release\Configurator.dll.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<AssemblyIdentity>NewVegasReloaded</AssemblyIdentity>
<EnableDpiAwareness>true</EnableDpiAwareness>
<AdditionalManifestFiles>$(MSBuildProjectDirectory)/NewVegasReloaded.dll.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
</Manifest>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\TESReloaded\Core\BinkManager.h" />
Expand Down
2 changes: 1 addition & 1 deletion TESReloaded/Core/Hooks/NewVegas/FlyCam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ static float Scroll = 0.0f;
void (__thiscall* UpdateFlyCam)(PlayerCharacter*) = (void (__thiscall*)(PlayerCharacter*))Hooks::UpdateFlyCam;
void __fastcall UpdateFlyCamHook(PlayerCharacter* This, UInt32 edx) {

SettingsMainStruct::FlyCamStruct* FlyCam = &TheSettingManager->SettingsMain.FlyCam;
ffi::FlyCamStruct* FlyCam = &TheSettingManager->Config->FlyCam;
float ScrollMultiplier = FlyCam->ScrollMultiplier;

if (Global->OnKeyDown(FlyCam->KeyAdd)) FlyCam->ScrollMultiplier += FlyCam->StepValue;
Expand Down
10 changes: 5 additions & 5 deletions TESReloaded/Core/Hooks/NewVegas/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

void AttachHooks() {

SettingsMainStruct* SettingsMain = &TheSettingManager->SettingsMain;
ffi::MainStruct* SettingsMain = &TheSettingManager->Config->Main;

DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
Expand Down Expand Up @@ -32,7 +32,7 @@ void AttachHooks() {
DetourAttach(&(PVOID&)ShowDetectorWindow, &ShowDetectorWindowHook);
DetourAttach(&(PVOID&)LoadForm, &LoadFormHook);
DetourAttach(&(PVOID&)GetWaterHeightLOD, &GetWaterHeightLODHook);
if (SettingsMain->FlyCam.Enabled) DetourAttach(&(PVOID&)UpdateFlyCam, &UpdateFlyCamHook);
if (TheSettingManager->Config->FlyCam.Enabled) DetourAttach(&(PVOID&)UpdateFlyCam, &UpdateFlyCamHook);
DetourTransactionCommit();


Expand Down Expand Up @@ -73,14 +73,14 @@ void AttachHooks() {
SafeWriteCall(Jumpers::MultiBoundWaterHeight::Fix2, (UInt32)MultiBoundWaterHeightFix);
//}

if (TheSettingManager->SettingsMain.Main.ReplaceIntro) SafeWriteJump(Jumpers::SetTileShaderConstants::Hook, (UInt32)SetTileShaderConstantsHook);
if (TheSettingManager->Config->Main.ReplaceIntro) SafeWriteJump(Jumpers::SetTileShaderConstants::Hook, (UInt32)SetTileShaderConstantsHook);

if (TheSettingManager->SettingsMain.Main.RemovePrecipitations) {
if (TheSettingManager->Config->Main.RemovePrecipitations) {
SafeWriteJump(0x0063AFC4, 0x0063AFD8);
SafeWriteJump(0x0063A5CB, 0x0063A5DE);
}

if (SettingsMain->FlyCam.Enabled) {
if (TheSettingManager->Config->FlyCam.Enabled) {
SafeWriteJump(Jumpers::FlyCam::UpdateForwardFlyCamHook, (UInt32)UpdateForwardFlyCamHook);
SafeWriteJump(Jumpers::FlyCam::UpdateBackwardFlyCamHook, (UInt32)UpdateBackwardFlyCamHook);
SafeWriteJump(Jumpers::FlyCam::UpdateRightFlyCamHook, (UInt32)UpdateRightFlyCamHook);
Expand Down
20 changes: 10 additions & 10 deletions TESReloaded/Core/Hooks/NewVegas/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
void (__thiscall* Render)(Main*, BSRenderedTexture*, int, int) = (void (__thiscall*)(Main*, BSRenderedTexture*, int, int))Hooks::Render;
void __fastcall RenderHook(Main* This, UInt32 edx, BSRenderedTexture* RenderedTexture, int Arg2, int Arg3) {

SettingsMainStruct* SettingsMain = &TheSettingManager->SettingsMain;
ffi::Config* SettingsMain = TheSettingManager->Config;

TheFrameRateManager->UpdatePerformance();
TheCameraManager->SetSceneGraph();
Expand All @@ -24,7 +24,7 @@ void __fastcall SetShadersHook(BSShader* This, UInt32 edx, UInt32 PassIndex) {
if (VertexShader && PixelShader) {
VertexShader->SetupShader(TheRenderManager->renderState->GetVertexShader());
PixelShader->SetupShader(TheRenderManager->renderState->GetPixelShader());
if (TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
char Name[256];
sprintf(Name, "Pass %i %s, %s (%s %s)", PassIndex, Pointers::Functions::GetPassDescription(PassIndex), Geometry->m_pcName, VertexShader->ShaderName, PixelShader->ShaderName);
if (VertexShader->ShaderHandle == VertexShader->ShaderHandleBackup) strcat(Name, " - Vertex: vanilla");
Expand Down Expand Up @@ -133,30 +133,30 @@ void __fastcall RenderReflectionsHook(WaterManager* This, UInt32 edx, NiCamera*
}
*/
BSRenderedTexture** boh = (BSRenderedTexture**) 0x011C7C2C; /*BOH*/
if (*boh && TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (*boh && TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
D3DXSaveSurfaceToFileA(".\\Test\\011C7C2C.jpg", D3DXIFF_JPG, (*boh)->RenderedTexture->buffer->data->Surface, NULL, NULL);

}

boh = (BSRenderedTexture**) 0x011C7AD4; /*Relfections*/
if (*boh && TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (*boh && TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
D3DXSaveSurfaceToFileA(".\\Test\\011C7AD4.jpg", D3DXIFF_JPG, (*boh)->RenderedTexture->buffer->data->Surface, NULL, NULL);

}

boh = (BSRenderedTexture**) 0x011C7B68; /*Depth*/
if (*boh && TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (*boh && TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
D3DXSaveSurfaceToFileA(".\\Test\\011C7B68.jpg", D3DXIFF_JPG, (*boh)->RenderedTexture->buffer->data->Surface, NULL, NULL);

}
boh = (BSRenderedTexture**) 0x011C7B64; /*dispalcmeent*/
if (*boh && TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (*boh && TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
D3DXSaveSurfaceToFileA(".\\Test\\011C7B64.jpg", D3DXIFF_JPG, (*boh)->RenderedTexture->buffer->data->Surface, NULL, NULL);

}

boh = (BSRenderedTexture**) 0x011C7B44;
if (*boh && TheSettingManager->SettingsMain.Develop.DebugMode && Global->OnKeyDown(0x17)) {
if (*boh && TheSettingManager->Config->Develop.DebugMode && Global->OnKeyDown(0x17)) {
D3DXSaveSurfaceToFileA(".\\Test\\011C7B44.jpg", D3DXIFF_JPG, (*boh)->RenderedTexture->buffer->data->Surface, NULL, NULL);

}
Expand Down Expand Up @@ -192,7 +192,7 @@ void __cdecl ProcessImageSpaceShadersHook(NiDX9Renderer* Renderer, BSRenderedTex

static void RenderMainMenuMovie() {

if (TheSettingManager->SettingsMain.Main.ReplaceIntro && InterfaceManager->IsActive(Menu::MenuType::kMenuType_Main))
if (TheSettingManager->Config->Main.ReplaceIntro && InterfaceManager->IsActive(Menu::MenuType::kMenuType_Main))
TheBinkManager->Render(MainMenuMovie);
else
TheBinkManager->Close();
Expand Down Expand Up @@ -245,8 +245,8 @@ float MultiBoundWaterHeightFix() {

}

void* (__thiscall* ShowDetectorWindow)(DetectorWindow*, HWND, HINSTANCE, NiNode*, char*, int, int, int, int) = (void* (__thiscall*)(DetectorWindow*, HWND, HINSTANCE, NiNode*, char*, int, int, int, int))::Hooks::ShowDetectorWindow;
void* __fastcall ShowDetectorWindowHook(DetectorWindow* This, UInt32 edx, HWND Handle, HINSTANCE Instance, NiNode* RootNode, char* FormCaption, int X, int Y, int Width, int Height) {
void* (__thiscall* ShowDetectorWindow)(DetectorWindow*, HWND, HINSTANCE, NiNode*, const char*, int, int, int, int) = (void* (__thiscall*)(DetectorWindow*, HWND, HINSTANCE, NiNode*, const char*, int, int, int, int))::Hooks::ShowDetectorWindow;
void* __fastcall ShowDetectorWindowHook(DetectorWindow* This, UInt32 edx, HWND Handle, HINSTANCE Instance, NiNode* RootNode, const char* FormCaption, int X, int Y, int Width, int Height) {

NiAVObject* Object = NULL;
void* r = NULL;
Expand Down
4 changes: 2 additions & 2 deletions TESReloaded/Core/Hooks/NewVegas/Render.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ float __fastcall GetWaterHeightLODHook(TESWorldSpace* This, UInt32 edx);
extern void(__cdecl* ProcessImageSpaceShaders)(NiDX9Renderer*, BSRenderedTexture*, BSRenderedTexture*);
void __cdecl ProcessImageSpaceShadersHook(NiDX9Renderer* Renderer, BSRenderedTexture* RenderedTexture1, BSRenderedTexture* RenderedTexture2);

extern void* (__thiscall* ShowDetectorWindow)(DetectorWindow*, HWND, HINSTANCE, NiNode*, char*, int, int, int, int);
void* __fastcall ShowDetectorWindowHook(DetectorWindow* This, UInt32 edx, HWND Handle, HINSTANCE Instance, NiNode* RootNode, char* FormCaption, int X, int Y, int Width, int Height);
extern void* (__thiscall* ShowDetectorWindow)(DetectorWindow*, HWND, HINSTANCE, NiNode*, const char*, int, int, int, int);
void* __fastcall ShowDetectorWindowHook(DetectorWindow* This, UInt32 edx, HWND Handle, HINSTANCE Instance, NiNode* RootNode, const char* FormCaption, int X, int Y, int Width, int Height);

extern int (__thiscall* WaterManager_4E8EC0)(WaterManager*);
int __fastcall WaterManager_4E8EC0Hook(WaterManager* This);
Expand Down
6 changes: 3 additions & 3 deletions TESReloaded/Core/Hooks/NewVegas/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ bool __fastcall ReadSettingHook(INISettingCollection* This, UInt32 edx, GameSett
Setting->iValue = 0;
else if (!strcmp(Setting->Name, "bFull Screen:Display"))
TheSettingManager->SetWindowedMode(Setting->iValue);
else if (!strcmp(Setting->Name, "SIntroSequence:General") && TheSettingManager->SettingsMain.Main.ReplaceIntro)
else if (!strcmp(Setting->Name, "SIntroSequence:General") && TheSettingManager->Config->Main.ReplaceIntro)
Setting->pValue = (char*)IntroMovie;
else if (!strcmp(Setting->Name, "SMainMenuMovie:General") && TheSettingManager->SettingsMain.Main.ReplaceIntro)
else if (!strcmp(Setting->Name, "SMainMenuMovie:General") && TheSettingManager->Config->Main.ReplaceIntro)
Setting->pValue = (char*)MainMenuMovie;
else if ((!strcmp(Setting->Name, "SMainMenuMusic:General") || !strcmp(Setting->Name, "STitleMusic:Loading")) && TheSettingManager->SettingsMain.Main.ReplaceIntro)
else if ((!strcmp(Setting->Name, "SMainMenuMusic:General") || !strcmp(Setting->Name, "STitleMusic:Loading")) && TheSettingManager->Config->Main.ReplaceIntro)
Setting->pValue = (char*)MainMenuMusic;
else if (!strcmp(Setting->Name, "bDoCanopyShadowPass:Display") || !strcmp(Setting->Name, "bDoActorShadows:Display") || !strcmp(Setting->Name, "iActorShadowCountExt:Display") || !strcmp(Setting->Name, "iActorShadowCountInt:Display"))
Setting->iValue = 0;
Expand Down
2 changes: 1 addition & 1 deletion TESReloaded/Core/Hooks/NewVegas/Shadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ __declspec(naked) void RenderShadowMapHook() {

static void AddCastShadowFlag(TESObjectREFR* Ref, TESObjectLIGH* Light, NiPointLight* LightPoint) {

SettingsShadowStruct::InteriorsStruct* ShadowsInteriors = &TheSettingManager->SettingsShadows.Interiors;
ffi::ShadowsInteriorStruct* ShadowsInteriors = &TheSettingManager->Config->ShadowsInterior;

if (Light->lightFlags & TESObjectLIGH::LightFlags::kLightFlags_CanCarry) {
LightPoint->CastShadows = ShadowsInteriors->TorchesCastShadows;
Expand Down
4 changes: 0 additions & 4 deletions TESReloaded/Core/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,6 @@ void RenderManager::CheckAndTakeScreenShot(IDirect3DSurface9* RenderTarget){
if (Global->OnKeyDown(0x17) && TheSettingManager->Config->Develop.DebugMode) {
char Filename[MAX_PATH];
char Filename2[MAX_PATH];
char Filename3[MAX_PATH];
char Filename4[MAX_PATH];
char Filename5[MAX_PATH];
char Filename6[MAX_PATH];

char Name[80];
time_t CurrentTime = time(NULL);
Expand Down
2 changes: 1 addition & 1 deletion TESReloaded/Core/ShadowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ D3DXMATRIX ShadowManager::GetCascadeViewProj(ShadowMapTypeEnum ShadowMapType, ff

float ar = h / w;

//Logger::Log("fov %f %f %f", WorldSceneGraph->cameraFOV, Player->GetFoV(false), Player->GetFoV(true));
Logger::Log("fov %f %f %f", WorldSceneGraph->cameraFOV, Player->GetFoV(false), Player->GetFoV(true));
float fov = TheRenderManager->FOVData.z;
float fovY = TheRenderManager->FOVData.w;

Expand Down
2 changes: 1 addition & 1 deletion TESReloaded/Framework/NewVegas/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
static const char* IntroMovie = "NVRGameStudios.bik";
static const char* MainMenuMovie = "\\Data\\Video\\NVRMainMenu.bik";
static const char* MainMenuMusic = "NVRMainMenu";
static char* TitleMenu = "New Vegas Reloaded - Settings";
static const char* TitleMenu = "New Vegas Reloaded - Settings";

// to review
static const char* WeatherColorTypes[TESWeather::kNumColorTypes] = { "SkyUpper", "Fog", "CloudsLower", "Ambient", "Sunlight", "Sun", "Stars", "SkyLower", "Horizon", "CloudsUpper" };
Expand Down
6 changes: 3 additions & 3 deletions TESReloaded/Framework/NewVegas/GameNi.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ assert(sizeof(NiPoint2) == 0x008);

class NiPoint3 {
public:
float NiPoint3::operator * (const NiPoint3 pt) const { return x * pt.x + y * pt.y + z * pt.z; }
float operator * (const NiPoint3 pt) const { return x * pt.x + y * pt.y + z * pt.z; }

void GetLookAt(NiPoint3* LookAt, NiPoint3* Rotation);

Expand All @@ -99,14 +99,14 @@ assert(sizeof(NiVector4) == 0x010);

class NiMatrix33 {
public:
NiPoint3 NiMatrix33::operator * (const NiPoint3 pt) const {
NiPoint3 operator * (const NiPoint3 pt) const {
return {
data[0][0] * pt.x + data[0][1] * pt.y + data[0][2] * pt.z,
data[1][0] * pt.x + data[1][1] * pt.y + data[1][2] * pt.z,
data[2][0] * pt.x + data[2][1] * pt.y + data[2][2] * pt.z
};
}
NiMatrix33 NiMatrix33::operator * (const NiMatrix33 mat) const {
NiMatrix33 operator * (const NiMatrix33 mat) const {
NiMatrix33 prd;

prd.data[0][0] =
Expand Down

0 comments on commit e256825

Please sign in to comment.