Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Defines the entry point for the DLL application.
- #include "stdafx.h"
- #include <ModAPI\MainUtilities.h>
- #include <Spore\Simulator\cSimulatorSpaceGame.h>
- /*
- Create detourings here.
- */
- void Initialization()
- {
- App::CheatManager()->AddCheat("planetBuster",
- [](const ArgScript::Line& line, ArgScript::FormatParser* formatParser) {
- using namespace Simulator;
- if (IsSpaceGame())
- {
- auto inventory = SimulatorSpaceGame()->GetPlayerInventory();
- intrusive_ptr<cSpaceToolData> tool;
- ToolManager()->LoadTool(instance_id(id("PlanetBusterBomb")), tool);
- size_t numArguments;
- auto args = line.GetArgumentsRange(&numArguments, 0, 1);
- if (numArguments == 1) {
- tool->mCurrentAmmoCount = formatParser->ParseInt(args[0]);
- }
- inventory->AddItem(tool.get());
- }
- },
- [](ArgScript::DescriptionMode mode) {
- return "Call the cheat. Drop the bomb. BOOM!";
- });
- }
- void AttachDetouring()
- {
- /*
- Only attach detourings (method redirections) in this method.
- For example, if you used 'detour(...) GetValue_detoured;', call 'GetValue_detoured::attach()' here.
- */
- }
- BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- // This line is always necessary
- ModAPI::ModAPIUtils::InitModAPI();
- /* Usually you don't need to insert code here. Use the AttachDetour and Initialization functions instead */
- PrepareDetours(hModule);
- AttachDetouring();
- SendDetours();
- ModAPI::AddInitFunction(&Initialization);
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement