MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / cheatsearch

Function cheatsearch

src/debug.cpp:3775–3872  ·  view source on GitHub ↗

cheat-search by Toni Wilen (originally by Holger Jakob) */

Source from the content-addressed store, hash-verified

3773
3774/* cheat-search by Toni Wilen (originally by Holger Jakob) */
3775static void cheatsearch (TCHAR **c)
3776{
3777 static uae_u8 *vlist;
3778 static int listsize;
3779 static int first = 1;
3780 static int size = 1;
3781 uae_u32 val, memcnt, prevmemcnt;
3782 int i, count, vcnt, memsize;
3783 uaecptr addr, end;
3784 bool err;
3785
3786 memsize = 0;
3787 addr = 0xffffffff;
3788 nextaddr_init(addr);
3789 while ((addr = nextaddr(addr, 0, &end, false, NULL)) != 0xffffffff) {
3790 memsize += end - addr;
3791 addr = end - 1;
3792 }
3793
3794 if (_totupper (**c) == 'L') {
3795 listcheater (1, size);
3796 return;
3797 }
3798 ignore_ws (c);
3799 if (!more_params (c)) {
3800 first = 1;
3801 console_out (_T("Search reset\n"));
3802 xfree (vlist);
3803 listsize = memsize;
3804 vlist = xcalloc (uae_u8, listsize >> 3);
3805 return;
3806 }
3807 if (first)
3808 val = readint(c, &size, &err);
3809 else
3810 val = readint(c, &err);
3811 if (err) {
3812 return;
3813 }
3814
3815 if (vlist == NULL) {
3816 listsize = memsize;
3817 vlist = xcalloc (uae_u8, listsize >> 3);
3818 }
3819
3820 count = 0;
3821 vcnt = 0;
3822
3823 clearcheater ();
3824 addr = 0xffffffff;
3825 nextaddr_init(addr);
3826 prevmemcnt = memcnt = 0;
3827 while ((addr = nextaddr(addr, 0, &end, true, NULL)) != 0xffffffff) {
3828 if (addr + size < end) {
3829 for (i = 0; i < size; i++) {
3830 int shift = (size - i - 1) * 8;
3831 if (get_byte_debug (addr + i) != ((val >> shift) & 0xff))
3832 break;

Callers 1

debug_lineFunction · 0.85

Calls 12

nextaddr_initFunction · 0.85
nextaddrFunction · 0.85
listcheaterFunction · 0.85
ignore_wsFunction · 0.85
more_paramsFunction · 0.85
readintFunction · 0.85
clearcheaterFunction · 0.85
addcheaterFunction · 0.85
iscancelFunction · 0.85
get_byte_debugFunction · 0.70
console_outFunction · 0.50
console_out_fFunction · 0.50

Tested by

no test coverage detected