I looked into this for testing purposes, but I was looking at the CreateWindowExA API, thinking that around it, would be the check to see if process was already running, didnt realise Halo used the MutexA API.
Nice work.
The issue I had also, was I kept corrupting Halo's exe, is there a way to bypass the protection?
Last edited by Limited; September 20th, 2009 at 02:38 PM.
Address are for Halo PC 1.08. Just some rendering code for Halo. There are so many more functions for rendering, but gotta start somewhere.
These structs are from the GBXModel tag in the Halo map files. They describe every model in that map and needed for rendering models. Reversed using MHS, Olly, and Guerilla(Bungie's tag editor).
Some needed globals for the following functions:Code:#ifndef GBXMODEL_H #define GBXMODEL_H #include <windows.h> #include <d3d9.h> struct GBXModel; struct GBXModel_Markers; struct GBXModel_Markers_Instances; struct GBXModel_Nodes; struct GBXModel_Regions; struct GBXModel_Regions_Permutations; struct GBXModel_Geometries; struct GBXModel_Geometries_Parts; struct GBXModel_Geometries_Parts_Indices; struct GBXModel_Geometries_Parts_Vertices; struct GBXModel_Shaders; struct GBXModel{ int Flags : 32; int NodeListChecksum; float SuperHighDetailCutoff; float HighDetailCutoff; float MediumDetailCutoff; float LowDetailCutoff; float SuperLowDetailCutoff; short SuperHighDetailNodeCount; short HighDetailNodeCount; short MediumDetailNodeCount; short LowDetailNodeCount; short SuperLowDetailNodeCount; char Unknown[10]; float BaseMapUScale; float BaseMapVScale; char Unknown2[116]; TagBlock Markers; TagBlock Nodes; TagBlock Regions; TagBlock Geometries; TagBlock Shaders; }; struct GBXModel_Markers{ char Name[32]; short MagicIdentifier; char Unknown[18]; TagBlock Instances; }; struct GBXModel_Markers_Instances{ unsigned char RegionIndex; unsigned char PermutationIndex; unsigned short NodeIndex; float Translation[3]; // xyz float Rotation[4]; // ijkw }; struct GBXModel_Nodes{ char Name[32]; short NextSiblingNodeIndex; short FirstChildNodeIndex; short ParentNodeIndex; short Unknown; float DefaultTranslation[3]; // xyz float DefaultRotation[4]; // ijkw float NodeDistanceFromParent; char Unknown2[84]; }; struct GBXModel_Regions{ char Name[64]; TagBlock Permutations; }; struct GBXModel_Regions_Permutations{ char Name[32]; int Flags; char Unknown[28]; short SuperLow; short Low; short Medium; short High; short SuperHigh; char Unknown2[14]; }; struct GBXModel_Geometries{ char Unknown[36]; TagBlock Parts; }; struct GBXModel_Geometries_Parts_Indices{ unsigned short PrimitiveTypeIndex; unsigned short Unknown; unsigned int IndiceCount; int Unknown2; IDirect3DIndexBuffer9* pIndexData; }; struct GBXModel_Geometries_Parts_Vertices{ unsigned short StrideIndex; unsigned short Unknown; unsigned int VerticeCount; int Unknown2[2]; IDirect3DVertexBuffer9* pStreamData; }; struct GBXModel_Geometries_Parts{ int Flags : 32; char PrevFilthyPartIndex; char NextFilthyPartIndex; short ShaderIndex; short CentroidPrimaryNode; short CentroidSecondaryNode; float CentroidPrimeryWeight; float CentroidSecondaryWeight; float Centroid[3]; // xyz char Unknown[36]; GBXModel_Geometries_Parts_Indices IndiceInfo; GBXModel_Geometries_Parts_Vertices VerticeInfo; char Unknown2[28]; }; struct GBXModel_Shaders{ TagReference Shader; unsigned char Permutation; char Unknown[15]; }; #endif /* GBXMODEL_H */
A function that does some if statements and calls different render functions, I have only done one out of five or six here, so this function is not even near complete, because I have to reverse 6 other functions to finish this one ><Code:bool* g_bSoftware = (bool*)0x0069C690; unsigned short* g_pStrideTable = (unsigned short*)0x0065DE50; unsigned int* g_pPrimitiveTypeTable = (unsigned int*)0x0065E084; IDirect3DDevice9*** pHaloDevice = (IDirect3DDevice9***)0x0071D09C; IDirect3DDevice9* g_pDevice = (IDirect3DDevice9*)**pHaloDevice; struct _ModelInfo{ char Unknown[48]; GBXModel_Geometries_Parts_Indices* IndiceInfo; char Unknown2[4]; unsigned int PrimitiveCount; char Unknown3[4]; GBXModel_Geometries_Parts_Vertices* VerticeInfo; }; _ModelInfo* ModelInfo = (_ModelInfo*)0x006E1750;
A function that renders a model. It is missing a chunk of code because it was some advanced assembly that changed the vertex processing mode based on the stride count(?). Other than that, it is complete and untested lol. Also, it can't render more than 10,000 primitives at once, or at least it doesn't want you to, so it loops and renders in chunks if it is greater.Code:HRESULT Unknown(_ModelInfo* pModelInfo) { if(pModelInfo->IndiceInfo) { if(pModelInfo->VerticeInfo) { return RenderModel(pModelInfo->PrimitiveCount, pModelInfo->VerticeInfo, pModelInfo->IndiceInfo); } //...More code Here } //...More Code Here }
Code:HRESULT RenderModel(unsigned int PrimitiveCount, GBXModel_Geometries_Parts_Vertices* VerticeInfo, GBXModel_Geometries_Parts_Indices* IndiceInfo) { unsigned short Stride; D3DPRIMITIVETYPE PrimitiveType; unsigned int PrimCount; unsigned int StartIndex = 0; while(PrimitiveCount > 0) { if(!IndiceInfo) break; if(!IndiceInfo->pIndexData) break; if(!VerticeInfo) break; if(!VerticeInfo->pStreamData) break; PrimCount = 10000; if(PrimitiveCount <= 10000) PrimCount = PrimitiveCount; Stride = *(unsigned short*)((unsigned long)g_pStrideTable + (VerticeInfo->StrideIndex * 2)); PrimitiveType = *(D3DPRIMITIVETYPE*)((unsigned long)g_pPrimitiveTypeTable + (IndiceInfo->PrimitiveTypeIndex * 4)); g_pDevice->SetSoftwareVertexProcessing(*g_bSoftware); g_pDevice->SetStreamSource(0, VerticeInfo->pStreamData, 0, Stride); g_pDevice->SetIndices(IndiceInfo->pIndexData); g_pDevice->DrawIndexedPrimitive(PrimitiveType, 0, 0,VerticeInfo->VerticeCount, StartIndex, PrimCount); PrimitiveCount -= PrimCount; if(IndiceInfo->PrimitiveTypeIndex){ if(IndiceInfo->PrimitiveTypeIndex == 1){ StartIndex += PrimCount; } } else{ StartIndex += PrimCount + PrimCount * 2; } } return g_pDevice->SetSoftwareVertexProcessing(*g_bSoftware); }
Another option for running multiple instances of ANYTHING I've found is Sandboxie. I tested it with Halo a bit, and I got 2 instances to start up easily. The first one I ran started a LAN server just fine, the second didn't seem to want to work. I think there are a few more inherit issues with 2 instances of halo sharing resources - namely .map files, and maybe network shtuff.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks