Code:
// Exported initialization function
extern "C" __declspec(dllexport) void Initialize()
{
using namespace std;
using namespace Cypher;
// Create HadesMgr
HadesMgr::Get();
HadesMgr::Get()->Initialize();
Loader::AddExe(L"hl2.exe", L"HXCSS.dll");
// Initialize CSS Hack
static CSSHack MyCSSHack;
// Debug output
wcout << "HXCSS initialized." << endl;
}
Code:
[SNIP]
CSSHack::CSSHack() : m_Models()
{
using namespace Cypher;
[SNIP]
// Hands
m_Models.push_back(ModelData(1286, 1778, 64, MT_HANDS)); // Norm + Knife
m_Models.push_back(ModelData(1276, 1778, 64, MT_HANDS)); // Dualies
// Register callbacks
D3D9Mgr::RegisterOnDrawIndexedPrimitive(boost::bind(
&CSSHack::DipCallback, this, _1, _2, _3));
}
bool CSSHack::DipCallback(IDirect3DDevice9* pDevice,
Cypher::D3D9HelperPtr pHelper, Cypher::D3D9Mgr::DipData* pData)
{
using namespace std;
using namespace Cypher;
static bool Enabled = true;
if (GetAsyncKeyState(VK_INSERT) & 1)
Enabled = !Enabled;
if (!Enabled)
return false;
IDirect3DDevice9Hk* pDeviceHk(static_cast<IDirect3DDevice9Hk*>(pDevice));
IDirect3DDevice9* pDeviceRl(pDeviceHk->GetDevice());
UINT Stride(pDeviceHk->GetStride());
UINT NumVerts(pData->NumVertices);
UINT PrimCount(pData->primCount);
ModelData CurT(ModelData(NumVerts, PrimCount, Stride, MT_TERRORIST));
ModelData CurCT(ModelData(NumVerts, PrimCount, Stride, MT_COUNTERTERRORIST));
ModelData CurWep(ModelData(NumVerts, PrimCount, Stride, MT_WEAPON));
ModelData CurH(ModelData(NumVerts, PrimCount, Stride, MT_HOSTAGE));
ModelData CurHands(ModelData(NumVerts, PrimCount, Stride, MT_HANDS));
bool TFound(find(m_Models.begin(), m_Models.end(), CurT)
!= m_Models.end());
bool CTFound(find(m_Models.begin(), m_Models.end(), CurCT)
!= m_Models.end());
bool WepFound(find(m_Models.begin(), m_Models.end(), CurWep)
!= m_Models.end());
bool HFound(find(m_Models.begin(), m_Models.end(), CurH)
!= m_Models.end());
bool HandsFound(find(m_Models.begin(), m_Models.end(), CurHands)
!= m_Models.end());
IDirect3DTexture9* pTexHidden(0);
IDirect3DTexture9* pTexShown(0);
if (CTFound)
{
pTexHidden = pHelper->GetTexCyan();
pTexShown = pHelper->GetTexBlue();
}
if (TFound)
{
pTexHidden = pHelper->GetTexOrange();
pTexShown = pHelper->GetTexRed();
}
if (WepFound)
{
pTexHidden = pHelper->GetTexPurple();
pTexShown = pHelper->GetTexYellow();
}
if (HFound)
{
pTexHidden = pHelper->GetTexGreen();
pTexShown = pHelper->GetTexWhite();
}
if (CTFound || TFound || WepFound || HFound)
{
pHelper->WallhackXQZ(pDeviceRl, pTexHidden, pTexShown, pData->Type,
pData->BaseVertexIndex, pData->MinVertexIndex, pData->NumVertices,
pData->startIndex, pData->primCount);
}
if (HandsFound)
return true;
return false;
}
Sorry about the ugly code, I havn't touched it since I originally wrote it, it was a quick test and once it was working I didn't really care after that.
Code:
// Constructor
GuiMgr::GuiMgr(const std::wstring& Path) : m_pRoot(0), m_pRenderer(0),
m_pSystem(0), m_pConsole(), m_Path(Path)
{
// C++ Standard Library
using namespace std;
// Set current GUI in mouse manager
MouseMgr::SetCurrentGui(this);
// Register D3D event callbacks
D3D9Mgr::RegisterOnInitialize(boost::bind(&GuiMgr::OnInitialize, this,
_1, _2));
D3D9Mgr::RegisterOnFrame(boost::bind(&GuiMgr::OnFrame, this, _1, _2));
D3D9Mgr::RegisterOnLostDevice(boost::bind(&GuiMgr::OnLostDevice, this,
_1, _2));
D3D9Mgr::RegisterOnResetDevice(boost::bind(&GuiMgr::OnResetDevice, this,
_1, _2));
// Register keyboard input callbacks
KeyboardMgr::RegisterOnKey(boost::bind(&GuiMgr::OnKeyboardKey, this, _1,
_2, _3));
KeyboardMgr::RegisterOnChar(boost::bind(&GuiMgr::OnKeyboardChar, this,
_1));
// Register mouse input callbacks
MouseMgr::RegisterOnButton(boost::bind(&GuiMgr::OnMouseButton, this, _1,
_2));
MouseMgr::RegisterOnMove(boost::bind(&GuiMgr::OnMouseMove, this, _1, _2));
MouseMgr::RegisterOnWheel(boost::bind(&GuiMgr::OnMouseWheel, this, _1));
// Debug output
wcout << "GuiMgr initialized." << endl;
}
Again though, most functionality is developer oriented and 'behind the scenes'. How would you propose I show examples of stuff like the Lua subsystem, the .NET subsystem, the input subsystem, the D3D subsystem, etc?