Skip to content

Commit

Permalink
Added a property post inits.
Browse files Browse the repository at this point in the history
You can now perform post inits on property files(similar to how key parent works), to apply a set of properties to a file.
Fixed transform and bbox overrides not getting replaced.
Renamed project to Universal Property Enhancer(UPE)
  • Loading branch information
Zarklord committed Feb 20, 2020
1 parent 22eb646 commit 9d5589c
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ bld/
[Oo]bj/

# Intermidate Building Things
UniversalPropertyReplacement/[Dd]ebug/
UniversalPropertyReplacement/[Rr]elease/
UniversalPropertyEnhancer/[Dd]ebug/
UniversalPropertyEnhancer/[Rr]elease/

# Visual Studio 2015 cache/options directory
.vs/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalPropertyReplacement", "UniversalPropertyReplacement\UniversalPropertyReplacement.vcxproj", "{07FC5B61-B575-4207-B464-AFAE6AF3FC19}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UniversalPropertyEnhancer", "UniversalPropertyEnhancer\UniversalPropertyEnhancer.vcxproj", "{07FC5B61-B575-4207-B464-AFAE6AF3FC19}"
ProjectSection(ProjectDependencies) = postProject
{F057451A-1413-4D68-AF56-1BF529933420} = {F057451A-1413-4D68-AF56-1BF529933420}
EndProjectSection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
========================================================================
DYNAMIC LINK LIBRARY : UniversalPropertyReplacement Project Overview
DYNAMIC LINK LIBRARY : UniversalPropertyEnhancer Project Overview
========================================================================

AppWizard has created this UniversalPropertyReplacement DLL for you.
AppWizard has created this UniversalPropertyEnhancer DLL for you.

This file contains a summary of what you will find in each of the files that
make up your UniversalPropertyReplacement application.
make up your UniversalPropertyEnhancer application.


UniversalPropertyReplacement.vcxproj
UniversalPropertyEnhancer.vcxproj
This is the main project file for VC++ projects generated using an Application Wizard.
It contains information about the version of Visual C++ that generated the file, and
information about the platforms, configurations, and project features selected with the
Application Wizard.

UniversalPropertyReplacement.vcxproj.filters
UniversalPropertyEnhancer.vcxproj.filters
This is the filters file for VC++ projects generated using an Application Wizard.
It contains information about the association between the files in your project
and the filters. This association is used in the IDE to show grouping of files with
Expand All @@ -26,7 +26,7 @@ Other standard files:

StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named UniversalPropertyReplacement.pch and a precompiled types file named StdAfx.obj.
named UniversalPropertyEnhancer.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{07FC5B61-B575-4207-B464-AFAE6AF3FC19}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>UniversalPropertyReplacement</RootNamespace>
<RootNamespace>UniversalPropertyEnhancer</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>UniversalPropertyEnhancer</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down Expand Up @@ -100,6 +101,7 @@
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="UniversalPropertyPostInit.h" />
<ClInclude Include="UniversalPropertyReplacement.h" />
<ClInclude Include="VerificationCheat.h" />
</ItemGroup>
Expand All @@ -116,6 +118,7 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="UniversalPropertyPostInit.cpp" />
<ClCompile Include="UniversalPropertyReplacement.cpp" />
<ClCompile Include="VerificationCheat.cpp" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<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>
</Filter>
<Filter Include="UniversalPropertyReplacement">
<UniqueIdentifier>{3880d018-2395-4502-abfe-4b83e0817aab}</UniqueIdentifier>
</Filter>
<Filter Include="Internal">
<UniqueIdentifier>{d62ad12d-69d8-4933-8342-03043c9adc22}</UniqueIdentifier>
</Filter>
<Filter Include="UniversalPropertyEnhancer">
<UniqueIdentifier>{3880d018-2395-4502-abfe-4b83e0817aab}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
Expand All @@ -20,24 +20,30 @@
<Filter>Internal</Filter>
</ClInclude>
<ClInclude Include="UniversalPropertyReplacement.h">
<Filter>UniversalPropertyReplacement</Filter>
<Filter>UniversalPropertyEnhancer</Filter>
</ClInclude>
<ClInclude Include="VerificationCheat.h">
<Filter>UniversalPropertyReplacement</Filter>
<Filter>UniversalPropertyEnhancer</Filter>
</ClInclude>
<ClInclude Include="UniversalPropertyPostInit.h">
<Filter>UniversalPropertyEnhancer</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>UniversalPropertyReplacement</Filter>
<Filter>UniversalPropertyEnhancer</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>Internal</Filter>
</ClCompile>
<ClCompile Include="UniversalPropertyReplacement.cpp">
<Filter>UniversalPropertyReplacement</Filter>
<Filter>UniversalPropertyEnhancer</Filter>
</ClCompile>
<ClCompile Include="VerificationCheat.cpp">
<Filter>UniversalPropertyReplacement</Filter>
<Filter>UniversalPropertyEnhancer</Filter>
</ClCompile>
<ClCompile Include="UniversalPropertyPostInit.cpp">
<Filter>UniversalPropertyEnhancer</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************
* Copyright (C) 2018, 2020 Zarklord
*
* This file is part of UniversalPropertyReplacement.
* This file is part of UniversalPropertyEnhancer.
*
* UniversalPropertyReplacement is free software: you can redistribute it and/or modify
* UniversalPropertyEnhancer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
Expand All @@ -14,12 +14,11 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with UniversalPropertyReplacement. If not, see <http://www.gnu.org/licenses/>.
* along with UniversalPropertyEnhancer. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#include "stdafx.h"
#include "UniversalPropertyReplacement.h"
#include "VerificationCheat.h"

