RCS file: /cvsroot/scummvm/scummvm/scumm/debugger.cpp,v
retrieving revision 1.53
diff -u -r1.53 debugger.cpp
|
|
|
183 | 183 | if (!_s->_debuggerDialog) { |
184 | 184 | _s->_debuggerDialog = new ConsoleDialog(_s->_newgui, _s->_screenWidth); |
185 | 185 | |
186 | | Debug_Printf("Debugger started, type 'exit' to return to the game\n"); |
| 186 | Debug_Printf("Debugger started, type 'exit' to return to the game.\n"); |
| 187 | Debug_Printf("Type 'help' to see a little list of commands and variables.\n"); |
187 | 188 | } |
188 | 189 | |
189 | 190 | if (errStr) { |
… |
… |
|
356 | 357 | |
357 | 358 | // Re-run bootscript |
358 | 359 | _s->runScript(1, 0, 0, &_s->_bootParam); |
359 | | |
| 360 | |
360 | 361 | _detach_now = true; |
361 | 362 | return false; |
362 | 363 | } |
… |
… |
|
384 | 385 | return true; |
385 | 386 | } |
386 | 387 | } |
387 | | |
| 388 | |
388 | 389 | bool ScummDebugger::Cmd_LoadGame(int argc, const char **argv) { |
389 | 390 | if (argc > 1) { |
390 | 391 | int slot = atoi(argv[1]); |
391 | | |
| 392 | |
392 | 393 | _s->_saveLoadSlot = slot; |
393 | 394 | _s->_saveLoadFlag = 2; |
394 | 395 | _s->_saveLoadCompatible = false; |
395 | | |
| 396 | |
396 | 397 | _detach_now = true; |
397 | 398 | return false; |
398 | 399 | } |
… |
… |
|
400 | 401 | Debug_Printf("Syntax: loadgame <slotnum>\n"); |
401 | 402 | return true; |
402 | 403 | } |
403 | | |
| 404 | |
404 | 405 | bool ScummDebugger::Cmd_SaveGame(int argc, const char **argv) { |
405 | 406 | if (argc > 2) { |
406 | 407 | int slot = atoi(argv[1]); |
… |
… |
|
421 | 422 | Debug_Printf("Syntax: show <parameter>\n"); |
422 | 423 | return true; |
423 | 424 | } |
424 | | |
| 425 | |
425 | 426 | if (!strcmp(argv[1], "hex")) { |
426 | 427 | _s->_hexdumpScripts = true; |
427 | 428 | Debug_Printf("Script hex dumping on\n"); |
… |
… |
|
429 | 430 | _s->_showStack = 1; |
430 | 431 | Debug_Printf("Stack tracing on\n"); |
431 | 432 | } else { |
432 | | Debug_Printf("Unknown show parameter '%s'\n", argv[1]); |
| 433 | Debug_Printf("Unknown show parameter '%s'\nParameters are 'hex' for hex dumping and 'sta' for stack tracing\n", argv[1]); |
433 | 434 | } |
434 | 435 | return true; |
435 | 436 | } |
… |
… |
|
440 | 441 | Debug_Printf("Syntax: hide <parameter>\n"); |
441 | 442 | return true; |
442 | 443 | } |
443 | | |
| 444 | |
444 | 445 | if (!strcmp(argv[1], "hex")) { |
445 | 446 | _s->_hexdumpScripts = false; |
446 | 447 | Debug_Printf("Script hex dumping off\n"); |
… |
… |
|
448 | 449 | _s->_showStack = 0; |
449 | 450 | Debug_Printf("Stack tracing off\n"); |
450 | 451 | } else { |
451 | | Debug_Printf("Unknown hide parameter '%s'\n", argv[1]); |
| 452 | Debug_Printf("Unknown hide parameter '%s'\nParameters are 'hex' to turn off hex dumping and 'sta' to turn off stack tracing\n", argv[1]); |
452 | 453 | } |
453 | 454 | return true; |
454 | 455 | } |
… |
… |
|
460 | 461 | Debug_Printf("Syntax: script <scriptnum> <command>\n"); |
461 | 462 | return true; |
462 | 463 | } |
463 | | |
| 464 | |
464 | 465 | scriptnum = atoi(argv[1]); |
465 | | |
| 466 | |
466 | 467 | // FIXME: what is the max range on these? |
467 | 468 | // if (scriptnum >= _s->_maxScripts) { |
468 | 469 | // Debug_Printf("Script number %d is out of range (range: 1 - %d)\n", scriptnum, _s->_maxScripts); |
469 | 470 | // return true; |
470 | 471 | //} |
471 | | |
| 472 | |
472 | 473 | if ((!strcmp(argv[2], "kill")) || (!strcmp(argv[2], "stop"))) { |
473 | 474 | _s->stopScript(scriptnum); |
474 | 475 | } else if ((!strcmp(argv[2], "run")) || (!strcmp(argv[2], "start"))) { |
475 | 476 | _s->runScript(scriptnum, 0, 0, 0); |
476 | 477 | return false; |
477 | 478 | } else { |
478 | | Debug_Printf("Unknown script command '%s'\n", argv[2]); |
| 479 | Debug_Printf("Unknown script command '%s'\nUse <kill/stop | run/start> as command\n", argv[2]); |
479 | 480 | } |
480 | 481 | |
481 | 482 | return true; |
… |
… |
|
485 | 486 | File file; |
486 | 487 | uint32 size; |
487 | 488 | int resnum; |
488 | | |
| 489 | |
489 | 490 | if (argc != 3) { |
490 | 491 | Debug_Printf("Syntax: importres <restype> <filename> <resnum>\n"); |
491 | 492 | return true; |
… |
… |
|
493 | 494 | |
494 | 495 | resnum = atoi(argv[3]); |
495 | 496 | // FIXME add bounds check |
496 | | |
| 497 | |
497 | 498 | if (!strncmp(argv[1], "scr", 3)) { |
498 | 499 | file.open(argv[2], ""); |
499 | 500 | if (file.isOpen() == false) { |
… |
… |
|
514 | 515 | size = file.readUint32BE(); |
515 | 516 | file.seek(-8, SEEK_CUR); |
516 | 517 | } |
517 | | |
| 518 | |
518 | 519 | file.read(_s->createResource(rtScript, resnum, size), size); |
519 | | |
| 520 | |
520 | 521 | } else |
521 | 522 | Debug_Printf("Unknown importres type '%s'\n", argv[1]); |
522 | 523 | return true; |
523 | 524 | } |
524 | | |
| 525 | |
525 | 526 | bool ScummDebugger::Cmd_PrintScript(int argc, const char **argv) { |
526 | 527 | int i; |
527 | 528 | ScriptSlot *ss = _s->vm.slot; |
… |
… |
|
537 | 538 | } |
538 | 539 | } |
539 | 540 | Debug_Printf("+--------------------------------------+\n"); |
540 | | |
| 541 | |
541 | 542 | return true; |
542 | 543 | } |
543 | 544 | |
… |
… |
|
571 | 572 | Debug_Printf("Actor[%d].costume = %d\n", actnum, a->costume); |
572 | 573 | } |
573 | 574 | } else { |
574 | | Debug_Printf("Unknown actor command '%s'\n", argv[2]); |
| 575 | Debug_Printf("Unknown actor command '%s'\nUse <ignoreboxes |costume> as command\n", argv[2]); |
575 | 576 | } |
576 | 577 | |
577 | 578 | return true; |
578 | | |
| 579 | |
579 | 580 | } |
580 | 581 | bool ScummDebugger::Cmd_PrintActor(int argc, const char **argv) { |
581 | 582 | int i; |
… |
… |
|
599 | 600 | bool ScummDebugger::Cmd_PrintObjects(int argc, const char **argv) { |
600 | 601 | int i; |
601 | 602 | ObjectData *o; |
602 | | Debug_Printf("Objects in current room\n"); |
| 603 | Debug_Printf("Objects in current room\n"); |
603 | 604 | Debug_Printf("+---------------------------------+--+\n"); |
604 | 605 | Debug_Printf("|num | x | y |width|height|state|fl|\n"); |
605 | 606 | Debug_Printf("+----+----+----+-----+------+-----+--+\n"); |
606 | | |
| 607 | |
607 | 608 | for (i = 1; (i < _s->_numLocalObjects) && (_s->_objs[i].obj_nr != 0) ; i++) { |
608 | 609 | o = &(_s->_objs[i]); |
609 | | Debug_Printf("|%4d|%4d|%4d|%5d|%6d|%5d|%2d|\n", |
| 610 | Debug_Printf("|%4d|%4d|%4d|%5d|%6d|%5d|%2d|\n", |
610 | 611 | o->obj_nr, o->x_pos, o->y_pos, o->width, o->height, o->state, o->fl_object_index); |
611 | 612 | } |
612 | 613 | Debug_Printf("\n"); |
… |
… |
|
616 | 617 | bool ScummDebugger::Cmd_Object(int argc, const char **argv) { |
617 | 618 | int i; |
618 | 619 | int obj; |
619 | | |
| 620 | |
620 | 621 | if (argc < 3) { |
621 | 622 | Debug_Printf("Syntax: object <objectnum> <command> <parameter>\n"); |
622 | 623 | return true; |
… |
… |
|
649 | 650 | _s->clearDrawObjectQueue(); |
650 | 651 | _s->runHook(obj); |
651 | 652 | } else { |
652 | | Debug_Printf("Unknown object command '%s'\n", argv[2]); |
| 653 | Debug_Printf("Unknown object command '%s'\nRight now the only command is pickup", argv[2]); //change when adding commands |
653 | 654 | } |
654 | 655 | |
655 | 656 | return true; |
… |
… |
|
659 | 660 | // console normally has 39 line width |
660 | 661 | // wrap around nicely |
661 | 662 | int width = 0, size, i; |
662 | | |
| 663 | |
663 | 664 | Debug_Printf("Commands are:\n"); |
664 | 665 | for (i = 0 ; i < _dcmd_count ; i++) { |
665 | 666 | size = strlen(_dcmds[i].name) + 1; |
666 | | |
| 667 | |
667 | 668 | if ((width + size) >= 39) { |
668 | 669 | Debug_Printf("\n"); |
669 | 670 | width = size; |
… |
… |
|
674 | 675 | } |
675 | 676 | |
676 | 677 | width = 0; |
677 | | |
| 678 | |
678 | 679 | Debug_Printf("\n\nVariables are:\n"); |
679 | 680 | for (i = 0 ; i < _dvar_count ; i++) { |
680 | 681 | size = strlen(_dvars[i].name) + 1; |
681 | | |
| 682 | |
682 | 683 | if ((width + size) >= 39) { |
683 | 684 | Debug_Printf("\n"); |
684 | 685 | width = size; |
… |
… |
|
689 | 690 | } |
690 | 691 | |
691 | 692 | Debug_Printf("\n"); |
692 | | |
| 693 | |
693 | 694 | return true; |
694 | 695 | } |
695 | 696 | |
… |
… |
|
711 | 712 | } else |
712 | 713 | Debug_Printf("Not a valid debug level\n"); |
713 | 714 | } |
714 | | |
| 715 | |
715 | 716 | return true; |
716 | 717 | } |
717 | 718 | |
718 | 719 | bool ScummDebugger::Cmd_PrintBox(int argc, const char **argv) { |
719 | 720 | int num, i = 0; |
720 | 721 | num = _s->getNumBoxes(); |
721 | | |
| 722 | |
722 | 723 | if (argc > 1) { |
723 | 724 | for (i = 1; i < argc; i++) |
724 | 725 | printBox(atoi(argv[i])); |