Skip to content

Commit

Permalink
Merge pull request #43 from mohabhassan/dev
Browse files Browse the repository at this point in the history
Universal Wrapper & RebornSecurityFixes
  • Loading branch information
mohabhassan authored Jan 15, 2024
2 parents 4f2dc75 + edfe227 commit 7554684
Show file tree
Hide file tree
Showing 79 changed files with 6,141 additions and 280 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,5 @@ ModelManifest.xml
/dgamexwrapper/generate_version_info.js
/dgamexwrapper/package.json
/dgamexwrapper/version_info.json
/tests/logbt240.txt
/tests/logaa111.txt
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
[submodule "libs/curlpp"]
path = dgamexwrapper/libs/curlpp
url = https://github.com/jpbarrette/curlpp.git
[submodule "dgamexwrapper/libs/RebornSecurityHeaders"]
path = dgamexwrapper/libs/RebornSecurityHeaders
url = https://github.com/mohabhassan/RebornSecurityHeaders.git
[submodule "tests/libs/mohpc"]
path = tests/libs/mohpc
url = https://github.com/mohabhassan/mohpc.git
Expand Down
File renamed without changes.
14 changes: 14 additions & 0 deletions dgamexwrapper/BaseHeaders/BaseHeaders.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
<ProjectCapability Include="SourceItemsFromImports" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="$(MSBuildThisFileDirectory)sv_misc.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ClientAdmin.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Player.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)safeptr.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)ClassMemory.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Listener.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Animate.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Class.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Entity.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Item.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Sentient.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)SimpleEntity.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Trigger.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Weapon.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)AddressManager.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)dgamex86.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)GameVersion.h" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include "safeptr.h"
#include "ClassMemory.h"

