mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
diimage: Added load_software_region() function that loads a software list region into a shared_ptr. [Curt Coder]
This commit is contained in:
parent
79471e5725
commit
7afab9bda2
@ -258,6 +258,7 @@ public:
|
||||
|
||||
// getter for explicit fetching
|
||||
UINT32 bytes() const { return m_bytes; }
|
||||
UINT32 mask() const { return m_bytes - 1; }
|
||||
|
||||
// setter for setting the object
|
||||
void set_target(_PointerType *target, size_t bytes) { this->m_target = target; m_bytes = bytes; }
|
||||
|
@ -434,6 +434,25 @@ const char *device_image_interface::get_feature(const char *feature_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// load_software_region -
|
||||
//-------------------------------------------------
|
||||
|
||||
bool device_image_interface::load_software_region(const char *tag, optional_shared_ptr<UINT8> &ptr)
|
||||
{
|
||||
size_t size = get_software_region_length(tag);
|
||||
|
||||
if (size)
|
||||
{
|
||||
ptr.allocate(size);
|
||||
|
||||
memcpy(ptr, get_software_region(tag), size);
|
||||
}
|
||||
|
||||
return size > 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
Hash info loading
|
||||
|
||||
|
@ -176,6 +176,8 @@ public:
|
||||
bool has_been_created() { return m_created; }
|
||||
void make_readonly() { m_readonly = true; }
|
||||
UINT32 fread(void *buffer, UINT32 length) { check_for_file(); return core_fread(m_file, buffer, length); }
|
||||
UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length) { ptr.allocate(length); return fread(ptr, length); }
|
||||
UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length, offs_t offset) { ptr.allocate(length); return fread(ptr + offset, length - offset); }
|
||||
UINT32 fwrite(const void *buffer, UINT32 length) { check_for_file(); return core_fwrite(m_file, buffer, length); }
|
||||
int fseek(INT64 offset, int whence) { check_for_file(); return core_fseek(m_file, offset, whence); }
|
||||
UINT64 ftell() { check_for_file(); return core_ftell(m_file); }
|
||||
@ -201,6 +203,7 @@ public:
|
||||
UINT8 *get_software_region(const char *tag);
|
||||
UINT32 get_software_region_length(const char *tag);
|
||||
const char *get_feature(const char *feature_name);
|
||||
bool load_software_region(const char *tag, optional_shared_ptr<UINT8> &ptr);
|
||||
|
||||
UINT32 crc();
|
||||
hash_collection& hash() { return m_hash; }
|
||||
|
Loading…
Reference in New Issue
Block a user