Skip to content

Commit

Permalink
Added OnControl event.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-fadely committed Jan 12, 2016
1 parent 0a41e6f commit 22c9ec4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions SA2ModLoader/Events.cpp
Expand Up @@ -4,6 +4,7 @@

std::vector<ModEvent> modFrameEvents;
std::vector<ModEvent> modInputEvents;
std::vector<ModEvent> modControlEvents;
CodeParser codeParser;

/**
Expand Down Expand Up @@ -83,3 +84,8 @@ void __cdecl OnInput()
{
RaiseEvents(modInputEvents);
}

void __cdecl OnControl()
{
RaiseEvents(modControlEvents);
}
4 changes: 3 additions & 1 deletion SA2ModLoader/Events.h
Expand Up @@ -6,6 +6,7 @@

extern std::vector<ModEvent> modFrameEvents;
extern std::vector<ModEvent> modInputEvents;
extern std::vector<ModEvent> modControlEvents;
extern CodeParser codeParser;

void RegisterEvent(std::vector<ModEvent>& eventList, HMODULE module, const char* name);
Expand All @@ -21,5 +22,6 @@ static inline void RaiseEvents(const std::vector<ModEvent>& eventList)
}

void InitOnFrame();
void __cdecl OnInput();
void __cdecl OnFrame();
void __cdecl OnInput();
void __cdecl OnControl();
4 changes: 3 additions & 1 deletion SA2ModLoader/dllmain.cpp
Expand Up @@ -965,6 +965,7 @@ void __cdecl InitMods(void)

RegisterEvent(modFrameEvents, module, "OnFrame");
RegisterEvent(modInputEvents, module, "OnInput");
RegisterEvent(modControlEvents, module, "OnControl");
}
else
{
Expand Down Expand Up @@ -1113,7 +1114,8 @@ void __cdecl InitMods(void)

// Sets up code/event handling
InitOnFrame(); // OnFrame
WriteJump((void*)0x0077E897, (void*)OnInput);
WriteJump((void*)0x0077E897, OnInput);
WriteJump((void*)0x00441D41, OnControl);

if (MainUserConfig->FullScreen == 0)
{
Expand Down

0 comments on commit 22c9ec4

Please sign in to comment.