00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CONVERTUSECODECRUSADER_H
00020 #define CONVERTUSECODECRUSADER_H
00021
00022 #include "Convert.h"
00023
00024
00025
00026 class ConvertUsecodeCrusader : public ConvertUsecode
00027 {
00028 public:
00029 const char* const *intrinsics() { return _intrinsics; };
00030 const char* const *event_names() { return _event_names; };
00031 void readheader(IDataSource *ucfile, UsecodeHeader &uch, uint32 &curOffset);
00032 void readevents(IDataSource *ucfile, const UsecodeHeader &uch)
00033 {
00034 EventMap.clear();
00035 uint32 num_crusader_routines = uch.offset / 6;
00036 for (uint32 i=0; i < num_crusader_routines; i++) {
00037 read2(ucfile);
00038 uint32 offset = read4(ucfile);
00039 EventMap[offset] = i;
00040 #ifdef DISASM_DEBUG
00041 pout << "Crusader Routine: " << i << ": " << std::hex << std::setw(4) << offset << std::dec << " size " << size << endl;
00042 #endif
00043 }
00044 };
00045
00046
00047
00048 void readOp(TempOp &op, IDataSource *ucfile, uint32 &dbg_symbol_offset, std::vector<DebugSymbol> &debugSymbols, bool &done)
00049 { readOpGeneric(op, ucfile, dbg_symbol_offset, debugSymbols, done, true); };
00050 Node *readOp(IDataSource *ucfile, uint32 &dbg_symbol_offset, std::vector<DebugSymbol> &debugSymbols, bool &done)
00051 { return readOpGeneric(ucfile, dbg_symbol_offset, debugSymbols, done, true); };
00052
00053 private:
00054 static const char* const _intrinsics[];
00055 static const char* const _event_names[];
00056 };
00057
00058
00059 const char* const ConvertUsecodeCrusader::_intrinsics[] = {
00060
00061 "Intrinsic0000()",
00062 "Item::getFrame(void)",
00063 "Item::setFrame(uint16)",
00064 "Item::getMapNum(void)",
00065 "Item::getStatus(void)",
00066 "Item::orStatus(sint16)",
00067 "Item::callEvent0A(sint16)",
00068 "Intrinsic0007()",
00069 "Item::isNpc(void)",
00070 "Item::getZ(void)",
00071 "Intrinsic000A()",
00072 "Item::getQLo(void)",
00073 "Item::destroy(void)",
00074 "Intrinsic000D()",
00075 "Item::getX(void)",
00076 "Item::getY(void)",
00077
00078 "Intrinsic0010()",
00079 "Item::getType(void)",
00080 "Intrinsic0012()",
00081 "Intrinsic0013()",
00082 "Item::legal_create(uint16,uint16,uint16,uint16,uint16)",
00083 "Item::andStatus(void)",
00084 "Intrinsic0016()",
00085 "Intrinsic00C3()",
00086 "Intrinsic00DA()",
00087 "Intrinsic0019()",
00088 "Item::create(uint16,uint16)",
00089 "Item::pop(uint16,uint16,uint8)",
00090 "Intrinsic00FA()",
00091 "Item::push(void)",
00092 "Intrinsic001E()",
00093 "Item::getQLo(void)",
00094
00095 "Item::setQLo(sint16)",
00096 "Item::getQHi(void)",
00097 "Item::setQHi(sint16)",
00098 "Intrinsic0023()",
00099 "Item::hurl(sint16,sint16,sint16,sint16)",
00100 "Item::getCY(void)",
00101 "Item::getCX(void)",
00102 "Intrinsic0027()",
00103 "Item::setNpcNum(sint16)",
00104 "Intrinsic0029()",
00105 "Intrinsic002A()",
00106 "Item::pop(void)",
00107 "Intrinsic002C()",
00108 "Item::isCompletelyOn(uint16)",
00109 "Item::pop(uint16)",
00110 "Intrinsic002F()",
00111
00112 "Intrinsic0030()",
00113 "Item::getFamily(void)",
00114 "Item::destroyContents(void)",
00115 "Intrinsic0033()",
00116 "Item::getDirToItem(uint16)",
00117 "Intrinsic0035()",
00118 "Intrinsic0036()",
00119 "Intrinsic0037()",
00120 "Item::andStatus(void)",
00121 "Kernel::resetRef(uint16,ProcessType)",
00122 "Item::touch(void)",
00123 "Egg::getEggId(void)",
00124 "Intrinsic003C()",
00125 "Intrinsic003D()",
00126 "Item::callEvent11(sint16)",
00127 "Intrinsic003F()",
00128
00129 "Intrinsic0040()",
00130 "Item::isOn(uint16)",
00131 "Item::getQHi(void)",
00132 "Item::isOn(uint16)",
00133 "Item::getQHi(void)",
00134 "Item::isOn(uint16)",
00135 "Item::getQHi(void)",
00136 "Item::isOn(uint16)",
00137 "Item::getQHi(void)",
00138 "Item::isOn(uint16)",
00139 "Item::getQHi(void)",
00140 "Item::isOn(uint16)",
00141 "Item::getQHi(void)",
00142 "Intrinsic004D()",
00143 "Npc::isDead(void)",
00144 "Intrinsic009C()",
00145
00146 "Intrinsic0050()",
00147 "Intrinsic0051()",
00148 "Intrinsic0052()",
00149 "Intrinsic00BD()",
00150 "Intrinsic0054()",
00151 "Intrinsic0055()",
00152 "Intrinsic0056()",
00153 "Intrinsic0057()",
00154 "Item::use(void)",
00155 "Item::setQuantity(sint16)",
00156 "Intrinsic005A()",
00157 "Item::getSurfaceWeight(void)",
00158 "Intrinsic005C()",
00159 "Item::setFrame(uint16)",
00160 "Intrinsic00DA()",
00161 "Intrinsic005F()",
00162
00163 "Intrinsic0060()",
00164 "Intrinsic0061()",
00165 "Intrinsic0062()",
00166 "Item::legal_create(uint16,uint16,WorldPoint&)",
00167 "Item::getPoint(WorldPoint&)",
00168 "Item::legal_move(WorldPoint&,uint16,uint16)",
00169 "Item::fall(void)",
00170 "Item::hurl(sint16,sint16,sint16,sint16)",
00171 "Kernel::getNumProcesses(uint16,ProcessType)",
00172 "Item::getCY(void)",
00173 "Intrinsic006A()",
00174 "Intrinsic006B()",
00175 "Intrinsic006C()",
00176 "Intrinsic006D()",
00177 "Intrinsic006E()",
00178 "Item::isInNpc(void)",
00179
00180 "Intrinsic0070()",
00181 "Intrinsic0071()",
00182 "Intrinsic0072()",
00183 "Intrinsic0073()",
00184 "Npc::isDead(void)",
00185 "Item::getNpcNum(void)",
00186 "IntrinsicReturn0",
00187 "Intrinsic0077()",
00188 "Item::callEvent0B(sint16)",
00189 "Item::andStatus(void)",
00190 "Item::move(uint16,uint16,uint8)",
00191 "Intrinsic007B()",
00192 "Intrinsic007C()",
00193 "Intrinsic007D()",
00194 "Intrinsic007E()",
00195 "Intrinsic007F()",
00196
00197 "Intrinsic0080()",
00198 "Intrinsic0081()",
00199 "Intrinsic0082()",
00200 "Intrinsic0083()",
00201 "Intrinsic0084()",
00202 "Intrinsic0085()",
00203 "teleportToEgg(sint16,int,uint8)",
00204 "Intrinsic0087()",
00205 "Intrinsic0088()",
00206 "Intrinsic00BD()",
00207 "Item::getQuality(void)",
00208 "Item::setQuality(sint16)",
00209 "Intrinsic008C()",
00210 "Intrinsic008D()",
00211 "Intrinsic008E()",
00212 "Camera::getX(void)",
00213
00214 "Camera::getY(void)",
00215 "Item::setMapNum(sint16)",
00216 "Item::getNpcNum(void)",
00217 "Item::shoot(WorldPoint&,sint16,sint16)",
00218 "Intrinsic0094()",
00219 "Item::enterFastArea(void)",
00220 "Intrinsic00CA()",
00221 "Item::hurl(sint16,sint16,sint16,sint16)",
00222 "Item::getNpcNum(void)",
00223 "Intrinsic0099()",
00224 "teleportToEgg(sint16,uint8)",
00225 "Intrinsic009B()",
00226 "Intrinsic009C()",
00227 "Intrinsic009D()",
00228 "Intrinsic009E()",
00229 "Intrinsic009F()",
00230
00231 "Item::andStatus(void)",
00232 "Item::getUnkEggType(void)",
00233 "Egg::setEggXRange(uint16)",
00234 "Item::setFrame(uint16)",
00235 "Item::overlaps(uint16)",
00236 "Item::isOn(uint16)",
00237 "Item::getQHi(void)",
00238 "Intrinsic00DA()",
00239 "Item::getCY(void)",
00240 "Intrinsic00A9()",
00241 "Item::isOn(uint16)",
00242 "Npc::isDead(void)",
00243 "Item::hurl(sint16,sint16,sint16,sint16)",
00244 "Intrinsic00AD()",
00245 "Item::getQHi(void)",
00246 "Item::andStatus(void)",
00247
00248 "Item::hurl(sint16,sint16,sint16,sint16)",
00249 "Item::andStatus(void)",
00250 "Item::hurl(sint16,sint16,sint16,sint16)",
00251 "Item::andStatus(void)",
00252 "Item::getDirToCoords(uint16,uint16)",
00253 "Intrinsic00B5()",
00254 "Intrinsic00B6()",
00255 "Item::getNpcNum(void)",
00256 "Item::getCY(void)",
00257 "Item::isOn(uint16)",
00258 "Item::getFootpad(sint16&,sint16&,sint16&)",
00259 "Npc::isDead(void)",
00260 "Intrinsic00BC()",
00261 "Intrinsic00BD()",
00262 "Intrinsic00BE()",
00263 "Item::andStatus(void)",
00264
00265 "Intrinsic00C0()",
00266 "Intrinsic00C1()",
00267 "IntrinsicReturn0",
00268 "Intrinsic00C3()",
00269 "Item::getQHi(void)",
00270 "Item::setQuality(sint16)",
00271 "Item::hurl(sint16,sint16,sint16,sint16)",
00272 "Intrinsic00C7()",
00273 "Intrinsic00C8()",
00274 "Item::callEvent0A(sint16)",
00275 "Intrinsic00CA()",
00276 "Item::isOn(uint16)",
00277 "Intrinsic00CC()",
00278 "Intrinsic00CD()",
00279 "Item::getQHi(void)",
00280 "Item::isOn(uint16)",
00281
00282 "Intrinsic00D0()",
00283 "Intrinsic00D1()",
00284 "Intrinsic00D2()",
00285 "Intrinsic00FA()",
00286 "Camera::getY(void)",
00287 "Intrinsic00D5()",
00288 "Intrinsic00D6()",
00289 "Intrinsic00D7()",
00290 "Intrinsic00D8()",
00291 "Intrinsic00D9()",
00292 "Intrinsic00DA()",
00293 "Intrinsic00DB()",
00294 "Item::getQLo(void)",
00295 "Item::getQHi(void)",
00296 "Item::getNpcNum(void)",
00297 "Intrinsic00DF()",
00298
00299 "Item::hurl(sint16,sint16,sint16,sint16)",
00300 "Intrinsic00FA()",
00301 "Item::getQLo(void)",
00302 "Item::getCY(void)",
00303 "Item::getNpcNum(void)",
00304 "Item::hurl(sint16,sint16,sint16,sint16)",
00305 "Item::getNpcNum(void)",
00306 "Item::hurl(sint16,sint16,sint16,sint16)",
00307 "Item::getNpcNum(void)",
00308 "Item::hurl(sint16,sint16,sint16,sint16)",
00309 "Item::getNpcNum(void)",
00310 "Item::hurl(sint16,sint16,sint16,sint16)",
00311 "Item::getNpcNum(void)",
00312 "Item::hurl(sint16,sint16,sint16,sint16)",
00313 "Item::getNpcNum(void)",
00314 "Item::hurl(sint16,sint16,sint16,sint16)",
00315
00316 "Item::getNpcNum(void)",
00317 "Item::hurl(sint16,sint16,sint16,sint16)",
00318 "Item::getNpcNum(void)",
00319 "Item::hurl(sint16,sint16,sint16,sint16)",
00320 "Item::getNpcNum(void)",
00321 "Item::hurl(sint16,sint16,sint16,sint16)",
00322 "Item::getNpcNum(void)",
00323 "Item::andStatus(void)",
00324 "Intrinsic00FA()",
00325 "Item::getQLo(void)",
00326 "Intrinsic00FA()",
00327 "Intrinsic00FB()",
00328 "Intrinsic00FC()",
00329 "Item::getQLo(void)",
00330 "Intrinsic00FE()",
00331 "Item::hurl(sint16,sint16,sint16,sint16)",
00332
00333 "Item::andStatus(void)",
00334 "Item::isOn(uint16)",
00335 "Npc::isDead(void)",
00336 "Intrinsic00BD()",
00337 "Item::getQHi(void)",
00338 "Intrinsic00DA()",
00339 "Intrinsic00FA()",
00340 "Item::getQLo(void)",
00341 "Item::isOn(uint16)",
00342 "Item::getQHi(void)",
00343 "Item::isOn(uint16)",
00344 "Item::getQHi(void)",
00345 "Item::hurl(sint16,sint16,sint16,sint16)",
00346 "Item::getNpcNum(void)",
00347 "Item::getCY(void)",
00348 "Item::hurl(sint16,sint16,sint16,sint16)",
00349
00350 "Item::isOn(uint16)",
00351 "Intrinsic0111()",
00352 "IntrinsicReturn0",
00353 "Npc::isDead(void)",
00354 "Intrinsic0088()",
00355 "Intrinsic00C1()",
00356 "Item::getQHi(void)",
00357 "Intrinsic00BD()",
00358 "Item::andStatus(void)",
00359 "Item::getNpcNum(void)",
00360 "Item::andStatus(void)",
00361 "Item::getNpcNum(void)",
00362 "Intrinsic011C()",
00363 "Item::andStatus(void)",
00364 "Item::getNpcNum(void)",
00365 "Item::AvatarStoleSomehting(uint16)",
00366
00367 "Item::andStatus(void)",
00368 "Item::getNpcNum(void)",
00369 "Item::getQ(void)",
00370 "Item::setQ(uint)",
00371 "Item::andStatus(void)",
00372 "Item::getNpcNum(void)",
00373 "Item::andStatus(void)",
00374 "Item::getNpcNum(void)",
00375 "Item::andStatus(void)",
00376 "Item::getNpcNum(void)",
00377 "Item::andStatus(void)",
00378 "Item::getNpcNum(void)",
00379 "Item::andStatus(void)",
00380 "Item::getNpcNum(void)",
00381 "Intrinsic00C3()",
00382 "Item::andStatus(void)",
00383
00384 "Item::getNpcNum(void)",
00385 "Intrinsic0131()",
00386 "Item::andStatus(void)",
00387 "Item::hurl(sint16,sint16,sint16,sint16)",
00388 "Item::andStatus(void)",
00389 "Camera::getY(void)",
00390 "Camera::getZ(void)",
00391 "Intrinsic0137()",
00392 "Intrinsic009C()",
00393 "Item::getTypeFlagCrusader(sint16)",
00394 "Item::getNpcNum(void)",
00395 "Item::hurl(sint16,sint16,sint16,sint16)",
00396 "Item::getCY(void)",
00397 "Item::getCZ(void)",
00398 "Item::setFrame(uint16)",
00399 "Intrinsic013F()",
00400
00401 "Intrinsic0140()",
00402 "Intrinsic0141()",
00403 "Intrinsic0142()",
00404 "Npc::isDead(void)",
00405 "Intrinsic00FA()",
00406 "Intrinsic0145()",
00407 "Intrinsic0146()",
00408 "Intrinsic0147()",
00409 "Item::getNpcNum(void)",
00410 "Item::getQLo(void)",
00411 "Item::andStatus(void)",
00412 "Intrinsic014B()",
00413 "Intrinsic014C()",
00414 "Intrinsic014D()",
00415 "Intrinsic003C()",
00416 "Egg::getEggXRange(void)",
00417
00418 "Intrinsic009C()",
00419 "Intrinsic0072()",
00420 "Item::setFrame(uint16)",
00421 "Intrinsic00C1()",
00422 "Intrinsic00C3()",
00423 "Intrinsic00C1()",
00424 "Item::isOn(uint16)",
00425 "Intrinsic00C3()",
00426 "Intrinsic00FA()",
00427 "Item::getQHi(void)",
00428 "Item::getQLo(void)",
00429 "Intrinsic00C1()",
00430 "Intrinsic00C3()",
00431 "Intrinsic015D()",
00432 0
00433 };
00434
00435 const char * const ConvertUsecodeCrusader::_event_names[] = {
00436 "look()",
00437 "use()",
00438 "anim()",
00439 "setActivity()",
00440 "cachein()",
00441 "hit(uword, word)",
00442 "gotHit(uword, word)",
00443 "hatch()",
00444 "schedule()",
00445 "release()",
00446 "func0A(sint16)",
00447 "func0B(sint16)",
00448 "combine()",
00449 "func0D",
00450 "calledFromAnim()",
00451 "enterFastArea()",
00452
00453 "leaveFastArea()",
00454 "func11(sint16)",
00455 "justMoved()",
00456 "AvatarStoleSomething(uword)",
00457 "animGetHit()",
00458 "func15",
00459 "func16",
00460 "func17",
00461 "func18",
00462 "func19",
00463 "func1A",
00464 "func1B",
00465 "func1C",
00466 "func1D",
00467 "func1E",
00468 "func1F",
00469 0
00470 };
00471
00472 void ConvertUsecodeCrusader::readheader(IDataSource *ucfile, UsecodeHeader &uch, uint32 &curOffset)
00473 {
00474 uch.routines = read4(ucfile);
00475 uch.maxOffset = read4(ucfile);
00476 uch.offset = read4(ucfile)-20;
00477 uch.externTable = read4(ucfile);
00478 uch.fixupTable = read4(ucfile);
00479 #ifdef DISASM_DEBUG
00480 con.Printf("Routines:\t%04X\n", uch.routines);
00481 con.Printf("MaxOffset:\t%04X\nOffset:\t\t%04X\n", uch.maxOffset, uch.offset);
00482 con.Printf("ExternTable:\t%04X\nFixupTable:\t%04X\n", uch.externTable, uch.fixupTable);
00483 #endif
00484 uch.maxOffset += 1;
00485 #ifdef DISASM_DEBUG
00486 con.Printf("Adjusted MaxOffset:\t%04X\n", uch.maxOffset);
00487 #endif
00488 curOffset = 1-uch.offset;
00489 };
00490
00491
00492
00493
00494
00495
00496 #endif