src/osd/sdl/debugwin.c
| r2998 | r2999 | |
| 119 | 119 | { |
| 120 | 120 | memorycombo_item **tail = &memorycombo; |
| 121 | 121 | UINT32 cpunum, spacenum; |
| 122 | | int rgnnum, itemnum; |
| 122 | int itemnum; |
| 123 | const char *rgnname; |
| 123 | 124 | |
| 124 | 125 | // first add all the CPUs' address spaces |
| 125 | 126 | for (cpunum = 0; cpunum < MAX_CPU; cpunum++) |
| r2998 | r2999 | |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | 144 | // then add all the memory regions |
| 144 | | for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) |
| 145 | rgnname = memory_region_next(machine, NULL); |
| 146 | while (rgnname != NULL) |
| 145 | 147 | { |
| 146 | | UINT8 *base = memory_region(machine, rgnnum); |
| 147 | | UINT32 type = memory_region_type(machine, rgnnum); |
| 148 | | if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) |
| 148 | UINT8 *base = memory_region(machine, rgnname); |
| 149 | memorycombo_item *ci = malloc_or_die(sizeof(*ci)); |
| 150 | UINT32 flags = memory_region_flags(machine, rgnname); |
| 151 | UINT8 width = 0, little_endian; |
| 152 | |
| 153 | memset(ci, 0, sizeof(*ci)); |
| 154 | ci->base = base; |
| 155 | ci->length = memory_region_length(machine, rgnname); |
| 156 | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 157 | switch (flags & ROMREGION_WIDTHMASK) |
| 149 | 158 | { |
| 150 | | memorycombo_item *ci = malloc_or_die(sizeof(*ci)); |
| 151 | | UINT32 flags = memory_region_flags(machine, rgnnum); |
| 152 | | UINT8 width, little_endian; |
| 153 | | memset(ci, 0, sizeof(*ci)); |
| 154 | | ci->base = base; |
| 155 | | ci->length = memory_region_length(machine, rgnnum); |
| 156 | | width = 1 << (flags & ROMREGION_WIDTHMASK); |
| 157 | | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 158 | | if (type >= REGION_CPU1 && type <= REGION_CPU8) |
| 159 | | { |
| 160 | | const debug_cpu_info *cpuinfo = debug_get_cpu_info(type - REGION_CPU1); |
| 161 | | if (cpuinfo) |
| 162 | | { |
| 163 | | width = cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes; |
| 164 | | little_endian = (cpuinfo->endianness == CPU_IS_LE); |
| 165 | | } |
| 166 | | } |
| 167 | | ci->prefsize = MIN(width, 4); |
| 168 | | ci->offset_xor = width - 1; |
| 169 | | ci->little_endian = little_endian; |
| 170 | | strcpy(ci->name, memory_region_names[type - REGION_INVALID]); |
| 171 | | *tail = ci; |
| 172 | | tail = &ci->next; |
| 159 | case ROMREGION_8BIT: |
| 160 | width = 8; |
| 161 | break; |
| 162 | case ROMREGION_16BIT: |
| 163 | width = 16; |
| 164 | break; |
| 165 | case ROMREGION_32BIT: |
| 166 | width = 32; |
| 167 | break; |
| 168 | case ROMREGION_64BIT: |
| 169 | width = 64; |
| 170 | break; |
| 173 | 171 | } |
| 172 | ci->prefsize = MIN(width, 4); |
| 173 | ci->offset_xor = width - 1; |
| 174 | ci->little_endian = little_endian; |
| 175 | strcpy(ci->name, rgnname); |
| 176 | *tail = ci; |
| 177 | tail = &ci->next; |
| 178 | |
| 179 | // and get the next region |
| 180 | rgnname = memory_region_next(machine, rgnname); |
| 174 | 181 | } |
| 175 | 182 | |
| 176 | 183 | // finally add all global array symbols |
src/osd/sdl/debugosx.c
| r2998 | r2999 | |
| 266 | 266 | #endif |
| 267 | 267 | static void generic_recompute_children(debugwin_info *info); |
| 268 | 268 | |
| 269 | | static void memory_create_window(void); |
| 269 | static void memory_create_window(running_machine *machine); |
| 270 | 270 | static void memory_recompute_children(debugwin_info *info); |
| 271 | 271 | static void memory_process_string(debugwin_info *info, const char *string); |
| 272 | 272 | static void memory_update_checkmarks(debugwin_info *info); |
| r2998 | r2999 | |
| 1986 | 1986 | // memory_determine_combo_items |
| 1987 | 1987 | //============================================================ |
| 1988 | 1988 | |
| 1989 | | static void memory_determine_combo_items(void) |
| 1989 | static void memory_determine_combo_items(running_machine *machine) |
| 1990 | 1990 | { |
| 1991 | 1991 | memorycombo_item **tail = &memorycombo; |
| 1992 | 1992 | UINT32 cpunum, spacenum; |
| 1993 | | int rgnnum, itemnum; |
| 1993 | int itemnum; |
| 1994 | const char *rgnname; |
| 1994 | 1995 | |
| 1995 | 1996 | // first add all the CPUs' address spaces |
| 1996 | 1997 | for (cpunum = 0; cpunum < MAX_CPU; cpunum++) |
| r2998 | r2999 | |
| 2012 | 2013 | } |
| 2013 | 2014 | |
| 2014 | 2015 | // then add all the memory regions |
| 2015 | | for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++) |
| 2016 | rgnname = memory_region_next(machine, NULL); |
| 2017 | while (rgnname != NULL) |
| 2016 | 2018 | { |
| 2017 | | UINT8 *base = memory_region(Machine, rgnnum); |
| 2018 | | UINT32 type = memory_region_type(Machine, rgnnum); |
| 2019 | | if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names)) |
| 2019 | UINT8 *base = memory_region(machine, rgnname); |
| 2020 | memorycombo_item *ci = malloc_or_die(sizeof(*ci)); |
| 2021 | UINT32 flags = memory_region_flags(machine, rgnname); |
| 2022 | UINT8 width = 0, little_endian; |
| 2023 | |
| 2024 | memset(ci, 0, sizeof(*ci)); |
| 2025 | ci->base = base; |
| 2026 | ci->length = memory_region_length(machine, rgnname); |
| 2027 | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 2028 | switch (flags & ROMREGION_WIDTHMASK) |
| 2020 | 2029 | { |
| 2021 | | memorycombo_item *ci = malloc_or_die(sizeof(*ci)); |
| 2022 | | UINT32 flags = memory_region_flags(Machine, rgnnum); |
| 2023 | | UINT8 width, little_endian; |
| 2024 | | memset(ci, 0, sizeof(*ci)); |
| 2025 | | ci->base = base; |
| 2026 | | ci->length = memory_region_length(Machine, rgnnum); |
| 2027 | | width = 1 << (flags & ROMREGION_WIDTHMASK); |
| 2028 | | little_endian = ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE); |
| 2029 | | if (type >= REGION_CPU1 && type <= REGION_CPU8) |
| 2030 | | { |
| 2031 | | const debug_cpu_info *cpuinfo = debug_get_cpu_info(type - REGION_CPU1); |
| 2032 | | if (cpuinfo) |
| 2033 | | { |
| 2034 | | width = cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes; |
| 2035 | | little_endian = (cpuinfo->endianness == CPU_IS_LE); |
| 2036 | | } |
| 2037 | | } |
| 2038 | | ci->prefsize = MIN(width, 4); |
| 2039 | | ci->offset_xor = width - 1; |
| 2040 | | ci->little_endian = little_endian; |
| 2041 | | strcpy(ci->name, memory_region_names[type - REGION_INVALID]); |
| 2042 | | *tail = ci; |
| 2043 | | tail = &ci->next; |
| 2030 | case ROMREGION_8BIT: |
| 2031 | width = 8; |
| 2032 | break; |
| 2033 | case ROMREGION_16BIT: |
| 2034 | width = 16; |
| 2035 | break; |
| 2036 | case ROMREGION_32BIT: |
| 2037 | width = 32; |
| 2038 | break; |
| 2039 | case ROMREGION_64BIT: |
| 2040 | width = 64; |
| 2041 | break; |
| 2044 | 2042 | } |
| 2043 | ci->prefsize = MIN(width, 4); |
| 2044 | ci->offset_xor = width - 1; |
| 2045 | ci->little_endian = little_endian; |
| 2046 | strcpy(ci->name, rgnname); |
| 2047 | *tail = ci; |
| 2048 | tail = &ci->next; |
| 2049 | |
| 2050 | // and get the next region |
| 2051 | rgnname = memory_region_next(machine, rgnname); |
| 2045 | 2052 | } |
| 2046 | 2053 | |
| 2047 | 2054 | // finally add all global array symbols |
| r2998 | r2999 | |
| 2103 | 2110 | // memory_create_window |
| 2104 | 2111 | //============================================================ |
| 2105 | 2112 | |
| 2106 | | static void memory_create_window(void) |
| 2113 | static void memory_create_window(running_machine *machine) |
| 2107 | 2114 | { |
| 2108 | 2115 | int curcpu = cpu_getactivecpu(), cursel = 0; |
| 2109 | 2116 | memorycombo_item *ci, *selci = NULL; |
| r2998 | r2999 | |
| 2208 | 2215 | |
| 2209 | 2216 | // populate the combobox |
| 2210 | 2217 | if (!memorycombo) |
| 2211 | | memory_determine_combo_items(); |
| 2218 | memory_determine_combo_items(machine); |
| 2212 | 2219 | for (ci = memorycombo; ci; ci = ci->next) |
| 2213 | 2220 | { |
| 2214 | 2221 | CFStringRef cfName = CFStringCreateWithCString( NULL, ci->name, CFStringGetSystemEncoding() ); |
| r2998 | r2999 | |
| 3515 | 3522 | switch( cmd.commandID ) |
| 3516 | 3523 | { |
| 3517 | 3524 | case ID_NEW_MEMORY_WND: |
| 3518 | | memory_create_window(); |
| 3525 | memory_create_window(Machine); |
| 3519 | 3526 | return 1; |
| 3520 | 3527 | |
| 3521 | 3528 | case ID_NEW_DISASM_WND: |
| r2998 | r2999 | |
| 3647 | 3654 | { |
| 3648 | 3655 | case 'm': |
| 3649 | 3656 | case 'M': |
| 3650 | | memory_create_window(); |
| 3657 | memory_create_window(Machine); |
| 3651 | 3658 | return 1; |
| 3652 | 3659 | |
| 3653 | 3660 | case 'd': |