Ticket #8255: scummvm-debuggerstate.diff
File scummvm-debuggerstate.diff, 4.2 KB (added by , 21 years ago) |
---|
-
scumm/debugger.cpp
53 53 54 54 if (entry) 55 55 errStr = strdup(entry); 56 56 57 57 _s = s; 58 58 s->_debugger = this; 59 59 _frame_countdown = 1; … … 113 113 _s->_debuggerDialog->setCompletionCallback(0, 0); 114 114 } 115 115 #endif 116 116 117 117 _s->_debugger = NULL; 118 118 _s = NULL; 119 119 _detach_now = false; … … 124 124 if (_frame_countdown == 0) 125 125 return; 126 126 --_frame_countdown; 127 127 128 128 if (!_frame_countdown) { 129 129 // Pause sound output 130 130 bool old_soundsPaused = _s->_sound->_soundsPaused; 131 131 _s->_sound->pauseSounds(true); 132 132 133 133 // Enter debugger 134 134 enter(); 135 135 136 136 _s->_sound->pauseSounds(old_soundsPaused); // Resume previous sound state 137 137 138 138 if (_detach_now) // Detach if we're finished with the debugger 139 139 detach(); 140 140 } … … 144 144 #if USE_CONSOLE 145 145 bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *input, void *refCon) { 146 146 ScummDebugger *debugger = (ScummDebugger *)refCon; 147 147 148 148 return debugger->RunCommand(input); 149 149 } 150 150 … … 167 167 _dvars[_dvar_count].type = type; 168 168 _dvars[_dvar_count].variable = pointer; 169 169 _dvars[_dvar_count].optional = optional; 170 170 171 171 _dvar_count++; 172 172 } 173 173 … … 175 175 assert(_dcmd_count < (int)sizeof(_dcmds)); 176 176 strcpy(_dcmds[_dcmd_count].name, cmdname); 177 177 _dcmds[_dcmd_count].function = pointer; 178 178 179 179 _dcmd_count++; 180 180 } 181 181 182 // Main Debugger Loop 182 // Main Debugger Loop 183 183 void ScummDebugger::enter() { 184 184 #if USE_CONSOLE 185 185 if (!_s->_debuggerDialog) { … … 194 194 free(errStr); 195 195 errStr = NULL; 196 196 } 197 197 198 198 _s->_debuggerDialog->setInputeCallback(debuggerInputCallback, this); 199 199 _s->_debuggerDialog->setCompletionCallback(debuggerCompletionCallback, 200 200 this); … … 206 206 // Or maybe instead of choosing between a console dialog and stdio, 207 207 // we should move that choice into the ConsoleDialog class - that is, 208 208 // the console dialog code could be #ifdef'ed to not print to the dialog 209 // but rather to stdio. This way, we could also reuse the command history 209 // but rather to stdio. This way, we could also reuse the command history 210 210 // and tab completion of the console. It would still require a lot of 211 211 // work, but at least no dependency on a 3rd party library... 212 212 … … 236 236 int i = 0, num_params = 0; 237 237 const char *param[256]; 238 238 char *input = strdup(inputOrig); // One of the rare occasions using strdup is OK (although avoiding strtok might be more elegant here). 239 239 240 240 // Parse out any params 241 241 char *tok = strtok(input, " "); 242 242 if (tok) { … … 280 280 } else { 281 281 var[element] = atoi(param[1]); 282 282 Debug_Printf("(int)%s = %d\n", param[0], var[element]); 283 283 284 284 } 285 285 } 286 } 286 } 287 287 break; 288 288 289 289 default: … … 310 310 Debug_Printf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].optional); 311 311 } else { 312 312 Debug_Printf("(int)%s = %d\n", param[0], var[element]); 313 313 314 314 } 315 315 } 316 316 } … … 650 650 _s->removeObjectFromRoom(obj); 651 651 _s->clearDrawObjectQueue(); 652 652 _s->runInventoryScript(obj); 653 654 } else if (!strcmp(argv[2], "state")) { 655 _s->putState(obj, atoi(argv[3])); 656 //is BgNeedsRedraw enough? 657 _s->_BgNeedsRedraw = TRUE; 653 658 } else { 654 Debug_Printf("Unknown object command '%s'\nRight now the only command is pickup", argv[2]); //change when adding commands659 Debug_Printf("Unknown object command '%s'\nUse <pickup | state> as command\n", argv[2]); 655 660 } 656 661 657 662 return true; … … 765 770 coords.ul.x, coords.ul.y, coords.ll.x, coords.ll.y, 766 771 coords.ur.x, coords.ur.y, coords.lr.x, coords.lr.y, 767 772 flags, mask, scale); 768 773 769 774 // Draw the box 770 775 drawBox(box); 771 776 } … … 787 792 788 793 if (x2 < x1) 789 794 SWAP(x2, x1); 790 795 791 796 // Clip x1 / x2 792 797 const int left = scumm->_screenStartStrip * 8; 793 798 const int right = scumm->_screenEndStrip * 8; … … 795 800 x1 = left; 796 801 if (x2 >= right) 797 802 x2 = right - 1; 798 803 799 804 800 805 ptr = vs->screenPtr + x1 + y * scumm->_screenWidth; 801 806 … … 912 917 15162, 15676, 16190, 64, 16961, 17475, 17989, 18503, 913 918 73, 19274, 76, 77, 20302, 20816, 21330, 84 914 919 }; 915 920 916 921 const char *notes = "cdefgabC"; 917 922 int i, base, draft; 918 923