Skip to content

Doc_Halo1_CheApeIntegration

Martin Ballantyne edited this page Mar 2, 2015 · 1 revision

Initialization

CheApe's initialization begins in Halo1_CheApe.cpp. Because that's where the DllMain() is located (surprise!). Consequently this is also where the dispose logic is executed when the DLL is unloaded

Before anything happens, CheApe sets the virtual memory of the host EXE (eg, OS_guerilla.exe) to be all writable and executable. The memory is left this way until the program closes. An ugly hack, yes, but at the time it was more desired than wrapping direct writes to the .text or .rdata in some fancy setup that changed the virtual memory permissions, performed the change, then reverted back the permissions.

Next, the settings code is initialized, via Initialize() in Common/YeloSettings.cpp. This is where the .xml settings files are processed, and where we setup the common folder paths like the UserProfilePath (see yelo_shared_settings.cpp for more info)

Next, Yelo's trivial debug/errors file logging system is opened (see errors_yelo.cpp for more details). This is mainly used for logging problems for systems that initialize before the engine's own debug systems are ready, or in cases where the engine's debug systems aren't available (ie, runtime builds)

Next, all the engine's major hard coded paths and filenames are fixed up in Yelo/MemoryFixups.cpp. Paths include the tags folder, the debug.txt path, etc. For files like debug.txt and hs_doc.txt, they're redirected to be created in CE profile directory, instead of the working directory (the folder where the EXE was launched). The tags and data folders can optionally (via .xml settings) be renamed or located in other places besides the working directory.

Next, the memory for CheApe.map is allocated (at a fixed base address) and then the file is loaded into memory. From here the new tag groups defined in the .map file are merged with the stock ones.

From here Yelo/Yelo.cpp's Initialize() is ran.

First, the debug dump (implemented via CrashRpt) is setup so that any crashes from here on out will be handled by it.

To be continued...

Clone this wiki locally