class SafePtrBase;
/*
* Class Class
* Used as a sub class for the patch.
Expand All @@ -13,6 +14,9 @@ class Class
public:
Class();
virtual ~Class();
#ifndef REBORNSECURITYFIXES_EXPORTS
CLASS_CUSTOM_ALLOCATION;
#endif
};

#include "safeptr.h"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once
#include "dgamex86.h"
#include "sv_misc.h"
#include <vector>
#include <list>
using std::string, std::vector, std::list;
Expand Down Expand Up @@ -113,6 +112,7 @@ class ClientAdmin
bool attemptLogout();

bool hasRight(AccessLevel right);
int getRights();

void AddKick(int kickedClientNum, bool hasReason = false, string reason = "");
void AddBan(int bannedClientNum, bool hasReason = false, string reason = "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class EntityAA : public SimpleEntity
public:
int entnum;//0
int radnum;//1
gentity_t* edict;//2
gentityAA_t* edict;//2
gclientAA_t* client;//3
int spawnflags;//4
str model;//5
Expand Down Expand Up @@ -92,7 +92,7 @@ class EntityDSH : public SimpleEntity
public:
int entnum;//0
int radnum;//1
gentity_t *edict;//2
gentityDSH_t *edict;//2
gclientDSH_t *client;//3
int spawnflags;//4
str model;//5
Expand Down
29 changes: 25 additions & 4 deletions dgamexwrapper/BaseHeaders/GameVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ class GameInfo
string dgamex86Path;
string system86Name;

inline static unordered_map<string, tuple<Expansion, Side, double>> md5_game_info = {
{"5e6dbee412397e0a57be8c9b4592ba55", {AA, Server, 1.11}},
inline static unordered_map<string, tuple<Expansion, Side, double>> md5_exe_info = {
{"a8b6296979bcad2af6edc6685ef4d06d", {AA, Server, 1.11}},
{"418deeab51331c7a9e1051b60cba23d5", {BT, Server, 2.30}},
{"ac58a6562cc8f53d2f3452b29902b54d", {BT, Server, 2.40}},
{"1db701ce0f5cf29b8fa479f0898f7d08", {BT, Server, 2.40}},
{"1162c8c26b7e0d687cbdaa2e52e5ae78", {SH, Server, 2.15}}
};

inline static unordered_map<string, tuple<Expansion, Side, double>> md5_game_info = {
{"6c7731b5259ac0da9c68382bbedc1bbc", {AA, Server, 1.11}},
{"16f69d0f22537c4c1718d72506efa988", {BT, Server, 2.30}},
{"ebf1898c107418d875e9afe89a45c381", {BT, Server, 2.40}},
{"f80ed34d942496cb5778206e4f11ee54", {SH, Server, 2.15}}
};

void InitMini(Expansion game_expansion, Side game_side, double game_version)
{
gameExpansion = game_expansion;
Expand Down Expand Up @@ -78,14 +86,27 @@ class GameInfo
bool InitFromMD5(string& md5)
{
using std::get;
auto it = md5_game_info.find(md5);
if (it == md5_game_info.end())
auto it = md5_exe_info.find(md5);
if (it == md5_exe_info.end())
return false;
auto &tpl = it->second;
Init(get<Expansion>(tpl), get<Side>(tpl), get<double>(tpl));
return true;
}

int ValidateGameDLLMD5(string& md5)
{
using std::get;
auto it = md5_game_info.find(md5);
if (it == md5_game_info.end())
return 1;
auto& tpl = it->second;
if (get<Expansion>(tpl) != gameExpansion || get<Side>(tpl) != gameSide || get<double>(tpl) != gameVersion)
return 2;

return 0;
}

const Expansion GetExpansion()
{
return gameExpansion;
Expand Down
7 changes: 3 additions & 4 deletions dgamexwrapper/src/Item.h → dgamexwrapper/BaseHeaders/Item.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once
#include "Trigger.h"
#include "Sentient.h"
#ifdef MOHAA_TMP
class Item : public Trigger
class ItemAA : public TriggerAA
{
SafePtr<Sentient> owner; /* bitsize 128, bitpos 7968 */
public:
SafePtr<SentientAA> owner; /* bitsize 128, bitpos 7968 */
qboolean respawnable; /* bitsize 32, bitpos 8096 */
qboolean playrespawn; /* bitsize 32, bitpos 8128 */
float respawntime; /* bitsize 32, bitpos 8160 */
Expand All @@ -16,4 +16,3 @@ class Item : public Trigger
str sPickupSound; /* bitsize 32, bitpos 8352 */
qboolean no_remove; /* bitsize 32, bitpos 8384 */
};
#endif // MOHAA
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@

class Event;

// entity subclass
#define ECF_ENTITY (1 << 0)
#define ECF_ANIMATE (1 << 1)
#define ECF_SENTIENT (1 << 2)
#define ECF_PLAYER (1 << 3)
#define ECF_ACTOR (1 << 4)
#define ECF_ITEM (1 << 5)
#define ECF_INVENTORYITEM (1 << 6)
#define ECF_WEAPON (1 << 7)
#define ECF_PROJECTILE (1 << 8)
#define ECF_DOOR (1 << 9)
#define ECF_CAMERA (1 << 10)
#define ECF_VEHICLE (1 << 11)
#define ECF_VEHICLETANK (1 << 12)
#define ECF_VEHICLETURRET (1 << 13)
#define ECF_TURRET (1 << 14)
#define ECF_PATHNODE (1 << 15)
#define ECF_WAYPOINT (1 << 16)
#define ECF_TEMPWAYPOINT (1 << 17)
#define ECF_VEHICLEPOINT (1 << 18)
#define ECF_SPLINEPATH (1 << 19)
#define ECF_CRATEOBJECT (1 << 20)

