Better hooked function calling.

This commit is contained in:
momo5502 2016-01-02 02:47:15 +01:00
parent 9aec8b2a1b
commit 8fb298ed16
3 changed files with 6 additions and 16 deletions

View File

@ -26,7 +26,7 @@ namespace Components
memcpy((void*)0x66E1CB0, &fastfiles, sizeof(fastfiles)); memcpy((void*)0x66E1CB0, &fastfiles, sizeof(fastfiles));
Game::LoadInitialFF(); Game::LoadInitialFF();
Utils::Hook::Call<void>(0x4F84C0); Utils::Hook::Call<void()>(0x4F84C0)();
} }
void Dedicated::MapRotate() void Dedicated::MapRotate()
@ -129,7 +129,7 @@ namespace Components
callback(); callback();
} }
Utils::Hook::Call<void>(0x5A8E80); Utils::Hook::Call<void()>(0x5A8E80)();
} }
Dedicated::Dedicated() Dedicated::Dedicated()

View File

@ -27,14 +27,8 @@ namespace Components
DWORD Playlist::StorePlaylistStub(const char** buffer) DWORD Playlist::StorePlaylistStub(const char** buffer)
{ {
Playlist::CurrentPlaylistBuffer = *buffer; Playlist::CurrentPlaylistBuffer = *buffer;
//return Utils::Hook::Call<DWORD>(0x4C0350);
__asm return Utils::Hook::Call<DWORD(const char**)>(0x4C0350)(buffer);
{
push buffer
mov eax, 4C0350h
call eax
add esp, 4h
}
} }
void Playlist::PlaylistRequest(Network::Address address, std::string data) void Playlist::PlaylistRequest(Network::Address address, std::string data)

View File

@ -23,13 +23,9 @@ namespace Utils
void* GetAddress(); void* GetAddress();
void Quick(); void Quick();
template <typename T> static T Call(DWORD function) template <typename T> static std::function<T> Call(DWORD function)
{ {
__asm return std::function<T>((T*)function);
{
mov eax, function
call eax
}
} }
static void SetString(void* place, const char* string, size_t length); static void SetString(void* place, const char* string, size_t length);