diff options
Diffstat (limited to 'simon/debug.cpp')
-rw-r--r-- | simon/debug.cpp | 401 |
1 files changed, 16 insertions, 385 deletions
diff --git a/simon/debug.cpp b/simon/debug.cpp index ce10fe39a7..8ba437e3da 100644 --- a/simon/debug.cpp +++ b/simon/debug.cpp @@ -23,6 +23,7 @@ #include "stdafx.h" #include "simon/simon.h" #include "simon/intern.h" +#include "simon/debug.h" #include "simon/vga.h" #if defined (WIN32) && !defined(_WIN32_WCE) @@ -30,270 +31,6 @@ #endif #ifdef SIMONDEBUG -#define SIMON2 -#define SIMON2WIN - -static const char *const opcode_name_table[256] = { - /* 0 */ - "|INV_COND", - "IJ|PTRA_PARENT_IS", - "IJ|PTRA_PARENT_ISNOT", - NULL, - /* 4 */ - NULL, - "IJ|PARENT_IS_1", - "IJ|PARENT_ISNOT_1", - "IIJ|PARENT_IS", - /* 8 */ - NULL, - NULL, - NULL, - "VJ|IS_ZERO", - /* 12 */ - "VJ|ISNOT_ZERO", - "VWJ|IS_EQ", - "VWJ|IS_NEQ", - "VWJ|IS_LE", - /* 16 */ - "VWJ|IS_GE", - "VVJ|IS_EQF", - "VVJ|IS_NEQF", - "VVJ|IS_LEF", - /* 20 */ - "VVJ|IS_GEF", - NULL, - NULL, - "WJ|UNK23", - /* 24 */ - NULL, - "IJ|HAS_CHILD_1", - "IJ|HAS_CHILD_2", - "IWJ|ITEM_UNK3_IS", - /* 28 */ - "IBJ|CHILD_HAS_FLAG", - NULL, - NULL, - "I|SET_NO_PARENT", - /* 32 */ - NULL, - "II|SET_PARENT", - NULL, - NULL, - /* 36 */ - "VV|MOVE", - NULL, - NULL, - NULL, - /* 40 */ - NULL, - "V|ZERO", - "VW|SET", - "VW|ADD", - /* 44 */ - "VW|SUB", - "VV|ADDF", - "VV|SUBF", - "VW|MUL", - /* 48 */ - "VW|DIV", - "VV|MULF", - "VV|DIVF", - "VW|MOD", - /* 52 */ - "VV|MODF", - "VW|RANDOM", - NULL, - "I|SET_A_PARENT", - /* 56 */ - "IB|SET_CHILD2_BIT", - "IB|CLEAR_CHILD2_BIT", - "II|MAKE_SIBLING", - "I|INC_UNK3", - /* 60 */ - "I|DEC_UNK3", - "IW|SET_UNK3", - "V|SHOW_INT", - "T|SHOW_STRING_NL", - /* 64 */ - "T|SHOW_STRING", - "WWWWWB|ADD_HITAREA", - "BT|SET_ITEM_NAME", -#if defined SIMON1WIN || defined SIMON2 - "BTw|SET_ITEM_DESC", -#endif -#ifdef SIMON1DOS - "BT|SET_ITEM_DESC", -#endif - /* 68 */ - "x|HALT", - "x|RET1", - "V|SHOW_STRING_AR3", - "W|START_SUB", - /* 72 */ - NULL, - NULL, - NULL, - NULL, - /* 76 */ - "WW|ADD_TIMEOUT", - "J|IS_M1_EMPTY", - "J|IS_M3_EMPTY", - "ITJ|CHILD_FR2_IS", - /* 80 */ - "IIJ|IS_ITEM_EQ", - NULL, - "B|UNK82", - "|RETM10", - /* 84 */ - NULL, - NULL, - NULL, - "W|UNK87", - /* 88 */ - "|OR_SCRIPT_WORD_10", - "|AND_SCRIPT_WORD_10", - "IB|SET_M_TO_PARENT", - "IB|SET_M_TO_SIBLING", - /* 92 */ - "IB|SET_M_TO_CHILD", - NULL, - NULL, - NULL, - /* 96 */ - "WB|UNK96", - "W|LOAD_VGA", -#ifdef SIMON2 - "WWBWWW|START_VGA", -#else - "WBWWW|START_VGA", -#endif -#ifdef SIMON2 - "WW|KILL_THREAD", -#else - "W|KILL_THREAD", -#endif - /* 100 */ - "|VGA_RESET", - "BWWWWWW|UNK101", - "B|UNK102", - "|UNK103", - /* 104 */ - "B|UNK104", - NULL, - NULL, - "WWWWWIW|ADD_ITEM_HITAREA", - /* 108 */ - "W|DEL_HITAREA", - "W|CLEAR_HITAREA_0x40", - "W|SET_HITAREA_0x40", - "WWW|SET_HITAREA_XY", - /* 112 */ - NULL, - NULL, - "IB|UNK114", - "IBJ|HAS_FLAG", - /* 116 */ - "IB|SET_FLAG", - "IB|CLEAR_FLAG", - NULL, - "W|WAIT_VGA", - /* 120 */ - "W|UNK120", - "BI|SET_VGA_ITEM", - NULL, - NULL, - /* 124 */ - NULL, - "IJ|IS_SIBLING_WITH_A", - "IBB|UNK126", - "WW|UNK127", - /* 128 */ - "W|GET_DUMMY_WORD", - "W|GET_WORD_COND_TRUE", - "Bww|UNK131", - NULL, /* opcode 131 doesn't exist */ - /* 132 */ - "|SAVE_GAME", - "|LOAD_GAME", - "|DUMMYPROC_134", - "|QUIT_IF_USER_PRESSES_Y", - /* 136 */ - "IV|GET_ITEM_UNK3", - "B|UNK137", - "|VGA_POINTER_OP_4", - "II|SET_PARENT_SPECIAL", - /* 140 */ - "|DEL_TE_AND_ADD_ONE", - "BI|SET_M1_OR_M3", - "WJ|IS_HITAREA_0x40_CLEAR", - "I|START_ITEM_SUB", - /* 144 */ - NULL, - NULL, - NULL, - NULL, - /* 148 */ - NULL, - NULL, - NULL, - "BI|SET_ARRAY6_TO", - /* 152 */ - "BB|SET_M1_M3_TO_ARRAY6", - "B|SET_BIT", - "B|CLEAR_BIT", - "BJ|IS_BIT_CLEAR", - /* 156 */ - "BJ|IS_BIT_SET", - "IBB|GET_ITEM_PROP", - "IBW|SET_ITEM_PROP", - NULL, - /* 160 */ - "B|UNK160", - "BWBW|SETUP_TEXT", -#if defined SIMON1WIN || defined SIMON2 - "BBTW|PRINT_STR", -#endif -#ifdef SIMON1DOS - "BBT|PRINT_STR", -#endif - "W|SOUND_1", - /* 164 */ - "|UNK164", - "IWWJ|ITEM_UNK1_UNK2_IS", - "B|SET_BIT2", - "B|CLEAR_BIT2", - /* 168 */ - "BJ|IS_BIT2_CLEAR", - "BJ|IS_BIT2_SET", - NULL, - NULL, - /* 172 */ - NULL, - NULL, - NULL, - "|VGA_POINTER_OP_1", - /* 176 */ - "|VGA_POINTER_OP_2", - "BBI|UNK177", - "WWBB|PATHFIND", - "BBB|UNK179", - /* 180 */ - "|FORCE_UNLOCK", - "|FORCE_LOCK", - "|READ_VGARES_328", - "|READ_VGARES_23", - /* 184 */ - "W|CLEAR_VGAPOINTER_ENTRY", - "W|DUMMY_185", - "|VGA_POINTER_OP_3", - "|FADE_TO_BLACK", -#ifdef SIMON2 - /* 188 */ - "BSJ|STRING2_IS", - "|UNK189", - "B|UNK190", -#endif -}; byte *SimonState::dumpOpcode(byte *p) { @@ -303,7 +40,15 @@ byte *SimonState::dumpOpcode(byte *p) opcode = *p++; if (opcode == 255) return NULL; - st = s = opcode_name_table[opcode]; + if (_game == GAME_SIMON1DOS || _game == GAME_SIMON1DEMO) { + st = s = simon1dos_opcode_name_table[opcode]; + } else if (_game == GAME_SIMON1TALKIE || _game == GAME_SIMON1WIN) { + st = s = simon1talkie_opcode_name_table[opcode]; + } else if (_game == GAME_SIMON2WIN) { + st = s = simon2talkie_opcode_name_table[opcode]; + } else { + st = s = simon2dos_opcode_name_table[opcode]; + } if (s == NULL) { error("INVALID OPCODE %d\n", opcode); return NULL; @@ -431,125 +176,6 @@ void SimonState::dumpSubroutines() } } -const char *const video_opcode_name_table[] = { - /* 0 */ - "x|RET", - "ddd|DUMMY", - "d|CALL", - "ddddd|NEW_THREAD", - /* 4 */ - "ddd|DUMMY_2", - "vd|SKIP_IF_NEQ", - "d|SKIP_IFN_SIB_WITH_A", - "d|SKIP_IF_SIB_WITH_A", - /* 8 */ - "dd|SKIP_IF_PARENT_IS", - "dd|SKIP_IF_UNK3_IS", -#ifdef SIMON2 - "ddddb|DRAW", -#else - "ddddd|DRAW", -#endif - "|CLEAR_PATHFIND_ARRAY", - /* 12 */ -#ifdef SIMON2 - "b|DELAY", -#else - "d|DELAY", -#endif - "d|OFFSET_X", - "d|OFFSET_Y", - "d|IDENT_WAKEUP", - /* 16 */ - "d|IDENT_SLEEP", - "dq|SET_PATHFIND_ITEM", - "i|JUMP_REL", - "|CHAIN_TO", - /* 20 */ - "dd|SET_CODE_WORD", - "i|JUMP_IF_CODE_WORD", - "dd|SET_PAL", - "d|SET_PRI", - /* 24 */ - "diid|SET_IMG_XY", - "x|HALT_THREAD", - "ddddd|SET_WINDOW", - "|RESET", - /* 28 */ - "dddd|DUMMY_3", - "|STOP_ALL_SOUNDS", - "d|SET_BASE_DELAY", - "d|SET_PALETTE_MODE", - /* 32 */ - "vv|COPY_VAR", - "|FORCE_UNLOCK", - "|FORCE_LOCK", - "dd|DUMMY_4", - /* 36 */ - "dd|SAVELOAD_THING", - "v|OFFSET_Y_F", - "v|SKIP_IF_VAR_ZERO", - "vd|SET_VAR", - /* 40 */ - "vd|ADD_VAR", - "vd|SUB_VAR", - "vd|SLEEP_UNTIL_SET", - "d|SKIP_IF_BIT_CLEAR", - /* 44 */ - "d|SKIP_IF_BIT_SET", - "v|SET_X_F", - "v|SET_Y_F", - "vv|ADD_VAR_F", - /* 48 */ - "|VC_48", - "d|SET_BIT", - "d|CLEAR_BIT", - "d|CLEAR_HITAREA_BIT_0x40", - /* 52 */ - "d|VC_52", - "dd|DUMMY_5", - "ddd|DUMMY_6", - "ddd|OFFSET_HIT_AREA", - /* 56 */ -#ifdef SIMON2 - "i|SLEEP_EX", -#else - "|DUMMY_7", -#endif - "|DUMMY_8", - "|DUMMY_9", -#ifdef SIMON2 - "ddd|KILL_MULTI_THREAD", -#else - "|SKIP_IF_SOUND??", -#endif - /* 60 */ -#ifdef SIMON2 - "dd|KILL_THREAD", -#else - "d|KILL_THREAD", -#endif - "ddd|INIT_SPRITE", - "|PALETTE_THING", - "|PALETTE_THING_2", -#ifdef SIMON2 - /* 64 */ - "|UNK64", - "|UNK65", - "|UNK66", - "|UNK67", - /* 68 */ - "|UNK68", - "dd|UNK69", - "dd|UNK70", - "|UNK71", - /* 72 */ - "dd|UNK72", - "bb|UNK73", - "bb|UNK74", -#endif -}; - void SimonState::dump_video_script(byte *src, bool one_opcode_only) { uint opcode; @@ -568,7 +194,12 @@ void SimonState::dump_video_script(byte *src, bool one_opcode_only) return; } - strn = str = video_opcode_name_table[opcode]; + if (!(_game & GAME_SIMON2)) { + strn = str = simon1_video_opcode_name_table[opcode]; + } else { + strn = str = simon2_video_opcode_name_table[opcode]; + } + while (*strn != '|') strn++; fprintf(_dump_file, "%.2d: %s ", opcode, strn + 1); |