summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus
diff options
context:
space:
mode:
author Oliver Stöneberg <firewave@users.noreply.github.com>2014-03-28 17:44:24 +0000
committer Oliver Stöneberg <firewave@users.noreply.github.com>2014-03-28 17:44:24 +0000
commit089ba456f408321f445b5d6af8cf6acf7fdcb5d2 (patch)
tree76d90e2971bf9677059a9803ad8dce43e3f00718 /src/emu/bus
parentfc38a629a83afe07c821339617923b22419f9864 (diff)
converted some global_alloc_array() usage to dynamic_array/dynamic_buffer (nw)
Diffstat (limited to 'src/emu/bus')
-rw-r--r--src/emu/bus/megadrive/md_slot.c8
-rw-r--r--src/emu/bus/snes/snes_slot.c3
2 files changed, 4 insertions, 7 deletions
diff --git a/src/emu/bus/megadrive/md_slot.c b/src/emu/bus/megadrive/md_slot.c
index e9cad87ab6a..f240048385a 100644
--- a/src/emu/bus/megadrive/md_slot.c
+++ b/src/emu/bus/megadrive/md_slot.c
@@ -462,12 +462,12 @@ static int genesis_is_SMD(unsigned char *buf, unsigned int len)
int base_md_cart_slot_device::load_nonlist()
{
- unsigned char *ROM, *tmpROM;
+ unsigned char *ROM;
bool is_smd, is_md;
UINT32 tmplen = length(), offset, len;
-
+ dynamic_buffer tmpROM(tmplen);
+
// STEP 1: store a (possibly headered) copy of the file and determine its type (SMD? MD? BIN?)
- tmpROM = global_alloc_array(unsigned char, tmplen);
fread(tmpROM, tmplen);
is_smd = genesis_is_SMD(&tmpROM[0x200], tmplen - 0x200);
is_md = (tmpROM[0x80] == 'E') && (tmpROM[0x81] == 'A') && (tmpROM[0x82] == 'M' || tmpROM[0x82] == 'G');
@@ -516,8 +516,6 @@ int base_md_cart_slot_device::load_nonlist()
fread(ROM, len);
}
- global_free_array(tmpROM);
-
// if we allocated a ROM larger that the file (e.g. due to uneven cart size), set remaining space to 0xff
if (len > (tmplen - offset))
memset(m_cart->get_rom_base() + (tmplen - offset)/2, 0xffff, (len - tmplen + offset)/2);
diff --git a/src/emu/bus/snes/snes_slot.c b/src/emu/bus/snes/snes_slot.c
index 61997ab448e..ee89932db7f 100644
--- a/src/emu/bus/snes/snes_slot.c
+++ b/src/emu/bus/snes/snes_slot.c
@@ -630,11 +630,10 @@ bool base_sns_cart_slot_device::call_load()
if (software_entry() == NULL)
{
UINT32 tmplen = length();
- UINT8 *tmpROM = global_alloc_array(UINT8, tmplen);
+ dynamic_buffer tmpROM(tmplen);
fread(tmpROM, tmplen);
offset = snes_skip_header(tmpROM, tmplen);
fseek(offset, SEEK_SET);
- global_free_array(tmpROM);
}
len = (software_entry() == NULL) ? (length() - offset) : get_software_region_length("rom");