Move ROM loading macros to romentry.h and remove romload.h from emu.h (nw)

This commit is contained in:
AJR 2018-06-24 09:05:55 -04:00
parent d2fbefd977
commit 297b99c0fa
33 changed files with 101 additions and 72 deletions

View File

@ -12,6 +12,7 @@
#include "chd_cd.h"
#include "cdrom.h"
#include "romload.h"
// device type definition
DEFINE_DEVICE_TYPE(CDROM, cdrom_image_device, "cdrom_image", "CD-ROM Image")

View File

@ -9,6 +9,7 @@
#include "emuopts.h"
#include "harddisk.h"
#include "romload.h"
OPTION_GUIDE_START(dsk_option_guide)

View File

@ -18,6 +18,7 @@
#include "emuopts.h"
#include "harddisk.h"
#include "romload.h"
OPTION_GUIDE_START(hd_option_guide)

View File

@ -17,6 +17,7 @@
#include "akiko.h"
#include "imagedev/chd_cd.h"
#include "coreutil.h"
#include "romload.h"
//**************************************************************************

View File

@ -14,6 +14,7 @@
#include "vbiparse.h"
#include "config.h"
#include "render.h"
#include "romload.h"
#include "chd.h"

View File

@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
#include "romload.h"
#include "validity.h"

View File

@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
#include "romload.h"
//**************************************************************************

View File

@ -9,6 +9,7 @@
***************************************************************************/
#include "emu.h"
#include "romload.h"
#include "speaker.h"
#include "debug/debugcpu.h"

View File

@ -12,6 +12,7 @@
#include "emuopts.h"
#include "drivenum.h"
#include "romload.h"
#include "ui/uimain.h"
#include "zippath.h"
#include "softlist.h"

View File

@ -53,7 +53,7 @@ class address_map; // Forward declaration
#include "memarray.h"
// machine-wide utilities
#include "romload.h"
#include "romentry.h"
#include "save.h"
// I/O

View File

@ -82,6 +82,7 @@
#include "dirtc.h"
#include "image.h"
#include "network.h"
#include "romload.h"
#include "ui/uimain.h"
#include <time.h>
#include <rapidjson/writer.h>

View File

@ -8,6 +8,10 @@
*********************************************************************/
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef MAME_EMU_ROMENTRY_H
#define MAME_EMU_ROMENTRY_H
@ -112,6 +116,71 @@ enum
#define ROM_INHERITEDFLAGS (ROM_GROUPMASK | ROM_SKIPMASK | ROM_REVERSEMASK | ROM_BITWIDTHMASK | ROM_BITSHIFTMASK | ROM_BIOSFLAGSMASK)
/* ----- start/stop macros ----- */
#define ROM_NAME(name) rom_##name
#define ROM_START(name) static const tiny_rom_entry ROM_NAME(name)[] = {
#define ROM_END { nullptr, nullptr, 0, 0, ROMENTRYTYPE_END } };
/* ----- ROM region macros ----- */
#define ROM_REGION(length,tag,flags) { tag, nullptr, 0, length, ROMENTRYTYPE_REGION | (flags) },
#define ROM_REGION16_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_LE)
#define ROM_REGION16_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_BE)
#define ROM_REGION32_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_32BIT | ROMREGION_LE)
#define ROM_REGION32_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_32BIT | ROMREGION_BE)
#define ROM_REGION64_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_64BIT | ROMREGION_LE)
#define ROM_REGION64_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_64BIT | ROMREGION_BE)
/* ----- core ROM loading macros ----- */
#define ROMX_LOAD(name,offset,length,hash,flags) { name, hash, offset, length, ROMENTRYTYPE_ROM | (flags) },
#define ROM_LOAD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, 0)
#define ROM_LOAD_OPTIONAL(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_OPTIONAL)
/* ----- specialized loading macros ----- */
#define ROM_LOAD_NIB_HIGH(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI)
#define ROM_LOAD_NIB_LOW(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO)
#define ROM_LOAD16_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1))
#define ROM_LOAD16_WORD(name,offset,length,hash) ROM_LOAD(name, offset, length, hash)
#define ROM_LOAD16_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE)
#define ROM_LOAD32_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(3))
#define ROM_LOAD32_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(2))
#define ROM_LOAD32_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2))
#define ROM_LOAD32_DWORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD)
#define ROM_LOAD64_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(7))
#define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6))
#define ROM_LOAD64_DWORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD | ROM_REVERSE | ROM_SKIP(4))
/* ----- ROM_RELOAD related macros ----- */
#define ROM_RELOAD(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS },
#define ROM_RELOAD_PLAIN(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD },
/* ----- additional ROM-related macros ----- */
#define ROM_CONTINUE(offset,length) { nullptr, nullptr, (offset), (length), ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS },
#define ROM_IGNORE(length) { nullptr, nullptr, 0, (length), ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS },
#define ROM_FILL(offset,length,value) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL },
#define ROMX_FILL(offset,length,value,flags) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL | flags },
#define ROM_COPY(srctag,srcoffs,offset,length) { (srctag), (const char *)(srcoffs), (offset), (length), ROMENTRYTYPE_COPY },
/* ----- system BIOS macros ----- */
#define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value) },
#define ROM_DEFAULT_BIOS(name) { name, nullptr, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS },
/* ----- game parameter macro ----- */
#define ROM_PARAMETER(tag, value) { tag, value, 0, 0, ROMENTRYTYPE_PARAMETER },
/* ----- disk loading macros ----- */
#define DISK_REGION(tag) ROM_REGION(1, tag, ROMREGION_DATATYPEDISK)
#define DISK_IMAGE(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READWRITE)
#define DISK_IMAGE_READONLY(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READONLY)
#define DISK_IMAGE_READONLY_OPTIONAL(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READONLY | ROM_OPTIONAL)
//**************************************************************************
// TYPE DEFINITIONS

