Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLHook core update #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FLHook.sln
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSAceSrv Plugin", "Plugins\Public\dsacesrv_discovery\dsace_plugin.vcxproj", "{209E8482-B6B8-4CF8-B117-B93BE1B9E72D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BountyScan", "Plugins\Public\bountyscan\BountyScan.vcxproj", "{985915AF-E158-45E7-BBDD-BCD4642E5574}"
ProjectSection(ProjectDependencies) = postProject
{81D33B95-1DDD-4F58-A24C-E2EC4A143DD0} = {81D33B95-1DDD-4F58-A24C-E2EC4A143DD0}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
4 changes: 2 additions & 2 deletions Source/FLHook.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<UseOfMfc>Dynamic</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -68,7 +68,7 @@ copy /Y $(OutDir)$(TargetName).lib $(SolutionDir)\Source\FLHookPluginSDK\libs\
</CustomBuildStep>
<ClCompile>
<AdditionalOptions>-D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
<Optimization>Full</Optimization>
<Optimization>Disabled</Optimization>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this intentional?

<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_NON_CONFORMING_SWPRINTFS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<ExceptionHandling>Async</ExceptionHandling>
Expand Down
7 changes: 4 additions & 3 deletions Source/FLHook/HkCbIServerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace HkIServerImpl
{
{ProcessPendingCommands, 50, 0},
{HkTimerCheckKick, 1000, 0},
{HkTimerNPCAndF1Check, 50, 0},
{HkTimerNPCAndF1Check, 100, 0},
};

int __stdcall Update(void)
Expand All @@ -64,11 +64,12 @@ namespace HkIServerImpl
}

// call timers
mstime currTime = timeInMS();
for (uint i = 0; (i < sizeof(Timers) / sizeof(TIMER)); i++)
{
if ((timeInMS() - Timers[i].tmLastCall) >= Timers[i].tmIntervallMS)
if ((currTime - Timers[i].tmLastCall) >= Timers[i].tmIntervallMS)
{
Timers[i].tmLastCall = timeInMS();
Timers[i].tmLastCall = currTime;
Timers[i].proc();
}
}
Expand Down
3 changes: 2 additions & 1 deletion Source/FLHook/HkFuncTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,10 @@ HK_ERROR HkResolveShortCut(const wstring &wscShortcut, uint &_iClientID)

uint HkGetClientIDByShip(uint iShip)
{
const CShip* cobj = reinterpret_cast<CShip*>(CObject::Find(iShip, CObject::CSHIP_OBJECT));
CShip* cobj = reinterpret_cast<CShip*>(CObject::Find(iShip, CObject::CSHIP_OBJECT));
if (cobj)
{
cobj->Release();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be called after we've got the result of GetOwnerPlayer and have actually stopped using the cobj object?

return cobj->GetOwnerPlayer();
}
return 0;
Expand Down
10 changes: 10 additions & 0 deletions Source/FLHook/HkInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ bool InitHookExports()
ReadProcMem(pAddress, szRepFreeFixOld, 5);
WriteProcMem(pAddress, szNOPs, 5);

// jump past a redundant XOR statement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh, what?

pAddress = SRV_ADDR(0x61D6);
char szJumpXor[1] = { '\x0D' };
WriteProcMem(pAddress, szJumpXor, sizeof(szJumpXor));

// patch pub::Save method
pAddress = SRV_ADDR(0x7EFA8);
char szNop[2] = { '\x90', '\x90' };
Expand All @@ -318,6 +323,11 @@ bool InitHookExports()

WriteProcMem(pAddress, szDivertJump, 1);

// jump out of the crash trap in TradeLane/SPObjUpdate related code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these tricks of our own or things we've gotten from adoxa/tsp friends?

pAddress = (char*)hModCommon + 0xF24A0;
char szSkipCrash[2] = { '\xEB', '\x28' };
WriteProcMem(pAddress, szSkipCrash, 2);

// install hook at new address
pAddress = SRV_ADDR(0x78B39);

Expand Down
2 changes: 2 additions & 0 deletions Source/FLHookPluginSDK/headers/FLCoreServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include <list>
#include <vector>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include "flmap.h"

#include "FLCoreDefs.h"
Expand Down
12 changes: 6 additions & 6 deletions Source/FLHookPluginSDK/headers/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,33 +335,33 @@ struct CUSTOM_BASE_BEAM_STRUCT
{
uint iClientID;
uint iTargetBaseID;
bool bBeamed;
bool bBeamed = false;
};

struct CUSTOM_BASE_IS_DOCKED_STRUCT
{
uint iClientID;
uint iDockedBaseID;
uint iDockedBaseID = 0;
};

struct CUSTOM_BASE_IS_IT_POB_STRUCT
{
uint iBase;
bool bAnswer;
bool bAnswer = false;
};

struct CLIENT_CLOAK_STRUCT
{
uint iClientID;
bool isChargingCloak;
bool isCloaked;
bool isChargingCloak = false;
bool isCloaked = false;
};

struct COMBAT_DAMAGE_OVERRIDE_STRUCT
{
uint iMunitionID;
uint iTargetTypeID;
float fDamageMultiplier;
float fDamageMultiplier = 1.0;
};

const enum JUMP_TYPE {
Expand Down