mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
add nullptr check to some strtoul calls
This commit is contained in:
parent
97a409b2a9
commit
3624b416ba
@ -2570,7 +2570,7 @@ Official VP+ upgaded versions (simply adds a background picture):
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="ppp">
|
||||
<software name="ppp" supported="partial">
|
||||
<description>Puzzle Piece Panic!</description>
|
||||
<year>2007</year>
|
||||
<publisher><homebrew></publisher>
|
||||
|
@ -103,11 +103,12 @@ static const o2_slot slot_list[] =
|
||||
|
||||
static int o2_get_pcb_id(const char *slot)
|
||||
{
|
||||
for (auto & elem : slot_list)
|
||||
{
|
||||
if (!core_stricmp(elem.slot_option, slot))
|
||||
return elem.pcb_id;
|
||||
}
|
||||
if (slot)
|
||||
for (auto & elem : slot_list)
|
||||
{
|
||||
if (!core_stricmp(elem.slot_option, slot))
|
||||
return elem.pcb_id;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -138,13 +139,12 @@ image_init_result o2_cart_slot_device::call_load()
|
||||
load_software_region("exrom", m_cart->m_exrom);
|
||||
load_software_region("voice", m_cart->m_voice);
|
||||
|
||||
const char *pcb_name = get_feature("slot");
|
||||
if (pcb_name)
|
||||
m_type = o2_get_pcb_id(pcb_name);
|
||||
m_type = o2_get_pcb_id(get_feature("slot"));
|
||||
|
||||
// Videopac+ determines whether the screen should have a border, with a gate connected
|
||||
// to the cartridge B pin. This way, old Videopac games can still run in full screen.
|
||||
m_b = bool(strtoul(get_feature("b_pin"), nullptr, 0)) ? 1 : 0;
|
||||
const char *b_pin = get_feature("b_pin");
|
||||
m_b = b_pin && strtoul(b_pin, nullptr, 0) ? 1 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -171,8 +171,9 @@ DEVICE_IMAGE_LOAD_MEMBER(ggm_state::cartridge)
|
||||
m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE);
|
||||
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");
|
||||
|
||||
// keypad overlay (will return 0 if it's not defined)
|
||||
m_overlay = strtoul(image.get_feature("overlay"), nullptr, 0) & 0xf;
|
||||
// keypad overlay
|
||||
const char *overlay = image.get_feature("overlay");
|
||||
m_overlay = overlay ? strtoul(overlay, nullptr, 0) & 0xf : 0;
|
||||
|
||||
// extra ram (optional)
|
||||
if (image.get_feature("ram"))
|
||||
|
@ -204,13 +204,20 @@ DEVICE_IMAGE_LOAD_MEMBER(microvision_state::cart_load)
|
||||
|
||||
if (image.loaded_through_softlist())
|
||||
{
|
||||
u32 sclock = strtoul(image.get_feature("clock"), nullptr, 0);
|
||||
const char *cclock = image.get_feature("clock");
|
||||
u32 sclock = cclock ? strtoul(cclock, nullptr, 0) : 0;
|
||||
if (sclock != 0)
|
||||
clock = sclock;
|
||||
|
||||
m_butmask_auto = ~strtoul(image.get_feature("butmask"), nullptr, 0) & 0xfff;
|
||||
m_pla_auto = strtoul(image.get_feature("pla"), nullptr, 0) ? 1 : 0;
|
||||
m_paddle_auto = bool(strtoul(image.get_feature("paddle"), nullptr, 0) ? 1 : 0);
|
||||
const char *butmask = image.get_feature("butmask");
|
||||
m_butmask_auto = butmask ? strtoul(butmask, nullptr, 0) : 0;
|
||||
m_butmask_auto = ~m_butmask_auto & 0xfff;
|
||||
|
||||
const char *pla = image.get_feature("pla");
|
||||
m_pla_auto = pla && strtoul(pla, nullptr, 0) ? 1 : 0;
|
||||
|
||||
const char *paddle = image.get_feature("paddle");
|
||||
m_paddle_auto = paddle && strtoul(paddle, nullptr, 0);
|
||||
}
|
||||
|
||||
// detect MCU on file size
|
||||
|
Loading…
Reference in New Issue
Block a user