View File

@ -8,6 +8,8 @@
*********************************************************************/
#include "emu.h"
#include "romload.h"
#include "emuopts.h"
#include "drivenum.h"
#include "softlist_dev.h"

View File

@ -9,15 +9,10 @@
#pragma once
#ifndef __EMU_H__
#error Dont include this file directly; include emu.h instead.
#endif
#ifndef MAME_EMU_ROMLOAD_H
#define MAME_EMU_ROMLOAD_H
#include "chd.h"
#include "romentry.h"
#include <type_traits>
@ -376,71 +371,6 @@ public:
} // namespace romload
/* ----- start/stop macros ----- */
#define ROM_NAME(name) rom_##name
#define ROM_START(name) static const tiny_rom_entry ROM_NAME(name)[] = {
#define ROM_END { nullptr, nullptr, 0, 0, ROMENTRYTYPE_END } };
/* ----- ROM region macros ----- */
#define ROM_REGION(length,tag,flags) { tag, nullptr, 0, length, ROMENTRYTYPE_REGION | (flags) },
#define ROM_REGION16_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_LE)
#define ROM_REGION16_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_16BIT | ROMREGION_BE)
#define ROM_REGION32_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_32BIT | ROMREGION_LE)
#define ROM_REGION32_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_32BIT | ROMREGION_BE)
#define ROM_REGION64_LE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_64BIT | ROMREGION_LE)
#define ROM_REGION64_BE(length,tag,flags) ROM_REGION(length, tag, (flags) | ROMREGION_64BIT | ROMREGION_BE)
/* ----- core ROM loading macros ----- */
#define ROMX_LOAD(name,offset,length,hash,flags) { name, hash, offset, length, ROMENTRYTYPE_ROM | (flags) },
#define ROM_LOAD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, 0)
#define ROM_LOAD_OPTIONAL(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_OPTIONAL)
/* ----- specialized loading macros ----- */
#define ROM_LOAD_NIB_HIGH(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_HI)
#define ROM_LOAD_NIB_LOW(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_NIBBLE | ROM_SHIFT_NIBBLE_LO)
#define ROM_LOAD16_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1))
#define ROM_LOAD16_WORD(name,offset,length,hash) ROM_LOAD(name, offset, length, hash)
#define ROM_LOAD16_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE)
#define ROM_LOAD32_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(3))
#define ROM_LOAD32_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(2))
#define ROM_LOAD32_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(2))
#define ROM_LOAD32_DWORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD)
#define ROM_LOAD64_BYTE(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(7))
#define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6))
#define ROM_LOAD64_WORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_SKIP(6))
#define ROM_LOAD64_DWORD_SWAP(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPDWORD | ROM_REVERSE | ROM_SKIP(4))
/* ----- ROM_RELOAD related macros ----- */
#define ROM_RELOAD(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD | ROM_INHERITFLAGS },
#define ROM_RELOAD_PLAIN(offset,length) { nullptr, nullptr, offset, length, ROMENTRYTYPE_RELOAD },
/* ----- additional ROM-related macros ----- */
#define ROM_CONTINUE(offset,length) { nullptr, nullptr, (offset), (length), ROMENTRYTYPE_CONTINUE | ROM_INHERITFLAGS },
#define ROM_IGNORE(length) { nullptr, nullptr, 0, (length), ROMENTRYTYPE_IGNORE | ROM_INHERITFLAGS },
#define ROM_FILL(offset,length,value) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL },
#define ROMX_FILL(offset,length,value,flags) { nullptr, (const char *)(value), (offset), (length), ROMENTRYTYPE_FILL | flags },
#define ROM_COPY(srctag,srcoffs,offset,length) { (srctag), (const char *)(srcoffs), (offset), (length), ROMENTRYTYPE_COPY },
/* ----- system BIOS macros ----- */
#define ROM_SYSTEM_BIOS(value,name,description) { name, description, 0, 0, ROMENTRYTYPE_SYSTEM_BIOS | ROM_BIOS(value) },
#define ROM_DEFAULT_BIOS(name) { name, nullptr, 0, 0, ROMENTRYTYPE_DEFAULT_BIOS },
/* ----- game parameter macro ----- */
#define ROM_PARAMETER(tag, value) { tag, value, 0, 0, ROMENTRYTYPE_PARAMETER },
/* ----- disk loading macros ----- */
#define DISK_REGION(tag) ROM_REGION(1, tag, ROMREGION_DATATYPEDISK)
#define DISK_IMAGE(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READWRITE)
#define DISK_IMAGE_READONLY(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READONLY)
#define DISK_IMAGE_READONLY_OPTIONAL(name,idx,hash) ROMX_LOAD(name, idx, 0, hash, DISK_READONLY | ROM_OPTIONAL)
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/