namespace UniversalPropertyReplacement {
long AttachDetours() {
Expand All @@ -31,7 +30,6 @@ namespace UniversalPropertyReplacement {
return result;
}
bool Inititalize() {
CheatManager.AddCheat("VerifyUPR", new VerificationCheat());
uint32_t groupID = id("prop_overrides");
eastl::vector<uint32_t> instanceList{};
PropManager.GetAllListIDs(groupID, instanceList);
Expand Down Expand Up @@ -126,18 +124,17 @@ namespace UniversalPropertyReplacement {
if (!result) continue;
colorRGBAValueMapOverride[replaceHash] = value;
} else if (typeString == "transform") {
/*ManualBreakpoint();
Transform value;
Transform* value;
result = propList->GetProperty(id(valueString.c_str()), out);
if (!result) continue;
value = *(out->GetValueTransform());
transformValueMapOverride[replaceHash] = value;*/
value = out->GetValueTransform();
transformValueMapArrayOverride[replaceHash] = eastl::pair<Transform*, uint32_t> {value, 1};
} else if (typeString == "bbox") {
/*BoundingBox value;
BoundingBox* value;
result = propList->GetProperty(id(valueString.c_str()), out);
if (!result) continue;
value = *(out->GetValueBBox());
bBoxValueMapOverride[replaceHash] = value;*/
value = out->GetValueBBox();
bBoxValueMapArrayOverride[replaceHash] = eastl::pair<BoundingBox*, uint32_t> {value, 1};
} else if (typeString == "bools") {
bool* value;
result = propList->GetProperty(id(valueString.c_str()), out);
Expand Down Expand Up @@ -360,12 +357,13 @@ void ApplyValueMapProperty(App::Property*& prop, uint32_t propertyID) {
case App::PropertyType::ColorRGBA: {
return ApplyTemplateValueMapProperty(prop, propertyID, colorRGBAValueMapOverride);
}
/* unreachable properties
case App::PropertyType::Transform: {
return ApplyTemplateValueMapProperty(prop, propertyID, transformValueMapOverride);
}
case App::PropertyType::BBox: {
return ApplyTemplateValueMapProperty(prop, propertyID, bBoxValueMapOverride);
}
}*/
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************
* Copyright (C) 2018, 2020 Zarklord
*
* This file is part of UniversalPropertyReplacement.
* This file is part of UniversalPropertyEnhancer.
*
* UniversalPropertyReplacement is free software: you can redistribute it and/or modify
* UniversalPropertyEnhancer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
Expand All @@ -14,7 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with UniversalPropertyReplacement. If not, see <http://www.gnu.org/licenses/>.
* along with UniversalPropertyEnhancer. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#pragma once
Expand Down Expand Up @@ -63,10 +63,8 @@ namespace UniversalPropertyReplacement {
static eastl::map<uint32_t, ColorRGBA> colorRGBAValueMapOverride {};
static eastl::map<uint32_t, eastl::pair<ColorRGBA*, uint32_t>> colorRGBAValueMapArrayOverride {};

static eastl::map<uint32_t, Transform> transformValueMapOverride {};
static eastl::map<uint32_t, eastl::pair<Transform*, uint32_t>> transformValueMapArrayOverride {};

static eastl::map<uint32_t, BoundingBox> bBoxValueMapOverride {};
static eastl::map<uint32_t, eastl::pair<BoundingBox*, uint32_t>> bBoxValueMapArrayOverride {};

member_detour(GetPropertyAlt__detour, App::PropertyList, bool(uint32_t propertyID, App::Property*& result)) {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************
* Copyright (C) 2018, 2020 Zarklord
*
* This file is part of UniversalPropertyReplacement.
* This file is part of UniversalPropertyEnhancer.
*
* UniversalPropertyReplacement is free software: you can redistribute it and/or modify
* UniversalPropertyEnhancer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
Expand All @@ -14,7 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with UniversalPropertyReplacement. If not, see <http://www.gnu.org/licenses/>.
* along with UniversalPropertyEnhancer. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#include "stdafx.h"
Expand Down Expand Up @@ -45,7 +45,7 @@ bool VerifyValue(char16_t*& toverify) {
return wcscmp((wchar_t*)toverify, L"1") == 0;
}
bool VerifyValue(ResourceKey& toverify) {
return toverify.groupID == id("prop_overrides") && toverify.instanceID == id("VerifyUPROverrides") && toverify.typeID == id("prop");
return toverify.groupID == id("prop_overrides") && toverify.instanceID == id("VerifyUPEOverrides") && toverify.typeID == id("prop");
}
bool VerifyValue(LocalizedString& toverify) {
return toverify.GetText() == eastl::string16 {"Name Your Creature"};
Expand Down Expand Up @@ -91,12 +91,12 @@ uint32_t GetPropertyId(eastl::string str) {

void VerificationCheat::ParseLine(const ArgScript::Line& line) {
PropertyListPtr propList;
PropManager.GetPropertyList(id("VerifyUPR"), id("VerifyUPR"), propList);
PropManager.GetPropertyList(id("VerifyUPE"), id("VerifyUPE"), propList);

App::Property* out;
bool testFailed = false;

bool boolTest;
bool boolTest = false;
App::Property::GetBool(propList.get(), GetPropertyId("bool"), boolTest);
if (VerifyValue(boolTest)) {
ReportReplacementFailed("bool");
Expand All @@ -110,7 +110,7 @@ void VerificationCheat::ParseLine(const ArgScript::Line& line) {
}
uint32_t uint32Test;
App::Property::GetUInt32(propList.get(), GetPropertyId("uint32"), uint32Test);
if (VerifyValue(boolTest)) {
if (VerifyValue(uint32Test)) {
ReportReplacementFailed("uint32");
testFailed = true;
}
Expand Down Expand Up @@ -186,22 +186,22 @@ void VerificationCheat::ParseLine(const ArgScript::Line& line) {
ReportReplacementFailed("colorRGBA");
testFailed = true;
}
/*Transform transformTest;
Transform transformTest;
if (propList->GetProperty(GetPropertyId("transform"), out)) {
transformTest = *(out->GetValueTransform());
if (VerifyValue(transformTest)) {
ReportReplacementFailed("transform");
testFailed = true;
}
}*/
/*BoundingBox bBoxTest;
}
BoundingBox bBoxTest;
if (propList->GetProperty(GetPropertyId("bbox"), out)) {
bBoxTest = *(out->GetValueBBox());
if (VerifyValue(bBoxTest)) {
ReportReplacementFailed("bbox");
testFailed = true;
}
}*/
}

uint32_t count;

Expand Down Expand Up @@ -344,4 +344,28 @@ void VerificationCheat::ParseLine(const ArgScript::Line& line) {
if (!testFailed) {
App::ConsolePrintF("no replacement tests failed!");
}

testFailed = false;
bool addTest = false;
App::Property::GetBool(propList.get(), id("postinitAdd"), addTest);
if (VerifyValue(addTest)) {
App::ConsolePrintF("Add Postinit failed!");
testFailed = true;
}
int32_t replaceTest;
App::Property::GetInt32(propList.get(), id("postinitReplace"), replaceTest);
if (VerifyValue(replaceTest)) {
App::ConsolePrintF("Replace Postinit failed!");
testFailed = true;
}
uint32_t remainTest;
App::Property::GetUInt32(propList.get(), id("postinitRemain"), remainTest);
if (VerifyValue(remainTest)) {
App::ConsolePrintF("Remain Postinit failed!");
testFailed = true;
}

if (!testFailed) {
App::ConsolePrintF("no postinit tests failed!");
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/****************************************************************************
* Copyright (C) 2018, 2020 Zarklord
*
* This file is part of UniversalPropertyReplacement.
* This file is part of UniversalPropertyEnhancer.
*
* UniversalPropertyReplacement is free software: you can redistribute it and/or modify
* UniversalPropertyEnhancer is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
Expand All @@ -14,7 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with UniversalPropertyReplacement. If not, see <http://www.gnu.org/licenses/>.
* along with UniversalPropertyEnhancer. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/

#pragma once
Expand Down
Loading

0 comments on commit 9d5589c

Please sign in to comment.