comparison src/common/CheatSearch.h @ 19:5e8e5083da94

brought in common and gba, fixed problems with outdated Makefile.am files in both of these packages
author Robert McIntyre <rlm@mit.edu>
date Sun, 04 Mar 2012 14:33:52 -0600
parents f9f4f1b99eed
children
comparison
equal deleted inserted replaced
18:ac56489c2ca6 19:5e8e5083da94
1 #ifndef VBA_CHEATSEARCH_H
2 #define VBA_CHEATSEARCH_H
3
4 #if _MSC_VER > 1000
5 #pragma once
6 #endif // _MSC_VER > 1000
7
8 #include "../Port.h"
9
10 struct CheatSearchBlock
11 {
12 u8 *data;
13 int size;
14 u32 offset;
15 u8 *saved;
16 u8 *bits;
17 };
18
19 struct CheatSearchData
20 {
21 int count;
22 CheatSearchBlock *blocks;
23 };
24
25 enum
26 {
27 SEARCH_EQ,
28 SEARCH_NE,
29 SEARCH_LT,
30 SEARCH_LE,
31 SEARCH_GT,
32 SEARCH_GE
33 };
34
35 enum
36 {
37 BITS_8,
38 BITS_16,
39 BITS_32
40 };
41
42 #define SET_BIT(bits, off) \
43 (bits)[(off) >> 3] |= (1 << ((off) & 7))
44
45 #define CLEAR_BIT(bits, off) \
46 (bits)[(off) >> 3] &= ~(1 << ((off) & 7))
47
48 #define IS_BIT_SET(bits, off) \
49 (bits)[(off) >> 3] & (1 << ((off) & 7))
50
51 extern CheatSearchData cheatSearchData;
52 extern void cheatSearchSetSavedAndBits(CheatSearchBlock *block);
53 extern void cheatSearchZeroBlock(CheatSearchBlock *block);
54 extern void cheatSearchCleanup(CheatSearchData *cs);
55 extern void cheatSearchStart(const CheatSearchData *cs);
56 extern void cheatSearch(const CheatSearchData *cs, int compare, int size,
57 bool isSigned);
58 extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size,
59 bool isSigned, u32 value);
60 extern int cheatSearchGetCount(const CheatSearchData *cs, int size);
61 extern void cheatSearchUpdateValues(const CheatSearchData *cs);
62 extern s32 cheatSearchSignedRead(u8 *data, int off, int size);
63 extern u32 cheatSearchRead(u8 *data, int off, int size);
64
65 #endif // VBA_CHEATSEARCH_H