forked from rickyrombo/TileBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debugger.cpp
141 lines (129 loc) · 2.92 KB
/
Debugger.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* Debugger.cpp
* Here you will be able to interact
* with the MMF2 debugger (that thing
* in the top left when you run your
* MFA from MMF2). You can add your own
* fields of your choice to your object's
* debugger tree.
* Functions defined here:
* GetDebugTree
* GetDebugItem
* EditDebugItem
*/
#include "Common.h"
#ifndef RUN_ONLY //The debugger is only available when running from MMF2, which uses the Edittime MFX
/* DB
* This is the namespace the debugger identifiers
* are stored in. It keeps them out of the global
* namespace and it helps with intellisense.
*/
namespace DB
{
/* <enum>
* The debugger identitifers.
*/
enum
{
// MyString,
// MyInt,
};
}
/* DebugTree
* The list of items to be displayed
* in the debugger tree.
*/
WORD DebugTree[] =
{
// DB::MyString|DB_EDITABLE,
// DB::MyInt|DB_EDITABLE,
// DB::SomethingThatIDontWantTheUserToBeAbleToEditAtRuntime,
DB_END
};
#endif
/* GetDerbugTree
* Plain and simple, just return the debug
* tree pointer from above. If you really
* want to you can create the debug tree
* dynamically and return that, but you'll
* need to store the pointer in your extension
* class every time so that you can release
* the memory in your extension class' destructor.
*/
LPWORD MMF2Func GetDebugTree(RD *rd)
{
#ifndef RUN_ONLY
return DebugTree;
#endif
return NULL;
}
/* GetDebugItem
* With respect to DB_BUFFERSIZE, give
* MMF2 the string to display in the
* debugger. You must include both the
* name and the value in the string,
* or any format you want.
*/
void MMF2Func GetDebugItem(LPSTR Buffer, RD *rd, int ID)
{
#ifndef RUN_ONLY
// char temp[DB_BUFFERSIZE];
// switch (ID)
// {
// case DB::MyString:
// {
// LoadString(hInstLib, IDS_CURRENTSTRING, temp, DB_BUFFERSIZE);
// wsprintf(pBuffer, temp, rdPtr->text);
// break;
// }
// case DB::MyInt:
// {
// LoadString(hInstLib, IDS_CURRENTVALUE, temp, DB_BUFFERSIZE);
// wsprintf(pBuffer, temp, rdPtr->value);
// break;
// }
// }
#endif
}
/* EditDebugItem
* When the user chooses to edit an
* editable debug item, this function
* is called. You can use the RFUNCTIONs
* provided by MMF2 to do simple text and
* number edits, or you can do whatever you
* want, such as creating a dialog that lets
* the user enter more sophisticated input to
* the debug item, or simply display more info.
*/
void MMF2Func EditDebugItem(RD *rd, int ID)
{
#ifndef RUN_ONLY
/*
switch(ID)
{
case DB::MyString:
{
EditDebugInfo dbi;
char buffer[256];
dbi.pText=buffer;
dbi.lText=TEXT_MAX;
dbi.pTitle=NULL;
strcpy(buffer, rdPtr->text);
long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITTEXT, 0, (LPARAM)&dbi);
if (ret)
strcpy(rdPtr->text, dbi.pText);
}
break;
case DB::MyInt:
{
EditDebugInfo dbi;
dbi.value=rdPtr->value;
dbi.pTitle=NULL;
long ret=callRunTimeFunction(rdPtr, RFUNCTION_EDITINT, 0, (LPARAM)&dbi);
if (ret)
rdPtr->value=dbi.value;
}
break;
}
*/
#endif
}