MCPcopy Create free account
hub / github.com/bubble2k16/snes9x_3ds / ProcessDebugCommand

Function ProcessDebugCommand

source/debug.cpp:1544–2119  ·  view source on GitHub ↗

/ ProcessDebugCommand() */ This function processes a debug command */ /

Source from the content-addressed store, hash-verified

1542/* This function processes a debug command */
1543/**********************************************************************************************/
1544void ProcessDebugCommand (char *Line)
1545{
1546 uint8 Bank = Registers.PB;
1547 uint32 Address = CPU.PC - CPU.PCBase;
1548 uint16 Hold;
1549 uint16 Number;
1550 char String [512];
1551 short ErrorCode;
1552
1553 if (strcasecmp (Line, "cheat") == 0)
1554 {
1555 S9xStartCheatSearch (&Cheat);
1556 printf ("Cheat Search Started\n");
1557 return;
1558 }
1559 if (strcasecmp (Line, "less") == 0)
1560 {
1561 S9xSearchForChange (&Cheat, S9X_LESS_THAN, S9X_8_BITS, FALSE, TRUE);
1562 printf ("Recorded all values that have decreased\n");
1563 return;
1564 }
1565 if (strcasecmp (Line, "print") == 0)
1566 {
1567 printf ("Cheat search results:\n");
1568 S9xOutputCheatSearchResults (&Cheat);
1569 return;
1570 }
1571
1572 if (strncasecmp (Line, "constant", 8) == 0)
1573 {
1574 uint32 Byte;
1575 if (sscanf (&Line [8], "%x %x", &Address, &Byte) == 2)
1576 S9xAddCheat (TRUE, TRUE, Address, Byte);
1577 return;
1578 }
1579
1580 if (strncasecmp (Line, "dump", 4) == 0)
1581 {
1582 int Count;
1583 if (sscanf (&Line [4], "%x %d", &Address, &Count) == 2)
1584 {
1585 sprintf (String, "%06x%05d.sd2", Address, Count);
1586 FILE *fs = fopen (String, "wb");
1587 if (fs)
1588 {
1589 int i;
1590 for (i = 0; i < Count; i++)
1591 putc (S9xGetByteNoCycles (Address + i), fs);
1592
1593 fclose (fs);
1594 }
1595 else
1596 printf ("Can't open %s for writing\n", String);
1597 }
1598 else
1599 printf ("Usage: dump start_address_in_hex count_in_decimal\n");
1600 return;
1601 }

Callers 1

S9xDoDebugFunction · 0.85

Calls 15

S9xStartCheatSearchFunction · 0.85
S9xSearchForChangeFunction · 0.85
S9xAddCheatFunction · 0.85
S9xGetByteNoCyclesFunction · 0.85
DPrintFunction · 0.85
S9xGetWordNoCyclesFunction · 0.85
S9xOPrintFunction · 0.85
S9xPrintAPUStateFunction · 0.85
S9xResetFunction · 0.85
GetNumberFunction · 0.85

Tested by

no test coverage detected