View File

@ -11,6 +11,7 @@
#include "emu.h"
#include "emuopts.h"
#include "diimage.h"
#include "romload.h"
#include "softlist_dev.h"
#include "validity.h"

View File

@ -12,6 +12,7 @@
#include "validity.h"
#include "emuopts.h"
#include "romload.h"
#include "video/rgbutil.h"
#include <ctype.h>

View File

@ -13,6 +13,7 @@
#include "audit.h"
#include "chd.h"
#include "drivenum.h"
#include "romload.h"
#include "sound/samples.h"
#include "softlist_dev.h"

View File

@ -16,6 +16,7 @@
#include "mameopts.h"
#include "audit.h"
#include "info.h"
#include "romload.h"
#include "unzip.h"
#include "validity.h"
#include "sound/samples.h"

View File

@ -18,6 +18,7 @@
#include "config.h"
#include "drivenum.h"
#include "romload.h"
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"

View File

@ -10,6 +10,7 @@
#ifndef MAME_FRONTEND_MEDIA_IDENT_H
#define MAME_FRONTEND_MEDIA_IDENT_H
#include "romload.h"
#include <vector>

View File

@ -11,6 +11,7 @@
#include "emu.h"
#include "ui/ui.h"
#include "ui/devopt.h"
#include "romload.h"
namespace ui {

View File

@ -14,6 +14,7 @@
#include "ui/ui.h"
#include "drivenum.h"
#include "romload.h"
#include "softlist.h"
#include "emuopts.h"

View File

@ -15,6 +15,7 @@
#include "pluginopts.h"
#include "drivenum.h"
#include "natkeyboard.h"
#include "romload.h"
#include "uiinput.h"
#include "ui/ui.h"

View File

@ -26,6 +26,7 @@
#include "emuopts.h"
#include "mame.h"
#include "rendutil.h"
#include "romload.h"
#include "softlist_dev.h"
#include "uiinput.h"
#include "luaengine.h"

View File

@ -29,6 +29,7 @@
#include "emuopts.h"
#include "rendfont.h"
#include "rendutil.h"
#include "romload.h"
#include "softlist.h"
#include "softlist_dev.h"
#include "uiinput.h"

View File

@ -19,6 +19,7 @@
#include "drivenum.h"
#include "rendfont.h"
#include "romload.h"
#include "softlist.h"
#include <bitset>

View File

@ -194,6 +194,7 @@ Notes:
#include "imagedev/chd_cd.h"
#include "machine/terminal.h"
#include "emupal.h"
#include "romload.h"
#include "softlist.h"
#include "screen.h"

View File

@ -365,6 +365,7 @@ G: gun mania only, drives air soft gun (this game uses real BB bullet)
#include "sound/cdda.h"
#include "video/psx.h"
#include "cdrom.h"
#include "romload.h"
#include "screen.h"
#include "speaker.h"

View File

@ -17,6 +17,7 @@
#include "ui/uimain.h"
#include "emuopts.h"
#include "romload.h"
#include "speaker.h"
#include "screen.h"

View File

@ -133,7 +133,7 @@ READ8_MEMBER(segas1x_bootleg_state::sound_command_irq_r)
WRITE8_MEMBER(segas1x_bootleg_state::soundbank_msm_w)
{
m_soundbank->set_entry((data & 7) ^ 6); // probably wrong
m_soundbank->set_entry(data & 7);
m_msm->reset_w(BIT(data, 3));
}

View File

@ -27,6 +27,7 @@ TODO:
#include "cpu/m68000/m68000.h"
#include "cdrom.h"
#include "romload.h"
#include "sound/cdda.h"

View File

@ -3,6 +3,7 @@
#include "emu.h"
#include "naomigd.h"
#include "romload.h"
#include "imagedev/chd_cd.h"
/*

View File

@ -11,6 +11,7 @@
#include "debug/debugcmd.h"
#include "debugger.h"
#include "romload.h"
#include <functional>