]> Dogcows Code - chaz/thecheat/blob - Variable.h
update contact information and project URL
[chaz/thecheat] / Variable.h
1
2 /*
3 * The Cheat - The legendary universal game trainer for Mac OS X.
4 * http://www.brokenzipper.com/trac/wiki/TheCheat
5 *
6 * Copyright (c) 2003-2011, Charles McGarvey et al.
7 *
8 * Distributable under the terms and conditions of the 2-clause BSD
9 * license; see the file COPYING for the legal text of the license.
10 */
11
12 #import <Cocoa/Cocoa.h>
13
14 #import "CheaterTypes.h"
15 #import "Process.h"
16
17 #include <string.h>
18
19
20 #define TC_MAX_VAR_SIZE (256)
21
22 @interface Variable : NSObject < NSCoding >
23 {
24 TCAddress _address;
25 BOOL _isValueValid;
26 BOOL _enabled;
27
28 #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
29 NSInteger _tag;
30 #else
31 int _tag;
32 #endif
33
34 Process *process;
35
36 @public;
37 // use the accessor methods unless you need fast access
38 // do not change these variables directly or things will be screwed.
39 TCVariableType _type;
40 TCIntegerSign _integerSign;
41 #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
42 NSUInteger _size;
43 #else
44 unsigned int _size;
45 #endif
46 void *_value;
47 BOOL _isEmulated;
48 }
49
50 // #############################################################################
51 #pragma mark Initialization
52 // #############################################################################
53
54 // type and sign can't be changed once variable is created.
55
56 - (id)init; // default: TCInt32
57 - (id)initWithType:(TCVariableType)type; // default: TCSigned
58 - (id)initWithType:(TCVariableType)type integerSign:(TCIntegerSign)sign;
59
60 - (void)setProcess:(Process *)process;
61 - (Process *)process;
62
63 - (BOOL)isEmulated;
64
65 // #############################################################################
66 #pragma mark NSCoding
67 // #############################################################################
68
69 - (id)initWithCoder:(NSCoder *)coder;
70 - (void)encodeWithCoder:(NSCoder *)coder;
71
72 // #############################################################################
73 #pragma mark Accessors
74 // #############################################################################
75
76 - (TCVariableType)type;
77 - (TCIntegerSign)integerSign;
78 - (NSString *)typeString;
79
80 - (TCAddress)address;
81 - (void)setAddress:(TCAddress)addr;
82 - (NSString *)addressString;
83 - (BOOL)setAddressString:(NSString *)string;
84
85 - (void const *)value;
86 - (void)setValue:(void const *)value;
87 - (void)setValue:(void const *)value size:(unsigned)size;
88 - (NSString *)stringValue;
89 - (BOOL)setStringValue:(NSString *)value;
90
91 void bigEndianValue(void *buffer, Variable *variable);
92
93 - (unsigned)valueSize;
94 - (BOOL)isValueValid;
95
96 - (BOOL)isEnabled;
97 - (void)setEnabled:(BOOL)enabled;
98
99 #if MAC_OS_X_VERSION_10_5 <= MAC_OS_X_VERSION_MAX_ALLOWED
100 - (NSInteger)tag;
101 - (void)setTag:(NSInteger)tag;
102 #else
103 - (int)tag;
104 - (void)setTag:(int)tag;
105 #endif
106
107 @end
This page took 0.036053 seconds and 4 git commands to generate.