diff 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
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/common/CheatSearch.h	Sun Mar 04 14:33:52 2012 -0600
     1.3 @@ -0,0 +1,65 @@
     1.4 +#ifndef VBA_CHEATSEARCH_H
     1.5 +#define VBA_CHEATSEARCH_H
     1.6 +
     1.7 +#if _MSC_VER > 1000
     1.8 +#pragma once
     1.9 +#endif // _MSC_VER > 1000
    1.10 +
    1.11 +#include "../Port.h"
    1.12 +
    1.13 +struct CheatSearchBlock
    1.14 +{
    1.15 +	u8 *data;
    1.16 +	int size;
    1.17 +	u32 offset;
    1.18 +	u8 *saved;
    1.19 +	u8 *bits;
    1.20 +};
    1.21 +
    1.22 +struct CheatSearchData
    1.23 +{
    1.24 +	int count;
    1.25 +	CheatSearchBlock *blocks;
    1.26 +};
    1.27 +
    1.28 +enum
    1.29 +{
    1.30 +	SEARCH_EQ,
    1.31 +	SEARCH_NE,
    1.32 +	SEARCH_LT,
    1.33 +	SEARCH_LE,
    1.34 +	SEARCH_GT,
    1.35 +	SEARCH_GE
    1.36 +};
    1.37 +
    1.38 +enum
    1.39 +{
    1.40 +	BITS_8,
    1.41 +	BITS_16,
    1.42 +	BITS_32
    1.43 +};
    1.44 +
    1.45 +#define SET_BIT(bits, off) \
    1.46 +    (bits)[(off) >> 3] |= (1 << ((off) & 7))
    1.47 +
    1.48 +#define CLEAR_BIT(bits, off) \
    1.49 +    (bits)[(off) >> 3] &= ~(1 << ((off) & 7))
    1.50 +
    1.51 +#define IS_BIT_SET(bits, off) \
    1.52 +    (bits)[(off) >> 3] & (1 << ((off) & 7))
    1.53 +
    1.54 +extern CheatSearchData cheatSearchData;
    1.55 +extern void cheatSearchSetSavedAndBits(CheatSearchBlock *block);
    1.56 +extern void cheatSearchZeroBlock(CheatSearchBlock *block);
    1.57 +extern void cheatSearchCleanup(CheatSearchData *cs);
    1.58 +extern void cheatSearchStart(const CheatSearchData *cs);
    1.59 +extern void cheatSearch(const CheatSearchData *cs, int compare, int size,
    1.60 +                        bool isSigned);
    1.61 +extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size,
    1.62 +                             bool isSigned, u32 value);
    1.63 +extern int cheatSearchGetCount(const CheatSearchData *cs, int size);
    1.64 +extern void cheatSearchUpdateValues(const CheatSearchData *cs);
    1.65 +extern s32 cheatSearchSignedRead(u8 *data, int off, int size);
    1.66 +extern u32 cheatSearchRead(u8 *data, int off, int size);
    1.67 +
    1.68 +#endif // VBA_CHEATSEARCH_H