Mercurial > otakunoraifu
annotate scn2k/scn2kdump.cc @ 62:3b1593186f12
fix pointers used to get strchr result
author | Thibaut GIRKA <thib@sitedethib.com> |
---|---|
date | Sat, 06 Feb 2010 17:03:47 +0100 |
parents | 15a18fbe6f21 |
children | 4416cfac86ae |
rev | line source |
---|---|
0 | 1 /* |
2 * | |
3 * Copyright (C) 2002- Kazunori Ueno(JAGARL) <jagarl@creator.club.ne.jp> | |
4 * | |
5 * This program is free software; you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License as published by | |
7 * the Free Software Foundation; either version 2 of the License, or | |
8 * (at your option) any later version. | |
9 * | |
10 * This program is distributed in the hope that it will be useful, | |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 * GNU General Public License for more details. | |
14 * | |
27 | 15 * You should have received a copy of the GNU General Public License along |
16 * with this program; if not, write to the Free Software Foundation, Inc., | |
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
0 | 18 * |
19 */ | |
20 | |
52 | 21 #include <stdlib.h> |
22 #include <stdarg.h> | |
23 #include <stdio.h> | |
24 #include <string.h> | |
25 #include <string> | |
26 #include <vector> | |
27 #include <map> | |
0 | 28 |
29 using namespace std; | |
30 | |
52 | 31 #include "system/file.h" |
32 #include "system/file_impl.h" | |
0 | 33 |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
34 #include "scn2k.h" |
0 | 35 |
36 | |
37 #define SCN_DUMP | |
38 | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
39 class CmdD : public Cmd |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
40 { |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
41 public: |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
42 CmdD(const Flags& flags, int system_version) : Cmd(flags, system_version) {} |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
43 //CmdD(const Flags& f) : flags(f) { argc = 0; errorflag = false; cmdstr[0] = 0;} |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
44 bool ClearError() { /*errorflag = false;*/} |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
45 static map<int, struct CmdDescrItem*> cmd_descr; |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
46 const char* CmdDescr(int cmd1, int cmd2, int cmd3, int cmd4); |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
47 }; |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
48 |
0 | 49 int system_version = 0; |
50 bool ruby_flag = false; | |
51 bool ret_flag = false; | |
52 bool text_flag = false; | |
53 bool selection_flag = false; | |
54 | |
55 | |
56 inline int eval(int v1, int op, int v2) { | |
57 switch(op) { | |
58 case 0: return v1+v2; | |
59 case 1: return v1-v2; | |
60 case 2: return v1*v2; | |
61 case 3: return v2!=0 ? v1/v2 : v1; | |
62 case 4: return v2!=0 ? v1%v2 : v1; | |
63 case 5: return v1&v2; | |
64 case 6: return v1|v2; | |
65 case 7: return v1^v2; | |
66 case 8: return v1<<v2; | |
67 case 9: return v1>>v2; | |
68 case 40: return v1 == v2; | |
69 case 41: return v1 != v2; | |
70 case 42: return v1 <= v2; | |
71 case 43: return v1 < v2; | |
72 case 44: return v1 >= v2; | |
73 case 45: return v1 > v2; | |
74 case 60: return v1 && v2; | |
75 case 61: return v1 || v2; | |
76 } | |
77 return v2; | |
78 } | |
79 | |
80 | |
81 void usage(void) { | |
82 fprintf(stderr,"usage : scn2kdump [inputfile] [outputfile]\n"); | |
83 fprintf(stderr," inputfile: seen.txt(default)\n"); | |
84 fprintf(stderr," outputfile: seen.txt_out(default)\n"); | |
85 exit(-1); | |
86 } | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
87 |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
88 extern int debug_flag; |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
89 |
0 | 90 int main(int argc, char** argv) { |
91 /* determine file names */ | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
92 debug_flag = true; |
0 | 93 bool verbose = false; |
94 char* inname = "seen.txt"; | |
95 char* outname = 0; | |
96 if (argc > 2 && strcmp(argv[1],"-v") == 0) { | |
97 int i; for (i=1; i<argc; i++) argv[i] = argv[i+1]; | |
98 argc--; | |
99 verbose = true; | |
100 } | |
101 switch(argc) { | |
102 case 1: break; | |
103 case 2: inname = argv[1]; break; | |
104 case 3: inname = argv[1]; outname = argv[2]; break; | |
105 default: usage(); | |
106 } | |
107 /* open output file */ | |
108 FILE* outstream = stdout; | |
109 /* create archive instance */ | |
110 SCN2kFILE archive(inname); | |
111 archive.Init(); | |
112 if (archive.Deal() == 0) { | |
113 fprintf(stderr,"Cannot open / Invalid archive file %s\n",inname); | |
114 usage(); | |
115 } | |
116 /* dump files */ | |
117 archive.InitList(); | |
118 char* fname; | |
119 fprintf(stderr,"Dump start\n"); | |
120 while( (fname = archive.ListItem()) != 0) { | |
52 | 121 ARCINFO* info = archive.Find(fname, ""); |
122 if (info == NULL) continue; | |
0 | 123 char* data = info->CopyRead(); |
124 char* d = data; | |
125 char* dend = d + info->Size(); | |
126 /* version ³Îǧ */ | |
127 if (read_little_endian_int(d) == 0x1cc) { | |
128 system_version = 0; | |
129 } else if (read_little_endian_int(d) == 0x1d0) { | |
130 system_version = 1; | |
131 } else { | |
132 continue; | |
133 } | |
134 if (read_little_endian_int(d+4) == 0x1adb2) ; // little busters! | |
135 else if (read_little_endian_int(d+4) != 0x2712) continue; | |
136 int header_size; | |
137 if (system_version == 0) { | |
138 header_size = 0x1cc + read_little_endian_int(d+0x20) * 4; | |
139 } else { | |
140 header_size = read_little_endian_int(d+0x20); | |
141 } | |
142 d += header_size; | |
143 | |
144 const char* dcur = d; | |
145 const char* dstart = d; | |
146 fprintf(stderr,"Dumping %s\n",fname); | |
147 fprintf(stdout,"Dumping %s\n",fname); | |
148 { int i; for (i=0; i<100; i++) { | |
149 int n = read_little_endian_int(data + 0x34 + i*4); | |
150 if (n != 6) fprintf(stdout,"subroutine table %2d: %6d\n",i,n); | |
151 }} | |
152 Flags flags; | |
153 /* ºÇ½é¤«¤éºÇ¸å¤Þ¤Ç¥³¥Þ¥ó¥É¼èÆÀ -> ½ÐÎϤò·«¤êÊÖ¤¹ */ | |
154 while(dcur<dend) { | |
155 const char* dprev = dcur; | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
156 CmdD cmd(flags, system_version); cmd.ClearError(); |
0 | 157 |
158 /* end? */ | |
159 if (*dcur == -1) { | |
160 /* 0xff x 32byte + 0x00 : end sign */ | |
161 int i; for (i=0; i<0x20; i++) | |
162 if (dcur[i] != -1) break; | |
163 if (i == 0x20 && dcur[i] == 0) break; | |
164 } | |
165 dprintf("%d : ",dcur-dstart); | |
166 cmd.GetCmd(flags, dcur); | |
167 if (cmd.IsError()) { | |
168 fprintf(outstream, "Error at %6d\n",dprev-dstart); | |
169 while(dcur < dend) { | |
170 if (*dcur == 0x29 && dcur[1] == 0x0a) {dcur++;break;} | |
171 if (*dcur == 0 && dcur[1] == 0x0a) {dcur++;break;} | |
172 if (*dcur == 0 && dcur[1] == 0x23) {dcur++;break;} | |
173 dcur++; | |
174 } | |
175 dprev -= 2*16; | |
176 int ilen = (dcur-dprev+15)/16; | |
177 int i; for (i=0; i<ilen; i++) { | |
178 fprintf(outstream, "%6d: ",dprev-dstart); | |
179 int j; for (j=0; j<16; j++) { | |
180 if (dprev >= dend) break; | |
181 if (dprev < data) continue; | |
182 fprintf(outstream, "%02x ",*(unsigned char*)(dprev)); | |
183 dprev++; | |
184 } | |
185 fprintf(outstream, "\n"); | |
186 } | |
187 } | |
188 } | |
189 delete info; | |
190 } | |
191 return 0; | |
192 } | |
193 | |
194 /* | |
195 SetStr | |
196 0x23 - cmd 01-0a:0000:00[ 2] | |
197 args:V<18>[17],"PB47" | |
198 CatStr | |
199 0x23 - cmd 01-0a:0002:00[ 2] | |
200 args:V<18>[17],V<18>[20] | |
201 | |
202 WaitClick | |
203 0x23 - cmd 00-03:0011:00[ 0] | |
204 | |
205 ChangeFaceGraphics | |
206 0x23 - cmd 00-03:03e8:00[ 1] | |
207 args:V<18>[17] | |
208 DeleteFaceGraphics | |
209 0x23 - cmd 00-03:03e9:01[ 0] | |
210 KoePlay | |
211 0x23 - cmd 01-17:0000:01[ 2] | |
212 args:100000026,5 | |
213 DrawGraphics(Á°·Ê²è¤¢¤ê¡Ë | |
214 0x23 - cmd 01-21:004b:00[ 1] | |
215 args:V<18>[1],10,kasane. #1 <args:V<18>[17],11> | |
216 | |
217 DrawGraphics(ÇطʤΤß) | |
218 0x23 - cmd 01-21:0049:00[ 2] | |
219 args:V<18>[1],10 | |
220 | |
221 Ruby | |
222 0x23 - cmd 00-03:0078:01[ 0] | |
223 "Íýͳ" | |
224 0x23 - cmd 00-03:0078:00[ 1] | |
225 "¤ï¤±" | |
226 SetTitle | |
227 0x23 - cmd 01-04:0000:00[ 1] | |
228 args:"Long Long Time Ago..." | |
229 WaitTime | |
230 0x23 - cmd 01-14:0069:00[ 1] | |
231 args:3000 | |
232 ChangeBGM ¿ôÃÍ°ú¿ô¤Ï¥Õ¥§¡¼¥É¥¢¥¦¥È¡¢¥¤¥ó¤Î»þ´Ö¤È¿ä¬ | |
233 0x23 - cmd 01-14:0000:02[ 3] | |
234 args:"BGM18",700,700 | |
235 */ | |
236 | |
237 struct CmdDescrItem { | |
238 CmdDescrItem* next; | |
239 int cmd4; | |
240 int cmd1; | |
241 int cmd2; | |
242 int cmd3; | |
243 const char* cmd_descr; | |
244 }; | |
245 CmdDescrItem cmd_descr_orig[] = { | |
246 // scn2k_impl.cc; Scn2k::SysExec() | |
247 {0,0,0x00,0x01,0x0a, "local return"}, | |
248 {0,0,0x00,0x01,0x0b, "global jump"}, | |
249 {0,0,0x00,0x01,0x0c, "global call"}, | |
250 {0,0,0x00,0x01,0x0d, "global return"}, | |
251 {0,0,0x00,0x01,0x12, "global call"}, | |
252 {0,0,0x00,0x01,0x13, "global return(?)"}, | |
253 {0,0,0x00,0x04,0x0d, "Menu_return"}, | |
254 {0,0,0x01,0x04,0x00, "SetWindowCaption"}, | |
255 {0,0,0x01,0x04,0x82, "ClearMousePress"}, | |
256 {0,0,0x01,0x04,0x83, "GetMouse(2)"}, | |
257 {0,0,0x01,0x04,0x85, "GetMouse"}, | |
258 {0,0,0x01,0x04,0x4b0,"QuitGame"}, | |
259 {0,0,0x01,0x04,0x58d,"PrevSaveNumber"}, | |
260 {0,0,0x01,0x04,0x585,"SavedDate"}, | |
261 {0,0,0x01,0x04,0xc23,"Save"}, | |
262 {0,0,0x01,0x04,0xc25,"Load"}, | |
263 {0,0,0x01,0x04,0x4b1,"GoMenu"}, | |
264 {0,0,0x01,0x04,0x4b3,"GoMenu_Badend"}, | |
265 {0,0,0x01,0x04,0xcc, "ShowMouseCursor"}, | |
266 {0,0,0x01,0x04,0xcd, "HideMouseCursor"}, | |
267 {0,0,0x01,0x04,0xcf, "SetCursorType"}, | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
268 // scn2k_cmd.cc; CmdD::GetCmd() |
0 | 269 {0,0,0x00,0x01,0, "local jump"}, |
270 {0,0,0x00,0x01,1, "local jump-if"}, | |
271 {0,0,0x00,0x01,2, "local jump-unless"}, | |
272 {0,0,0x00,0x01,3, "local jump-switch??"}, | |
273 {0,0,0x00,0x01,4, "local switch"}, | |
274 {0,0,0x00,0x01,5, "local call"}, | |
275 {0,0,0x00,0x01,8, "local switch(simple form)"}, | |
276 {0,0,0x01,0x0b,0, "set multiple variables"}, | |
277 {0,0,0x01,0x0b,1, "set variables in a range"}, | |
278 {0,0,0x01,0x0b,4, "clear variables in a range"}, | |
279 {0,0,0x01,0x0b,0x64, "get summation of variables in a range"}, | |
280 // scn2k_cmd.cc; Flags::Exec() | |
281 {0,0,0x01,0x0a,0, "SetStr"}, | |
282 {0,0,0x01,0x0a,1, "ClearStr"}, | |
283 {0,0,0x01,0x0a,2, "AppendStr"}, | |
284 {0,0,0x01,0x0a,3, "StrLen"}, | |
285 {0,0,0x01,0x0a,4, "StrCmp"}, | |
286 {0,0,0x01,0x0a,5, "SubStrL"}, | |
287 {0,0,0x01,0x0a,6, "SubStrR"}, | |
288 {0,0,0x01,0x0a,7, "StrLenWideChar"}, | |
289 {0,0,0x01,0x0a,8, "TrimStr"}, | |
290 {0,0,0x01,0x0a,0x0f, "IntToStr"}, | |
291 {0,0,0x01,0x0a,0x11, "IntToStr_Fill"}, | |
292 {0,0,0x01,0x0a,0x64, "ShowStr"}, | |
293 // scn2k_text.cc; TextImpl::Exec() | |
294 {0,0,0x01,0x21,0x49, "SetFaceGraphic"}, | |
295 {0,0,0x01,0x21,0x4b, "SetFaceGraphic"}, | |
296 {0,0,0x01,0x21,0x4c, "SetFaceGraphic"}, | |
297 {0,0,0x00,0x03,0x97, "CloseTextWindow"}, | |
298 {0,0,0x00,0x03,0x11, "WaitText"}, | |
299 {0,0,0x00,0x03,0x03, "TextReturn"}, | |
300 {0,0,0x00,0x03,0xc9, "TextReturn"}, | |
301 {0,0,0x00,0x03,0x3e8,"SetFaceGraphic"}, | |
302 {0,0,0x00,0x03,0x3e9,"SetFaceGraphic"}, | |
303 {0,0,0x00,0x03,0x78, "TextRuby"}, | |
304 {0,0,0x00,0x03,0x66, "SetTextWindowType"}, | |
305 {0,0,0x00,0x03,0x67, "OpenTextWindow"}, | |
306 {0,0,0x00,0x03,0x98, "ClearTextWindow"}, | |
307 {0,0,0x00,0x03,0x68, "ShowText"}, | |
308 {0,0,0x00,0x02,0x01, "Select"}, | |
309 {0,0,0x00,0x02,0x03, "Select"}, | |
310 {0,0,0x00,0x04,0x44c,"TextSkipStart"}, | |
311 {0,0,0x00,0x04,0x3e8,"CloseTextWindow"}, | |
312 {0,0,0x01,0x04,0x64, "WaitTime"}, | |
313 {0,0,0x01,0x04,0x6f, "WaitTime"}, | |
314 {0,0,0x01,0x04,0x79, "WaitTime"}, | |
315 {0,0,0x01,0x04,0x65, "WaitTime w/ Cancel"}, | |
316 {0,0,0x01,0x04,0x70, "WaitTime w/ Cancel"}, | |
317 {0,0,0x01,0x04,0x1fe,"GetTimer"}, | |
318 {0,0,0x01,0x04,0x201,"ResetTimer (unsupported; see rldev)"}, | |
319 {0,0,0x01,0x04,0x202,"ResetTimerAll (unsupported; see rldev)"}, | |
320 {0,0,0x01,0x04,0x72, "GetTimer"}, | |
321 {0,0,0x01,0x04,0x7c, "GetTimer(2)"}, | |
322 {0,0,0x01,0x04,0x6e, "ClearTimer"}, | |
323 {0,0,0x01,0x04,0x78, "ClearTimer(2)"}, | |
324 {0,0,0x01,0x04,0x26c,"ClearTimer(multi)"}, | |
325 {0,0,0x01,0x04,0x270,"ClearTimer(multi)"}, | |
326 {0,0,0x01,0x04,0x276,"GetTimer(multi)"}, | |
327 {0,0,0x01,0x04,0x1f4,"SetTimer"}, | |
328 {0,0,0x01,0x04,0x3e8,"rand(x,y)"}, | |
329 {0,0,0x01,0x04,0x3ec,"min(x,y)"}, | |
330 {0,0,0x01,0x04,0x3ef,"min(x,y)"}, | |
331 {0,0,0x01,0x04,0x320,"range conversion(V,?,ResultMin,ValMin,ValMax,ResultMax,?)"}, | |
332 {0,0,0x01,0x04,0x3f1,"in_range(x,y,a)"}, | |
333 {0,0,0x01,0x04,0x16c,"SetCursorType?"}, | |
334 {0,0,0x01,0x04,0xbc1,"LoadFromMenu"}, | |
335 {0,0,0x01,0x04,0x8d4,"SetTextWindowColor"}, | |
336 {0,0,0x01,0x04,0x8d5,"SetTextWindowColor"}, | |
337 {0,0,0x01,0x04,0x8d6,"SetTextWindowColor"}, | |
338 {0,0,0x01,0x04,0x8d7,"SetTextWindowColor"}, | |
339 {0,0,0x01,0x04,0x8d8,"SetTextWindowColor"}, | |
340 {0,0,0x01,0x04,0x8db,"SetTextWindowColor"}, | |
341 {0,0,0x01,0x04,0x93f,"SetTextWindowColor"}, | |
342 {0,0,0x01,0x04,0xa39,"SetTextWindowColor"}, | |
343 {0,0,0x01,0x04,0xa28,"Get #INIT_MESSAGE_SPEED (original) from gameexe.ini"}, | |
344 {0,0,0x01,0x04,0xa29,"Get #INIT_MESSAGE_SPEED (original) from gameexe.ini"}, | |
345 {0,0,0x01,0x04,0xa2c,"Get #MESSAGE_KEY_WAIT_USE (original) from gameexe.ini"}, | |
346 {0,0,0x01,0x04,0xa2d,"Get #INIT_MESSAGE_SPEED (original) from gameexe.ini"}, | |
347 {0,0,0x01,0x04,0xa2e,"Get #MESSAGE_KEY_WAIT_TIME (original) from gameexe.ini"}, | |
348 {0,0,0x01,0x04,0x913,"Get #INIT_MESSAGE_SPEED"}, | |
349 {0,0,0x01,0x04,0x914,"Get #INIT_MESSAGE_SPEED_MOD"}, | |
350 {0,0,0x01,0x04,0x92e,"Get #MESSAGE_KEY_WAIT_USE"}, | |
351 {0,0,0x01,0x04,0x92f,"Get #INIT_MESSAGE_SPEED_MOD"}, | |
352 {0,0,0x01,0x04,0x930,"Get #MESSAGE_KEY_WAIT_TIME"}, | |
353 {0,0,0x01,0x04,0x8af,"Set #INIT_MESSAGE_SPEED"}, | |
354 {0,0,0x01,0x04,0x8b0,"Set #INIT_MESSAGE_SPEED_MOD"}, | |
355 {0,0,0x01,0x04,0x8ca,"Set #MESSAGE_KEY_WAIT_USE"}, | |
356 {0,0,0x01,0x04,0x8cb,"Set #INIT_MESSAGE_SPEED_MOD"}, | |
357 {0,0,0x01,0x04,0x8cc,"Set #MESSAGE_KEY_WAIT_USE"}, | |
358 {0,0,0x01,0x04,0x51f,"Set Name Text"}, | |
359 {0,0,0x01,0x04,0x51e,"Get Name Text"}, | |
360 {0,0,0x01,0x04,0x514,"Get Name Text"}, | |
361 // scn2k_grp.cc; GrpImpl::Exec() | |
362 // music commands | |
363 {0,0,0x01,0x14,0, "PlayBGM"}, | |
364 {0,0,0x01,0x14,2, "PlayBGM"}, | |
365 {0,0,0x01,0x14,0x05, "StopBGM"}, | |
366 {0,0,0x01,0x14,0x69, "FadeBGM"}, | |
367 {0,0,0x01,0x15,0, "PlaySE"}, | |
368 {0,0,0x01,0x15,2, "PlaySE"}, | |
369 {0,0,0x01,0x17,0, "PlayKoe"}, | |
370 {0,0,0x01,0x1a,1, "PlayMovie"}, | |
371 {0,0,0x01,0x1a,0x14, "PlayMovie"}, | |
372 // graphic commands | |
373 {0,0,0x01,0x1e,0, "GraphicStackClear"}, | |
374 {0,0,0x01,0x1f,0, "GraphicStackClear"}, | |
375 {0,0,0x01,0x21,0x46, "LoadSurface"}, | |
376 {0,0,0x01,0x21,0x49, "LoadBackSurface"}, | |
377 {0,0,0x01,0x21,0x4b, "LoadForeSurface"}, | |
378 {0,0,0x01,0x21,0x4c, "LoadSurface"}, | |
379 {0,0,0x01,0x21,0x64, "CopySurface"}, | |
380 {0,0,0x01,0x21,0x4b1,"ClearSurface"}, | |
381 {0,0,0x01,0x21,0x44c,"AlphaCopy"}, | |
382 {0,0,0x01,0x21,0x640,"SaturateCopy"}, | |
383 {0,0,0x01,0x21,0x196,"??? grp"}, | |
384 {0,0,0x01,0x22,0xc30,"ScrollEffect (Princess Bride)"}, | |
385 {0,0,0x01,0x22,0xc1c,"FallEffect (Princess Bride)"}, | |
386 {0,0,0x01,0x22,0x835,"FallEffect (Princess Bride)"}, | |
387 // grphic object commands | |
388 {0,0,0x01,0x04,0xd2, "??? grp"}, | |
389 {0,0,0x01,0x04,0xd3, "??? grp"}, | |
390 {0,0,0x01,0x04,0xd7, "??? grp"}, | |
391 {0,0,0x01,0x04,0xd8, "??? grp"}, | |
392 {0,0,0x01,0x04,0x5e0,"GetShownGrpFlag"}, | |
393 {0,0,0x01,0x3d,0x0a, "ClearGrpObj"}, | |
394 {0,0,0x01,0x3d,0x0b, "ClearGrpObj"}, | |
395 {0,0,0x01,0x3e,0x0a, "ClearGrpObj"}, | |
396 {0,0,0x01,0x3e,0x0a, "ClearGrpObj"}, | |
397 {0,0,0x01,0x3c,0x01, "??? grp (CLANNAD)"}, | |
398 {0,0,0x01,0x47,0x3e8,"SetGrpObj_Fname"}, | |
399 {0,0,0x01,0x47,0x3eb,"SetGrpObj_GANname"}, | |
400 {0,0,0x01,0x47,0x4b0,"SetGrpObj_Text"}, | |
401 {0,0,0x01,0x48,0x3e8,"SetGrpObj_ForeGrp?"}, | |
402 {0,0,0x01,0x49,0, "StopAnimation"}, | |
403 {0,0,0x01,0x49,3, "QueryExecAnimation"}, | |
404 {0,0,0x01,0x49,0x7d3,"SetGrpObj_GAN?"}, | |
405 {0,0,0x01,0x49,0xbb9,"StartAnimation"}, | |
406 {0,0,0x01,0x49,0xbbb,"StartAnimation"}, | |
407 {0,0,0x01,0x49,0xbbd,"StartAnimation"}, | |
408 {0,0,0x01,0x51,0x3e8,"SetGrpObj_xy"}, | |
409 {0,0,0x01,0x51,0x3e9,"SetGrpObj_x"}, | |
410 {0,0,0x01,0x51,0x3ea,"SetGrpObj_y"}, | |
411 {0,0,0x01,0x51,0x3eb,"SetGrpObj_alpha"}, | |
412 {0,0,0x01,0x51,0x3ec,"SetGrpObj_visible"}, | |
413 {0,0,0x01,0x51,0x3ee,"SetGrpObj_xy?"}, | |
414 {0,0,0x01,0x51,0x3fd,"SetGrpObj_centering?"}, | |
415 {0,0,0x01,0x51,0x401,"SetGrpObj_textsize"}, | |
416 {0,0,0x01,0x51,0x40a,"SetGrpObj_clipregion"}, | |
417 {0,0,0x01,0x51,0x40f,"SetGrpObj_surfacenum"}, | |
418 {0,0,0x01,0x51,0x416,"SetGrpObj_expand"}, | |
419 {0,0,0x01,0x51,0x419,"SetGrpObj_rotate"}, | |
420 {0,0,0x01,0x52,0x3e8,"SetGrpObj_xy(2)"}, | |
421 {0,0,0x01,0x52,0x3ea,"SetGrpObj_y(2)"}, | |
422 {0,0,0x01,0x52,0x3eb,"SetGrpObj_alpha(2)"}, | |
423 {0,0,0x01,0x52,0x3ec,"SetGrpObj_visible(2)"}, | |
424 {0,0,0x01,0x52,0x3ee,"SetGrpObj_xy?(2)"}, | |
425 {0,0,0x01,0x52,0x3fd,"SetGrpObj_centering?(2)"}, | |
426 {0,0,0x01,0x52,0x401,"SetGrpObj_textsize(2)"}, | |
427 {0,0,0x01,0x52,0x408,"SetGrpObj_order (not supported)"}, | |
428 {0,0,0x01,0x52,0x40a,"SetGrpObj_clipregion(2)"}, | |
429 {0,0,0x01,0x52,0x40f,"SetGrpObj_surfacenum(2)"}, | |
430 {0,0,0x01,0x52,0x416,"SetGrpObj_expand(2)"}, | |
431 {0,0,0x01,0x52,0x419,"SetGrpObj_rotate(2)"}, | |
432 {0,0,0x01,0x54,0x3e8,"GetGrpObj_xy"}, | |
433 {0,0,0x01,0x54,0x44c,"GetGrpObj_wh"}, | |
434 | |
435 {0,0,0x02,0x3d,0x0a, "ClearGrpObj(2)"}, | |
436 {0,0,0x02,0x3d,0x0b, "ClearGrpObj(2)"}, | |
437 {0,0,0x02,0x3e,0x0a, "ClearGrpObj(2)"}, | |
438 {0,0,0x02,0x3e,0x0a, "ClearGrpObj(2)"}, | |
439 {0,0,0x02,0x3c,0x01, "??? grp (CLANNAD)(2)"}, | |
440 {0,0,0x02,0x47,0x3e8,"SetGrpObj_Fname(2)"}, | |
441 {0,0,0x02,0x47,0x3eb,"SetGrpObj_GANname(2)"}, | |
442 {0,0,0x02,0x47,0x4b0,"SetGrpObj_Text(2)"}, | |
443 {0,0,0x02,0x48,0x3e8,"SetGrpObj_ForeGrp?(2)"}, | |
444 {0,0,0x02,0x49,0, "StopAnimation(2)"}, | |
445 {0,0,0x02,0x49,3, "QueryExecAnimation(2)"}, | |
446 {0,0,0x02,0x49,0x7d3,"SetGrpObj_GAN?(2)"}, | |
447 {0,0,0x02,0x49,0xbb9,"StartAnimation(2)"}, | |
448 {0,0,0x02,0x49,0xbbb,"StartAnimation(2)"}, | |
449 {0,0,0x02,0x49,0xbbd,"StartAnimation(2)"}, | |
450 {0,0,0x02,0x51,0x3e8,"SetGrpObj_xy(2)"}, | |
451 {0,0,0x02,0x51,0x3ea,"SetGrpObj_y(2)"}, | |
452 {0,0,0x02,0x51,0x3eb,"SetGrpObj_alpha(2)"}, | |
453 {0,0,0x02,0x51,0x3ec,"SetGrpObj_visible(2)"}, | |
454 {0,0,0x02,0x51,0x3ee,"SetGrpObj_xy?(2)"}, | |
455 {0,0,0x02,0x51,0x3fd,"SetGrpObj_centering?(2)"}, | |
456 {0,0,0x02,0x51,0x401,"SetGrpObj_textsize(2)"}, | |
457 {0,0,0x02,0x51,0x40a,"SetGrpObj_clipregion(2)"}, | |
458 {0,0,0x02,0x51,0x40f,"SetGrpObj_surfacenum(2)"}, | |
459 {0,0,0x02,0x51,0x416,"SetGrpObj_expand(2)"}, | |
460 {0,0,0x02,0x51,0x419,"SetGrpObj_rotate(2)"}, | |
461 {0,0,0x02,0x52,0x3e8,"SetGrpObj_xy(2)(2)"}, | |
462 {0,0,0x02,0x52,0x3ea,"SetGrpObj_y(2)(2)"}, | |
463 {0,0,0x02,0x52,0x3eb,"SetGrpObj_alpha(2)(2)"}, | |
464 {0,0,0x02,0x52,0x3ec,"SetGrpObj_visible(2)(2)"}, | |
465 {0,0,0x02,0x52,0x3ee,"SetGrpObj_xy?(2)(2)"}, | |
466 {0,0,0x02,0x52,0x3fd,"SetGrpObj_centering?(2)(2)"}, | |
467 {0,0,0x02,0x52,0x401,"SetGrpObj_textsize(2)(2)"}, | |
468 {0,0,0x02,0x52,0x40a,"SetGrpObj_clipregion(2)(2)"}, | |
469 {0,0,0x02,0x52,0x40f,"SetGrpObj_surfacenum(2)(2)"}, | |
470 {0,0,0x02,0x52,0x416,"SetGrpObj_expand(2)(2)"}, | |
471 {0,0,0x02,0x52,0x419,"SetGrpObj_rotate(2)(2)"}, | |
472 {0,0,0x02,0x54,0x3e8,"GetGrpObj_xy(2)"}, | |
473 {0,0,0x02,0x54,0x44c,"GetGrpObj_wh(2)"}, | |
474 {0,0,0,0,0,0} | |
475 }; | |
29
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
476 map<int, CmdDescrItem*> CmdD::cmd_descr; |
d229cce98f50
* no more (or, at least, less) duplicate code between scn2kdump and the rest
thib
parents:
27
diff
changeset
|
477 const char* CmdD::CmdDescr(int cmd1, int cmd2, int cmd3, int cmd4) { |
0 | 478 if (cmd_descr.empty()) { |
479 int i; | |
480 for (i=0; cmd_descr_orig[i].cmd_descr != 0; i++) { | |
481 CmdDescrItem& cur = cmd_descr_orig[i]; | |
482 int item_num = cur.cmd1*1000000+cur.cmd2*10000+cur.cmd3; | |
483 map<int,CmdDescrItem*>::iterator it = cmd_descr.find(item_num); | |
484 if (it == cmd_descr.end()) cmd_descr[item_num] = &cur; | |
485 else { | |
486 cur.next = it->second; | |
487 it->second = &cur; | |
488 } | |
489 } | |
490 } | |
491 int item_num = cmd1*1000000+cmd2*10000+cmd3; | |
492 map<int,CmdDescrItem*>::iterator it = cmd_descr.find(item_num); | |
493 if (it == cmd_descr.end()) return "No descr (unsupported)"; | |
494 CmdDescrItem* cur = it->second; | |
495 do { | |
496 if (cur->cmd1 == cmd1 && cur->cmd2 == cmd2 && cur->cmd3 == cmd3) { | |
497 return cur->cmd_descr; | |
498 } | |
499 cur = cur->next; | |
500 } while(cur != 0); | |
501 return "No descr (unsupported)"; | |
502 } |