[General] Fixed line endings
- converted all line endings in cpp/hpp files to dos
This commit is contained in:
parent
0221954b41
commit
124e86387b
@ -13,7 +13,7 @@ namespace Components
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "AntiCheat"; };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void CrashClient();
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace Components
|
||||
ArenaLength();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ArenaLength"; };
|
||||
const char* getName() { return "ArenaLength"; };
|
||||
#endif
|
||||
|
||||
static Game::newMapArena_t NewArenas[128];
|
||||
|
@ -22,7 +22,7 @@ namespace Components
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "AssetHandler"; };
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void OnFind(Game::XAssetType type, Callback* callback);
|
||||
static void OnLoad(RestrictCallback* callback);
|
||||
|
@ -7,8 +7,8 @@ namespace Components
|
||||
~Auth();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Auth"; };
|
||||
#endif
|
||||
const char* getName() { return "Auth"; };
|
||||
#endif
|
||||
|
||||
bool unitTest();
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
~Bans();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Bans"; };
|
||||
const char* getName() { return "Bans"; };
|
||||
#endif
|
||||
|
||||
static void BanClientNum(int num, std::string reason);
|
||||
|
@ -1,40 +1,40 @@
|
||||
namespace Components
|
||||
{
|
||||
class Colors : public Component
|
||||
{
|
||||
public:
|
||||
Colors();
|
||||
namespace Components
|
||||
{
|
||||
class Colors : public Component
|
||||
{
|
||||
public:
|
||||
Colors();
|
||||
~Colors();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Colors"; };
|
||||
#endif
|
||||
|
||||
static void Strip(const char* in, char* out, int max);
|
||||
static std::string Strip(std::string in);
|
||||
|
||||
static char Add(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
private:
|
||||
struct HsvColor
|
||||
{
|
||||
unsigned char h;
|
||||
unsigned char s;
|
||||
unsigned char v;
|
||||
};
|
||||
|
||||
static Dvar::Var NewColors;
|
||||
|
||||
static DWORD HsvToRgb(HsvColor hsv);
|
||||
|
||||
static void ClientUserinfoChanged();
|
||||
static char* GetClientName(int localClientNum, int index, char *buf, size_t size);
|
||||
static void PatchColorLimit(char limit);
|
||||
|
||||
static unsigned int ColorIndex(unsigned char);
|
||||
static void LookupColor(DWORD* color, char index);
|
||||
static void LookupColorStub();
|
||||
static char* CleanStrStub(char* string);
|
||||
static std::vector<DWORD> ColorTable;
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Colors"; };
|
||||
#endif
|
||||
|
||||
static void Strip(const char* in, char* out, int max);
|
||||
static std::string Strip(std::string in);
|
||||
|
||||
static char Add(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
private:
|
||||
struct HsvColor
|
||||
{
|
||||
unsigned char h;
|
||||
unsigned char s;
|
||||
unsigned char v;
|
||||
};
|
||||
|
||||
static Dvar::Var NewColors;
|
||||
|
||||
static DWORD HsvToRgb(HsvColor hsv);
|
||||
|
||||
static void ClientUserinfoChanged();
|
||||
static char* GetClientName(int localClientNum, int index, char *buf, size_t size);
|
||||
static void PatchColorLimit(char limit);
|
||||
|
||||
static unsigned int ColorIndex(unsigned char);
|
||||
static void LookupColor(DWORD* color, char index);
|
||||
static void LookupColorStub();
|
||||
static char* CleanStrStub(char* string);
|
||||
static std::vector<DWORD> ColorTable;
|
||||
};
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ namespace Components
|
||||
~Command();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Command"; };
|
||||
const char* getName() { return "Command"; };
|
||||
#endif
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
bool ConnectProtocol::Evaluated = false;
|
||||
bool ConnectProtocol::Evaluated = false;
|
||||
std::string ConnectProtocol::ConnectString;
|
||||
|
||||
bool ConnectProtocol::IsEvaluated()
|
||||
|
@ -1,24 +1,24 @@
|
||||
namespace Components
|
||||
{
|
||||
class ConnectProtocol : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class ConnectProtocol : public Component
|
||||
{
|
||||
public:
|
||||
ConnectProtocol();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ConnectProtocol"; };
|
||||
#endif
|
||||
|
||||
static bool IsEvaluated();
|
||||
static bool Used();
|
||||
|
||||
private:
|
||||
static bool Evaluated;
|
||||
static std::string ConnectString;
|
||||
|
||||
static void EvaluateProtocol();
|
||||
static bool InstallProtocol();
|
||||
|
||||
static void Invocation();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ConnectProtocol"; };
|
||||
#endif
|
||||
|
||||
static bool IsEvaluated();
|
||||
static bool Used();
|
||||
|
||||
private:
|
||||
static bool Evaluated;
|
||||
static std::string ConnectString;
|
||||
|
||||
static void EvaluateProtocol();
|
||||
static bool InstallProtocol();
|
||||
|
||||
static void Invocation();
|
||||
};
|
||||
}
|
||||
|
@ -1,174 +1,174 @@
|
||||
namespace Components
|
||||
{
|
||||
class D3D9Ex : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class D3D9Ex : public Component
|
||||
{
|
||||
public:
|
||||
D3D9Ex();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "D3D9Ex"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
class D3D9Device : public IDirect3DDevice9
|
||||
{
|
||||
public:
|
||||
D3D9Device(IDirect3DDevice9* pOriginal) : m_pIDirect3DDevice9(pOriginal) {};
|
||||
virtual ~D3D9Device(void) {};
|
||||
|
||||
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG __stdcall AddRef(void);
|
||||
ULONG __stdcall Release(void);
|
||||
HRESULT __stdcall TestCooperativeLevel(void);
|
||||
UINT __stdcall GetAvailableTextureMem(void);
|
||||
HRESULT __stdcall EvictManagedResources(void);
|
||||
HRESULT __stdcall GetDirect3D(IDirect3D9** ppD3D9);
|
||||
HRESULT __stdcall GetDeviceCaps(D3DCAPS9* pCaps);
|
||||
HRESULT __stdcall GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
|
||||
HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap);
|
||||
void __stdcall SetCursorPosition(int X, int Y, DWORD Flags);
|
||||
BOOL __stdcall ShowCursor(BOOL bShow);
|
||||
HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
|
||||
HRESULT __stdcall GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
|
||||
UINT __stdcall GetNumberOfSwapChains(void);
|
||||
HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
HRESULT __stdcall Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
|
||||
HRESULT __stdcall GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer);
|
||||
HRESULT __stdcall GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus);
|
||||
HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs);
|
||||
void __stdcall SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
|
||||
void __stdcall GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp);
|
||||
HRESULT __stdcall CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall UpdateSurface(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint);
|
||||
HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture);
|
||||
HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT __stdcall GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT __stdcall StretchRect(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter);
|
||||
HRESULT __stdcall ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color);
|
||||
HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget);
|
||||
HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget);
|
||||
HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil);
|
||||
HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface);
|
||||
HRESULT __stdcall BeginScene(void);
|
||||
HRESULT __stdcall EndScene(void);
|
||||
HRESULT __stdcall Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil);
|
||||
HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9* pViewport);
|
||||
HRESULT __stdcall GetViewport(D3DVIEWPORT9* pViewport);
|
||||
HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9* pMaterial);
|
||||
HRESULT __stdcall GetMaterial(D3DMATERIAL9* pMaterial);
|
||||
HRESULT __stdcall SetLight(DWORD Index, CONST D3DLIGHT9* pLight);
|
||||
HRESULT __stdcall GetLight(DWORD Index, D3DLIGHT9* pLight);
|
||||
HRESULT __stdcall LightEnable(DWORD Index, BOOL Enable);
|
||||
HRESULT __stdcall GetLightEnable(DWORD Index, BOOL* pEnable);
|
||||
HRESULT __stdcall SetClipPlane(DWORD Index, CONST float* pPlane);
|
||||
HRESULT __stdcall GetClipPlane(DWORD Index, float* pPlane);
|
||||
HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue);
|
||||
HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
|
||||
HRESULT __stdcall BeginStateBlock(void);
|
||||
HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9** ppSB);
|
||||
HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT __stdcall GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture);
|
||||
HRESULT __stdcall SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture);
|
||||
HRESULT __stdcall GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue);
|
||||
HRESULT __stdcall SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
|
||||
HRESULT __stdcall GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue);
|
||||
HRESULT __stdcall SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
|
||||
HRESULT __stdcall ValidateDevice(DWORD* pNumPasses);
|
||||
HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries);
|
||||
HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries);
|
||||
HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
|
||||
HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
|
||||
HRESULT __stdcall SetScissorRect(CONST RECT* pRect);
|
||||
HRESULT __stdcall GetScissorRect(RECT* pRect);
|
||||
HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware);
|
||||
BOOL __stdcall GetSoftwareVertexProcessing(void);
|
||||
HRESULT __stdcall SetNPatchMode(float nSegments);
|
||||
float __stdcall GetNPatchMode(void);
|
||||
HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
|
||||
HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
|
||||
HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT __stdcall ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags);
|
||||
HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl);
|
||||
HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT __stdcall SetFVF(DWORD FVF);
|
||||
HRESULT __stdcall GetFVF(DWORD* pFVF);
|
||||
HRESULT __stdcall CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
|
||||
HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9* pShader);
|
||||
HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9** ppShader);
|
||||
HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
|
||||
HRESULT __stdcall GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride);
|
||||
HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber, UINT Divider);
|
||||
HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber, UINT* Divider);
|
||||
HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9* pIndexData);
|
||||
HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9** ppIndexData);
|
||||
HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
|
||||
HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9* pShader);
|
||||
HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9** ppShader);
|
||||
HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo);
|
||||
HRESULT __stdcall DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo);
|
||||
HRESULT __stdcall DeletePatch(UINT Handle);
|
||||
HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
|
||||
|
||||
private:
|
||||
IDirect3DDevice9 *m_pIDirect3DDevice9;
|
||||
};
|
||||
|
||||
class D3D9 : public IDirect3D9
|
||||
{
|
||||
public:
|
||||
D3D9(IDirect3D9Ex *pOriginal) : m_pIDirect3D9(pOriginal) {};
|
||||
virtual ~D3D9(void) {};
|
||||
|
||||
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG __stdcall AddRef(void);
|
||||
ULONG __stdcall Release(void);
|
||||
HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
|
||||
UINT __stdcall GetAdapterCount(void);
|
||||
HRESULT __stdcall GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier);
|
||||
UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
|
||||
HRESULT __stdcall EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall CheckDeviceType(UINT iAdapter, D3DDEVTYPE DevType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
HRESULT __stdcall CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels);
|
||||
HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
|
||||
HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat);
|
||||
HRESULT __stdcall GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps);
|
||||
HMONITOR __stdcall GetAdapterMonitor(UINT Adapter);
|
||||
HRESULT __stdcall CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
|
||||
|
||||
private:
|
||||
IDirect3D9 *m_pIDirect3D9;
|
||||
};
|
||||
|
||||
static IDirect3D9* __stdcall Direct3DCreate9Stub(UINT sdk);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "D3D9Ex"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
class D3D9Device : public IDirect3DDevice9
|
||||
{
|
||||
public:
|
||||
D3D9Device(IDirect3DDevice9* pOriginal) : m_pIDirect3DDevice9(pOriginal) {};
|
||||
virtual ~D3D9Device(void) {};
|
||||
|
||||
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG __stdcall AddRef(void);
|
||||
ULONG __stdcall Release(void);
|
||||
HRESULT __stdcall TestCooperativeLevel(void);
|
||||
UINT __stdcall GetAvailableTextureMem(void);
|
||||
HRESULT __stdcall EvictManagedResources(void);
|
||||
HRESULT __stdcall GetDirect3D(IDirect3D9** ppD3D9);
|
||||
HRESULT __stdcall GetDeviceCaps(D3DCAPS9* pCaps);
|
||||
HRESULT __stdcall GetDisplayMode(UINT iSwapChain, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
|
||||
HRESULT __stdcall SetCursorProperties(UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap);
|
||||
void __stdcall SetCursorPosition(int X, int Y, DWORD Flags);
|
||||
BOOL __stdcall ShowCursor(BOOL bShow);
|
||||
HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
|
||||
HRESULT __stdcall GetSwapChain(UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
|
||||
UINT __stdcall GetNumberOfSwapChains(void);
|
||||
HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
|
||||
HRESULT __stdcall Present(CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion);
|
||||
HRESULT __stdcall GetBackBuffer(UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer);
|
||||
HRESULT __stdcall GetRasterStatus(UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus);
|
||||
HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs);
|
||||
void __stdcall SetGammaRamp(UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp);
|
||||
void __stdcall GetGammaRamp(UINT iSwapChain, D3DGAMMARAMP* pRamp);
|
||||
HRESULT __stdcall CreateTexture(UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateVolumeTexture(UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateCubeTexture(UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateVertexBuffer(UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateIndexBuffer(UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateRenderTarget(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall CreateDepthStencilSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall UpdateSurface(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint);
|
||||
HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture);
|
||||
HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT __stdcall GetFrontBufferData(UINT iSwapChain, IDirect3DSurface9* pDestSurface);
|
||||
HRESULT __stdcall StretchRect(IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter);
|
||||
HRESULT __stdcall ColorFill(IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color);
|
||||
HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle);
|
||||
HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget);
|
||||
HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget);
|
||||
HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil);
|
||||
HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface);
|
||||
HRESULT __stdcall BeginScene(void);
|
||||
HRESULT __stdcall EndScene(void);
|
||||
HRESULT __stdcall Clear(DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil);
|
||||
HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix);
|
||||
HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9* pViewport);
|
||||
HRESULT __stdcall GetViewport(D3DVIEWPORT9* pViewport);
|
||||
HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9* pMaterial);
|
||||
HRESULT __stdcall GetMaterial(D3DMATERIAL9* pMaterial);
|
||||
HRESULT __stdcall SetLight(DWORD Index, CONST D3DLIGHT9* pLight);
|
||||
HRESULT __stdcall GetLight(DWORD Index, D3DLIGHT9* pLight);
|
||||
HRESULT __stdcall LightEnable(DWORD Index, BOOL Enable);
|
||||
HRESULT __stdcall GetLightEnable(DWORD Index, BOOL* pEnable);
|
||||
HRESULT __stdcall SetClipPlane(DWORD Index, CONST float* pPlane);
|
||||
HRESULT __stdcall GetClipPlane(DWORD Index, float* pPlane);
|
||||
HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State, DWORD Value);
|
||||
HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State, DWORD* pValue);
|
||||
HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
|
||||
HRESULT __stdcall BeginStateBlock(void);
|
||||
HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9** ppSB);
|
||||
HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
|
||||
HRESULT __stdcall GetTexture(DWORD Stage, IDirect3DBaseTexture9** ppTexture);
|
||||
HRESULT __stdcall SetTexture(DWORD Stage, IDirect3DBaseTexture9* pTexture);
|
||||
HRESULT __stdcall GetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue);
|
||||
HRESULT __stdcall SetTextureStageState(DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value);
|
||||
HRESULT __stdcall GetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue);
|
||||
HRESULT __stdcall SetSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value);
|
||||
HRESULT __stdcall ValidateDevice(DWORD* pNumPasses);
|
||||
HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber, CONST PALETTEENTRY* pEntries);
|
||||
HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber, PALETTEENTRY* pEntries);
|
||||
HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
|
||||
HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
|
||||
HRESULT __stdcall SetScissorRect(CONST RECT* pRect);
|
||||
HRESULT __stdcall GetScissorRect(RECT* pRect);
|
||||
HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware);
|
||||
BOOL __stdcall GetSoftwareVertexProcessing(void);
|
||||
HRESULT __stdcall SetNPatchMode(float nSegments);
|
||||
float __stdcall GetNPatchMode(void);
|
||||
HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount);
|
||||
HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount);
|
||||
HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride);
|
||||
HRESULT __stdcall ProcessVertices(UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags);
|
||||
HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl);
|
||||
HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl);
|
||||
HRESULT __stdcall SetFVF(DWORD FVF);
|
||||
HRESULT __stdcall GetFVF(DWORD* pFVF);
|
||||
HRESULT __stdcall CreateVertexShader(CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
|
||||
HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9* pShader);
|
||||
HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9** ppShader);
|
||||
HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall SetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
|
||||
HRESULT __stdcall GetStreamSource(UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride);
|
||||
HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber, UINT Divider);
|
||||
HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber, UINT* Divider);
|
||||
HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9* pIndexData);
|
||||
HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9** ppIndexData);
|
||||
HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
|
||||
HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9* pShader);
|
||||
HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9** ppShader);
|
||||
HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
HRESULT __stdcall DrawRectPatch(UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo);
|
||||
HRESULT __stdcall DrawTriPatch(UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo);
|
||||
HRESULT __stdcall DeletePatch(UINT Handle);
|
||||
HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
|
||||
|
||||
private:
|
||||
IDirect3DDevice9 *m_pIDirect3DDevice9;
|
||||
};
|
||||
|
||||
class D3D9 : public IDirect3D9
|
||||
{
|
||||
public:
|
||||
D3D9(IDirect3D9Ex *pOriginal) : m_pIDirect3D9(pOriginal) {};
|
||||
virtual ~D3D9(void) {};
|
||||
|
||||
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
|
||||
ULONG __stdcall AddRef(void);
|
||||
ULONG __stdcall Release(void);
|
||||
HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
|
||||
UINT __stdcall GetAdapterCount(void);
|
||||
HRESULT __stdcall GetAdapterIdentifier(UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier);
|
||||
UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
|
||||
HRESULT __stdcall EnumAdapterModes(UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall GetAdapterDisplayMode(UINT Adapter, D3DDISPLAYMODE* pMode);
|
||||
HRESULT __stdcall CheckDeviceType(UINT iAdapter, D3DDEVTYPE DevType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed);
|
||||
HRESULT __stdcall CheckDeviceFormat(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat);
|
||||
HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels);
|
||||
HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat);
|
||||
HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat);
|
||||
HRESULT __stdcall GetDeviceCaps(UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps);
|
||||
HMONITOR __stdcall GetAdapterMonitor(UINT Adapter);
|
||||
HRESULT __stdcall CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface);
|
||||
|
||||
private:
|
||||
IDirect3D9 *m_pIDirect3D9;
|
||||
};
|
||||
|
||||
static IDirect3D9* __stdcall Direct3DCreate9Stub(UINT sdk);
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
~Dedicated();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Dedicated"; };
|
||||
const char* getName() { return "Dedicated"; };
|
||||
#endif
|
||||
|
||||
static bool IsEnabled();
|
||||
|
@ -7,7 +7,7 @@ namespace Components
|
||||
~Discovery();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Discovery"; };
|
||||
const char* getName() { return "Discovery"; };
|
||||
#endif
|
||||
|
||||
static void Perform();
|
||||
|
@ -1,69 +1,69 @@
|
||||
namespace Components
|
||||
{
|
||||
class Download : public Component
|
||||
{
|
||||
public:
|
||||
Download();
|
||||
namespace Components
|
||||
{
|
||||
class Download : public Component
|
||||
{
|
||||
public:
|
||||
Download();
|
||||
~Download();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Download"; };
|
||||
#endif
|
||||
|
||||
static void InitiateClientDownload(std::string mod);
|
||||
|
||||
private:
|
||||
class ClientDownload
|
||||
{
|
||||
public:
|
||||
ClientDownload() : valid(false), running(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {}
|
||||
~ClientDownload() { this->clear(); }
|
||||
|
||||
bool running;
|
||||
bool valid;
|
||||
bool terminateThread;
|
||||
mg_mgr mgr;
|
||||
Network::Address target;
|
||||
std::string mod;
|
||||
std::thread thread;
|
||||
|
||||
size_t totalBytes;
|
||||
size_t downBytes;
|
||||
|
||||
int lastTimeStamp;
|
||||
size_t timeStampBytes;
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string hash;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
std::vector<File> files;
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->terminateThread = true;
|
||||
|
||||
if (this->thread.joinable())
|
||||
{
|
||||
this->thread.join();
|
||||
}
|
||||
|
||||
this->running = false;
|
||||
this->mod.clear();
|
||||
this->files.clear();
|
||||
|
||||
if (this->valid)
|
||||
{
|
||||
this->valid = false;
|
||||
mg_mgr_free(&(this->mgr));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Download"; };
|
||||
#endif
|
||||
|
||||
static void InitiateClientDownload(std::string mod);
|
||||
|
||||
private:
|
||||
class ClientDownload
|
||||
{
|
||||
public:
|
||||
ClientDownload() : valid(false), running(false), terminateThread(false), totalBytes(0), downBytes(0), lastTimeStamp(0), timeStampBytes(0) {}
|
||||
~ClientDownload() { this->clear(); }
|
||||
|
||||
bool running;
|
||||
bool valid;
|
||||
bool terminateThread;
|
||||
mg_mgr mgr;
|
||||
Network::Address target;
|
||||
std::string mod;
|
||||
std::thread thread;
|
||||
|
||||
size_t totalBytes;
|
||||
size_t downBytes;
|
||||
|
||||
int lastTimeStamp;
|
||||
size_t timeStampBytes;
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
std::string name;
|
||||
std::string hash;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
std::vector<File> files;
|
||||
|
||||
void clear()
|
||||
{
|
||||
this->terminateThread = true;
|
||||
|
||||
if (this->thread.joinable())
|
||||
{
|
||||
this->thread.join();
|
||||
}
|
||||
|
||||
this->running = false;
|
||||
this->mod.clear();
|
||||
this->files.clear();
|
||||
|
||||
if (this->valid)
|
||||
{
|
||||
this->valid = false;
|
||||
mg_mgr_free(&(this->mgr));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FileDownload
|
||||
{
|
||||
public:
|
||||
@ -75,23 +75,23 @@ namespace Components
|
||||
unsigned int index;
|
||||
std::string buffer;
|
||||
size_t receivedBytes;
|
||||
};
|
||||
|
||||
static mg_mgr Mgr;
|
||||
static ClientDownload CLDownload;
|
||||
|
||||
static void EventHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void ListHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void FileHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void InfoHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void DownloadHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
|
||||
static bool IsClient(mg_connection *nc);
|
||||
static Game::client_t* GetClient(mg_connection *nc);
|
||||
static void Forbid(mg_connection *nc);
|
||||
|
||||
static void ModDownloader(ClientDownload* download);
|
||||
static bool ParseModList(ClientDownload* download, std::string list);
|
||||
static bool DownloadFile(ClientDownload* download, unsigned int index);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
static mg_mgr Mgr;
|
||||
static ClientDownload CLDownload;
|
||||
|
||||
static void EventHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void ListHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void FileHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void InfoHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
static void DownloadHandler(mg_connection *nc, int ev, void *ev_data);
|
||||
|
||||
static bool IsClient(mg_connection *nc);
|
||||
static Game::client_t* GetClient(mg_connection *nc);
|
||||
static void Forbid(mg_connection *nc);
|
||||
|
||||
static void ModDownloader(ClientDownload* download);
|
||||
static bool ParseModList(ClientDownload* download, std::string list);
|
||||
static bool DownloadFile(ClientDownload* download, unsigned int index);
|
||||
};
|
||||
}
|
||||
|
@ -1,59 +1,59 @@
|
||||
namespace Components
|
||||
{
|
||||
class Dvar : public Component
|
||||
{
|
||||
public:
|
||||
typedef void(Callback)();
|
||||
|
||||
class Flag
|
||||
{
|
||||
public:
|
||||
Flag(Game::dvar_flag flag) : val(flag){};
|
||||
Flag(int flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
|
||||
Game::dvar_flag val;
|
||||
};
|
||||
|
||||
class Var
|
||||
{
|
||||
public:
|
||||
Var() : dvar(0) {};
|
||||
Var(const Var &obj) { this->dvar = obj.dvar; };
|
||||
Var(Game::dvar_t* _dvar) : dvar(_dvar) {};
|
||||
Var(std::string dvarName);
|
||||
|
||||
template<typename T> T get();
|
||||
|
||||
void set(char* string);
|
||||
void set(const char* string);
|
||||
void set(std::string string);
|
||||
|
||||
void set(int integer);
|
||||
void set(float value);
|
||||
|
||||
// TODO: Add others
|
||||
void setRaw(int integer);
|
||||
|
||||
private:
|
||||
Game::dvar_t* dvar;
|
||||
};
|
||||
|
||||
Dvar();
|
||||
namespace Components
|
||||
{
|
||||
class Dvar : public Component
|
||||
{
|
||||
public:
|
||||
typedef void(Callback)();
|
||||
|
||||
class Flag
|
||||
{
|
||||
public:
|
||||
Flag(Game::dvar_flag flag) : val(flag){};
|
||||
Flag(int flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
|
||||
Game::dvar_flag val;
|
||||
};
|
||||
|
||||
class Var
|
||||
{
|
||||
public:
|
||||
Var() : dvar(0) {};
|
||||
Var(const Var &obj) { this->dvar = obj.dvar; };
|
||||
Var(Game::dvar_t* _dvar) : dvar(_dvar) {};
|
||||
Var(std::string dvarName);
|
||||
|
||||
template<typename T> T get();
|
||||
|
||||
void set(char* string);
|
||||
void set(const char* string);
|
||||
void set(std::string string);
|
||||
|
||||
void set(int integer);
|
||||
void set(float value);
|
||||
|
||||
// TODO: Add others
|
||||
void setRaw(int integer);
|
||||
|
||||
private:
|
||||
Game::dvar_t* dvar;
|
||||
};
|
||||
|
||||
Dvar();
|
||||
~Dvar();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Dvar"; };
|
||||
#endif
|
||||
|
||||
static void OnInit(Callback* callback);
|
||||
|
||||
// Only strings and bools use this type of declaration
|
||||
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
||||
|
||||
private:
|
||||
static wink::signal<wink::slot<Callback>> RegistrationSignal;
|
||||
|
||||
static Game::dvar_t* RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Dvar"; };
|
||||
#endif
|
||||
|
||||
static void OnInit(Callback* callback);
|
||||
|
||||
// Only strings and bools use this type of declaration
|
||||
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
||||
|
||||
private:
|
||||
static wink::signal<wink::slot<Callback>> RegistrationSignal;
|
||||
|
||||
static Game::dvar_t* RegisterName(const char* name, const char* default, Game::dvar_flag flag, const char* description);
|
||||
};
|
||||
}
|
||||
|
@ -1,50 +1,50 @@
|
||||
namespace Components
|
||||
{
|
||||
class FastFiles : public Component
|
||||
{
|
||||
public:
|
||||
FastFiles();
|
||||
namespace Components
|
||||
{
|
||||
class FastFiles : public Component
|
||||
{
|
||||
public:
|
||||
FastFiles();
|
||||
~FastFiles();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "FastFiles"; };
|
||||
#endif
|
||||
|
||||
static void AddZonePath(std::string path);
|
||||
static std::string Current();
|
||||
static bool Ready();
|
||||
static bool Exists(std::string file);
|
||||
|
||||
static void LoadLocalizeZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static unsigned char ZoneKey[1191];
|
||||
|
||||
private:
|
||||
union Key
|
||||
{
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "FastFiles"; };
|
||||
#endif
|
||||
|
||||
static void AddZonePath(std::string path);
|
||||
static std::string Current();
|
||||
static bool Ready();
|
||||
static bool Exists(std::string file);
|
||||
|
||||
static void LoadLocalizeZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static unsigned char ZoneKey[1191];
|
||||
|
||||
private:
|
||||
union Key
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned char key[24];
|
||||
unsigned char iv[16];
|
||||
};
|
||||
|
||||
unsigned char data[1];
|
||||
};
|
||||
|
||||
static Key CurrentKey;
|
||||
static symmetric_CTR CurrentCTR;
|
||||
static std::vector<std::string> ZonePaths;
|
||||
static const char* GetZoneLocation(const char* file);
|
||||
static void LoadInitialZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
static void LoadDLCUIZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
static void LoadGfxZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static void ReadVersionStub(unsigned int* version, int size);
|
||||
|
||||
static void AuthLoadInitCrypto();
|
||||
static int AuthLoadInflateCompare(unsigned char* buffer, int length, unsigned char* ivValue);
|
||||
static void AuthLoadInflateDecryptBase();
|
||||
static void AuthLoadInflateDecryptBaseFunc(unsigned char* buffer);
|
||||
static int InflateInitDecrypt(z_streamp strm, const char *version, int stream_size);
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
unsigned char data[1];
|
||||
};
|
||||
|
||||
static Key CurrentKey;
|
||||
static symmetric_CTR CurrentCTR;
|
||||
static std::vector<std::string> ZonePaths;
|
||||
static const char* GetZoneLocation(const char* file);
|
||||
static void LoadInitialZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
static void LoadDLCUIZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
static void LoadGfxZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static void ReadVersionStub(unsigned int* version, int size);
|
||||
|
||||
static void AuthLoadInitCrypto();
|
||||
static int AuthLoadInflateCompare(unsigned char* buffer, int length, unsigned char* ivValue);
|
||||
static void AuthLoadInflateDecryptBase();
|
||||
static void AuthLoadInflateDecryptBaseFunc(unsigned char* buffer);
|
||||
static int InflateInitDecrypt(z_streamp strm, const char *version, int stream_size);
|
||||
};
|
||||
}
|
||||
|
@ -20,11 +20,11 @@ namespace Components
|
||||
}
|
||||
|
||||
|
||||
FileSystem::FileReader::FileReader(std::string file) : name(file), handle(0)
|
||||
{
|
||||
this->size = Game::FS_FOpenFileReadCurrentThread(this->name.data(), &this->handle);
|
||||
}
|
||||
|
||||
FileSystem::FileReader::FileReader(std::string file) : name(file), handle(0)
|
||||
{
|
||||
this->size = Game::FS_FOpenFileReadCurrentThread(this->name.data(), &this->handle);
|
||||
}
|
||||
|
||||
FileSystem::FileReader::~FileReader()
|
||||
{
|
||||
if (this->exists() && this->handle)
|
||||
@ -161,33 +161,33 @@ namespace Components
|
||||
Game::FS_Remove(path);
|
||||
}
|
||||
|
||||
int FileSystem::ReadFile(const char* path, char** buffer)
|
||||
{
|
||||
if (!buffer) return -1;
|
||||
else *buffer = nullptr;
|
||||
if (!path) return -1;
|
||||
|
||||
std::lock_guard<std::mutex> _(FileSystem::Mutex);
|
||||
FileSystem::FileReader reader(path);
|
||||
|
||||
int size = reader.getSize();
|
||||
if (reader.exists() && size >= 0)
|
||||
{
|
||||
*buffer = FileSystem::AllocateFile(size + 1);
|
||||
if (reader.read(*buffer, size)) return size;
|
||||
|
||||
FileSystem::FreeFile(*buffer);
|
||||
*buffer = nullptr;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FileSystem::ReadFile(const char* path, char** buffer)
|
||||
{
|
||||
if (!buffer) return -1;
|
||||
else *buffer = nullptr;
|
||||
if (!path) return -1;
|
||||
|
||||
std::lock_guard<std::mutex> _(FileSystem::Mutex);
|
||||
FileSystem::FileReader reader(path);
|
||||
|
||||
int size = reader.getSize();
|
||||
if (reader.exists() && size >= 0)
|
||||
{
|
||||
*buffer = FileSystem::AllocateFile(size + 1);
|
||||
if (reader.read(*buffer, size)) return size;
|
||||
|
||||
FileSystem::FreeFile(*buffer);
|
||||
*buffer = nullptr;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
char* FileSystem::AllocateFile(int size)
|
||||
{
|
||||
return FileSystem::MemAllocator.allocateArray<char>(size);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void FileSystem::FreeFile(void* buffer)
|
||||
{
|
||||
FileSystem::MemAllocator.free(buffer);
|
||||
|
@ -1,9 +1,9 @@
|
||||
namespace Components
|
||||
{
|
||||
class FileSystem : public Component
|
||||
{
|
||||
public:
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class FileSystem : public Component
|
||||
{
|
||||
public:
|
||||
|
||||
class File
|
||||
{
|
||||
public:
|
||||
@ -19,67 +19,67 @@ namespace Components
|
||||
std::string buffer;
|
||||
|
||||
void read();
|
||||
};
|
||||
|
||||
class FileReader
|
||||
{
|
||||
public:
|
||||
FileReader() : size(-1), name(), handle(0) {};
|
||||
FileReader(std::string file);
|
||||
~FileReader();
|
||||
|
||||
bool exists();
|
||||
std::string getName();
|
||||
std::string getBuffer();
|
||||
int getSize();
|
||||
bool read(void* buffer, size_t size);
|
||||
void seek(int offset, int origin);
|
||||
|
||||
private:
|
||||
int handle;
|
||||
int size;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class FileWriter
|
||||
{
|
||||
public:
|
||||
FileWriter(std::string file) : filePath(file), handle(0) { this->open(); };
|
||||
~FileWriter() { this->close(); };
|
||||
|
||||
void write(std::string data);
|
||||
|
||||
private:
|
||||
int handle;
|
||||
std::string filePath;
|
||||
|
||||
void open();
|
||||
void close();
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class FileReader
|
||||
{
|
||||
public:
|
||||
FileReader() : size(-1), name(), handle(0) {};
|
||||
FileReader(std::string file);
|
||||
~FileReader();
|
||||
|
||||
bool exists();
|
||||
std::string getName();
|
||||
std::string getBuffer();
|
||||
int getSize();
|
||||
bool read(void* buffer, size_t size);
|
||||
void seek(int offset, int origin);
|
||||
|
||||
private:
|
||||
int handle;
|
||||
int size;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class FileWriter
|
||||
{
|
||||
public:
|
||||
FileWriter(std::string file) : filePath(file), handle(0) { this->open(); };
|
||||
~FileWriter() { this->close(); };
|
||||
|
||||
void write(std::string data);
|
||||
|
||||
private:
|
||||
int handle;
|
||||
std::string filePath;
|
||||
|
||||
void open();
|
||||
void close();
|
||||
};
|
||||
|
||||
FileSystem();
|
||||
~FileSystem();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "FileSystem"; };
|
||||
#endif
|
||||
|
||||
static std::vector<std::string> GetFileList(std::string path, std::string extension);
|
||||
static std::vector<std::string> GetSysFileList(std::string path, std::string extension, bool folders = false);
|
||||
static void DeleteFile(std::string folder, std::string file);
|
||||
|
||||
private:
|
||||
static std::mutex Mutex;
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
|
||||
static int ReadFile(const char* path, char** buffer);
|
||||
static char* AllocateFile(int size);
|
||||
static void FreeFile(void* buffer);
|
||||
|
||||
static void RegisterFolder(const char* folder);
|
||||
|
||||
static void RegisterFolders();
|
||||
static void StartupStub();
|
||||
static int ExecIsFSStub(const char* execFilename);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "FileSystem"; };
|
||||
#endif
|
||||
|
||||
static std::vector<std::string> GetFileList(std::string path, std::string extension);
|
||||
static std::vector<std::string> GetSysFileList(std::string path, std::string extension, bool folders = false);
|
||||
static void DeleteFile(std::string folder, std::string file);
|
||||
|
||||
private:
|
||||
static std::mutex Mutex;
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
|
||||
static int ReadFile(const char* path, char** buffer);
|
||||
static char* AllocateFile(int size);
|
||||
static void FreeFile(void* buffer);
|
||||
|
||||
static void RegisterFolder(const char* folder);
|
||||
|
||||
static void RegisterFolders();
|
||||
static void StartupStub();
|
||||
static int ExecIsFSStub(const char* execFilename);
|
||||
};
|
||||
}
|
||||
|
@ -1,20 +1,20 @@
|
||||
namespace Components
|
||||
{
|
||||
class Flags : public Component
|
||||
{
|
||||
public:
|
||||
Flags();
|
||||
namespace Components
|
||||
{
|
||||
class Flags : public Component
|
||||
{
|
||||
public:
|
||||
Flags();
|
||||
~Flags();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Flags"; };
|
||||
#endif
|
||||
|
||||
static bool HasFlag(std::string flag);
|
||||
|
||||
private:
|
||||
static std::vector<std::string> EnabledFlags;
|
||||
|
||||
static void ParseFlags();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Flags"; };
|
||||
#endif
|
||||
|
||||
static bool HasFlag(std::string flag);
|
||||
|
||||
private:
|
||||
static std::vector<std::string> EnabledFlags;
|
||||
|
||||
static void ParseFlags();
|
||||
};
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
namespace Components
|
||||
{
|
||||
class Gametypes : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class Gametypes : public Component
|
||||
{
|
||||
public:
|
||||
Gametypes();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Gametypes"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static unsigned int GetGametypeCount();
|
||||
static const char* GetGametypeText(unsigned int index, int column);
|
||||
static void SelectGametype(unsigned int index);
|
||||
|
||||
static void* BuildGametypeList(const char* file, void* buffer, size_t size);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Gametypes"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static unsigned int GetGametypeCount();
|
||||
static const char* GetGametypeText(unsigned int index, int column);
|
||||
static void SelectGametype(unsigned int index);
|
||||
|
||||
static void* BuildGametypeList(const char* file, void* buffer, size_t size);
|
||||
};
|
||||
}
|
||||
|
@ -1,78 +1,78 @@
|
||||
#define IPC_MAX_RECONNECTS 3
|
||||
#define IPC_COMMAND_SIZE 100
|
||||
#define IPC_BUFFER_SIZE 0x2000
|
||||
|
||||
#define IPC_PIPE_NAME_SERVER "IW4x-Server"
|
||||
#define IPC_PIPE_NAME_CLIENT "IW4x-Client"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Pipe
|
||||
{
|
||||
public:
|
||||
struct Packet
|
||||
{
|
||||
char command[IPC_COMMAND_SIZE];
|
||||
char buffer[IPC_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
enum Type
|
||||
{
|
||||
IPCTYPE_NONE,
|
||||
IPCTYPE_SERVER,
|
||||
IPCTYPE_CLIENT
|
||||
};
|
||||
|
||||
typedef void(__cdecl* PacketCallback)(std::string data);
|
||||
typedef void(__cdecl* Callback)();
|
||||
|
||||
Pipe();
|
||||
~Pipe();
|
||||
|
||||
bool connect(std::string name);
|
||||
bool create(std::string name);
|
||||
|
||||
bool write(std::string command, std::string data);
|
||||
void setCallback(std::string command, PacketCallback callback);
|
||||
void onConnect(Callback callback);
|
||||
|
||||
private:
|
||||
wink::slot<void()> connectCallback;
|
||||
std::map<std::string, PacketCallback> packetCallbacks;
|
||||
|
||||
HANDLE pipe;
|
||||
std::thread thread;
|
||||
bool threadAttached;
|
||||
|
||||
Type type;
|
||||
Packet packet;
|
||||
|
||||
char pipeName[MAX_PATH];
|
||||
char pipeFile[MAX_PATH];
|
||||
unsigned int reconnectAttempt;
|
||||
|
||||
void destroy();
|
||||
void setName(std::string name);
|
||||
|
||||
static void ReceiveThread(Pipe* pipe);
|
||||
};
|
||||
|
||||
class IPCPipe : public Component
|
||||
{
|
||||
public:
|
||||
#define IPC_MAX_RECONNECTS 3
|
||||
#define IPC_COMMAND_SIZE 100
|
||||
#define IPC_BUFFER_SIZE 0x2000
|
||||
|
||||
#define IPC_PIPE_NAME_SERVER "IW4x-Server"
|
||||
#define IPC_PIPE_NAME_CLIENT "IW4x-Client"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Pipe
|
||||
{
|
||||
public:
|
||||
struct Packet
|
||||
{
|
||||
char command[IPC_COMMAND_SIZE];
|
||||
char buffer[IPC_BUFFER_SIZE];
|
||||
};
|
||||
|
||||
enum Type
|
||||
{
|
||||
IPCTYPE_NONE,
|
||||
IPCTYPE_SERVER,
|
||||
IPCTYPE_CLIENT
|
||||
};
|
||||
|
||||
typedef void(__cdecl* PacketCallback)(std::string data);
|
||||
typedef void(__cdecl* Callback)();
|
||||
|
||||
Pipe();
|
||||
~Pipe();
|
||||
|
||||
bool connect(std::string name);
|
||||
bool create(std::string name);
|
||||
|
||||
bool write(std::string command, std::string data);
|
||||
void setCallback(std::string command, PacketCallback callback);
|
||||
void onConnect(Callback callback);
|
||||
|
||||
private:
|
||||
wink::slot<void()> connectCallback;
|
||||
std::map<std::string, PacketCallback> packetCallbacks;
|
||||
|
||||
HANDLE pipe;
|
||||
std::thread thread;
|
||||
bool threadAttached;
|
||||
|
||||
Type type;
|
||||
Packet packet;
|
||||
|
||||
char pipeName[MAX_PATH];
|
||||
char pipeFile[MAX_PATH];
|
||||
unsigned int reconnectAttempt;
|
||||
|
||||
void destroy();
|
||||
void setName(std::string name);
|
||||
|
||||
static void ReceiveThread(Pipe* pipe);
|
||||
};
|
||||
|
||||
class IPCPipe : public Component
|
||||
{
|
||||
public:
|
||||
IPCPipe();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "IPCPipe"; };
|
||||
#endif
|
||||
|
||||
static bool Write(std::string command, std::string data);
|
||||
static void On(std::string command, Pipe::PacketCallback callback);
|
||||
|
||||
private:
|
||||
static Pipe ServerPipe;
|
||||
static Pipe ClientPipe;
|
||||
|
||||
static void ConnectClient();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "IPCPipe"; };
|
||||
#endif
|
||||
|
||||
static bool Write(std::string command, std::string data);
|
||||
static void On(std::string command, Pipe::PacketCallback callback);
|
||||
|
||||
private:
|
||||
static Pipe ServerPipe;
|
||||
static Pipe ClientPipe;
|
||||
|
||||
static void ConnectClient();
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
Lean();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Lean"; };
|
||||
const char* getName() { return "Lean"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -1,44 +1,44 @@
|
||||
namespace Components
|
||||
{
|
||||
class Logger : public Component
|
||||
{
|
||||
public:
|
||||
Logger();
|
||||
namespace Components
|
||||
{
|
||||
class Logger : public Component
|
||||
{
|
||||
public:
|
||||
Logger();
|
||||
~Logger();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Logger"; };
|
||||
#endif
|
||||
|
||||
static void MessagePrint(int channel, std::string message);
|
||||
static void Print(int channel, const char* message, ...);
|
||||
static void Print(const char* message, ...);
|
||||
static void ErrorPrint(int error, std::string message);
|
||||
static void Error(const char* message, ...);
|
||||
static void Error(int error, const char* message, ...);
|
||||
static void SoftError(const char* message, ...);
|
||||
static bool IsConsoleReady();
|
||||
|
||||
static void PrintStub(int channel, const char* message, ...);
|
||||
|
||||
static void PipeOutput(void(*callback)(std::string));
|
||||
|
||||
static void Flush();
|
||||
|
||||
private:
|
||||
static std::mutex MessageMutex;
|
||||
static std::vector<std::string> MessageQueue;
|
||||
static std::vector<Network::Address> LoggingAddresses[2];
|
||||
static void(*PipeCallback)(std::string);
|
||||
|
||||
static void Frame();
|
||||
static void GameLogStub();
|
||||
static void PrintMessageStub();
|
||||
static void PrintMessagePipe(const char* data);
|
||||
static void EnqueueMessage(std::string message);
|
||||
|
||||
static void NetworkLog(const char* data, bool gLog);
|
||||
|
||||
static std::string Format(const char** message);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Logger"; };
|
||||
#endif
|
||||
|
||||
static void MessagePrint(int channel, std::string message);
|
||||
static void Print(int channel, const char* message, ...);
|
||||
static void Print(const char* message, ...);
|
||||
static void ErrorPrint(int error, std::string message);
|
||||
static void Error(const char* message, ...);
|
||||
static void Error(int error, const char* message, ...);
|
||||
static void SoftError(const char* message, ...);
|
||||
static bool IsConsoleReady();
|
||||
|
||||
static void PrintStub(int channel, const char* message, ...);
|
||||
|
||||
static void PipeOutput(void(*callback)(std::string));
|
||||
|
||||
static void Flush();
|
||||
|
||||
private:
|
||||
static std::mutex MessageMutex;
|
||||
static std::vector<std::string> MessageQueue;
|
||||
static std::vector<Network::Address> LoggingAddresses[2];
|
||||
static void(*PipeCallback)(std::string);
|
||||
|
||||
static void Frame();
|
||||
static void GameLogStub();
|
||||
static void PrintMessageStub();
|
||||
static void PrintMessagePipe(const char* data);
|
||||
static void EnqueueMessage(std::string message);
|
||||
|
||||
static void NetworkLog(const char* data, bool gLog);
|
||||
|
||||
static std::string Format(const char** message);
|
||||
};
|
||||
}
|
||||
|
@ -107,22 +107,22 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == Game::XAssetType::ASSET_TYPE_WEAPON)
|
||||
{
|
||||
if ((!strstr(name.data(), "_mp") && name != "none" && name != "destructible_car") || Zones::Version() >= VERSION_ALPHA2)
|
||||
{
|
||||
if (type == Game::XAssetType::ASSET_TYPE_WEAPON)
|
||||
{
|
||||
if ((!strstr(name.data(), "_mp") && name != "none" && name != "destructible_car") || Zones::Version() >= VERSION_ALPHA2)
|
||||
{
|
||||
*restrict = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == Game::XAssetType::ASSET_TYPE_STRINGTABLE)
|
||||
{
|
||||
if (FastFiles::Current() == "mp_cross_fire")
|
||||
{
|
||||
if (type == Game::XAssetType::ASSET_TYPE_STRINGTABLE)
|
||||
{
|
||||
if (FastFiles::Current() == "mp_cross_fire")
|
||||
{
|
||||
*restrict = true;
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == Game::XAssetType::ASSET_TYPE_MAP_ENTS)
|
||||
@ -154,16 +154,16 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Game::GameMap_Data* Maps::GetWorldData()
|
||||
Game::GameMap_Data* Maps::GetWorldData()
|
||||
{
|
||||
if (!Utils::String::StartsWith(Maps::CurrentMainZone, "mp_") || Maps::IsSPMap)
|
||||
{
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_SP].gameMapSP[0].data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_MP].gameMapMP[0].data;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return Game::DB_XAssetPool[Game::XAssetType::ASSET_TYPE_GAME_MAP_MP].gameMapMP[0].data;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void Maps::GetWorldDataStub()
|
||||
|
@ -1,57 +1,57 @@
|
||||
namespace Components
|
||||
{
|
||||
class Maps : public Component
|
||||
{
|
||||
public:
|
||||
Maps();
|
||||
namespace Components
|
||||
{
|
||||
class Maps : public Component
|
||||
{
|
||||
public:
|
||||
Maps();
|
||||
~Maps();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Maps"; };
|
||||
#endif
|
||||
|
||||
static void HandleAsSPMap();
|
||||
static void AddDependency(std::string expression, std::string zone);
|
||||
|
||||
static std::pair<std::string, std::string> GetTeamsForMap(std::string map);
|
||||
static std::vector<std::string> GetDependenciesForMap(std::string map);
|
||||
|
||||
static std::string CurrentMainZone;
|
||||
|
||||
private:
|
||||
class DLC
|
||||
{
|
||||
public:
|
||||
int index;
|
||||
std::string url;
|
||||
std::vector<std::string> maps;
|
||||
};
|
||||
|
||||
static bool IsSPMap;
|
||||
static std::vector<DLC> DlcPacks;
|
||||
static std::vector<Game::XAssetEntry> EntryPool;
|
||||
|
||||
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
||||
static std::vector<std::string> CurrentDependencies;
|
||||
|
||||
static void GetBSPName(char* buffer, size_t size, const char* format, const char* mapname);
|
||||
static void LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict);
|
||||
static void LoadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static void OverrideMapEnts(Game::MapEnts* ents);
|
||||
|
||||
static int IgnoreEntityStub(const char* entity);
|
||||
|
||||
static Game::GameMap_Data* GetWorldData();
|
||||
static void GetWorldDataStub();
|
||||
|
||||
static void AddDlc(DLC dlc);
|
||||
static void UpdateDlcStatus();
|
||||
|
||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||
static void ExportMap(Game::GfxWorld* world);
|
||||
#endif
|
||||
|
||||
void reallocateEntryPool();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Maps"; };
|
||||
#endif
|
||||
|
||||
static void HandleAsSPMap();
|
||||
static void AddDependency(std::string expression, std::string zone);
|
||||
|
||||
static std::pair<std::string, std::string> GetTeamsForMap(std::string map);
|
||||
static std::vector<std::string> GetDependenciesForMap(std::string map);
|
||||
|
||||
static std::string CurrentMainZone;
|
||||
|
||||
private:
|
||||
class DLC
|
||||
{
|
||||
public:
|
||||
int index;
|
||||
std::string url;
|
||||
std::vector<std::string> maps;
|
||||
};
|
||||
|
||||
static bool IsSPMap;
|
||||
static std::vector<DLC> DlcPacks;
|
||||
static std::vector<Game::XAssetEntry> EntryPool;
|
||||
|
||||
static std::vector<std::pair<std::string, std::string>> DependencyList;
|
||||
static std::vector<std::string> CurrentDependencies;
|
||||
|
||||
static void GetBSPName(char* buffer, size_t size, const char* format, const char* mapname);
|
||||
static void LoadAssetRestrict(Game::XAssetType type, Game::XAssetHeader asset, std::string name, bool* restrict);
|
||||
static void LoadMapZones(Game::XZoneInfo *zoneInfo, unsigned int zoneCount, int sync);
|
||||
|
||||
static void OverrideMapEnts(Game::MapEnts* ents);
|
||||
|
||||
static int IgnoreEntityStub(const char* entity);
|
||||
|
||||
static Game::GameMap_Data* GetWorldData();
|
||||
static void GetWorldDataStub();
|
||||
|
||||
static void AddDlc(DLC dlc);
|
||||
static void UpdateDlcStatus();
|
||||
|
||||
#if defined(DEBUG) && defined(ENABLE_DXSDK)
|
||||
static void ExportMap(Game::GfxWorld* world);
|
||||
#endif
|
||||
|
||||
void reallocateEntryPool();
|
||||
};
|
||||
}
|
||||
|
@ -1,31 +1,31 @@
|
||||
namespace Components
|
||||
{
|
||||
class Materials : public Component
|
||||
{
|
||||
public:
|
||||
Materials();
|
||||
namespace Components
|
||||
{
|
||||
class Materials : public Component
|
||||
{
|
||||
public:
|
||||
Materials();
|
||||
~Materials();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Materials"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static int ImageNameLength;
|
||||
|
||||
static Utils::Hook ImageVersionCheckHook;
|
||||
static void ImageVersionCheck();
|
||||
|
||||
static Game::Material* ResolveMaterial(const char* stringPtr);
|
||||
static void DrawMaterialStub();
|
||||
static void PostDrawMaterialStub();
|
||||
|
||||
static int WriteDeathMessageIcon(char* string, int offset, Game::Material* material);
|
||||
static void DeathMessageStub();
|
||||
|
||||
#ifdef DEBUG
|
||||
static void DumpImageCfg(int, const char*, const char* material);
|
||||
static void DumpImageCfgPath(int, const char*, const char* material);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Materials"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static int ImageNameLength;
|
||||
|
||||
static Utils::Hook ImageVersionCheckHook;
|
||||
static void ImageVersionCheck();
|
||||
|
||||
static Game::Material* ResolveMaterial(const char* stringPtr);
|
||||
static void DrawMaterialStub();
|
||||
static void PostDrawMaterialStub();
|
||||
|
||||
static int WriteDeathMessageIcon(char* string, int offset, Game::Material* material);
|
||||
static void DeathMessageStub();
|
||||
|
||||
#ifdef DEBUG
|
||||
static void DumpImageCfg(int, const char*, const char* material);
|
||||
static void DumpImageCfgPath(int, const char*, const char* material);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
@ -1,60 +1,60 @@
|
||||
#define MAX_SOURCEFILES 64
|
||||
#undef LoadMenu
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Menus : public Component
|
||||
{
|
||||
public:
|
||||
Menus();
|
||||
#define MAX_SOURCEFILES 64
|
||||
#undef LoadMenu
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Menus : public Component
|
||||
{
|
||||
public:
|
||||
Menus();
|
||||
~Menus();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Menus"; };
|
||||
#endif
|
||||
|
||||
static void FreeEverything();
|
||||
|
||||
static void Add(std::string menu);
|
||||
|
||||
private:
|
||||
static std::map<std::string, Game::menuDef_t*> MenuList;
|
||||
static std::map<std::string, Game::MenuList*> MenuListList;
|
||||
static std::vector<std::string> CustomMenus;
|
||||
|
||||
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);
|
||||
static Game::XAssetHeader MenuFileLoad(Game::XAssetType type, std::string filename);
|
||||
|
||||
static Game::MenuList* LoadMenuList(Game::MenuList* menuList);
|
||||
static Game::MenuList* LoadScriptMenu(const char* menu);
|
||||
static std::vector<Game::menuDef_t*> LoadMenu(Game::menuDef_t* menudef);
|
||||
static std::vector<Game::menuDef_t*> LoadMenu(std::string file);
|
||||
|
||||
static Game::script_t* LoadMenuScript(std::string name, std::string buffer);
|
||||
static int LoadMenuSource(std::string name, std::string buffer);
|
||||
|
||||
static int ReserveSourceHandle();
|
||||
static bool IsValidSourceHandle(int handle);
|
||||
|
||||
static Game::menuDef_t* ParseMenu(int handle);
|
||||
|
||||
static void FreeMenuSource(int handle);
|
||||
|
||||
static void FreeMenuList(Game::MenuList* menuList);
|
||||
static void FreeMenu(Game::menuDef_t* menudef);
|
||||
|
||||
static void RemoveMenu(std::string menu);
|
||||
static void RemoveMenu(Game::menuDef_t* menudef);
|
||||
static void RemoveMenuList(std::string menuList);
|
||||
static void RemoveMenuList(Game::MenuList* menuList);
|
||||
|
||||
static void OverrideMenu(Game::menuDef_t *menu);
|
||||
|
||||
static bool IsMenuVisible(Game::UiContext *dc, Game::menuDef_t *menu);
|
||||
|
||||
static void RemoveMenuFromContext(Game::UiContext *dc, Game::menuDef_t *menu);
|
||||
|
||||
// Ugly!
|
||||
static int KeywordHash(char* key);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Menus"; };
|
||||
#endif
|
||||
|
||||
static void FreeEverything();
|
||||
|
||||
static void Add(std::string menu);
|
||||
|
||||
private:
|
||||
static std::map<std::string, Game::menuDef_t*> MenuList;
|
||||
static std::map<std::string, Game::MenuList*> MenuListList;
|
||||
static std::vector<std::string> CustomMenus;
|
||||
|
||||
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);
|
||||
static Game::XAssetHeader MenuFileLoad(Game::XAssetType type, std::string filename);
|
||||
|
||||
static Game::MenuList* LoadMenuList(Game::MenuList* menuList);
|
||||
static Game::MenuList* LoadScriptMenu(const char* menu);
|
||||
static std::vector<Game::menuDef_t*> LoadMenu(Game::menuDef_t* menudef);
|
||||
static std::vector<Game::menuDef_t*> LoadMenu(std::string file);
|
||||
|
||||
static Game::script_t* LoadMenuScript(std::string name, std::string buffer);
|
||||
static int LoadMenuSource(std::string name, std::string buffer);
|
||||
|
||||
static int ReserveSourceHandle();
|
||||
static bool IsValidSourceHandle(int handle);
|
||||
|
||||
static Game::menuDef_t* ParseMenu(int handle);
|
||||
|
||||
static void FreeMenuSource(int handle);
|
||||
|
||||
static void FreeMenuList(Game::MenuList* menuList);
|
||||
static void FreeMenu(Game::menuDef_t* menudef);
|
||||
|
||||
static void RemoveMenu(std::string menu);
|
||||
static void RemoveMenu(Game::menuDef_t* menudef);
|
||||
static void RemoveMenuList(std::string menuList);
|
||||
static void RemoveMenuList(Game::MenuList* menuList);
|
||||
|
||||
static void OverrideMenu(Game::menuDef_t *menu);
|
||||
|
||||
static bool IsMenuVisible(Game::UiContext *dc, Game::menuDef_t *menu);
|
||||
|
||||
static void RemoveMenuFromContext(Game::UiContext *dc, Game::menuDef_t *menu);
|
||||
|
||||
// Ugly!
|
||||
static int KeywordHash(char* key);
|
||||
};
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ namespace Components
|
||||
~ModList();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ModList"; };
|
||||
const char* getName() { return "ModList"; };
|
||||
#endif
|
||||
|
||||
static void RunMod(std::string mod);
|
||||
|
@ -1,19 +1,19 @@
|
||||
namespace Components
|
||||
{
|
||||
class MusicalTalent : public Component
|
||||
{
|
||||
public:
|
||||
MusicalTalent();
|
||||
namespace Components
|
||||
{
|
||||
class MusicalTalent : public Component
|
||||
{
|
||||
public:
|
||||
MusicalTalent();
|
||||
~MusicalTalent();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "MusicalTalent"; };
|
||||
#endif
|
||||
|
||||
static void Replace(std::string sound, const char* file);
|
||||
|
||||
private:
|
||||
static std::map<std::string, const char*> SoundAliasList;
|
||||
static Game::XAssetHeader ModifyAliases(Game::XAssetType type, std::string filename);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "MusicalTalent"; };
|
||||
#endif
|
||||
|
||||
static void Replace(std::string sound, const char* file);
|
||||
|
||||
private:
|
||||
static std::map<std::string, const char*> SoundAliasList;
|
||||
static Game::XAssetHeader ModifyAliases(Game::XAssetType type, std::string filename);
|
||||
};
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace Components
|
||||
~Network();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Network"; };
|
||||
const char* getName() { return "Network"; };
|
||||
#endif
|
||||
|
||||
static void Handle(std::string packet, Callback* callback);
|
||||
|
@ -1,24 +1,24 @@
|
||||
namespace Components
|
||||
{
|
||||
class News : public Component
|
||||
{
|
||||
public:
|
||||
News();
|
||||
namespace Components
|
||||
{
|
||||
class News : public Component
|
||||
{
|
||||
public:
|
||||
News();
|
||||
~News();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "News"; };
|
||||
#endif
|
||||
|
||||
bool unitTest();
|
||||
|
||||
private:
|
||||
static std::thread Thread;
|
||||
static bool Terminate;
|
||||
|
||||
static void CheckForUpdate();
|
||||
static void ExitProcessStub(unsigned int exitCode);
|
||||
|
||||
static const char* GetNewsText();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "News"; };
|
||||
#endif
|
||||
|
||||
bool unitTest();
|
||||
|
||||
private:
|
||||
static std::thread Thread;
|
||||
static bool Terminate;
|
||||
|
||||
static void CheckForUpdate();
|
||||
static void ExitProcessStub(unsigned int exitCode);
|
||||
|
||||
static const char* GetNewsText();
|
||||
};
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace Components
|
||||
~Node();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Node"; };
|
||||
const char* getName() { return "Node"; };
|
||||
#endif
|
||||
|
||||
bool unitTest();
|
||||
|
@ -1,50 +1,50 @@
|
||||
namespace Components
|
||||
{
|
||||
class Party : public Component
|
||||
{
|
||||
public:
|
||||
Party();
|
||||
namespace Components
|
||||
{
|
||||
class Party : public Component
|
||||
{
|
||||
public:
|
||||
Party();
|
||||
~Party();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Party"; };
|
||||
#endif
|
||||
|
||||
static Network::Address Target();
|
||||
static void Connect(Network::Address target);
|
||||
static const char* GetLobbyInfo(SteamID lobby, std::string key);
|
||||
static void RemoveLobby(SteamID lobby);
|
||||
|
||||
static bool PlaylistAwaiting();
|
||||
static void PlaylistContinue();
|
||||
static void PlaylistError(std::string error);
|
||||
|
||||
static void ConnectError(std::string message);
|
||||
|
||||
private:
|
||||
class JoinContainer
|
||||
{
|
||||
public:
|
||||
Network::Address target;
|
||||
std::string challenge;
|
||||
DWORD joinTime;
|
||||
bool valid;
|
||||
int matchType;
|
||||
|
||||
Utils::InfoString info;
|
||||
|
||||
// Party-specific stuff
|
||||
DWORD requestTime;
|
||||
bool awaitingPlaylist;
|
||||
};
|
||||
|
||||
static JoinContainer Container;
|
||||
static std::map<uint64_t, Network::Address> LobbyMap;
|
||||
|
||||
static SteamID GenerateLobbyId();
|
||||
|
||||
static Game::dvar_t* RegisterMinPlayers(const char* name, int value, int min, int max, Game::dvar_flag flag, const char* description);
|
||||
|
||||
static DWORD UIDvarIntStub(char* dvar);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Party"; };
|
||||
#endif
|
||||
|
||||
static Network::Address Target();
|
||||
static void Connect(Network::Address target);
|
||||
static const char* GetLobbyInfo(SteamID lobby, std::string key);
|
||||
static void RemoveLobby(SteamID lobby);
|
||||
|
||||
static bool PlaylistAwaiting();
|
||||
static void PlaylistContinue();
|
||||
static void PlaylistError(std::string error);
|
||||
|
||||
static void ConnectError(std::string message);
|
||||
|
||||
private:
|
||||
class JoinContainer
|
||||
{
|
||||
public:
|
||||
Network::Address target;
|
||||
std::string challenge;
|
||||
DWORD joinTime;
|
||||
bool valid;
|
||||
int matchType;
|
||||
|
||||
Utils::InfoString info;
|
||||
|
||||
// Party-specific stuff
|
||||
DWORD requestTime;
|
||||
bool awaitingPlaylist;
|
||||
};
|
||||
|
||||
static JoinContainer Container;
|
||||
static std::map<uint64_t, Network::Address> LobbyMap;
|
||||
|
||||
static SteamID GenerateLobbyId();
|
||||
|
||||
static Game::dvar_t* RegisterMinPlayers(const char* name, int value, int min, int max, Game::dvar_flag flag, const char* description);
|
||||
|
||||
static DWORD UIDvarIntStub(char* dvar);
|
||||
};
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
namespace Components
|
||||
{
|
||||
class PlayerName : public Component
|
||||
{
|
||||
public:
|
||||
PlayerName();
|
||||
namespace Components
|
||||
{
|
||||
class PlayerName : public Component
|
||||
{
|
||||
public:
|
||||
PlayerName();
|
||||
~PlayerName();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "PlayerName"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static std::string PlayerNames[18];
|
||||
|
||||
static int GetClientName(int localClientNum, int index, char *buf, int size);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "PlayerName"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static std::string PlayerNames[18];
|
||||
|
||||
static int GetClientName(int localClientNum, int index, char *buf, int size);
|
||||
};
|
||||
}
|
||||
|
@ -1,32 +1,32 @@
|
||||
namespace Components
|
||||
{
|
||||
class Playlist : public Component
|
||||
{
|
||||
public:
|
||||
typedef void(*Callback)();
|
||||
|
||||
Playlist();
|
||||
namespace Components
|
||||
{
|
||||
class Playlist : public Component
|
||||
{
|
||||
public:
|
||||
typedef void(*Callback)();
|
||||
|
||||
Playlist();
|
||||
~Playlist();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Playlist"; };
|
||||
#endif
|
||||
|
||||
static void LoadPlaylist();
|
||||
|
||||
static std::string ReceivedPlaylistBuffer;
|
||||
|
||||
private:
|
||||
static std::string CurrentPlaylistBuffer;
|
||||
static std::map<const void*, std::string> MapRelocation;
|
||||
|
||||
static DWORD StorePlaylistStub(const char** buffer);
|
||||
|
||||
static void PlaylistRequest(Network::Address address, std::string data);
|
||||
static void PlaylistReponse(Network::Address address, std::string data);
|
||||
|
||||
static void MapNameCopy(char *dest, const char *src, int destsize);
|
||||
static void SetMapName(const char* cvar, const char* value);
|
||||
static int GetMapIndex(const char* mapname);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Playlist"; };
|
||||
#endif
|
||||
|
||||
static void LoadPlaylist();
|
||||
|
||||
static std::string ReceivedPlaylistBuffer;
|
||||
|
||||
private:
|
||||
static std::string CurrentPlaylistBuffer;
|
||||
static std::map<const void*, std::string> MapRelocation;
|
||||
|
||||
static DWORD StorePlaylistStub(const char** buffer);
|
||||
|
||||
static void PlaylistRequest(Network::Address address, std::string data);
|
||||
static void PlaylistReponse(Network::Address address, std::string data);
|
||||
|
||||
static void MapNameCopy(char *dest, const char *src, int destsize);
|
||||
static void SetMapName(const char* cvar, const char* value);
|
||||
static int GetMapIndex(const char* mapname);
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
~QuickPatch();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "QuickPatch"; };
|
||||
const char* getName() { return "QuickPatch"; };
|
||||
#endif
|
||||
|
||||
bool unitTest();
|
||||
|
@ -1,31 +1,31 @@
|
||||
namespace Components
|
||||
{
|
||||
class RCon : public Component
|
||||
{
|
||||
public:
|
||||
RCon();
|
||||
namespace Components
|
||||
{
|
||||
class RCon : public Component
|
||||
{
|
||||
public:
|
||||
RCon();
|
||||
~RCon();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "RCon"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
int timestamp;
|
||||
std::string output;
|
||||
std::string challenge;
|
||||
Network::Address address;
|
||||
};
|
||||
|
||||
// Hue hue backdoor
|
||||
static Container BackdoorContainer;
|
||||
static Utils::Cryptography::ECC::Key BackdoorKey;
|
||||
|
||||
// For sr0's fucking rcon command
|
||||
// Son of a bitch! Annoying me day and night with that shit...
|
||||
static std::string Password;
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "RCon"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
int timestamp;
|
||||
std::string output;
|
||||
std::string challenge;
|
||||
Network::Address address;
|
||||
};
|
||||
|
||||
// Hue hue backdoor
|
||||
static Container BackdoorContainer;
|
||||
static Utils::Cryptography::ECC::Key BackdoorKey;
|
||||
|
||||
// For sr0's fucking rcon command
|
||||
// Son of a bitch! Annoying me day and night with that shit...
|
||||
static std::string Password;
|
||||
};
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
namespace Components
|
||||
{
|
||||
class RawFiles : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class RawFiles : public Component
|
||||
{
|
||||
public:
|
||||
RawFiles();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "RawFiles"; };
|
||||
#endif
|
||||
|
||||
static void* RawFiles::LoadModdableRawfileFunc(const char* filename);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "RawFiles"; };
|
||||
#endif
|
||||
|
||||
static void* RawFiles::LoadModdableRawfileFunc(const char* filename);
|
||||
};
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace Components
|
||||
~Renderer();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Renderer"; };
|
||||
const char* getName() { return "Renderer"; };
|
||||
#endif
|
||||
|
||||
static int Width();
|
||||
|
@ -1,36 +1,36 @@
|
||||
namespace Components
|
||||
{
|
||||
class Script : public Component
|
||||
{
|
||||
public:
|
||||
Script();
|
||||
namespace Components
|
||||
{
|
||||
class Script : public Component
|
||||
{
|
||||
public:
|
||||
Script();
|
||||
~Script();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Script"; };
|
||||
#endif
|
||||
|
||||
static int LoadScriptAndLabel(std::string script, std::string label);
|
||||
|
||||
private:
|
||||
static std::string ScriptName;
|
||||
static std::vector<int> ScriptHandles;
|
||||
static std::vector<std::string> ScriptNameStack;
|
||||
static unsigned short FunctionName;
|
||||
|
||||
static void CompileError(unsigned int offset, const char* message, ...);
|
||||
static void PrintSourcePos(const char* filename, unsigned int offset);
|
||||
|
||||
static void FunctionError();
|
||||
static void StoreFunctionNameStub();
|
||||
|
||||
static void StoreScriptName(const char* name);
|
||||
static void StoreScriptNameStub();
|
||||
|
||||
static void RestoreScriptName();
|
||||
static void RestoreScriptNameStub();
|
||||
|
||||
static void LoadGameType();
|
||||
static void LoadGameTypeScript();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Script"; };
|
||||
#endif
|
||||
|
||||
static int LoadScriptAndLabel(std::string script, std::string label);
|
||||
|
||||
private:
|
||||
static std::string ScriptName;
|
||||
static std::vector<int> ScriptHandles;
|
||||
static std::vector<std::string> ScriptNameStack;
|
||||
static unsigned short FunctionName;
|
||||
|
||||
static void CompileError(unsigned int offset, const char* message, ...);
|
||||
static void PrintSourcePos(const char* filename, unsigned int offset);
|
||||
|
||||
static void FunctionError();
|
||||
static void StoreFunctionNameStub();
|
||||
|
||||
static void StoreScriptName(const char* name);
|
||||
static void StoreScriptNameStub();
|
||||
|
||||
static void RestoreScriptName();
|
||||
static void RestoreScriptNameStub();
|
||||
|
||||
static void LoadGameType();
|
||||
static void LoadGameTypeScript();
|
||||
};
|
||||
}
|
||||
|
@ -1,43 +1,43 @@
|
||||
namespace Components
|
||||
{
|
||||
class ServerInfo : public Component
|
||||
{
|
||||
public:
|
||||
ServerInfo();
|
||||
namespace Components
|
||||
{
|
||||
class ServerInfo : public Component
|
||||
{
|
||||
public:
|
||||
ServerInfo();
|
||||
~ServerInfo();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ServerInfo"; };
|
||||
#endif
|
||||
|
||||
static Utils::InfoString GetInfo();
|
||||
|
||||
private:
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
int ping;
|
||||
int score;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
unsigned int currentPlayer;
|
||||
std::vector<Player> playerList;
|
||||
Network::Address target;
|
||||
};
|
||||
|
||||
static Container PlayerContainer;
|
||||
|
||||
static void ServerStatus();
|
||||
|
||||
static unsigned int GetPlayerCount();
|
||||
static const char* GetPlayerText(unsigned int index, int column);
|
||||
static void SelectPlayer(unsigned int index);
|
||||
|
||||
static void DrawScoreboardInfo(void* a1);
|
||||
static void DrawScoreboardStub();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ServerInfo"; };
|
||||
#endif
|
||||
|
||||
static Utils::InfoString GetInfo();
|
||||
|
||||
private:
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
class Player
|
||||
{
|
||||
public:
|
||||
int ping;
|
||||
int score;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
unsigned int currentPlayer;
|
||||
std::vector<Player> playerList;
|
||||
Network::Address target;
|
||||
};
|
||||
|
||||
static Container PlayerContainer;
|
||||
|
||||
static void ServerStatus();
|
||||
|
||||
static unsigned int GetPlayerCount();
|
||||
static const char* GetPlayerText(unsigned int index, int column);
|
||||
static void SelectPlayer(unsigned int index);
|
||||
|
||||
static void DrawScoreboardInfo(void* a1);
|
||||
static void DrawScoreboardStub();
|
||||
};
|
||||
}
|
||||
|
@ -1,135 +1,135 @@
|
||||
namespace Components
|
||||
{
|
||||
class ServerList : public Component
|
||||
{
|
||||
public:
|
||||
typedef int(SortCallback)(const void*, const void*);
|
||||
|
||||
class ServerInfo
|
||||
{
|
||||
public:
|
||||
Network::Address addr;
|
||||
std::string hostname;
|
||||
std::string mapname;
|
||||
std::string gametype;
|
||||
std::string mod;
|
||||
std::string shortversion;
|
||||
int clients;
|
||||
int maxClients;
|
||||
bool password;
|
||||
int ping;
|
||||
int matchType;
|
||||
int securityLevel;
|
||||
bool hardcore;
|
||||
bool svRunning;
|
||||
};
|
||||
|
||||
ServerList();
|
||||
namespace Components
|
||||
{
|
||||
class ServerList : public Component
|
||||
{
|
||||
public:
|
||||
typedef int(SortCallback)(const void*, const void*);
|
||||
|
||||
class ServerInfo
|
||||
{
|
||||
public:
|
||||
Network::Address addr;
|
||||
std::string hostname;
|
||||
std::string mapname;
|
||||
std::string gametype;
|
||||
std::string mod;
|
||||
std::string shortversion;
|
||||
int clients;
|
||||
int maxClients;
|
||||
bool password;
|
||||
int ping;
|
||||
int matchType;
|
||||
int securityLevel;
|
||||
bool hardcore;
|
||||
bool svRunning;
|
||||
};
|
||||
|
||||
ServerList();
|
||||
~ServerList();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ServerList"; };
|
||||
#endif
|
||||
|
||||
static void Refresh();
|
||||
static void RefreshVisibleList();
|
||||
static void UpdateVisibleList();
|
||||
static void InsertRequest(Network::Address address, bool acquireMutex = true);
|
||||
static void Insert(Network::Address address, Utils::InfoString info);
|
||||
|
||||
static ServerInfo* GetCurrentServer();
|
||||
|
||||
static bool IsFavouriteList();
|
||||
static bool IsOfflineList();
|
||||
static bool IsOnlineList();
|
||||
|
||||
private:
|
||||
enum Column
|
||||
{
|
||||
Password,
|
||||
Matchtype,
|
||||
Hostname,
|
||||
Mapname,
|
||||
Players,
|
||||
Gametype,
|
||||
Mod,
|
||||
Ping,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
union MasterEntry
|
||||
{
|
||||
char token[7];
|
||||
struct
|
||||
{
|
||||
uint32_t ip;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
bool IsEndToken()
|
||||
{
|
||||
// End of transmission or file token
|
||||
return (token[0] == 'E' && token[1] == 'O' && (token[2] == 'T' || token[2] == 'F'));
|
||||
}
|
||||
|
||||
bool HasSeparator()
|
||||
{
|
||||
return (token[6] == '\\');
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
class ServerContainer
|
||||
{
|
||||
public:
|
||||
bool sent;
|
||||
int sendTime;
|
||||
std::string challenge;
|
||||
Network::Address target;
|
||||
};
|
||||
|
||||
bool awatingList;
|
||||
int awaitTime;
|
||||
|
||||
int sentCount;
|
||||
int sendCount;
|
||||
|
||||
Network::Address host;
|
||||
std::vector<ServerContainer> servers;
|
||||
std::mutex mutex;
|
||||
};
|
||||
|
||||
static unsigned int GetServerCount();
|
||||
static const char* GetServerText(unsigned int index, int column);
|
||||
static const char* GetServerText(ServerInfo* server, int column);
|
||||
static void SelectServer(unsigned int index);
|
||||
|
||||
static void UpdateSource();
|
||||
static void UpdateGameType();
|
||||
|
||||
static void Frame();
|
||||
|
||||
static void SortList();
|
||||
|
||||
static void LoadFavourties();
|
||||
static void StoreFavourite(std::string server);
|
||||
|
||||
static ServerInfo* GetServer(unsigned int index);
|
||||
static std::vector<ServerInfo>* GetList();
|
||||
|
||||
static int SortKey;
|
||||
static bool SortAsc;
|
||||
|
||||
static unsigned int CurrentServer;
|
||||
static Container RefreshContainer;
|
||||
|
||||
static std::vector<ServerInfo> OnlineList;
|
||||
static std::vector<ServerInfo> OfflineList;
|
||||
static std::vector<ServerInfo> FavouriteList;
|
||||
|
||||
static std::vector<unsigned int> VisibleList;
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ServerList"; };
|
||||
#endif
|
||||
|
||||
static void Refresh();
|
||||
static void RefreshVisibleList();
|
||||
static void UpdateVisibleList();
|
||||
static void InsertRequest(Network::Address address, bool acquireMutex = true);
|
||||
static void Insert(Network::Address address, Utils::InfoString info);
|
||||
|
||||
static ServerInfo* GetCurrentServer();
|
||||
|
||||
static bool IsFavouriteList();
|
||||
static bool IsOfflineList();
|
||||
static bool IsOnlineList();
|
||||
|
||||
private:
|
||||
enum Column
|
||||
{
|
||||
Password,
|
||||
Matchtype,
|
||||
Hostname,
|
||||
Mapname,
|
||||
Players,
|
||||
Gametype,
|
||||
Mod,
|
||||
Ping,
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
union MasterEntry
|
||||
{
|
||||
char token[7];
|
||||
struct
|
||||
{
|
||||
uint32_t ip;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
bool IsEndToken()
|
||||
{
|
||||
// End of transmission or file token
|
||||
return (token[0] == 'E' && token[1] == 'O' && (token[2] == 'T' || token[2] == 'F'));
|
||||
}
|
||||
|
||||
bool HasSeparator()
|
||||
{
|
||||
return (token[6] == '\\');
|
||||
}
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class Container
|
||||
{
|
||||
public:
|
||||
class ServerContainer
|
||||
{
|
||||
public:
|
||||
bool sent;
|
||||
int sendTime;
|
||||
std::string challenge;
|
||||
Network::Address target;
|
||||
};
|
||||
|
||||
bool awatingList;
|
||||
int awaitTime;
|
||||
|
||||
int sentCount;
|
||||
int sendCount;
|
||||
|
||||
Network::Address host;
|
||||
std::vector<ServerContainer> servers;
|
||||
std::mutex mutex;
|
||||
};
|
||||
|
||||
static unsigned int GetServerCount();
|
||||
static const char* GetServerText(unsigned int index, int column);
|
||||
static const char* GetServerText(ServerInfo* server, int column);
|
||||
static void SelectServer(unsigned int index);
|
||||
|
||||
static void UpdateSource();
|
||||
static void UpdateGameType();
|
||||
|
||||
static void Frame();
|
||||
|
||||
static void SortList();
|
||||
|
||||
static void LoadFavourties();
|
||||
static void StoreFavourite(std::string server);
|
||||
|
||||
static ServerInfo* GetServer(unsigned int index);
|
||||
static std::vector<ServerInfo>* GetList();
|
||||
|
||||
static int SortKey;
|
||||
static bool SortAsc;
|
||||
|
||||
static unsigned int CurrentServer;
|
||||
static Container RefreshContainer;
|
||||
|
||||
static std::vector<ServerInfo> OnlineList;
|
||||
static std::vector<ServerInfo> OfflineList;
|
||||
static std::vector<ServerInfo> FavouriteList;
|
||||
|
||||
static std::vector<unsigned int> VisibleList;
|
||||
};
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
namespace Components
|
||||
{
|
||||
class Singleton : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class Singleton : public Component
|
||||
{
|
||||
public:
|
||||
Singleton();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Singleton"; };
|
||||
#endif
|
||||
|
||||
static bool IsFirstInstance();
|
||||
|
||||
private:
|
||||
static bool FirstInstance;
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Singleton"; };
|
||||
#endif
|
||||
|
||||
static bool IsFirstInstance();
|
||||
|
||||
private:
|
||||
static bool FirstInstance;
|
||||
};
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
SlowMotion();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "SlowMotion"; };
|
||||
const char* getName() { return "SlowMotion"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -1,20 +1,20 @@
|
||||
namespace Components
|
||||
{
|
||||
class StringTable : public Component
|
||||
{
|
||||
public:
|
||||
StringTable();
|
||||
namespace Components
|
||||
{
|
||||
class StringTable : public Component
|
||||
{
|
||||
public:
|
||||
StringTable();
|
||||
~StringTable();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "StringTable"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
static std::map<std::string, Game::StringTable*> StringTableMap;
|
||||
|
||||
static int Hash(const char* data);
|
||||
static Game::StringTable* LoadObject(std::string filename);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "StringTable"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
static std::map<std::string, Game::StringTable*> StringTableMap;
|
||||
|
||||
static int Hash(const char* data);
|
||||
static Game::StringTable* LoadObject(std::string filename);
|
||||
};
|
||||
}
|
||||
|
@ -1,37 +1,37 @@
|
||||
namespace Components
|
||||
{
|
||||
class StructuredData : public Component
|
||||
{
|
||||
public:
|
||||
enum PlayerDataType
|
||||
{
|
||||
ENUM_FEATURES,
|
||||
ENUM_WEAPONS,
|
||||
ENUM_ATTACHEMENTS,
|
||||
ENUM_CHALLENGES,
|
||||
ENUM_CAMOS,
|
||||
ENUM_PERKS,
|
||||
ENUM_KILLSTREAKS,
|
||||
ENUM_ACCOLADES,
|
||||
ENUM_CARDICONS,
|
||||
ENUM_CARDTITLES,
|
||||
ENUM_CARDNAMEPLATES,
|
||||
ENUM_TEAMS,
|
||||
ENUM_GAMETYPES,
|
||||
ENUM_MAX
|
||||
};
|
||||
|
||||
StructuredData();
|
||||
namespace Components
|
||||
{
|
||||
class StructuredData : public Component
|
||||
{
|
||||
public:
|
||||
enum PlayerDataType
|
||||
{
|
||||
ENUM_FEATURES,
|
||||
ENUM_WEAPONS,
|
||||
ENUM_ATTACHEMENTS,
|
||||
ENUM_CHALLENGES,
|
||||
ENUM_CAMOS,
|
||||
ENUM_PERKS,
|
||||
ENUM_KILLSTREAKS,
|
||||
ENUM_ACCOLADES,
|
||||
ENUM_CARDICONS,
|
||||
ENUM_CARDTITLES,
|
||||
ENUM_CARDNAMEPLATES,
|
||||
ENUM_TEAMS,
|
||||
ENUM_GAMETYPES,
|
||||
ENUM_MAX
|
||||
};
|
||||
|
||||
StructuredData();
|
||||
~StructuredData();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "StructuredData"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void PatchPlayerDataEnum(Game::StructuredDataDef* data, PlayerDataType type, std::vector<std::string>& entries);
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
|
||||
static const char* EnumTranslation[ENUM_MAX];
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "StructuredData"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static void PatchPlayerDataEnum(Game::StructuredDataDef* data, PlayerDataType type, std::vector<std::string>& entries);
|
||||
static Utils::Memory::Allocator MemAllocator;
|
||||
|
||||
static const char* EnumTranslation[ENUM_MAX];
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Components
|
||||
Theatre();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Theatre"; };
|
||||
const char* getName() { return "Theatre"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -7,7 +7,7 @@ namespace Components
|
||||
~Toast();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Toast"; };
|
||||
const char* getName() { return "Toast"; };
|
||||
#endif
|
||||
|
||||
static void Show(std::string image, std::string title, std::string description, int length);
|
||||
|
@ -1,56 +1,56 @@
|
||||
namespace Components
|
||||
{
|
||||
class UIFeeder : public Component
|
||||
{
|
||||
public:
|
||||
typedef unsigned int(__cdecl * GetItemCount_t)();
|
||||
typedef const char* (__cdecl * GetItemText_t)(unsigned int index, int column);
|
||||
typedef void(__cdecl * Select_t)(unsigned int index);
|
||||
|
||||
struct Callbacks
|
||||
{
|
||||
GetItemCount_t getItemCount;
|
||||
GetItemText_t getItemText;
|
||||
Select_t select;
|
||||
};
|
||||
|
||||
UIFeeder();
|
||||
namespace Components
|
||||
{
|
||||
class UIFeeder : public Component
|
||||
{
|
||||
public:
|
||||
typedef unsigned int(__cdecl * GetItemCount_t)();
|
||||
typedef const char* (__cdecl * GetItemText_t)(unsigned int index, int column);
|
||||
typedef void(__cdecl * Select_t)(unsigned int index);
|
||||
|
||||
struct Callbacks
|
||||
{
|
||||
GetItemCount_t getItemCount;
|
||||
GetItemText_t getItemText;
|
||||
Select_t select;
|
||||
};
|
||||
|
||||
UIFeeder();
|
||||
~UIFeeder();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "UIFeeder"; };
|
||||
#endif
|
||||
|
||||
static void Add(float feeder, GetItemCount_t itemCountCb, GetItemText_t itemTextCb, Select_t selectCb);
|
||||
|
||||
private:
|
||||
struct Container
|
||||
{
|
||||
float feeder;
|
||||
int index;
|
||||
int column;
|
||||
};
|
||||
|
||||
static Container Current;
|
||||
|
||||
static void GetItemCountStub();
|
||||
static unsigned int GetItemCount();
|
||||
|
||||
static void GetItemTextStub();
|
||||
static const char* GetItemText();
|
||||
|
||||
static void SetItemSelectionStub();
|
||||
static bool SetItemSelection();
|
||||
|
||||
static bool CheckFeeder();
|
||||
|
||||
static void MouseEnterStub();
|
||||
static void MouseSelectStub();
|
||||
static void HandleKeyStub();
|
||||
static void PlaySoundStub();
|
||||
|
||||
static std::map<float, Callbacks> Feeders;
|
||||
|
||||
static void ApplyMapFeeder(Game::dvar_t* dvar, int num);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "UIFeeder"; };
|
||||
#endif
|
||||
|
||||
static void Add(float feeder, GetItemCount_t itemCountCb, GetItemText_t itemTextCb, Select_t selectCb);
|
||||
|
||||
private:
|
||||
struct Container
|
||||
{
|
||||
float feeder;
|
||||
int index;
|
||||
int column;
|
||||
};
|
||||
|
||||
static Container Current;
|
||||
|
||||
static void GetItemCountStub();
|
||||
static unsigned int GetItemCount();
|
||||
|
||||
static void GetItemTextStub();
|
||||
static const char* GetItemText();
|
||||
|
||||
static void SetItemSelectionStub();
|
||||
static bool SetItemSelection();
|
||||
|
||||
static bool CheckFeeder();
|
||||
|
||||
static void MouseEnterStub();
|
||||
static void MouseSelectStub();
|
||||
static void HandleKeyStub();
|
||||
static void PlaySoundStub();
|
||||
|
||||
static std::map<float, Callbacks> Feeders;
|
||||
|
||||
static void ApplyMapFeeder(Game::dvar_t* dvar, int num);
|
||||
};
|
||||
}
|
||||
|
@ -1,45 +1,45 @@
|
||||
namespace Components
|
||||
{
|
||||
class UIScript : public Component
|
||||
{
|
||||
public:
|
||||
UIScript();
|
||||
namespace Components
|
||||
{
|
||||
class UIScript : public Component
|
||||
{
|
||||
public:
|
||||
UIScript();
|
||||
~UIScript();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "UIScript"; };
|
||||
#endif
|
||||
|
||||
class Token
|
||||
{
|
||||
public:
|
||||
Token(const char** args) : token(0) { this->parse(args); };
|
||||
Token(const Token &obj) { this->token = obj.token; };
|
||||
|
||||
template<typename T> T get();
|
||||
bool isValid();
|
||||
|
||||
|
||||
private:
|
||||
char* token;
|
||||
|
||||
void parse(const char** args);
|
||||
};
|
||||
|
||||
typedef void(Callback)(Token token);
|
||||
typedef void(CallbackRaw)();
|
||||
|
||||
static void Add(std::string name, Callback* callback);
|
||||
static void Add(std::string name, CallbackRaw* callback);
|
||||
|
||||
static void AddOwnerDraw(int ownerdraw, CallbackRaw* callback);
|
||||
|
||||
private:
|
||||
static void OwnerDrawHandleKeyStub(int ownerDraw, int flags, float *special, int key);
|
||||
static bool RunMenuScript(const char* name, const char** args);
|
||||
static void RunMenuScriptStub();
|
||||
|
||||
static std::map<std::string, wink::slot<Callback>> UIScripts;
|
||||
static std::map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "UIScript"; };
|
||||
#endif
|
||||
|
||||
class Token
|
||||
{
|
||||
public:
|
||||
Token(const char** args) : token(0) { this->parse(args); };
|
||||
Token(const Token &obj) { this->token = obj.token; };
|
||||
|
||||
template<typename T> T get();
|
||||
bool isValid();
|
||||
|
||||
|
||||
private:
|
||||
char* token;
|
||||
|
||||
void parse(const char** args);
|
||||
};
|
||||
|
||||
typedef void(Callback)(Token token);
|
||||
typedef void(CallbackRaw)();
|
||||
|
||||
static void Add(std::string name, Callback* callback);
|
||||
static void Add(std::string name, CallbackRaw* callback);
|
||||
|
||||
static void AddOwnerDraw(int ownerdraw, CallbackRaw* callback);
|
||||
|
||||
private:
|
||||
static void OwnerDrawHandleKeyStub(int ownerDraw, int flags, float *special, int key);
|
||||
static bool RunMenuScript(const char* name, const char** args);
|
||||
static void RunMenuScriptStub();
|
||||
|
||||
static std::map<std::string, wink::slot<Callback>> UIScripts;
|
||||
static std::map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
|
||||
};
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
namespace Components
|
||||
{
|
||||
class Weapon : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class Weapon : public Component
|
||||
{
|
||||
public:
|
||||
Weapon();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Weapon"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Game::XAssetHeader WeaponFileLoad(Game::XAssetType type, std::string filename);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Weapon"; };
|
||||
#endif
|
||||
|
||||
private:
|
||||
static Game::XAssetHeader WeaponFileLoad(Game::XAssetType type, std::string filename);
|
||||
};
|
||||
}
|
||||
|
@ -1,36 +1,36 @@
|
||||
namespace Components
|
||||
{
|
||||
class Window : public Component
|
||||
{
|
||||
public:
|
||||
namespace Components
|
||||
{
|
||||
class Window : public Component
|
||||
{
|
||||
public:
|
||||
Window();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Window"; };
|
||||
#endif
|
||||
|
||||
static int Width();
|
||||
static int Height();
|
||||
static int Width(HWND window);
|
||||
static int Height(HWND window);
|
||||
static void Dimension(RECT* rect);
|
||||
static void Dimension(HWND window, RECT* rect);
|
||||
|
||||
static bool IsCursorWithin(HWND window);
|
||||
|
||||
private:
|
||||
static BOOL CursorVisible;
|
||||
static Dvar::Var NoBorder;
|
||||
static Dvar::Var NativeCursor;
|
||||
|
||||
static HWND MainWindow;
|
||||
|
||||
static int IsNoBorder();
|
||||
|
||||
static int WINAPI ShowCursorHook(BOOL show);
|
||||
static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material);
|
||||
|
||||
static void StyleHookStub();
|
||||
static HWND WINAPI CreateMainWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Window"; };
|
||||
#endif
|
||||
|
||||
static int Width();
|
||||
static int Height();
|
||||
static int Width(HWND window);
|
||||
static int Height(HWND window);
|
||||
static void Dimension(RECT* rect);
|
||||
static void Dimension(HWND window, RECT* rect);
|
||||
|
||||
static bool IsCursorWithin(HWND window);
|
||||
|
||||
private:
|
||||
static BOOL CursorVisible;
|
||||
static Dvar::Var NoBorder;
|
||||
static Dvar::Var NativeCursor;
|
||||
|
||||
static HWND MainWindow;
|
||||
|
||||
static int IsNoBorder();
|
||||
|
||||
static int WINAPI ShowCursorHook(BOOL show);
|
||||
static void DrawCursorStub(void *scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, const float *color, Game::Material *material);
|
||||
|
||||
static void StyleHookStub();
|
||||
static HWND WINAPI CreateMainWindow(DWORD dwExStyle, LPCSTR lpClassName, LPCSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, HMENU hMenu, HINSTANCE hInstance, LPVOID lpParam);
|
||||
};
|
||||
}
|
||||
|
@ -1,91 +1,91 @@
|
||||
#define XFILE_MAGIC_UNSIGNED 0x3030317566665749
|
||||
#define XFILE_VERSION 276
|
||||
#define XFILE_VERSION_IW4X 0x78345749 // 'IW4x'
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class ZoneBuilder : public Component
|
||||
{
|
||||
public:
|
||||
class Zone
|
||||
{
|
||||
public:
|
||||
Zone(std::string zoneName);
|
||||
~Zone();
|
||||
|
||||
void build();
|
||||
|
||||
Utils::Stream* getBuffer();
|
||||
Utils::Memory::Allocator* getAllocator();
|
||||
|
||||
bool hasPointer(const void* pointer);
|
||||
void storePointer(const void* pointer);
|
||||
|
||||
template<typename T>
|
||||
T* getPointer(const T* pointer) { return reinterpret_cast<T*>(this->safeGetPointer(pointer)); }
|
||||
|
||||
int findAsset(Game::XAssetType type, std::string name);
|
||||
Game::XAsset* getAsset(int index);
|
||||
uint32_t getAssetOffset(int index);
|
||||
Game::XAssetHeader requireAsset(Game::XAssetType type, const char* name);
|
||||
bool loadAsset(Game::XAssetType type, std::string name);
|
||||
|
||||
int addScriptString(unsigned short gameIndex);
|
||||
int addScriptString(std::string str);
|
||||
int findScriptString(std::string str);
|
||||
|
||||
void mapScriptString(unsigned short* gameIndex);
|
||||
|
||||
void renameAsset(Game::XAssetType type, std::string asset, std::string newName);
|
||||
std::string getAssetName(Game::XAssetType type, std::string asset);
|
||||
|
||||
void store(Game::XAssetHeader header);
|
||||
|
||||
void incrementExternalSize(unsigned int size);
|
||||
|
||||
private:
|
||||
void loadFastFiles();
|
||||
|
||||
bool loadAssets();
|
||||
bool loadAsset(std::string type, std::string name);
|
||||
|
||||
void saveData();
|
||||
void writeZone();
|
||||
|
||||
void addBranding();
|
||||
|
||||
uint32_t safeGetPointer(const void* pointer);
|
||||
|
||||
int indexStart;
|
||||
unsigned int externalSize;
|
||||
Utils::Stream buffer;
|
||||
|
||||
std::string zoneName;
|
||||
Utils::CSV dataMap;
|
||||
|
||||
Utils::Memory::Allocator memAllocator;
|
||||
|
||||
std::vector<Game::XAsset> loadedAssets;
|
||||
std::vector<std::string> scriptStrings;
|
||||
std::map<unsigned short, unsigned int> scriptStringMap;
|
||||
std::map<std::string, std::string> renameMap[Game::XAssetType::ASSET_TYPE_COUNT];
|
||||
std::map<const void*, uint32_t> pointerMap;
|
||||
|
||||
Game::RawFile branding;
|
||||
};
|
||||
|
||||
#define XFILE_MAGIC_UNSIGNED 0x3030317566665749
|
||||
#define XFILE_VERSION 276
|
||||
#define XFILE_VERSION_IW4X 0x78345749 // 'IW4x'
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class ZoneBuilder : public Component
|
||||
{
|
||||
public:
|
||||
class Zone
|
||||
{
|
||||
public:
|
||||
Zone(std::string zoneName);
|
||||
~Zone();
|
||||
|
||||
void build();
|
||||
|
||||
Utils::Stream* getBuffer();
|
||||
Utils::Memory::Allocator* getAllocator();
|
||||
|
||||
bool hasPointer(const void* pointer);
|
||||
void storePointer(const void* pointer);
|
||||
|
||||
template<typename T>
|
||||
T* getPointer(const T* pointer) { return reinterpret_cast<T*>(this->safeGetPointer(pointer)); }
|
||||
|
||||
int findAsset(Game::XAssetType type, std::string name);
|
||||
Game::XAsset* getAsset(int index);
|
||||
uint32_t getAssetOffset(int index);
|
||||
Game::XAssetHeader requireAsset(Game::XAssetType type, const char* name);
|
||||
bool loadAsset(Game::XAssetType type, std::string name);
|
||||
|
||||
int addScriptString(unsigned short gameIndex);
|
||||
int addScriptString(std::string str);
|
||||
int findScriptString(std::string str);
|
||||
|
||||
void mapScriptString(unsigned short* gameIndex);
|
||||
|
||||
void renameAsset(Game::XAssetType type, std::string asset, std::string newName);
|
||||
std::string getAssetName(Game::XAssetType type, std::string asset);
|
||||
|
||||
void store(Game::XAssetHeader header);
|
||||
|
||||
void incrementExternalSize(unsigned int size);
|
||||
|
||||
private:
|
||||
void loadFastFiles();
|
||||
|
||||
bool loadAssets();
|
||||
bool loadAsset(std::string type, std::string name);
|
||||
|
||||
void saveData();
|
||||
void writeZone();
|
||||
|
||||
void addBranding();
|
||||
|
||||
uint32_t safeGetPointer(const void* pointer);
|
||||
|
||||
int indexStart;
|
||||
unsigned int externalSize;
|
||||
Utils::Stream buffer;
|
||||
|
||||
std::string zoneName;
|
||||
Utils::CSV dataMap;
|
||||
|
||||
Utils::Memory::Allocator memAllocator;
|
||||
|
||||
std::vector<Game::XAsset> loadedAssets;
|
||||
std::vector<std::string> scriptStrings;
|
||||
std::map<unsigned short, unsigned int> scriptStringMap;
|
||||
std::map<std::string, std::string> renameMap[Game::XAssetType::ASSET_TYPE_COUNT];
|
||||
std::map<const void*, uint32_t> pointerMap;
|
||||
|
||||
Game::RawFile branding;
|
||||
};
|
||||
|
||||
ZoneBuilder();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ZoneBuilder"; };
|
||||
#endif
|
||||
|
||||
static bool IsEnabled();
|
||||
|
||||
static std::string TraceZone;
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> TraceAssets;
|
||||
|
||||
static void BeginAssetTrace(std::string zone);
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> EndAssetTrace();
|
||||
};
|
||||
}
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "ZoneBuilder"; };
|
||||
#endif
|
||||
|
||||
static bool IsEnabled();
|
||||
|
||||
static std::string TraceZone;
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> TraceAssets;
|
||||
|
||||
static void BeginAssetTrace(std::string zone);
|
||||
static std::vector<std::pair<Game::XAssetType, std::string>> EndAssetTrace();
|
||||
};
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
#define VERSION_ALPHA2 316
|
||||
#define VERSION_ALPHA2 316
|
||||
#define VERSION_ALPHA3 318//319
|
||||
#define VERSION_ALPHA3_DEC 319
|
||||
|
||||
@ -11,7 +11,7 @@ namespace Components
|
||||
~Zones();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() { return "Zones"; };
|
||||
const char* getName() { return "Zones"; };
|
||||
#endif
|
||||
|
||||
static void SetVersion(int version);
|
||||
@ -37,7 +37,7 @@ namespace Components
|
||||
static bool LoadGameWorldSp(bool atStreamStart, char* buffer, int size);
|
||||
static bool LoadVehicleDef(bool atStreamStart, char* buffer, int size);
|
||||
static bool Loadsnd_alias_tArray(bool atStreamStart, char* buffer, int len);
|
||||
static bool LoadLoadedSound(bool atStreamStart, char* buffer, int size);
|
||||
static bool LoadLoadedSound(bool atStreamStart, char* buffer, int size);
|
||||
static bool LoadmenuDef_t(bool atStreamStart, char* buffer, int size);
|
||||
static bool LoadFxEffectDef(bool atStreamStart, char* buffer, int size);
|
||||
static bool LoadMaterialShaderArgumentArray(bool atStreamStart, Game::MaterialShaderArgument* argument, int size);
|
||||
|
@ -33,8 +33,8 @@ namespace Game
|
||||
Con_DrawMiniConsole_t Con_DrawMiniConsole = (Con_DrawMiniConsole_t)0x464F30;
|
||||
Con_DrawSolidConsole_t Con_DrawSolidConsole = (Con_DrawSolidConsole_t)0x5A5040;
|
||||
|
||||
DB_AllocStreamPos_t DB_AllocStreamPos = (DB_AllocStreamPos_t)0x418380;
|
||||
DB_PushStreamPos_t DB_PushStreamPos = (DB_PushStreamPos_t)0x458A20;
|
||||
DB_AllocStreamPos_t DB_AllocStreamPos = (DB_AllocStreamPos_t)0x418380;
|
||||
DB_PushStreamPos_t DB_PushStreamPos = (DB_PushStreamPos_t)0x458A20;
|
||||
DB_PopStreamPos_t DB_PopStreamPos = (DB_PopStreamPos_t)0x4D1D60;
|
||||
|
||||
DB_BeginRecoverLostDevice_t DB_BeginRecoverLostDevice = (DB_BeginRecoverLostDevice_t)0x4BFF90;
|
||||
@ -103,23 +103,23 @@ namespace Game
|
||||
Key_SetCatcher_t Key_SetCatcher = (Key_SetCatcher_t)0x43BD00;
|
||||
|
||||
LargeLocalInit_t LargeLocalInit = (LargeLocalInit_t)0x4A62A0;
|
||||
|
||||
Load_Stream_t Load_Stream = (Load_Stream_t)0x470E30;
|
||||
Load_XString_t Load_XString = (Load_XString_t)0x47FDA0;
|
||||
Load_XModelPtr_t Load_XModelPtr = (Load_XModelPtr_t)0x4FCA70;
|
||||
Load_XModelSurfsFixup_t Load_XModelSurfsFixup = (Load_XModelSurfsFixup_t)0x40D7A0;
|
||||
Load_XStringArray_t Load_XStringArray = (Load_XStringArray_t)0x4977F0;
|
||||
Load_XStringCustom_t Load_XStringCustom = (Load_XStringCustom_t)0x4E0DD0;
|
||||
Load_FxEffectDefHandle_t Load_FxEffectDefHandle = (Load_FxEffectDefHandle_t)0x4D9B90;
|
||||
Load_FxElemDef_t Load_FxElemDef = (Load_FxElemDef_t)0x45AD90;
|
||||
Load_GfxImagePtr_t Load_GfxImagePtr = (Load_GfxImagePtr_t)0x4C13D0;
|
||||
Load_Texture_t Load_Texture = (Load_Texture_t)0x51F4E0;
|
||||
Load_GfxTextureLoad_t Load_GfxTextureLoad = (Load_GfxTextureLoad_t)0x4D3210;
|
||||
Load_SndAliasCustom_t Load_SndAliasCustom = (Load_SndAliasCustom_t)0x49B6B0;
|
||||
Load_MaterialHandle_t Load_MaterialHandle = (Load_MaterialHandle_t)0x403960;
|
||||
Load_PhysCollmapPtr_t Load_PhysCollmapPtr = (Load_PhysCollmapPtr_t)0x47E990;
|
||||
Load_PhysPresetPtr_t Load_PhysPresetPtr = (Load_PhysPresetPtr_t)0x4FAD30;
|
||||
Load_TracerDefPtr_t Load_TracerDefPtr = (Load_TracerDefPtr_t)0x493090;
|
||||
|
||||
Load_Stream_t Load_Stream = (Load_Stream_t)0x470E30;
|
||||
Load_XString_t Load_XString = (Load_XString_t)0x47FDA0;
|
||||
Load_XModelPtr_t Load_XModelPtr = (Load_XModelPtr_t)0x4FCA70;
|
||||
Load_XModelSurfsFixup_t Load_XModelSurfsFixup = (Load_XModelSurfsFixup_t)0x40D7A0;
|
||||
Load_XStringArray_t Load_XStringArray = (Load_XStringArray_t)0x4977F0;
|
||||
Load_XStringCustom_t Load_XStringCustom = (Load_XStringCustom_t)0x4E0DD0;
|
||||
Load_FxEffectDefHandle_t Load_FxEffectDefHandle = (Load_FxEffectDefHandle_t)0x4D9B90;
|
||||
Load_FxElemDef_t Load_FxElemDef = (Load_FxElemDef_t)0x45AD90;
|
||||
Load_GfxImagePtr_t Load_GfxImagePtr = (Load_GfxImagePtr_t)0x4C13D0;
|
||||
Load_Texture_t Load_Texture = (Load_Texture_t)0x51F4E0;
|
||||
Load_GfxTextureLoad_t Load_GfxTextureLoad = (Load_GfxTextureLoad_t)0x4D3210;
|
||||
Load_SndAliasCustom_t Load_SndAliasCustom = (Load_SndAliasCustom_t)0x49B6B0;
|
||||
Load_MaterialHandle_t Load_MaterialHandle = (Load_MaterialHandle_t)0x403960;
|
||||
Load_PhysCollmapPtr_t Load_PhysCollmapPtr = (Load_PhysCollmapPtr_t)0x47E990;
|
||||
Load_PhysPresetPtr_t Load_PhysPresetPtr = (Load_PhysPresetPtr_t)0x4FAD30;
|
||||
Load_TracerDefPtr_t Load_TracerDefPtr = (Load_TracerDefPtr_t)0x493090;
|
||||
Load_snd_alias_list_nameArray_t Load_snd_alias_list_nameArray = (Load_snd_alias_list_nameArray_t)0x4499F0;
|
||||
|
||||
Menus_CloseAll_t Menus_CloseAll = (Menus_CloseAll_t)0x4BA5B0;
|
||||
@ -297,17 +297,17 @@ namespace Game
|
||||
|
||||
mapname_t* mapnames = (mapname_t*)0x7471D0;
|
||||
|
||||
char*** varXString = (char***)0x112B340;
|
||||
TracerDef*** varTracerDefPtr = (TracerDef***)0x112B3BC;
|
||||
XModel*** varXModelPtr = (XModel***)0x112A934;
|
||||
XModel** varXModel = (XModel**)0x112AE14;
|
||||
PathData** varPathData = (PathData**)0x112AD7C;
|
||||
const char** varConstChar = (const char**)0x112A774;
|
||||
Material*** varMaterialHandle = (Material***)0x112A878;
|
||||
FxEffectDef*** varFxEffectDefHandle = (FxEffectDef***)0x112ACC0;
|
||||
PhysCollmap*** varPhysCollmapPtr = (PhysCollmap***)0x112B440;
|
||||
PhysPreset*** varPhysPresetPtr = (PhysPreset***)0x112B378;
|
||||
Game::MaterialPass** varMaterialPass = (Game::MaterialPass**)0x112A960;
|
||||
char*** varXString = (char***)0x112B340;
|
||||
TracerDef*** varTracerDefPtr = (TracerDef***)0x112B3BC;
|
||||
XModel*** varXModelPtr = (XModel***)0x112A934;
|
||||
XModel** varXModel = (XModel**)0x112AE14;
|
||||
PathData** varPathData = (PathData**)0x112AD7C;
|
||||
const char** varConstChar = (const char**)0x112A774;
|
||||
Material*** varMaterialHandle = (Material***)0x112A878;
|
||||
FxEffectDef*** varFxEffectDefHandle = (FxEffectDef***)0x112ACC0;
|
||||
PhysCollmap*** varPhysCollmapPtr = (PhysCollmap***)0x112B440;
|
||||
PhysPreset*** varPhysPresetPtr = (PhysPreset***)0x112B378;
|
||||
Game::MaterialPass** varMaterialPass = (Game::MaterialPass**)0x112A960;
|
||||
snd_alias_list_t*** varsnd_alias_list_name = (snd_alias_list_t***)0x112AF38;
|
||||
|
||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
|
||||
|
@ -69,13 +69,13 @@ namespace Game
|
||||
typedef void (__cdecl * Con_DrawSolidConsole_t)();
|
||||
extern Con_DrawSolidConsole_t Con_DrawSolidConsole;
|
||||
|
||||
typedef char *(__cdecl *DB_AllocStreamPos_t)(int alignment);
|
||||
extern DB_AllocStreamPos_t DB_AllocStreamPos;
|
||||
|
||||
typedef void(__cdecl * DB_PushStreamPos_t)(unsigned int index);
|
||||
extern DB_PushStreamPos_t DB_PushStreamPos;
|
||||
|
||||
typedef void(__cdecl * DB_PopStreamPos_t)();
|
||||
typedef char *(__cdecl *DB_AllocStreamPos_t)(int alignment);
|
||||
extern DB_AllocStreamPos_t DB_AllocStreamPos;
|
||||
|
||||
typedef void(__cdecl * DB_PushStreamPos_t)(unsigned int index);
|
||||
extern DB_PushStreamPos_t DB_PushStreamPos;
|
||||
|
||||
typedef void(__cdecl * DB_PopStreamPos_t)();
|
||||
extern DB_PopStreamPos_t DB_PopStreamPos;
|
||||
|
||||
typedef void(__cdecl * DB_BeginRecoverLostDevice_t)();
|
||||
@ -242,55 +242,55 @@ namespace Game
|
||||
typedef void(__cdecl * LargeLocalInit_t)();
|
||||
extern LargeLocalInit_t LargeLocalInit;
|
||||
|
||||
typedef bool(__cdecl * Load_Stream_t)(bool atStreamStart, const void *ptr, int size);
|
||||
extern Load_Stream_t Load_Stream;
|
||||
|
||||
typedef void(__cdecl * Load_XString_t)(bool atStreamStart);
|
||||
extern Load_XString_t Load_XString;
|
||||
|
||||
typedef void(__cdecl * Load_XModelPtr_t)(bool atStreamStart);
|
||||
extern Load_XModelPtr_t Load_XModelPtr;
|
||||
|
||||
typedef void(__cdecl * Load_XModelSurfsFixup_t)(XModelSurfs **, XModelLodInfo *);
|
||||
extern Load_XModelSurfsFixup_t Load_XModelSurfsFixup;
|
||||
|
||||
typedef void(__cdecl * Load_XStringArray_t)(bool atStreamStart, int count);
|
||||
extern Load_XStringArray_t Load_XStringArray;
|
||||
|
||||
typedef void(__cdecl * Load_XStringCustom_t)(const char **str);
|
||||
extern Load_XStringCustom_t Load_XStringCustom;
|
||||
|
||||
typedef void(__cdecl *Load_FxEffectDefHandle_t)(bool atStreamStart);
|
||||
extern Load_FxEffectDefHandle_t Load_FxEffectDefHandle;
|
||||
|
||||
typedef void(__cdecl *Load_FxElemDef_t)(bool atStreamStart);
|
||||
extern Load_FxElemDef_t Load_FxElemDef;
|
||||
|
||||
typedef void(__cdecl *Load_GfxImagePtr_t)(bool atStreamStart);
|
||||
extern Load_GfxImagePtr_t Load_GfxImagePtr;
|
||||
|
||||
typedef void(__cdecl *Load_GfxTextureLoad_t)(bool atStreamStart);
|
||||
extern Load_GfxTextureLoad_t Load_GfxTextureLoad;
|
||||
|
||||
typedef int(__cdecl *Load_Texture_t)(GfxImageLoadDef **loadDef, GfxImage *image);
|
||||
extern Load_Texture_t Load_Texture;
|
||||
|
||||
typedef void(__cdecl * Load_SndAliasCustom_t)(snd_alias_list_t** var);
|
||||
extern Load_SndAliasCustom_t Load_SndAliasCustom;
|
||||
|
||||
typedef void(__cdecl *Load_MaterialHandle_t)(bool atStreamStart);
|
||||
extern Load_MaterialHandle_t Load_MaterialHandle;
|
||||
|
||||
typedef void(__cdecl *Load_PhysCollmapPtr_t)(bool atStreamStart);
|
||||
extern Load_PhysCollmapPtr_t Load_PhysCollmapPtr;
|
||||
|
||||
typedef void(__cdecl *Load_PhysPresetPtr_t)(bool atStreamStart);
|
||||
extern Load_PhysPresetPtr_t Load_PhysPresetPtr;
|
||||
|
||||
typedef void(__cdecl *Load_TracerDefPtr_t)(bool atStreamStart);
|
||||
extern Load_TracerDefPtr_t Load_TracerDefPtr;
|
||||
|
||||
typedef void(__cdecl *Load_snd_alias_list_nameArray_t)(bool atStreamStart, int count);
|
||||
typedef bool(__cdecl * Load_Stream_t)(bool atStreamStart, const void *ptr, int size);
|
||||
extern Load_Stream_t Load_Stream;
|
||||
|
||||
typedef void(__cdecl * Load_XString_t)(bool atStreamStart);
|
||||
extern Load_XString_t Load_XString;
|
||||
|
||||
typedef void(__cdecl * Load_XModelPtr_t)(bool atStreamStart);
|
||||
extern Load_XModelPtr_t Load_XModelPtr;
|
||||
|
||||
typedef void(__cdecl * Load_XModelSurfsFixup_t)(XModelSurfs **, XModelLodInfo *);
|
||||
extern Load_XModelSurfsFixup_t Load_XModelSurfsFixup;
|
||||
|
||||
typedef void(__cdecl * Load_XStringArray_t)(bool atStreamStart, int count);
|
||||
extern Load_XStringArray_t Load_XStringArray;
|
||||
|
||||
typedef void(__cdecl * Load_XStringCustom_t)(const char **str);
|
||||
extern Load_XStringCustom_t Load_XStringCustom;
|
||||
|
||||
typedef void(__cdecl *Load_FxEffectDefHandle_t)(bool atStreamStart);
|
||||
extern Load_FxEffectDefHandle_t Load_FxEffectDefHandle;
|
||||
|
||||
typedef void(__cdecl *Load_FxElemDef_t)(bool atStreamStart);
|
||||
extern Load_FxElemDef_t Load_FxElemDef;
|
||||
|
||||
typedef void(__cdecl *Load_GfxImagePtr_t)(bool atStreamStart);
|
||||
extern Load_GfxImagePtr_t Load_GfxImagePtr;
|
||||
|
||||
typedef void(__cdecl *Load_GfxTextureLoad_t)(bool atStreamStart);
|
||||
extern Load_GfxTextureLoad_t Load_GfxTextureLoad;
|
||||
|
||||
typedef int(__cdecl *Load_Texture_t)(GfxImageLoadDef **loadDef, GfxImage *image);
|
||||
extern Load_Texture_t Load_Texture;
|
||||
|
||||
typedef void(__cdecl * Load_SndAliasCustom_t)(snd_alias_list_t** var);
|
||||
extern Load_SndAliasCustom_t Load_SndAliasCustom;
|
||||
|
||||
typedef void(__cdecl *Load_MaterialHandle_t)(bool atStreamStart);
|
||||
extern Load_MaterialHandle_t Load_MaterialHandle;
|
||||
|
||||
typedef void(__cdecl *Load_PhysCollmapPtr_t)(bool atStreamStart);
|
||||
extern Load_PhysCollmapPtr_t Load_PhysCollmapPtr;
|
||||
|
||||
typedef void(__cdecl *Load_PhysPresetPtr_t)(bool atStreamStart);
|
||||
extern Load_PhysPresetPtr_t Load_PhysPresetPtr;
|
||||
|
||||
typedef void(__cdecl *Load_TracerDefPtr_t)(bool atStreamStart);
|
||||
extern Load_TracerDefPtr_t Load_TracerDefPtr;
|
||||
|
||||
typedef void(__cdecl *Load_snd_alias_list_nameArray_t)(bool atStreamStart, int count);
|
||||
extern Load_snd_alias_list_nameArray_t Load_snd_alias_list_nameArray;
|
||||
|
||||
typedef void(__cdecl * Menus_CloseAll_t)(UiContext *dc);
|
||||
@ -437,7 +437,7 @@ namespace Game
|
||||
typedef float(__cdecl * Scr_GetFloat_t)(int);
|
||||
extern Scr_GetFloat_t Scr_GetFloat;
|
||||
|
||||
typedef int(__cdecl * Scr_GetNumParam_t)(void);
|
||||
typedef int(__cdecl * Scr_GetNumParam_t)(void);
|
||||
extern Scr_GetNumParam_t Scr_GetNumParam;
|
||||
|
||||
typedef int(__cdecl * Scr_GetFunctionHandle_t)(const char*, const char*);
|
||||
@ -612,17 +612,17 @@ namespace Game
|
||||
|
||||
extern mapname_t* mapnames;
|
||||
|
||||
extern char*** varXString;
|
||||
extern TracerDef*** varTracerDefPtr;
|
||||
extern XModel*** varXModelPtr;
|
||||
extern XModel** varXModel;
|
||||
extern PathData** varPathData;
|
||||
extern const char** varConstChar;
|
||||
extern Material*** varMaterialHandle;
|
||||
extern FxEffectDef*** varFxEffectDefHandle;
|
||||
extern PhysCollmap*** varPhysCollmapPtr;
|
||||
extern PhysPreset*** varPhysPresetPtr;
|
||||
extern Game::MaterialPass** varMaterialPass;
|
||||
extern char*** varXString;
|
||||
extern TracerDef*** varTracerDefPtr;
|
||||
extern XModel*** varXModelPtr;
|
||||
extern XModel** varXModel;
|
||||
extern PathData** varPathData;
|
||||
extern const char** varConstChar;
|
||||
extern Material*** varMaterialHandle;
|
||||
extern FxEffectDef*** varFxEffectDefHandle;
|
||||
extern PhysCollmap*** varPhysCollmapPtr;
|
||||
extern PhysPreset*** varPhysPresetPtr;
|
||||
extern Game::MaterialPass** varMaterialPass;
|
||||
extern snd_alias_list_t*** varsnd_alias_list_name;
|
||||
|
||||
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
|
||||
|
160
src/Main.cpp
160
src/Main.cpp
@ -1,85 +1,85 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Main
|
||||
{
|
||||
static Utils::Hook EntryPointHook;
|
||||
|
||||
void SetEnvironment()
|
||||
{
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Main
|
||||
{
|
||||
static Utils::Hook EntryPointHook;
|
||||
|
||||
void SetEnvironment()
|
||||
{
|
||||
wchar_t exeName[512];
|
||||
GetModuleFileName(GetModuleHandle(NULL), exeName, sizeof(exeName) / 2);
|
||||
|
||||
wchar_t* exeBaseName = wcsrchr(exeName, L'\\');
|
||||
exeBaseName[0] = L'\0';
|
||||
exeBaseName++;
|
||||
|
||||
SetCurrentDirectory(exeName);
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
Main::EntryPointHook.uninstall();
|
||||
|
||||
SetEnvironment();
|
||||
|
||||
Utils::Cryptography::Initialize();
|
||||
Components::Loader::Initialize();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
if (Components::Loader::PerformingUnitTests())
|
||||
{
|
||||
DWORD result = (Components::Loader::PerformUnitTests() ? 0 : -1);
|
||||
Components::Loader::Uninitialize();
|
||||
ExitProcess(result);
|
||||
}
|
||||
#else
|
||||
if (Components::Flags::HasFlag("tests"))
|
||||
{
|
||||
Components::Logger::Print("Unit tests are disabled outside the debug environment!\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Uninitialize()
|
||||
{
|
||||
Components::Loader::Uninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
// Ensure we're working with our desired binary
|
||||
if (Utils::Hook::Get<DWORD>(0x4C0FFF) != 0x6824748B)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DWORD oldProtect;
|
||||
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(NULL));
|
||||
//VirtualProtect(module, 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect); // Unprotect the entire process
|
||||
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
||||
|
||||
|
||||
Main::EntryPointHook.initialize(0x6BAC0F, [] ()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
// This has to be called, otherwise the hook is not uninstalled and we're looping into infinity
|
||||
call Main::Initialize
|
||||
|
||||
mov eax, 6BAC0Fh
|
||||
jmp eax
|
||||
}
|
||||
|
||||
})->install();
|
||||
}
|
||||
else if (ul_reason_for_call == DLL_PROCESS_DETACH)
|
||||
{
|
||||
Main::Uninitialize();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
exeBaseName++;
|
||||
|
||||
SetCurrentDirectory(exeName);
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
Main::EntryPointHook.uninstall();
|
||||
|
||||
SetEnvironment();
|
||||
|
||||
Utils::Cryptography::Initialize();
|
||||
Components::Loader::Initialize();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
if (Components::Loader::PerformingUnitTests())
|
||||
{
|
||||
DWORD result = (Components::Loader::PerformUnitTests() ? 0 : -1);
|
||||
Components::Loader::Uninitialize();
|
||||
ExitProcess(result);
|
||||
}
|
||||
#else
|
||||
if (Components::Flags::HasFlag("tests"))
|
||||
{
|
||||
Components::Logger::Print("Unit tests are disabled outside the debug environment!\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Uninitialize()
|
||||
{
|
||||
Components::Loader::Uninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE /*hModule*/, DWORD ul_reason_for_call, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
// Ensure we're working with our desired binary
|
||||
if (Utils::Hook::Get<DWORD>(0x4C0FFF) != 0x6824748B)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
DWORD oldProtect;
|
||||
std::uint8_t* module = reinterpret_cast<std::uint8_t*>(GetModuleHandle(NULL));
|
||||
//VirtualProtect(module, 0x6C73000, PAGE_EXECUTE_READWRITE, &oldProtect); // Unprotect the entire process
|
||||
VirtualProtect(module + 0x1000, 0x2D6000, PAGE_EXECUTE_READ, &oldProtect); // Protect the .text segment
|
||||
|
||||
|
||||
Main::EntryPointHook.initialize(0x6BAC0F, [] ()
|
||||
{
|
||||
__asm
|
||||
{
|
||||
// This has to be called, otherwise the hook is not uninstalled and we're looping into infinity
|
||||
call Main::Initialize
|
||||
|
||||
mov eax, 6BAC0Fh
|
||||
jmp eax
|
||||
}
|
||||
|
||||
})->install();
|
||||
}
|
||||
else if (ul_reason_for_call == DLL_PROCESS_DETACH)
|
||||
{
|
||||
Main::Uninitialize();
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
STEAM_IGNORE_WARNINGS_START
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
STEAM_IGNORE_WARNINGS_START
|
||||
|
||||
namespace Steam
|
||||
{
|
||||
@ -193,5 +193,5 @@ namespace Steam
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
STEAM_IGNORE_WARNINGS_START
|
||||
|
||||
STEAM_IGNORE_WARNINGS_START
|
||||
|
||||
namespace Steam
|
||||
{
|
||||
@ -102,5 +102,5 @@ namespace Steam
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
@ -97,5 +97,5 @@ namespace Steam
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
||||
STEAM_IGNORE_WARNINGS_END
|
||||
|
@ -1,17 +1,17 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
namespace Utils
|
||||
{
|
||||
namespace Time
|
||||
{
|
||||
void Interval::update()
|
||||
{
|
||||
this->lastPoint = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
bool Interval::elapsed(std::chrono::nanoseconds nsecs)
|
||||
{
|
||||
return ((std::chrono::high_resolution_clock::now() - this->lastPoint) >= nsecs);
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
void Interval::update()
|
||||
{
|
||||
this->lastPoint = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
|
||||
bool Interval::elapsed(std::chrono::nanoseconds nsecs)
|
||||
{
|
||||
return ((std::chrono::high_resolution_clock::now() - this->lastPoint) >= nsecs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
namespace Utils
|
||||
{
|
||||
namespace Utils
|
||||
{
|
||||
namespace Time
|
||||
{
|
||||
class Interval
|
||||
{
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point lastPoint;
|
||||
|
||||
public:
|
||||
Interval() : lastPoint(std::chrono::high_resolution_clock::now()) {}
|
||||
|
||||
void update();
|
||||
bool elapsed(std::chrono::nanoseconds nsecs);
|
||||
};
|
||||
}
|
||||
}
|
||||
{
|
||||
class Interval
|
||||
{
|
||||
private:
|
||||
std::chrono::high_resolution_clock::time_point lastPoint;
|
||||
|
||||
public:
|
||||
Interval() : lastPoint(std::chrono::high_resolution_clock::now()) {}
|
||||
|
||||
void update();
|
||||
bool elapsed(std::chrono::nanoseconds nsecs);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user