2021-02-08 01:18:57 +01:00
|
|
|
#ifndef TR1MAIN_UTIL_H
|
|
|
|
#define TR1MAIN_UTIL_H
|
|
|
|
|
|
|
|
#define FEATURE_NOCD_DATA
|
|
|
|
#define FEATURE_KEEP_HEALTH_BETWEEN_LEVELS
|
|
|
|
#define FEATURE_DISABLE_MEDPACKS
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct {
|
|
|
|
__int8 opCode; // must be 0xE9;
|
|
|
|
__int32 offset; // jump offset
|
|
|
|
} JMP;
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
#define TRACE(...) { \
|
|
|
|
printf("%s:%d %s ", __FILE__, __LINE__, __func__); \
|
|
|
|
printf(__VA_ARGS__); \
|
|
|
|
printf("\n"); \
|
|
|
|
fflush(stdout); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define VAR_U_(address, type) (*(type*)(address))
|
|
|
|
#define VAR_I_(address, type, value) (*(type*)(address))
|
|
|
|
#define ARRAY_(address, type, length) (*(type(*)length)(address))
|
|
|
|
|
2021-02-08 11:50:39 +01:00
|
|
|
void tr1m_inject_func(void *from, void *to);
|
|
|
|
void tr1m_print_stack_trace();
|
2021-02-08 01:18:57 +01:00
|
|
|
|
|
|
|
#define INJECT(from, to) { \
|
2021-02-08 11:50:39 +01:00
|
|
|
tr1m_inject_func((void*)from, (void*)to); \
|
2021-02-08 01:18:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|