diff options
author | 2023-08-17 05:20:28 +1000 | |
---|---|---|
committer | 2023-08-17 05:20:28 +1000 | |
commit | 9c4b57cf99d2fdc4d7effa752ee3fa3ec032d0e3 (patch) | |
tree | 9aa39f585dd64a6da7a26db77a46215dd208a061 /src | |
parent | 54ea3debf372419b6877a6331a4b7fda2890e002 (diff) |
ui/info.cpp: Get decimal separator from C++ locale. Also random cleanup.
* emu/machine.cpp, emu/render.cpp: Catch exceptions by const reference.
* Various spacing and #include order cleanup.
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/machine.cpp | 10 | ||||
-rw-r--r-- | src/emu/render.cpp | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/info.cpp | 17 | ||||
-rw-r--r-- | src/mame/apple/apple3_m.cpp | 4 | ||||
-rw-r--r-- | src/mame/apple/f108.cpp | 6 | ||||
-rwxr-xr-x | src/mame/apple/macquadra630.cpp | 6 | ||||
-rw-r--r-- | src/mame/bfm/bfm_sc6.cpp | 8 | ||||
-rw-r--r-- | src/mame/heathkit/tlb.cpp | 8 | ||||
-rw-r--r-- | src/mame/namco/namcos12.cpp | 38 |
9 files changed, 55 insertions, 44 deletions
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 90eb21181cd..669f5fa27a5 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -350,29 +350,29 @@ int running_machine::run(bool quiet) nvram_save(); m_configuration->save_settings(); } - catch (emu_fatalerror &fatal) + catch (emu_fatalerror const &fatal) { osd_printf_error("Fatal error: %s\n", fatal.what()); error = EMU_ERR_FATALERROR; if (fatal.exitcode() != 0) error = fatal.exitcode(); } - catch (emu_exception &) + catch (emu_exception const &) { osd_printf_error("Caught unhandled emulator exception\n"); error = EMU_ERR_FATALERROR; } - catch (binding_type_exception &btex) + catch (binding_type_exception const &btex) { osd_printf_error("Error performing a late bind of function expecting type %s to instance of type %s\n", btex.target_type().name(), btex.actual_type().name()); error = EMU_ERR_FATALERROR; } - catch (tag_add_exception &aex) + catch (tag_add_exception const &aex) { osd_printf_error("Tag '%s' already exists in tagged map\n", aex.tag()); error = EMU_ERR_FATALERROR; } - catch (std::exception &ex) + catch (std::exception const &ex) { osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what()); error = EMU_ERR_FATALERROR; diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 5fd430d16d4..dc26cedfd29 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -2215,7 +2215,7 @@ bool render_target::load_layout_file(device_t &device, util::xml::data_node cons { m_filelist.emplace_back(device, rootnode, searchpath, dirname); } - catch (emu_fatalerror &err) + catch (emu_fatalerror const &err) { osd_printf_warning("%s\n", err.what()); return false; diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp index 9515df727b6..569070f8a29 100644 --- a/src/frontend/mame/ui/info.cpp +++ b/src/frontend/mame/ui/info.cpp @@ -21,8 +21,10 @@ #include "softlist.h" #include "speaker.h" -#include "utf8.h" +#include "util/unicode.h" +#include "util/utf8.h" +#include <locale> #include <set> #include <sstream> #include <type_traits> @@ -364,6 +366,13 @@ std::string machine_info::game_info_string() const { std::ostringstream buf; + // get decimal separator + std::string point; + { + wchar_t const s(std::use_facet<std::numpunct<wchar_t> >(std::locale()).decimal_point()); + point = utf8_from_wstring(std::wstring_view(&s, 1)); + } + // print description, manufacturer, and CPU: std::string_view src(m_machine.system().type.source()); auto prefix(src.find("src/mame/")); @@ -402,7 +411,7 @@ std::string machine_info::game_info_string() const if (d > 0) { size_t dpos = hz.length() - d; - hz.insert(dpos, "."); + hz.insert(dpos, point); size_t last = hz.find_last_not_of('0'); hz = hz.substr(0, last + (last != dpos ? 1 : 0)); } @@ -445,7 +454,7 @@ std::string machine_info::game_info_string() const if (d > 0) { size_t dpos = hz.length() - d; - hz.insert(dpos, "."); + hz.insert(dpos, point); size_t last = hz.find_last_not_of('0'); hz = hz.substr(0, last + (last != dpos ? 1 : 0)); } @@ -480,7 +489,7 @@ std::string machine_info::game_info_string() const if (valid) { size_t dpos = hz.length() - 6; - hz.insert(dpos, "."); + hz.insert(dpos, point); size_t last = hz.find_last_not_of('0'); hz = hz.substr(0, last + (last != dpos ? 1 : 0)); } diff --git a/src/mame/apple/apple3_m.cpp b/src/mame/apple/apple3_m.cpp index 6bfe49647b1..67f2517972b 100644 --- a/src/mame/apple/apple3_m.cpp +++ b/src/mame/apple/apple3_m.cpp @@ -1127,18 +1127,18 @@ TIMER_CALLBACK_MEMBER(apple3_state::scanend_cb) INPUT_CHANGED_MEMBER(apple3_state::keyb_special_changed) { - // check for ctrl-reset (RESET) if (((m_kbspecial->read() & 0x88) == 0x88) && (m_via_0_a & ENV_NMIENABLE)) { + // ctrl-reset pressed (RESET) if (!m_reset_latch) { m_reset_latch = true; m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } } - // check for reset key only (NMI) else if ((m_kbspecial->read() & 0x80) && (m_via_0_a & ENV_NMIENABLE)) { + // reset key only pressed (NMI) if (!m_nmi_latch) { m_nmi_latch = true; diff --git a/src/mame/apple/f108.cpp b/src/mame/apple/f108.cpp index e89fb4ee31f..1c60940e7ed 100644 --- a/src/mame/apple/f108.cpp +++ b/src/mame/apple/f108.cpp @@ -13,14 +13,14 @@ */ #include "emu.h" - #include "f108.h" -#include "softlist_dev.h" - #include "bus/nscsi/devices.h" #include "bus/rs232/rs232.h" +#include "softlist_dev.h" + + //************************************************************************** // DEVICE DEFINITIONS //************************************************************************** diff --git a/src/mame/apple/macquadra630.cpp b/src/mame/apple/macquadra630.cpp index e6daf656d8d..3d78a106f58 100755 --- a/src/mame/apple/macquadra630.cpp +++ b/src/mame/apple/macquadra630.cpp @@ -10,7 +10,7 @@ These machines took the cost-reduced but still decent Quadra 605/LC 575 and made them even cheaper by replacing the full-featured DAFB video chip - with "Valkyrie". Which appears to offer only a few pre-programmed video + with "Valkyrie". It appears to offer only a few pre-programmed video mode timings. Further cost reduction occured by replacing the hard disk with an ATA/IDE @@ -32,7 +32,6 @@ ****************************************************************************/ #include "emu.h" -#include "softlist_dev.h" #include "cuda.h" #include "f108.h" @@ -45,6 +44,9 @@ #include "machine/ram.h" #include "machine/timer.h" +#include "softlist_dev.h" + + #define C32M 31.3344_MHz_XTAL #define C15M (C32M/2) #define C7M (C32M/4) diff --git a/src/mame/bfm/bfm_sc6.cpp b/src/mame/bfm/bfm_sc6.cpp index 60a32f87438..0672bc6db5a 100644 --- a/src/mame/bfm/bfm_sc6.cpp +++ b/src/mame/bfm/bfm_sc6.cpp @@ -74,7 +74,7 @@ ROM_END } // anonymous namespace -GAME( 201?, sc6dndem, 0, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM","Deal or No Deal Easy Money (Scorpion 6, 9561082)", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 201?, sc6dndema, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM","Deal or No Deal Easy Money (Scorpion 6, 9561082, protocol)", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 201?, sc6dndemb, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM","Deal or No Deal Easy Money (Scorpion 6, 9560933)", MACHINE_IS_SKELETON_MECHANICAL ) -GAME( 201?, sc6dndemc, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM","Deal or No Deal Easy Money (Scorpion 6, 9560933, protocol)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 201?, sc6dndem, 0, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM", "Deal or No Deal Easy Money (Scorpion 6, 9561082)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 201?, sc6dndema, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM", "Deal or No Deal Easy Money (Scorpion 6, 9561082, protocol)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 201?, sc6dndemb, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM", "Deal or No Deal Easy Money (Scorpion 6, 9560933)", MACHINE_IS_SKELETON_MECHANICAL ) +GAME( 201?, sc6dndemc, sc6dndem, bfm_sc6, bfm_sc6, bfm_sc6_state, empty_init, ROT0, "BFM", "Deal or No Deal Easy Money (Scorpion 6, 9560933, protocol)", MACHINE_IS_SKELETON_MECHANICAL ) diff --git a/src/mame/heathkit/tlb.cpp b/src/mame/heathkit/tlb.cpp index 353b633152e..fcf6c7a9322 100644 --- a/src/mame/heathkit/tlb.cpp +++ b/src/mame/heathkit/tlb.cpp @@ -284,28 +284,28 @@ void heath_tlb_device::mm5740_data_ready_w(int state) void heath_tlb_device::crtc_addr_w(offs_t reg, uint8_t val) { - m_allow_vsync_nmi = bool(BIT(reg,2)); + m_allow_vsync_nmi = bool(BIT(reg, 2)); m_crtc->address_w(val); } uint8_t heath_tlb_device::crtc_reg_r(offs_t reg) { - m_allow_vsync_nmi = bool(BIT(reg,2)); + m_allow_vsync_nmi = bool(BIT(reg, 2)); return m_crtc->register_r(); } void heath_tlb_device::crtc_reg_w(offs_t reg, uint8_t val) { - m_allow_vsync_nmi = bool(BIT(reg,2)); + m_allow_vsync_nmi = bool(BIT(reg, 2)); m_crtc->register_w(val); } void heath_tlb_device::crtc_vsync_w(int val) { - m_maincpu->set_input_line(INPUT_LINE_NMI, m_allow_vsync_nmi ? val: CLEAR_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, m_allow_vsync_nmi ? val : CLEAR_LINE); } void heath_tlb_device::serial_irq_w(int state) diff --git a/src/mame/namco/namcos12.cpp b/src/mame/namco/namcos12.cpp index f02ca1f5d28..1359de7f10c 100644 --- a/src/mame/namco/namcos12.cpp +++ b/src/mame/namco/namcos12.cpp @@ -1272,31 +1272,31 @@ void namcos12_state::bankoffset_w(offs_t offset, uint16_t data, uint16_t mem_mas /* Banking notes for various alt bank games: mdhorse, kaiunqz: - *0x1f000000 = ((val >> 0x17) & 0xe) | 8; + *0x1f000000 = ((val >> 0x17) & 0xe) | 8; golgo13, g13knd: - *0x1f000000 = ((val >> 0x17) & 0x6) + 8; - followed by - *0x1f000000 = (val >> 0x15) & 0x7; + *0x1f000000 = ((val >> 0x17) & 0x6) + 8; + followed by + *0x1f000000 = (val >> 0x15) & 0x7; truckk: - *0x1f000000 = ((val >> 0x17) & 0x1e) + 8; - followed by - *0x1f000000 = (val >> 0x15) & 0x7ff; (lower bits only set for manual transfers, mask is implicit) + *0x1f000000 = ((val >> 0x17) & 0x1e) + 8; + followed by + *0x1f000000 = (val >> 0x15) & 0x7ff; (lower bits only set for manual transfers, mask is implicit) sws2001: - The upper bits are set using fixed range checks: - if (val <= 0x0ffffff) - *0x1f000000 = 0x08; - else if (val >= 0x1000000 && val <= 0x1ffffff) - *0x1f000000 = 0x0a; - else if (val >= 0x2000000 && val <= 0x2ffffff) - *0x1f000000 = 0x0c; - else if (val >= 0x3000000) - *0x1f000000 = 0x0e; - - The function at 8004d01c is the same logic as above + logic for the lower 3 bits: - *0x1f000000 = (val >> 0x15) & 0x7; + The upper bits are set using fixed range checks: + if (val <= 0x0ffffff) + *0x1f000000 = 0x08; + else if (val >= 0x1000000 && val <= 0x1ffffff) + *0x1f000000 = 0x0a; + else if (val >= 0x2000000 && val <= 0x2ffffff) + *0x1f000000 = 0x0c; + else if (val >= 0x3000000) + *0x1f000000 = 0x0e; + + The function at 8004d01c is the same logic as above + logic for the lower 3 bits: + *0x1f000000 = (val >> 0x15) & 0x7; */ if( m_alt_bank == 1 ) { |