OpenRCT2/test/testpaint/Hook.h

97 lines
1.7 KiB
C
Raw Normal View History

2017-12-03 23:07:24 +01:00
/*****************************************************************************
* Copyright (c) 2014-2018 OpenRCT2 developers
2017-12-03 23:07:24 +01:00
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2017-12-03 23:07:24 +01:00
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
2017-12-03 23:07:24 +01:00
*****************************************************************************/
2018-02-01 12:28:50 +01:00
#pragma once
2017-12-03 23:07:24 +01:00
#ifndef NO_RCT2
2018-07-21 17:27:15 +02:00
# include <openrct2/common.h>
2017-12-03 23:07:24 +01:00
2018-06-22 22:29:03 +02:00
enum
{
2017-12-03 23:07:24 +01:00
X86_FLAG_CARRY = 1 << 0,
X86_FLAG_PARITY = 1 << 2,
X86_FLAG_ADJUST = 1 << 4,
X86_FLAG_ZERO = 1 << 6,
X86_FLAG_SIGN = 1 << 7,
};
2021-01-17 20:15:37 +01:00
/**
* x86 register structure, only used for easy interop to RCT2 code.
*/
# pragma pack(push, 1)
struct registers
{
union
{
int32_t eax;
int16_t ax;
struct
{
char al;
char ah;
};
};
union
{
int32_t ebx;
int16_t bx;
struct
{
char bl;
char bh;
};
};
union
{
int32_t ecx;
int16_t cx;
struct
{
char cl;
char ch;
};
};
union
{
int32_t edx;
int16_t dx;
struct
{
char dl;
char dh;
};
};
union
{
int32_t esi;
int16_t si;
};
union
{
int32_t edi;
int16_t di;
};
union
{
int32_t ebp;
int16_t bp;
};
};
assert_struct_size(registers, 7 * 4);
# pragma pack(pop)
2018-06-22 22:29:03 +02:00
using hook_function = uint8_t (*)(registers* regs);
2017-12-03 23:07:24 +01:00
void addhook(uintptr_t address, hook_function function);
2017-12-03 23:07:24 +01:00
#endif