summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/funworld.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2014-03-11 15:54:58 +0000
committer Aaron Giles <aaron@aarongiles.com>2014-03-11 15:54:58 +0000
commit4ea9df02a1daf1893246a01e21ffe201781f9266 (patch)
tree70dcb5feb88dcabe713fc172c30fd159ed1a0a43 /src/mame/drivers/funworld.c
parentb05606404a780c5309d39d8ee45411292279f117 (diff)
Moved core template container classes up from emutempl.h to coretmpl.h:
[Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)
Diffstat (limited to 'src/mame/drivers/funworld.c')
-rw-r--r--src/mame/drivers/funworld.c129
1 files changed, 63 insertions, 66 deletions
diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c
index 1c7abeeb945..9635ccfd4c8 100644
--- a/src/mame/drivers/funworld.c
+++ b/src/mame/drivers/funworld.c
@@ -5840,7 +5840,6 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
int sizep = memregion("proms")->bytes();
int startp = 0;
- UINT8 *buffer;
int i, a;
/*****************************
@@ -5854,38 +5853,38 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 0, 1, 2);
}
- buffer = auto_alloc_array(machine(), UINT8, size);
- memcpy(buffer, rom, size);
+ {
+ dynamic_buffer buffer(size);
+ memcpy(buffer, rom, size);
- /* address lines swap: fedcba9876543210 -> fedcba9820134567 */
+ /* address lines swap: fedcba9876543210 -> fedcba9820134567 */
- for (i = start; i < size; i++)
- {
- a = ((i & 0xff00) | BITSWAP8(i & 0xff, 2, 0, 1, 3, 4, 5, 6, 7));
- rom[a] = buffer[i];
+ for (i = start; i < size; i++)
+ {
+ a = ((i & 0xff00) | BITSWAP8(i & 0xff, 2, 0, 1, 3, 4, 5, 6, 7));
+ rom[a] = buffer[i];
+ }
}
-
- auto_free(machine(), buffer);
/******************************
* Graphics ROM decryption *
******************************/
- buffer = auto_alloc_array(machine(), UINT8, sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ {
+ dynamic_buffer buffer(sizeg);
+ memcpy(buffer, gfxrom, sizeg);
- /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
+ /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
- for (i = startg; i < sizeg; i++)
- {
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 6, 7, 5, 8, 4, 10, 3, 9, 0, 1, 2);
- gfxrom[a] = buffer[i];
+ for (i = startg; i < sizeg; i++)
+ {
+ a = BITSWAP16(i, 15, 14, 13, 12, 11, 6, 7, 5, 8, 4, 10, 3, 9, 0, 1, 2);
+ gfxrom[a] = buffer[i];
+ }
}
- auto_free(machine(), buffer);
-
/****************************
* Color PROM decryption *
@@ -5898,20 +5897,20 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
prom[i] = BITSWAP8(prom[i], 2, 3, 5, 4, 6, 7, 1, 0);
}
- buffer = auto_alloc_array(machine(), UINT8, sizep);
- memcpy(buffer, prom, sizep);
+ {
+ dynamic_buffer buffer(sizep);
+ memcpy(buffer, prom, sizep);
- /* address lines swap: fedcba9876543210 -> fedcba9487652013 */
+ /* address lines swap: fedcba9876543210 -> fedcba9487652013 */
- for (i = startp; i < sizep; i++)
- {
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 4, 8, 7, 6, 5, 2, 0, 1, 3);
- prom[a] = buffer[i];
+ for (i = startp; i < sizep; i++)
+ {
+ a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 4, 8, 7, 6, 5, 2, 0, 1, 3);
+ prom[a] = buffer[i];
+ }
}
- auto_free(machine(), buffer);
-
m_palette->update();
}
@@ -6026,7 +6025,6 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
int sizeg = memregion("gfx1")->bytes();
int startg = 0;
- UINT8 *buffer;
int i, a;
/*****************************
@@ -6040,37 +6038,37 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
}
- buffer = auto_alloc_array(machine(), UINT8, size);
- memcpy(buffer, rom, size);
+ {
+ dynamic_buffer buffer(size);
+ memcpy(buffer, rom, size);
- /* address lines swap: fedcba9876543210 -> fedcba9867543210 */
+ /* address lines swap: fedcba9876543210 -> fedcba9867543210 */
- for (i = start; i < size; i++)
- {
- a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
- rom[a] = buffer[i];
+ for (i = start; i < size; i++)
+ {
+ a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ rom[a] = buffer[i];
+ }
}
- auto_free(machine(), buffer);
-
/******************************
* Graphics ROM decryption *
******************************/
- buffer = auto_alloc_array(machine(), UINT8, sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ {
+ dynamic_buffer buffer(sizeg);
+ memcpy(buffer, gfxrom, sizeg);
- /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
+ /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
- for (i = startg; i < sizeg; i++)
- {
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
- gfxrom[a] = buffer[i];
+ for (i = startg; i < sizeg; i++)
+ {
+ a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
+ gfxrom[a] = buffer[i];
+ }
}
-
- auto_free(machine(), buffer);
}
@@ -6145,7 +6143,6 @@ DRIVER_INIT_MEMBER(funworld_state, rcdino4)
int sizeg = memregion("gfx1")->bytes();
int startg = 0;
- UINT8 *buffer;
int i, a;
/*****************************
@@ -6159,38 +6156,38 @@ DRIVER_INIT_MEMBER(funworld_state, rcdino4)
rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
}
- buffer = auto_alloc_array(machine(), UINT8, size);
- memcpy(buffer, rom, size);
+ {
+ dynamic_buffer buffer(size);
+ memcpy(buffer, rom, size);
- /* address lines swap: fedcba9876543210 -> fedcba9867543210 */
+ /* address lines swap: fedcba9876543210 -> fedcba9867543210 */
- for (i = start; i < size; i++)
- {
- a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
- rom[a] = buffer[i];
+ for (i = start; i < size; i++)
+ {
+ a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ rom[a] = buffer[i];
+ }
}
- auto_free(machine(), buffer);
-
/******************************
* Graphics ROM decryption *
******************************/
- buffer = auto_alloc_array(machine(), UINT8, sizeg);
- memcpy(buffer, gfxrom, sizeg);
+ {
+ dynamic_buffer buffer(sizeg);
+ memcpy(buffer, gfxrom, sizeg);
- /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
+ /* address lines swap: fedcba9876543210 -> fedcb67584a39012 */
- for (i = startg; i < sizeg; i++)
- {
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
- gfxrom[a] = buffer[i];
+ for (i = startg; i < sizeg; i++)
+ {
+ a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
+ gfxrom[a] = buffer[i];
+ }
}
- auto_free(machine(), buffer);
-
/* d4-d5 data lines swap, plus a XOR with 0x81, implemented in two steps for an easy view */
int x;