/*
* Class Listener
* Used as an important utility class for the patch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,17 @@ class PlayerNF : public SentientNF
ScriptEventHandler(GetConnStateEvent);
ScriptEventHandler(GetActiveWeapEvent);
ScriptEventHandler(SecFireHeldEvent);
ScriptEventHandler(RunHeldEvent);
ScriptEventHandler(LeanLeftHeldEvent);
ScriptEventHandler(LeanRightHeldEvent);
ScriptEventHandler(GetUserInfoEvent);
ScriptEventHandler(GetInventoryEvent);
ScriptEventHandler(IsAdminEvent);
ScriptEventHandler(AdminRightsEvent);

ScriptEventHandler(AddKillsEventAA);
ScriptEventHandler(AddDeathsEventAA);
ScriptEventHandler(BindWeapEventAA);

//The following functions are console(client command) events.
ScriptEventHandler(PatchVersionEvent);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ class SimpleEntity : public Listener
public:
SimpleEntity();
~SimpleEntity();

int IsSubclassOfPlayer() const;
int IsSubclassOfTurretGun() const;
int IsSubclassOfInventoryItem() const;
};

Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#pragma once
#include "Animate.h"

#ifdef MOHAA_TMP
class ScriptThreadLabel
class ScriptThreadLabelAA
{
void* m_Script;//FIXME: GameScript*
const_str m_Label;
};

class Trigger : public sdgfsgAnimate // todo: universalize handle this
class TriggerAA : public AnimateAA // todo: universalize handle this
{
protected:
float wait; /* bitsize 32, bitpos 7200 */
Expand All @@ -18,7 +17,7 @@ class Trigger : public sdgfsgAnimate // todo: universalize handle this
int count; /* bitsize 32, bitpos 7328 */
const_str noise; /* bitsize 32, bitpos 7360 */
const_str message; /* bitsize 32, bitpos 7392 */
ScriptThreadLabel /* id 260 */ m_Thread; /* bitsize 64, bitpos 7424 */
ScriptThreadLabelAA /* id 260 */ m_Thread; /* bitsize 64, bitpos 7424 */
SafePtr<Entity> activator; /* bitsize 128, bitpos 7488 */
int respondto; /* bitsize 32, bitpos 7616 */
qboolean useTriggerDir; /* bitsize 32, bitpos 7648 */
Expand All @@ -30,5 +29,4 @@ class Trigger : public sdgfsgAnimate // todo: universalize handle this
qboolean edgeTriggered; /* bitsize 32, bitpos 7904 */
int multiFaceted; /* bitsize 32, bitpos 7936 */
};
#endif // MOHAA

2 changes: 1 addition & 1 deletion dgamexwrapper/BaseHeaders/Version.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#define PATCH_NAME "NightFall"
//don't remove this macro from this file as it's used in building/packaging scripts
#define PATCH_VERSION "1.1.1"
#define PATCH_VERSION "1.2.0"
#define PATCH_STAGE "stable"
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "Item.h"
#ifdef MOHAA_TMP
class Weapon : public Item
#ifdef MOHAA_TMP //todo: see if we need this
class WeaponAA : public ItemAA
{
protected:
int m_iAnimSlot; /* bitsize 32, bitpos 8416 */
Expand All @@ -28,7 +28,7 @@ class Weapon : public Item
weaponstate_t weaponstate; /* bitsize 32, bitpos 9152 */
int rank; /* bitsize 32, bitpos 9184 */
int order; /* bitsize 32, bitpos 9216 */
SafePtr<Sentient> last_owner; /* bitsize 128, bitpos 9248 */
SafePtr<SentientAA> last_owner; /* bitsize 128, bitpos 9248 */
float last_owner_trigger_time; /* bitsize 32, bitpos 9376 */
qboolean notdroppable; /* bitsize 32, bitpos 9408 */
int aimanim; /* bitsize 32, bitpos 9440 */
Expand Down Expand Up @@ -94,6 +94,6 @@ class Weapon : public Item
int m_iNumLeftArmShots; /* bitsize 32, bitpos 12960 */
int m_iNumRightArmShots; /* bitsize 32, bitpos 12992 */
AIRanges_t mAIRange; /* bitsize 32, bitpos 13024 */
SafePtr<Entity> aim_target; /* bitsize 128, bitpos 13056 */
SafePtr<EntityAA> aim_target; /* bitsize 128, bitpos 13056 */
};
#endif // MOHAA
#endif
Loading

0 comments on commit 7554684

Please sign in to comment.