Mercurial > repos > blastem
changeset 2380:1b21290358a8
Fix regression in debugger for Mega CD
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 20 Nov 2023 19:53:00 -0800 |
parents | 9e6cb50d0639 |
children | d3479965e631 |
files | debug.c |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/debug.c Sat Nov 18 22:00:45 2023 -0800 +++ b/debug.c Mon Nov 20 19:53:00 2023 -0800 @@ -309,23 +309,23 @@ return debug_int(array->size); } -static debug_root *roots; +static debug_root **roots; static uint32_t num_roots, root_storage; debug_root *find_root(void *cpu) { for (uint32_t i = 0; i < num_roots; i++) { - if (roots[i].cpu_context == cpu) { - return roots + i; + if (roots[i]->cpu_context == cpu) { + return roots[i]; } } if (num_roots == root_storage) { root_storage = root_storage ? root_storage * 2 : 5; - roots = realloc(roots, root_storage * sizeof(debug_root)); - } - debug_root *root = roots + num_roots++; - memset(root, 0, sizeof(debug_root)); + roots = realloc(roots, root_storage * sizeof(debug_root*)); + } + debug_root *root = calloc(1, sizeof(debug_root)); + roots[num_roots++] = root; root->cpu_context = cpu; new_readonly_variable(root, "sin", new_native_func(debug_sin, 1, 1)); new_readonly_variable(root, "cos", new_native_func(debug_cos, 1, 1));