Revision 1, 1.1 kB
(checked in by jinshiro, 17 years ago)
|
|
Line | |
---|
1 | // Copyright (c) Athena Dev Teams - Licensed under GNU GPL |
---|
2 | // For more information, see LICENCE in the main folder |
---|
3 | |
---|
4 | #ifndef _UTILS_H_ |
---|
5 | #define _UTILS_H_ |
---|
6 | |
---|
7 | #ifndef _CBASETYPES_H_ |
---|
8 | #include "../common/cbasetypes.h" |
---|
9 | #endif |
---|
10 | |
---|
11 | #include <stdio.h> // FILE* |
---|
12 | |
---|
13 | // generate a hex dump of the first 'length' bytes of 'buffer' |
---|
14 | void dump(FILE* fp, const unsigned char* buffer, int length); |
---|
15 | |
---|
16 | void findfile(const char *p, const char *pat, void (func)(const char*)); |
---|
17 | |
---|
18 | //Caps values to min/max |
---|
19 | #define cap_value(a, min, max) ((a >= max) ? max : (a <= min) ? min : a) |
---|
20 | |
---|
21 | /// calculates the value of A / B, in percent (rounded down) |
---|
22 | unsigned int get_percentage(const unsigned int A, const unsigned int B); |
---|
23 | |
---|
24 | ////////////////////////////////////////////////////////////////////////// |
---|
25 | // byte word dword access [Shinomori] |
---|
26 | ////////////////////////////////////////////////////////////////////////// |
---|
27 | |
---|
28 | extern uint8 GetByte(uint32 val, int idx); |
---|
29 | extern uint16 GetWord(uint32 val, int idx); |
---|
30 | extern uint16 MakeWord(uint8 byte0, uint8 byte1); |
---|
31 | extern uint32 MakeDWord(uint16 word0, uint16 word1); |
---|
32 | |
---|
33 | #endif /* _UTILS_H_ */ |
---|