Skip to content

Commit

Permalink
Fixed to work in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
c-m-w committed Aug 25, 2019
1 parent bd6fff0 commit 8fbefbb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,15 @@ Solution/Crosshair/Debug/*
Solution/Crosshair/Release/*

# imgui configuration
imgui.ini
imgui.ini
*.vcxproj
Solution/Crosshair/x64/Debug/Crosshair.log
Solution/Crosshair/x64/Debug/Crosshair.tlog/CL.command.1.tlog
Solution/Crosshair/x64/Debug/Crosshair.tlog/CL.read.1.tlog
Solution/Crosshair/x64/Debug/Crosshair.tlog/CL.write.1.tlog
Solution/Crosshair/x64/Debug/Crosshair.tlog/Crosshair.lastbuildstate
Solution/Crosshair/x64/Debug/Crosshair.tlog/unsuccessfulbuild
Solution/Crosshair/x64/Debug/vc142.idb
Solution/Crosshair/x64/Debug/vc142.pdb
Solution/Crosshair/Crosshair.vcxproj
Solution/Crosshair/Crosshair.vcxproj
15 changes: 11 additions & 4 deletions Solution/Crosshair/Source/Crosshair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,34 @@ namespace Main
/** \return Whether or not initialization was successful. */
__declspec( naked ) bool __stdcall InitializeObject( IBaseInterface* pObject, const char* szSuccessMessage, const char* szErrorMessage )
{
DWORD dwReturnAddress;
DWORD dwReturnAddress;
__asm
{
pop dwReturnAddress
pop pObject
pop szSuccessMessage
pop szErrorMessage

mov ecx, pObject
push pObject
push dwReturnAddress

push ecx
mov ecx, [ ecx ]
add ecx, 4
mov ecx, [ ecx ]
call ecx

pop dwReturnAddress
pop pObject
pop szSuccessMessage
pop szErrorMessage

cmp eax, 0
jnz LogSuccessful
jmp Shutdown

LogSuccessful:

push dwReturnAddress
push szSuccessMessage
push LOCATION_MAIN
push PREFIX_SUCCESS
Expand All @@ -76,7 +84,6 @@ namespace Main
pop ecx
pop ecx
pop ecx
push dwReturnAddress
ret

Shutdown:
Expand Down

0 comments on commit 8fbefbb

Please sign in to comment.