summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2008-01-03 09:03:31 +0000
committer Aaron Giles <aaron@aarongiles.com>2008-01-03 09:03:31 +0000
commitd73ea1bf01d99528fdf3ecc04b2a5fec56617276 (patch)
treece20276e199d581a5d1941e93e9357ade672f93d /src
parent415aebd2bd98af36894581ff61d089dc4113e08b (diff)
(From Oliver Stoneberg)
This patch fixes a few UNICODE=1 issues in the disassembly and memory windows of the MAME debugger. I also removed two redundant arrays.
Diffstat (limited to 'src')
-rw-r--r--src/emu/debug/debugcmd.c3
-rw-r--r--src/emu/debug/debugcpu.c4
-rw-r--r--src/osd/windows/debugwin.c37
3 files changed, 30 insertions, 14 deletions
diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c
index 75c444a6d00..da43ff1040b 100644
--- a/src/emu/debug/debugcmd.c
+++ b/src/emu/debug/debugcmd.c
@@ -1275,7 +1275,6 @@ static void execute_wpdisenable(int ref, int params, const char *param[])
static void execute_wplist(int ref, int params, const char *param[])
{
- static const char *const spacenames[ADDRESS_SPACES] = { "program", "data", "I/O" };
int cpunum, printed = 0;
char buffer[256];
@@ -1295,7 +1294,7 @@ static void execute_wplist(int ref, int params, const char *param[])
static const char *const types[] = { "unkn ", "read ", "write", "r/w " };
debug_cpu_watchpoint *wp;
- debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, spacenames[spacenum]);
+ debug_console_printf("CPU %d %s space watchpoints:\n", cpunum, address_space_names[spacenum]);
/* loop over the watchpoints */
for (wp = cpuinfo->space[spacenum].first_wp; wp; wp = wp->next)
diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c
index 3d25239aaac..2614d16123f 100644
--- a/src/emu/debug/debugcpu.c
+++ b/src/emu/debug/debugcpu.c
@@ -42,8 +42,6 @@
FILE *debug_source_file;
symbol_table *global_symtable;
-static const char *const address_space_name[] = { "program", "data", "I/O" };
-
static UINT64 wpdata;
static UINT64 wpaddr;
@@ -1551,7 +1549,7 @@ static void check_hotspots(int cpunum, int spacenum, offs_t address)
/* if the bottom of the list is over the threshhold, print it */
debug_hotspot_entry *spot = &info->hotspots[info->hotspot_count - 1];
if (spot->count > info->hotspot_threshhold)
- debug_console_printf("Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", address_space_name[spot->spacenum], spot->access, spot->pc, spot->count);
+ debug_console_printf("Hotspot @ %s %08X (PC=%08X) hit %d times (fell off bottom)\n", address_space_names[spot->spacenum], spot->access, spot->pc, spot->count);
/* move everything else down and insert this one at the top */
memmove(&info->hotspots[1], &info->hotspots[0], sizeof(info->hotspots[0]) * (info->hotspot_count - 1));
diff --git a/src/osd/windows/debugwin.c b/src/osd/windows/debugwin.c
index 7b7621bc51f..60c4df80cf5 100644
--- a/src/osd/windows/debugwin.c
+++ b/src/osd/windows/debugwin.c
@@ -156,7 +156,7 @@ typedef struct _memorycombo_item memorycombo_item;
struct _memorycombo_item
{
memorycombo_item * next;
- char name[256];
+ TCHAR name[256];
UINT8 cpunum;
UINT8 spacenum;
void * base;
@@ -1721,6 +1721,7 @@ static void memory_determine_combo_items(void)
memorycombo_item **tail = &memorycombo;
UINT32 cpunum, spacenum;
int rgnnum, itemnum;
+ TCHAR *t_cpunum_name, *t_address_space_names;
// first add all the CPUs' address spaces
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
@@ -1735,7 +1736,13 @@ static void memory_determine_combo_items(void)
ci->cpunum = cpunum;
ci->spacenum = spacenum;
ci->prefsize = MIN(cpuinfo->space[spacenum].databytes, 8);
- sprintf(ci->name, "CPU #%d (%s) %s memory", cpunum, cpunum_name(cpunum), address_space_names[spacenum]);
+ t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum));
+ t_address_space_names = tstring_from_utf8(address_space_names[spacenum]);
+ _stprintf(ci->name, TEXT("CPU #%d (%s) %s memory"), cpunum, t_cpunum_name, t_address_space_names);
+ free(t_address_space_names),
+ t_address_space_names = NULL;
+ free(t_cpunum_name);
+ t_cpunum_name = NULL;
*tail = ci;
tail = &ci->next;
}
@@ -1744,6 +1751,7 @@ static void memory_determine_combo_items(void)
// then add all the memory regions
for (rgnnum = 0; rgnnum < MAX_MEMORY_REGIONS; rgnnum++)
{
+ TCHAR* t_memory_region_name;
UINT8 *base = memory_region(rgnnum);
UINT32 type = memory_region_type(Machine, rgnnum);
if (base != NULL && type > REGION_INVALID && (type - REGION_INVALID) < ARRAY_LENGTH(memory_region_names))
@@ -1768,7 +1776,10 @@ static void memory_determine_combo_items(void)
ci->prefsize = MIN(width, 8);
ci->offset_xor = width - 1;
ci->little_endian = little_endian;
- strcpy(ci->name, memory_region_names[type - REGION_INVALID]);
+ t_memory_region_name = tstring_from_utf8(memory_region_names[type - REGION_INVALID]);
+ _tcscpy(ci->name, t_memory_region_name);
+ free(t_memory_region_name);
+ t_memory_region_name = NULL;
*tail = ci;
tail = &ci->next;
}
@@ -1780,6 +1791,7 @@ static void memory_determine_combo_items(void)
UINT32 valsize, valcount;
const char *name;
void *base;
+ TCHAR* t_name;
/* stop when we run out of items */
name = state_save_get_indexed_item(itemnum, &base, &valsize, &valcount);
@@ -1795,7 +1807,10 @@ static void memory_determine_combo_items(void)
ci->length = valcount * valsize;
ci->prefsize = MIN(valsize, 8);
ci->little_endian = TRUE;
- strcpy(ci->name, strrchr(name, '/') + 1);
+ t_name = tstring_from_utf8(name);
+ _tcscpy(ci->name, _tcsrchr(t_name, TEXT('/')) + sizeof(t_name[0]));
+ free(t_name);
+ t_name = NULL;
*tail = ci;
tail = &ci->next;
}
@@ -1816,7 +1831,7 @@ static void memory_update_selection(debugwin_info *info, memorycombo_item *ci)
debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_RAW_OFFSET_XOR, ci->offset_xor);
debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_RAW_LITTLE_ENDIAN, ci->little_endian);
debug_view_set_property_UINT32(info->view[0].view, DVP_MEM_BYTES_PER_CHUNK, ci->prefsize);
- win_set_window_text_utf8(info->wnd, ci->name);
+ SetWindowText(info->wnd, ci->name);
}
@@ -1871,7 +1886,7 @@ static void memory_create_window(void)
SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info);
SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debug_edit_proc);
SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
- SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)"0");
+ SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)TEXT("0"));
SendMessage(info->editwnd, EM_LIMITTEXT, (WPARAM)MAX_EDIT_STRING, (LPARAM)0);
SendMessage(info->editwnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
@@ -2204,7 +2219,7 @@ static void disasm_create_window(void)
SetWindowLongPtr(info->editwnd, GWLP_USERDATA, (LONG_PTR)info);
SetWindowLongPtr(info->editwnd, GWLP_WNDPROC, (LONG_PTR)debug_edit_proc);
SendMessage(info->editwnd, WM_SETFONT, (WPARAM)debug_font, (LPARAM)FALSE);
- SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)"curpc");
+ SendMessage(info->editwnd, WM_SETTEXT, (WPARAM)0, (LPARAM)TEXT("curpc"));
SendMessage(info->editwnd, EM_LIMITTEXT, (WPARAM)MAX_EDIT_STRING, (LPARAM)0);
SendMessage(info->editwnd, EM_SETSEL, (WPARAM)0, (LPARAM)-1);
@@ -2217,13 +2232,17 @@ static void disasm_create_window(void)
// populate the combobox
for (cpunum = 0; cpunum < MAX_CPU; cpunum++)
{
+ TCHAR* t_cpunum_name;
const debug_cpu_info *cpuinfo = debug_get_cpu_info(cpunum);
if (cpuinfo->valid)
if (cpuinfo->space[ADDRESS_SPACE_PROGRAM].databytes)
{
- char name[100];
+ TCHAR name[100];
int item;
- sprintf(name, "CPU #%d (%s)", cpunum, cpunum_name(cpunum));
+ t_cpunum_name = tstring_from_utf8(cpunum_name(cpunum));
+ _stprintf(name, TEXT("CPU #%d (%s)"), cpunum, t_cpunum_name);
+ free(t_cpunum_name);
+ t_cpunum_name = NULL;
item = SendMessage(info->otherwnd[0], CB_ADDSTRING, 0, (LPARAM)name);
if (cpunum == curcpu)
cursel = item;