annotate src/common/CheatSearch.h @ 318:9a4d3f801c89

fixing runs to use new util functions.
author Robert McIntyre <rlm@mit.edu>
date Mon, 02 Apr 2012 23:13:49 -0500
parents f9f4f1b99eed
children
rev   line source
rlm@1 1 #ifndef VBA_CHEATSEARCH_H
rlm@1 2 #define VBA_CHEATSEARCH_H
rlm@1 3
rlm@1 4 #if _MSC_VER > 1000
rlm@1 5 #pragma once
rlm@1 6 #endif // _MSC_VER > 1000
rlm@1 7
rlm@1 8 #include "../Port.h"
rlm@1 9
rlm@1 10 struct CheatSearchBlock
rlm@1 11 {
rlm@1 12 u8 *data;
rlm@1 13 int size;
rlm@1 14 u32 offset;
rlm@1 15 u8 *saved;
rlm@1 16 u8 *bits;
rlm@1 17 };
rlm@1 18
rlm@1 19 struct CheatSearchData
rlm@1 20 {
rlm@1 21 int count;
rlm@1 22 CheatSearchBlock *blocks;
rlm@1 23 };
rlm@1 24
rlm@1 25 enum
rlm@1 26 {
rlm@1 27 SEARCH_EQ,
rlm@1 28 SEARCH_NE,
rlm@1 29 SEARCH_LT,
rlm@1 30 SEARCH_LE,
rlm@1 31 SEARCH_GT,
rlm@1 32 SEARCH_GE
rlm@1 33 };
rlm@1 34
rlm@1 35 enum
rlm@1 36 {
rlm@1 37 BITS_8,
rlm@1 38 BITS_16,
rlm@1 39 BITS_32
rlm@1 40 };
rlm@1 41
rlm@1 42 #define SET_BIT(bits, off) \
rlm@1 43 (bits)[(off) >> 3] |= (1 << ((off) & 7))
rlm@1 44
rlm@1 45 #define CLEAR_BIT(bits, off) \
rlm@1 46 (bits)[(off) >> 3] &= ~(1 << ((off) & 7))
rlm@1 47
rlm@1 48 #define IS_BIT_SET(bits, off) \
rlm@1 49 (bits)[(off) >> 3] & (1 << ((off) & 7))
rlm@1 50
rlm@1 51 extern CheatSearchData cheatSearchData;
rlm@1 52 extern void cheatSearchSetSavedAndBits(CheatSearchBlock *block);
rlm@1 53 extern void cheatSearchZeroBlock(CheatSearchBlock *block);
rlm@1 54 extern void cheatSearchCleanup(CheatSearchData *cs);
rlm@1 55 extern void cheatSearchStart(const CheatSearchData *cs);
rlm@1 56 extern void cheatSearch(const CheatSearchData *cs, int compare, int size,
rlm@1 57 bool isSigned);
rlm@1 58 extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size,
rlm@1 59 bool isSigned, u32 value);
rlm@1 60 extern int cheatSearchGetCount(const CheatSearchData *cs, int size);
rlm@1 61 extern void cheatSearchUpdateValues(const CheatSearchData *cs);
rlm@1 62 extern s32 cheatSearchSignedRead(u8 *data, int off, int size);
rlm@1 63 extern u32 cheatSearchRead(u8 *data, int off, int size);
rlm@1 64
rlm@1 65 #endif // VBA_CHEATSEARCH_H