Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_console_hook.c
Go to the documentation of this file.
1
7#include "../sf_wrappers.h"
8#include "sf_console_hook.h"
9
13static console_print_ptr s_console_print;
14
18void console_log(const char *message)
19{
20 if (s_console_print != NULL)
21 {
22 uint32_t _application = ASI::AddrOf(0x925C64);
23 s_console_print(_application, message);
24 }
25 else
26 {
27 OutputDebugStringA(message);
28 }
29 // Appened to log file
30 log_message("sfsf.log", message);
31}
32
37{
38 uint32_t CAppMain_ptr = ASI::AddrOf(0x9229A8);
39 uint32_t CAppMenu_ptr = *(uint32_t *)(CAppMain_ptr + 0x4);
40 uint32_t CMnuScrConsole_ptr = *(uint32_t *)(CAppMenu_ptr + 0x80);
41 s_console_print = (console_print_ptr)ASI::AddrOf(0x1b58f0);
44}
void initialize_console_data_hooks()
void console_log(const char *message)
SF_String_ctor_ptr g_create_sf_string
Definition sf_wrappers.c:25
void log_message(const char *filename, const char *message)
Definition sf_wrappers.c:71
SF_String_dtor_ptr g_destroy_sf_string
Definition sf_wrappers.c:26
int AddrOf(int offset)
returns "real" virtual address of given memory offset
Definition sf_asi.h:135
void(__thiscall * console_print_ptr)(uint32_t, const char *)
SF_String *(__thiscall * SF_String_ctor_ptr)(SF_String *, const char *)
Definition sf_wrappers.h:7
void(__thiscall * SF_String_dtor_ptr)(SF_String *)
Definition sf_wrappers.h:8