summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2022-03-16 04:13:18 +1100
committer Vas Crabb <vas@vastheman.com>2022-03-16 04:13:18 +1100
commit394e5f18b6fb034b04fae0f35575dc24a4a1d620 (patch)
tree86875ae05bd30adcd3d25fa66f6dbe1093f4d3df /src/emu
parentc074526b03e51a8a1368813cee130a543a560c0f (diff)
Fixed some debugger memory view annoyances and cleaned up Lua bindings.
Made the debugger memory view not depend on isprint which is affected by the global locale. Assume the OSD will display as ISO-8869-1 and replace problematic printable characters. Started changing Lua function bindings to use set_function to avoid potential issues related to ThePhD/sol2#608, and worked out what was causing problems with symbol table read_memory/write_memory. (They aren't really essential - you can do the same thing with the address space object itself, but they're easier to parameterise.)
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/debug/dvmemory.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/emu/debug/dvmemory.cpp b/src/emu/debug/dvmemory.cpp
index 02fcde9cbc3..4831023d479 100644
--- a/src/emu/debug/dvmemory.cpp
+++ b/src/emu/debug/dvmemory.cpp
@@ -20,6 +20,20 @@
//**************************************************************************
+// HELPER FUNCTIONS
+//**************************************************************************
+
+namespace {
+
+constexpr u8 sanitise_character(u8 ch)
+{
+ // assume ISO-8859-1 (low 256 Unicode codepoints) - tab, soft hyphen, C0 and C1 cause problems
+ return ('\t' == ch) ? ' ' : (0xadU == ch) ? '-' : ((' ' > ch) || (('~' < ch) && (0xa0U > ch))) ? '.' : ch;
+}
+
+} // anonymous namespace
+
+//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
@@ -301,7 +315,7 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char *
if (dest >= destmin && dest < destmax)
dest->byte = addrtext[ch];
- // generate the data and the ascii string
+ // generate the data and the ASCII string
std::string chunkascii;
if (m_shift_bits != 0)
{
@@ -323,7 +337,7 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char *
for (int i = 0; i < m_bytes_per_chunk; i++)
{
u8 chval = chunkdata >> (8 * (m_bytes_per_chunk - i - 1));
- chunkascii += char((ismapped && isprint(chval)) ? chval : '.');
+ chunkascii += char(ismapped ? sanitise_character(chval) : '.');
}
}
}
@@ -380,7 +394,7 @@ void debug_view_memory::generate_row(debug_view_char *destmin, debug_view_char *
for (int i = 0; i < m_bytes_per_chunk; i++)
{
u8 chval = chunkdata >> (8 * (m_bytes_per_chunk - i - 1));
- chunkascii += char((ismapped && isprint(chval)) ? chval : '.');
+ chunkascii += char(ismapped ? sanitise_character(chval) : '.');
}
}
}