mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-07-12 04:54:35 +00:00
GIT forgot the Watchdog code
This commit is contained in:
parent
a7c9fc2f6e
commit
0bf33a7190
11 changed files with 266 additions and 0 deletions
25
Mod Sources/Watchdog/README.md
Normal file
25
Mod Sources/Watchdog/README.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
TSExtension
|
||||
=====
|
||||
|
||||
A general extension to the Torque Scripting language.
|
||||
|
||||
Additions
|
||||
====
|
||||
|
||||
#### GrenadeProjectile.getVelocity()
|
||||
This function did not exist before in Torque Script. It returns the current velocity vector of a GrenadeProjectile.
|
||||
|
||||
#### GrenadeProjectile.getPosition()
|
||||
This function already existed to return the position of a GrenadeProjectile object but it is now much more accurate.
|
||||
|
||||
#### Player.isJetting()
|
||||
This function did not exist before in Torque Script, it returns whether or not the Player is currently jetting.
|
||||
|
||||
#### Player.isJumping()
|
||||
This function did not exist before in Torque Script, it returns whether or not the Player is currently jumping.
|
||||
|
||||
#### sprintf(format, ...)
|
||||
This function did not exist before in Torque Script. It returns a formatted string according to format with all variable
|
||||
arguments up to a total of twenty filled in. Refer to C's sprintf for more information.
|
||||
|
||||
Note: Only %s should be used in the format as Torque Script passes all data around as strings.
|
||||
BIN
Mod Sources/Watchdog/Release/WatchDog.exp
Normal file
BIN
Mod Sources/Watchdog/Release/WatchDog.exp
Normal file
Binary file not shown.
|
|
@ -0,0 +1,2 @@
|
|||
#v4.0:v100
|
||||
Release|Win32|C:\Users\Robert MacGregor\Documents\T2-CPP\Mod Sources\Watchdog\|
|
||||
85
Mod Sources/Watchdog/TSExtension/TSExtension.vcxproj
Normal file
85
Mod Sources/Watchdog/TSExtension/TSExtension.vcxproj
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>BaseMod</RootNamespace>
|
||||
<ProjectName>WatchDog</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>ws2_32.lib;Dnsapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>ws2_32.lib;Dnsapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
Mod Sources/Watchdog/TSExtension/TSExtension.vcxproj.filters
Normal file
22
Mod Sources/Watchdog/TSExtension/TSExtension.vcxproj.filters
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<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>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
47
Mod Sources/Watchdog/TSExtension/script/tsExtension.cs
Normal file
47
Mod Sources/Watchdog/TSExtension/script/tsExtension.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
function tsExtensionLoop()
|
||||
{
|
||||
if (!$TSExtension::isActive)
|
||||
{
|
||||
error("TSExtension.cs - Unable to run loop! Is the DLL installed?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (isEventPending($TSExtension::LastUpdateHandle))
|
||||
cancel($TSExtension::LastUpdateHandle);
|
||||
|
||||
tsExtensionUpdate();
|
||||
|
||||
$TSExtension::LastUpdateHandle = schedule(32,0,"tsExtensionLoop");
|
||||
}
|
||||
|
||||
package TSExtension
|
||||
{
|
||||
function LoginDlg::onWake(%this)
|
||||
{
|
||||
parent::onWake(%this);
|
||||
|
||||
if (!$TSExtension::isActive)
|
||||
{
|
||||
loadMod("TSExtension");
|
||||
schedule(2000,0,"tsExtensionLoop");
|
||||
}
|
||||
}
|
||||
|
||||
function GameGUI::onWake(%this)
|
||||
{
|
||||
parent::onWake(%this);
|
||||
|
||||
if (!$TSExtension::isActive)
|
||||
{
|
||||
//loadMod("TSExtension");
|
||||
//schedule(2000,0,"tsExtensionLoop");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (!isActivePackage(TSExtension))
|
||||
activatePackage(TSExtension);
|
||||
|
||||
memPatch("005BD190","C3");
|
||||
memPatch("005BD1F0","C3");
|
||||
memPatch("005BD210","C3");
|
||||
62
Mod Sources/Watchdog/TSExtension/source/dllmain.cpp
Normal file
62
Mod Sources/Watchdog/TSExtension/source/dllmain.cpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// dllmain.cpp : Defines the entry point for the DLL application.
|
||||
#include <SDKDDKVer.h>
|
||||
#include <Windows.h>
|
||||
#include <time.h>
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool sDogPetted = false;
|
||||
static HANDLE sMainThread = NULL;
|
||||
DWORD WINAPI WatchDogThread(LPVOID lpParam)
|
||||
{
|
||||
time_t lastPet = clock();
|
||||
|
||||
while (true)
|
||||
{
|
||||
time_t now = clock();
|
||||
time_t seconds = (now - lastPet) / CLOCKS_PER_SEC;
|
||||
|
||||
if (!sDogPetted && seconds > 2) // Wait 2 seconds to be safe
|
||||
{
|
||||
CloseHandle(sMainThread);
|
||||
exit(0);
|
||||
}
|
||||
else if (sDogPetted)
|
||||
{
|
||||
sDogPetted = false;
|
||||
lastPet = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
__declspec(dllexport) void ModInitialize(void)
|
||||
{
|
||||
sMainThread = GetCurrentThread();
|
||||
|
||||
DWORD threadID;
|
||||
|
||||
HANDLE thread = CreateThread(NULL, 0, WatchDogThread, NULL, 0, &threadID);
|
||||
}
|
||||
|
||||
__declspec(dllexport) void ServerProcess(unsigned int deltaTime)
|
||||
{
|
||||
sDogPetted = true;
|
||||
}
|
||||
}
|
||||
|
||||
20
Mod Sources/Watchdog/Watchdog.sln
Normal file
20
Mod Sources/Watchdog/Watchdog.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TSExtension", "TSExtension\TSExtension.vcxproj", "{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
Mod Sources/Watchdog/Watchdog.suo
Normal file
BIN
Mod Sources/Watchdog/Watchdog.suo
Normal file
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue