view src/common/CheatSearch.h @ 523:d00096b6bf17

added sound introspection abilities.
author Robert McIntyre <rlm@mit.edu>
date Sat, 23 Jun 2012 20:34:14 -0500
parents f9f4f1b99eed
children
line wrap: on
line source
1 #ifndef VBA_CHEATSEARCH_H
2 #define VBA_CHEATSEARCH_H
4 #if _MSC_VER > 1000
5 #pragma once
6 #endif // _MSC_VER > 1000
8 #include "../Port.h"
10 struct CheatSearchBlock
11 {
12 u8 *data;
13 int size;
14 u32 offset;
15 u8 *saved;
16 u8 *bits;
17 };
19 struct CheatSearchData
20 {
21 int count;
22 CheatSearchBlock *blocks;
23 };
25 enum
26 {
27 SEARCH_EQ,
28 SEARCH_NE,
29 SEARCH_LT,
30 SEARCH_LE,
31 SEARCH_GT,
32 SEARCH_GE
33 };
35 enum
36 {
37 BITS_8,
38 BITS_16,
39 BITS_32
40 };
42 #define SET_BIT(bits, off) \
43 (bits)[(off) >> 3] |= (1 << ((off) & 7))
45 #define CLEAR_BIT(bits, off) \
46 (bits)[(off) >> 3] &= ~(1 << ((off) & 7))
48 #define IS_BIT_SET(bits, off) \
49 (bits)[(off) >> 3] & (1 << ((off) & 7))
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);
65 #endif // VBA_CHEATSEARCH_H