Alchemy
Loading...
Searching...
No Matches

types.h

Go to the documentation of this file.
1#ifndef ALCHEMY_TYPES_H
2#define ALCHEMY_TYPES_H
3
4/// @file
5/// The integer types, TRUE, UNUSED and the fixed-address macros.
6
7#include "version.h"
8#include "config.h"
9
10typedef signed char s8;
11typedef unsigned char u8;
12typedef signed short s16;
13typedef unsigned short u16;
14typedef signed int s32;
15typedef unsigned int u32;
16typedef signed long long s64;
17typedef unsigned long long u64;
18
19#define NULL ((void *)0)
20#define FALSE 0
21#define TRUE 1
22#define UNUSED __attribute__((unused))
23
24#ifdef MODERN
25/// Reaches a fixed address through its linked name, in the modern build.
26// The modern build places code and data where its own compiler puts them: a
27// fixed address is the linked name, called through a register as at a fixed
28// address, so that code copied into RAM still reaches it. The linked name is
29// pasted before it is macro-expanded: a name that is itself a macro would
30// otherwise expand first and cannot be pasted.
31#define FIXED_LINKED_(symbol, name) \
32 ({ \
33 extern char symbol[] __asm__(name); \
34 void *volatile modern_address = symbol; \
35 modern_address; \
36 })
37#define FIXED_ADDRESS(type, address, linked) \
38 (type FIXED_LINKED_(modern_##linked, #linked))
39#define FIXED_OFFSET(value, linked, from) \
40 ((u32)FIXED_LINKED_(modern_##linked, #linked) - \
41 (u32)FIXED_LINKED_(modern_##from, #from))
42#else
43#define FIXED_ADDRESS(type, address, linked) (type address)
44#define FIXED_OFFSET(value, linked, from) value
45#endif
46#define CAMELOT_ASM(proof)
47
48#endif
Build switches, as pret's config.h: BUGFIX opts in to fixes of the original game's bugs,...
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
signed long long s64
Definition types.h:16
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned long long u64
Definition types.h:17
unsigned char u8
Definition types.h:11
The patch levels: our groups of the measured changes from the Japanese release.