-Improved some Lua APIs:
* Moved several machine lifecycle callbacks to the notifier/subscriber model. The old callback registration model is still available for them for now, but prints a deprecation warning. * Added pre-save/post-load notifications. * Use a single allocated timer rather than one anonymous timer per waiter. Waiters no longer prevent saved states from being loaded. * Clean up outstanding waiters on stop or state load rather than just leaking them. * Started documenting parts of the emulator interface object that should be relatively stable. -imagedev/avivideo.cpp: Fixed an object leak on unload. Also changed some other media image devices to use smart pointers.
This commit is contained in:
parent
c4282feced
commit
b67b969bf0
@ -63,9 +63,9 @@ copyright = u'1997-2023, MAMEdev and contributors'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.253'
|
version = '0.254'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.253'
|
release = '0.254'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
@ -4,6 +4,5 @@ Dummy Test Plugin
|
|||||||
=================
|
=================
|
||||||
|
|
||||||
This is a sample plugin that shows how to set necessary plugin metadata,
|
This is a sample plugin that shows how to set necessary plugin metadata,
|
||||||
register callbacks, and display a simple menu. It prints status messages if the
|
register callbacks, and display a simple menu. It prints status messages, and
|
||||||
:ref:`verbose <mame-commandline-verbose>` option is on, and it adds a **Dummy**
|
it adds a **Dummy** option to the **Plugin Options** menu.
|
||||||
option to the **Plugin Options** menu.
|
|
||||||
|
@ -53,9 +53,9 @@ Many of the classes are documented on the
|
|||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
MAME supports external scripting via Lua (>= 5.3) scripts, either entered at the
|
MAME supports external scripting via Lua scripts, either entered at the
|
||||||
interactive console or loaded as a file. To reach the console, enable the
|
interactive console or loaded as a file. To reach the console, enable the
|
||||||
console plugin (e.g. run MAME with ``-plugin console``) and you will be greeted
|
console plugin (e.g. run MAME with ``-console``) and you will be greeted
|
||||||
with a ``[MAME]>`` prompt where you can enter Lua script interactively.
|
with a ``[MAME]>`` prompt where you can enter Lua script interactively.
|
||||||
|
|
||||||
To load a whole script at once, store it in a plain text file and pass it using
|
To load a whole script at once, store it in a plain text file and pass it using
|
||||||
@ -78,7 +78,7 @@ Let’s first run MAME in a terminal to reach the Lua console:
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
$ mame -console YOUR_ROM
|
$ mame -console YOUR_SYSTEM
|
||||||
/| /| /| /| /| _______
|
/| /| /| /| /| _______
|
||||||
/ | / | / | / | / | / /
|
/ | / | / | / | / | / /
|
||||||
/ |/ | / | / |/ | / ____/
|
/ |/ | / | / |/ | / ____/
|
||||||
@ -90,10 +90,10 @@ Let’s first run MAME in a terminal to reach the Lua console:
|
|||||||
/ /
|
/ /
|
||||||
/ _/
|
/ _/
|
||||||
|
|
||||||
mame 0.227
|
mame 0.254
|
||||||
Copyright (C) Nicola Salmoria and the MAME team
|
Copyright (C) Nicola Salmoria and the MAME team
|
||||||
|
|
||||||
Lua 5.3
|
Lua 5.4
|
||||||
Copyright (C) Lua.org, PUC-Rio
|
Copyright (C) Lua.org, PUC-Rio
|
||||||
|
|
||||||
[MAME]>
|
[MAME]>
|
||||||
@ -113,7 +113,7 @@ You can check at runtime which version of MAME you are running, with:
|
|||||||
::
|
::
|
||||||
|
|
||||||
[MAME]> print(emu.app_name() .. " " .. emu.app_version())
|
[MAME]> print(emu.app_name() .. " " .. emu.app_version())
|
||||||
mame 0.227
|
mame 0.254
|
||||||
|
|
||||||
We now start exploring screen related methods. First, let's enumerate available
|
We now start exploring screen related methods. First, let's enumerate available
|
||||||
screens:
|
screens:
|
||||||
|
@ -55,6 +55,82 @@ c:index_of(v)
|
|||||||
value.
|
value.
|
||||||
|
|
||||||
|
|
||||||
|
.. _luareference-globals:
|
||||||
|
|
||||||
|
Global objects
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. _luareference-globals-emu:
|
||||||
|
|
||||||
|
Emulator interface
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
The emulator interface ``emu`` provides access to core functionality. Many
|
||||||
|
classes are also available as properties of the emulator interface.
|
||||||
|
|
||||||
|
Methods
|
||||||
|
^^^^^^^
|
||||||
|
|
||||||
|
emu.wait(duration, …)
|
||||||
|
Yields for the specified duration in terms of emulated time. The duration
|
||||||
|
may be specified as an :ref:`attotime <luareference-core-attotime>` or a
|
||||||
|
number in seconds. Any additional arguments are returned to the caller.
|
||||||
|
Returns a Boolean indicating whether the duration expired normally.
|
||||||
|
|
||||||
|
All outstanding calls to ``emu.wait`` will return ``false`` immediately if a
|
||||||
|
saved state is loaded or the emulation session ends. Calling this function
|
||||||
|
from callbacks that are not run as coroutines will raise an error.
|
||||||
|
emu.wait_next_update(…)
|
||||||
|
Yields until the next video/UI update. Any arguments are returned to the
|
||||||
|
caller. Calling this function from callbacks that are not run as coroutines
|
||||||
|
will raise an error.
|
||||||
|
emu.wait_next_frame(…)
|
||||||
|
Yields until the next emulated frame completes. Any arguments are returned
|
||||||
|
to the caller. Calling this function from callbacks that are not run as
|
||||||
|
coroutines will raise an error.
|
||||||
|
emu.add_machine_reset_notifier(callback)
|
||||||
|
Add a callback to receive notifications when the emulated system is reset.
|
||||||
|
Returns a :ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_stop_notifier(callback)
|
||||||
|
Add a callback to receive notifications when the emulated system is stopped.
|
||||||
|
Returns a :ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_pause_notifier(callback)
|
||||||
|
Add a callback to receive notifications when the emulated system is paused.
|
||||||
|
Returns a :ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_resume_notifier(callback)
|
||||||
|
Add a callback to receive notifications when the emulated system is resumed
|
||||||
|
after being paused. Returns a
|
||||||
|
:ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_frame_notifier(callback)
|
||||||
|
Add a callback to receive notifications when an emulated frame completes.
|
||||||
|
Returns a :ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_pre_save_notifier(callback)
|
||||||
|
Add a callback to receive notification before the emulated system state is
|
||||||
|
saved. Returns a
|
||||||
|
:ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.add_machine_post_load_notifier(callback)
|
||||||
|
Add a callback to receive notification after the emulated system is restored
|
||||||
|
to a previously saved state. Returns a
|
||||||
|
:ref:`notifier subscription <luareference-core-notifiersub>`.
|
||||||
|
emu.print_error(message)
|
||||||
|
Print an error message.
|
||||||
|
emu.print_warning(message)
|
||||||
|
Print a warning message.
|
||||||
|
emu.print_info(message)
|
||||||
|
Print an informational message.
|
||||||
|
emu.print_verbose(message)
|
||||||
|
Print a verbose diagnostic message (disabled by default).
|
||||||
|
emu.print_debug(message)
|
||||||
|
Print a debug message (only enabled for debug builds by default).
|
||||||
|
emu.lang_translate([context], message)
|
||||||
|
Look up a message with optional context in the current localised message
|
||||||
|
catalog. Returns the message unchanged if no corresponding localised
|
||||||
|
message is found.
|
||||||
|
emu.subst_env(string)
|
||||||
|
Substitute environment variables in a string. The syntax is dependent on
|
||||||
|
the host operating system.
|
||||||
|
|
||||||
|
|
||||||
.. _luareference-core:
|
.. _luareference-core:
|
||||||
|
|
||||||
Core classes
|
Core classes
|
||||||
@ -1598,7 +1674,8 @@ Pass-through handler
|
|||||||
Tracks a pass-through handler installed in an
|
Tracks a pass-through handler installed in an
|
||||||
:ref:`address space <luareference-mem-space>`. A memory pass-through handler
|
:ref:`address space <luareference-mem-space>`. A memory pass-through handler
|
||||||
receives notifications on accesses to a specified range of addresses, and can
|
receives notifications on accesses to a specified range of addresses, and can
|
||||||
modify the data that is read or written if desired.
|
modify the data that is read or written if desired. Note that pass-through handler
|
||||||
|
callbacks are not run as coroutines.
|
||||||
|
|
||||||
Instantiation
|
Instantiation
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
@ -3572,7 +3649,8 @@ Layout file
|
|||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
Wraps MAME’s ``layout_file`` class, representing the views loaded from a layout
|
Wraps MAME’s ``layout_file`` class, representing the views loaded from a layout
|
||||||
file for use by a render target.
|
file for use by a render target. Note that layout file callbacks are not run as
|
||||||
|
coroutines.
|
||||||
|
|
||||||
Instantiation
|
Instantiation
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
@ -3616,7 +3694,8 @@ Layout view
|
|||||||
Wraps MAME’s ``layout_view`` class, representing a view that can be displayed in
|
Wraps MAME’s ``layout_view`` class, representing a view that can be displayed in
|
||||||
a render target. Views are created from XML layout files, which may be loaded
|
a render target. Views are created from XML layout files, which may be loaded
|
||||||
from external artwork, internal to MAME, or automatically generated based on the
|
from external artwork, internal to MAME, or automatically generated based on the
|
||||||
screens in the emulated system.
|
screens in the emulated system. Note that layout view callbacks are not run as
|
||||||
|
coroutines.
|
||||||
|
|
||||||
Instantiation
|
Instantiation
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
@ -3695,7 +3774,8 @@ Layout view item
|
|||||||
|
|
||||||
Wraps MAME’s ``layout_view_item`` class, representing an item in a view. An
|
Wraps MAME’s ``layout_view_item`` class, representing an item in a view. An
|
||||||
item is drawn as a rectangular textured surface. The texture is supplied by an
|
item is drawn as a rectangular textured surface. The texture is supplied by an
|
||||||
emulated screen or a layout element.
|
emulated screen or a layout element. Note that layout view item callbacks are
|
||||||
|
not run as coroutines.
|
||||||
|
|
||||||
Instantiation
|
Instantiation
|
||||||
^^^^^^^^^^^^^
|
^^^^^^^^^^^^^
|
||||||
|
@ -9,6 +9,8 @@ local exports = {
|
|||||||
|
|
||||||
local autofire = exports
|
local autofire = exports
|
||||||
|
|
||||||
|
local frame_subscription, stop_subscription
|
||||||
|
|
||||||
function autofire.startplugin()
|
function autofire.startplugin()
|
||||||
|
|
||||||
-- List of autofire buttons, each being a table with keys:
|
-- List of autofire buttons, each being a table with keys:
|
||||||
@ -104,9 +106,9 @@ function autofire.startplugin()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_frame(process_frame)
|
frame_subscription = emu.add_machine_frame_notifier(process_frame)
|
||||||
emu.register_prestart(load_settings)
|
emu.register_prestart(load_settings)
|
||||||
emu.register_stop(save_settings)
|
stop_subscription = emu.add_machine_stop_notifier(save_settings)
|
||||||
emu.register_menu(menu_callback, menu_populate, _p('plugin-autofire', 'Autofire'))
|
emu.register_menu(menu_callback, menu_populate, _p('plugin-autofire', 'Autofire'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ exports.author = { name = "Carl" }
|
|||||||
|
|
||||||
local cheat = exports
|
local cheat = exports
|
||||||
|
|
||||||
|
local reset_subscription, stop_subscription, frame_subscription
|
||||||
|
|
||||||
function cheat.set_folder(path)
|
function cheat.set_folder(path)
|
||||||
cheat.path = path
|
cheat.path = path
|
||||||
end
|
end
|
||||||
@ -809,7 +811,7 @@ function cheat.startplugin()
|
|||||||
return menu_populate()
|
return menu_populate()
|
||||||
end, _("Cheat"))
|
end, _("Cheat"))
|
||||||
|
|
||||||
emu.register_start(function()
|
reset_subscription = emu.add_machine_reset_notifier(function ()
|
||||||
if not stop then
|
if not stop then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -832,13 +834,13 @@ function cheat.startplugin()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_stop(function()
|
stop_subscription = emu.add_machine_stop_notifier(function ()
|
||||||
stop = true
|
stop = true
|
||||||
consolelog = nil
|
consolelog = nil
|
||||||
save_hotkeys()
|
save_hotkeys()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_frame(function()
|
frame_subscription = emu.add_machine_frame_notifier(function ()
|
||||||
if stop then
|
if stop then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -10,6 +10,8 @@ exports.author = { name = "Carl" }
|
|||||||
|
|
||||||
local cheatfind = exports
|
local cheatfind = exports
|
||||||
|
|
||||||
|
local reset_subscription
|
||||||
|
|
||||||
function cheatfind.startplugin()
|
function cheatfind.startplugin()
|
||||||
local cheat = {}
|
local cheat = {}
|
||||||
|
|
||||||
@ -333,7 +335,7 @@ function cheatfind.startplugin()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_start(start)
|
reset_subscription = emu.add_machine_reset_notifier(start)
|
||||||
|
|
||||||
local menu_is_showing = false
|
local menu_is_showing = false
|
||||||
local tabbed_out = false
|
local tabbed_out = false
|
||||||
|
@ -13,6 +13,8 @@ local history_file = "console_history"
|
|||||||
|
|
||||||
local history_fullpath = nil
|
local history_fullpath = nil
|
||||||
|
|
||||||
|
local reset_subscription, stop_subscription
|
||||||
|
|
||||||
function console.startplugin()
|
function console.startplugin()
|
||||||
local conth = emu.thread()
|
local conth = emu.thread()
|
||||||
local ln_started = false
|
local ln_started = false
|
||||||
@ -220,16 +222,18 @@ function console.startplugin()
|
|||||||
return table.concat(result, '\001')
|
return table.concat(result, '\001')
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_start(function()
|
reset_subscription = emu.add_machine_reset_notifier(function ()
|
||||||
if not consolebuf and manager.machine.debugger then
|
if not consolebuf and manager.machine.debugger then
|
||||||
consolebuf = manager.machine.debugger.consolelog
|
consolebuf = manager.machine.debugger.consolelog
|
||||||
lastindex = 0
|
lastindex = 0
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_stop(function() consolebuf = nil end)
|
stop_subscription = emu.add_machine_stop_notifier(function ()
|
||||||
|
consolebuf = nil
|
||||||
|
end)
|
||||||
|
|
||||||
emu.register_periodic(function()
|
emu.register_periodic(function ()
|
||||||
if stopped then
|
if stopped then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -15,6 +15,8 @@ local data = exports
|
|||||||
|
|
||||||
local plugindir
|
local plugindir
|
||||||
|
|
||||||
|
local reset_subscription
|
||||||
|
|
||||||
function data.set_folder(path)
|
function data.set_folder(path)
|
||||||
plugindir = path
|
plugindir = path
|
||||||
end
|
end
|
||||||
@ -25,7 +27,7 @@ function data.startplugin()
|
|||||||
local cur_set
|
local cur_set
|
||||||
local cur_list
|
local cur_list
|
||||||
|
|
||||||
emu.register_start(
|
reset_subscription = emu.add_machine_reset_notifier(
|
||||||
function ()
|
function ()
|
||||||
data_scr = {}
|
data_scr = {}
|
||||||
for file in lfs.dir(plugindir) do
|
for file in lfs.dir(plugindir) do
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
-- license:BSD-3-Clause
|
-- license:BSD-3-Clause
|
||||||
-- copyright-holders:Carl
|
-- copyright-holders:Carl
|
||||||
local exports = {}
|
local exports = {
|
||||||
exports.name = "discord"
|
name = "discord",
|
||||||
exports.version = "0.0.1"
|
version = "0.0.1",
|
||||||
exports.description = "Discord presence"
|
description = "Discord presence",
|
||||||
exports.license = "BSD-3-Clause"
|
license = "BSD-3-Clause",
|
||||||
exports.author = { name = "Carl" }
|
author = { name = "Carl" } }
|
||||||
|
|
||||||
local discord = exports
|
local discord = exports
|
||||||
|
|
||||||
|
local reset_subscription, pause_subscription, resume_subscription
|
||||||
|
|
||||||
function discord.startplugin()
|
function discord.startplugin()
|
||||||
local pipe = emu.file("rw")
|
local pipe = emu.file("rw")
|
||||||
local json = require("json")
|
local json = require("json")
|
||||||
@ -98,16 +100,16 @@ function discord.startplugin()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_start(function()
|
reset_subscription = emu.add_machine_reset_notifier(function ()
|
||||||
starttime = os.time()
|
starttime = os.time()
|
||||||
update("Playing")
|
update("Playing")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_pause(function()
|
pause_subscription = emu.add_machine_pause_notifier(function ()
|
||||||
update("Paused")
|
update("Paused")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_resume(function()
|
resume_subscription = emu.add_machine_resume_notifier(function ()
|
||||||
update("Playing")
|
update("Playing")
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
@ -9,21 +9,25 @@ local exports = {
|
|||||||
|
|
||||||
local dummy = exports
|
local dummy = exports
|
||||||
|
|
||||||
function dummy.startplugin()
|
local reset_subscription, stop_subscription
|
||||||
emu.register_start(function()
|
|
||||||
emu.print_verbose("Starting " .. emu.gamename())
|
|
||||||
end)
|
|
||||||
|
|
||||||
emu.register_stop(function()
|
function dummy.startplugin()
|
||||||
emu.print_verbose("Exiting " .. emu.gamename())
|
reset_subscription = emu.add_machine_reset_notifier(
|
||||||
end)
|
function ()
|
||||||
|
emu.print_info("Starting " .. emu.gamename())
|
||||||
|
end)
|
||||||
|
|
||||||
|
stop_subscription = emu.add_machine_stop_notifier(
|
||||||
|
function ()
|
||||||
|
emu.print_info("Exiting " .. emu.gamename())
|
||||||
|
end)
|
||||||
|
|
||||||
local function menu_populate()
|
local function menu_populate()
|
||||||
return {{ "This is a", "test", "off" }, { "Also a", "test", "" }}
|
return {{ "This is a", "test", "off" }, { "Also a", "test", "" }}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function menu_callback(index, event)
|
local function menu_callback(index, event)
|
||||||
emu.print_verbose("index: " .. index .. " event: " .. event)
|
emu.print_info("index: " .. index .. " event: " .. event)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
-- license:BSD-3-Clause
|
-- license:BSD-3-Clause
|
||||||
-- copyright-holders: Carl
|
-- copyright-holders: Carl
|
||||||
local exports = {}
|
local exports = {
|
||||||
exports.name = "gdbstub"
|
name = "gdbstub",
|
||||||
exports.version = "0.0.1"
|
version = "0.0.1",
|
||||||
exports.description = "GDB stub plugin"
|
description = "GDB stub plugin",
|
||||||
exports.license = "BSD-3-Clause"
|
license = "BSD-3-Clause",
|
||||||
exports.author = { name = "Carl" }
|
author = { name = "Carl" } }
|
||||||
|
|
||||||
local gdbstub = exports
|
local gdbstub = exports
|
||||||
|
|
||||||
@ -25,6 +25,8 @@ local regmaps = {
|
|||||||
regmaps.i486 = regmaps.i386
|
regmaps.i486 = regmaps.i386
|
||||||
regmaps.pentium = regmaps.i386
|
regmaps.pentium = regmaps.i386
|
||||||
|
|
||||||
|
local reset_subscription, stop_subscription
|
||||||
|
|
||||||
function gdbstub.startplugin()
|
function gdbstub.startplugin()
|
||||||
local debugger
|
local debugger
|
||||||
local debug
|
local debug
|
||||||
@ -35,7 +37,7 @@ function gdbstub.startplugin()
|
|||||||
local consolelast
|
local consolelast
|
||||||
local running
|
local running
|
||||||
|
|
||||||
emu.register_start(function ()
|
reset_subscription = emu.add_machine_reset_notifier(function ()
|
||||||
debugger = manager.machine.debugger
|
debugger = manager.machine.debugger
|
||||||
if not debugger then
|
if not debugger then
|
||||||
print("gdbstub: debugger not enabled")
|
print("gdbstub: debugger not enabled")
|
||||||
@ -56,7 +58,7 @@ function gdbstub.startplugin()
|
|||||||
running = false
|
running = false
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_stop(function()
|
stop_subscription = emu.add_machine_stop_notifier(function ()
|
||||||
consolelog = nil
|
consolelog = nil
|
||||||
cpu = nil
|
cpu = nil
|
||||||
debug = nil
|
debug = nil
|
||||||
|
@ -14,7 +14,8 @@ local exports = {
|
|||||||
|
|
||||||
local hiscore = exports
|
local hiscore = exports
|
||||||
|
|
||||||
local hiscore_plugin_path = ""
|
local hiscore_plugin_path
|
||||||
|
local reset_subscription, frame_subscription, stop_subscription
|
||||||
|
|
||||||
function hiscore.set_folder(path)
|
function hiscore.set_folder(path)
|
||||||
hiscore_plugin_path = path
|
hiscore_plugin_path = path
|
||||||
@ -328,7 +329,7 @@ function hiscore.startplugin()
|
|||||||
scores_have_been_read = false;
|
scores_have_been_read = false;
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_start(function()
|
reset_subscription = emu.add_machine_reset_notifier(function ()
|
||||||
found_hiscore_entry = false
|
found_hiscore_entry = false
|
||||||
mem_check_passed = false
|
mem_check_passed = false
|
||||||
scores_have_been_read = false;
|
scores_have_been_read = false;
|
||||||
@ -354,18 +355,18 @@ function hiscore.startplugin()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_frame(function()
|
frame_subscription = emu.add_machine_frame_notifier(function ()
|
||||||
if found_hiscore_entry then
|
if found_hiscore_entry then
|
||||||
tick()
|
tick()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_stop(function()
|
stop_subscription = emu.add_machine_stop_notifier(function ()
|
||||||
reset()
|
reset()
|
||||||
save_config()
|
save_config()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_prestart(function()
|
emu.register_prestart(function ()
|
||||||
reset()
|
reset()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ local exports = {
|
|||||||
|
|
||||||
local inputmacro = exports
|
local inputmacro = exports
|
||||||
|
|
||||||
|
local frame_subscription, stop_subscription
|
||||||
|
|
||||||
function inputmacro.startplugin()
|
function inputmacro.startplugin()
|
||||||
--[[
|
--[[
|
||||||
Configuration data:
|
Configuration data:
|
||||||
@ -129,9 +131,9 @@ function inputmacro.startplugin()
|
|||||||
return menu:populate()
|
return menu:populate()
|
||||||
end
|
end
|
||||||
|
|
||||||
emu.register_frame(process_frame)
|
frame_subscription = emu.add_machine_frame_notifier(process_frame)
|
||||||
emu.register_prestart(start)
|
emu.register_prestart(start)
|
||||||
emu.register_stop(stop)
|
stop_subscription = emu.add_machine_stop_notifier(stop)
|
||||||
emu.register_menu(menu_callback, menu_populate, _p('plugin-inputmacro', 'Input Macros'))
|
emu.register_menu(menu_callback, menu_populate, _p('plugin-inputmacro', 'Input Macros'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,15 +2,17 @@
|
|||||||
-- copyright-holders:Carl
|
-- copyright-holders:Carl
|
||||||
-- Layout scripts should return a table and a string. The table can have two optional keys reset and frame
|
-- Layout scripts should return a table and a string. The table can have two optional keys reset and frame
|
||||||
-- which have functions for values called on reset and frame draw respectively and the string is a unique name.
|
-- which have functions for values called on reset and frame draw respectively and the string is a unique name.
|
||||||
local exports = {}
|
local exports = {
|
||||||
exports.name = "layout"
|
name = "layout",
|
||||||
exports.version = "0.0.1"
|
version = "0.0.1",
|
||||||
exports.description = "Layout helper plugin"
|
description = "Layout helper plugin",
|
||||||
exports.license = "BSD-3-Clause"
|
license = "BSD-3-Clause",
|
||||||
exports.author = { name = "Carl" }
|
author = { name = "Carl" } }
|
||||||
|
|
||||||
local layout = exports
|
local layout = exports
|
||||||
|
|
||||||
|
local frame_subscription, stop_subscription
|
||||||
|
|
||||||
function layout.startplugin()
|
function layout.startplugin()
|
||||||
local scripts = {}
|
local scripts = {}
|
||||||
local function prepare_layout(file, script)
|
local function prepare_layout(file, script)
|
||||||
@ -45,7 +47,7 @@ function layout.startplugin()
|
|||||||
end
|
end
|
||||||
|
|
||||||
emu.register_callback(prepare_layout, "layout")
|
emu.register_callback(prepare_layout, "layout")
|
||||||
emu.register_frame(function()
|
frame_subscription = emu.add_machine_frame_notifier(function ()
|
||||||
if manager.machine.paused then
|
if manager.machine.paused then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -55,14 +57,16 @@ function layout.startplugin()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
emu.register_start(function()
|
emu.register_prestart(function ()
|
||||||
for num, scr in pairs(scripts) do
|
for num, scr in pairs(scripts) do
|
||||||
if scr.reset then
|
if scr.reset then
|
||||||
scr.reset()
|
scr.reset()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
emu.register_stop(function() scripts = {} end)
|
stop_subscription = emu.add_machine_stop_notifier(function ()
|
||||||
|
scripts = {}
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return exports
|
return exports
|
||||||
|
@ -10,6 +10,8 @@ local exports = {
|
|||||||
|
|
||||||
local timecode = exports
|
local timecode = exports
|
||||||
|
|
||||||
|
local frame_subscription, stop_subscription
|
||||||
|
|
||||||
function timecode.startplugin()
|
function timecode.startplugin()
|
||||||
local file -- the timecode log file
|
local file -- the timecode log file
|
||||||
local write -- whether to record a timecode on the next emulated frame
|
local write -- whether to record a timecode on the next emulated frame
|
||||||
@ -338,10 +340,10 @@ function timecode.startplugin()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
emu.register_frame(process_frame)
|
frame_subscription = emu.add_machine_frame_notifier(process_frame)
|
||||||
emu.register_frame_done(process_frame_done)
|
emu.register_frame_done(process_frame_done)
|
||||||
emu.register_prestart(start)
|
emu.register_prestart(start)
|
||||||
emu.register_stop(stop)
|
stop_subscription = emu.add_machine_stop_notifier(stop)
|
||||||
emu.register_menu(menu_callback, menu_populate, _p('plugin-timecode', 'Timecode Recorder'))
|
emu.register_menu(menu_callback, menu_populate, _p('plugin-timecode', 'Timecode Recorder'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
-- license:BSD-3-Clause
|
-- license:BSD-3-Clause
|
||||||
-- copyright-holders:Vas Crabb
|
-- copyright-holders:Vas Crabb
|
||||||
|
-- TODO: track time properly across soft reset and state load
|
||||||
local exports = {
|
local exports = {
|
||||||
name = 'timer',
|
name = 'timer',
|
||||||
version = '0.0.3',
|
version = '0.0.3',
|
||||||
@ -9,6 +10,8 @@ local exports = {
|
|||||||
|
|
||||||
local timer = exports
|
local timer = exports
|
||||||
|
|
||||||
|
local reset_subscription, stop_subscription
|
||||||
|
|
||||||
function timer.startplugin()
|
function timer.startplugin()
|
||||||
local total_time = 0
|
local total_time = 0
|
||||||
local start_time = 0
|
local start_time = 0
|
||||||
@ -53,8 +56,8 @@ function timer.startplugin()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
emu.register_start(
|
reset_subscription = emu.add_machine_reset_notifier(
|
||||||
function()
|
function ()
|
||||||
if emu.romname() ~= '___empty' then
|
if emu.romname() ~= '___empty' then
|
||||||
start_time = os.time()
|
start_time = os.time()
|
||||||
local persister = require('timer/timer_persist')
|
local persister = require('timer/timer_persist')
|
||||||
@ -62,8 +65,8 @@ function timer.startplugin()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
emu.register_stop(
|
stop_subscription = emu.add_machine_stop_notifier(
|
||||||
function()
|
function ()
|
||||||
if emu.romname() ~= '___empty' then
|
if emu.romname() ~= '___empty' then
|
||||||
local persister = require('timer/timer_persist')
|
local persister = require('timer/timer_persist')
|
||||||
persister:update_totals(start_time)
|
persister:update_totals(start_time)
|
||||||
|
@ -84,7 +84,7 @@ bool mcd_isa_device::read_sector(bool first)
|
|||||||
if(m_cdrom_handle->get_track_type(m_cdrom_handle->get_track(lba)) == cdrom_file::CD_TRACK_AUDIO)
|
if(m_cdrom_handle->get_track_type(m_cdrom_handle->get_track(lba)) == cdrom_file::CD_TRACK_AUDIO)
|
||||||
{
|
{
|
||||||
m_cdda->stop_audio();
|
m_cdda->stop_audio();
|
||||||
m_cdda->set_cdrom(m_cdrom_handle);
|
m_cdda->set_cdrom(get_cdrom_file());
|
||||||
m_cdda->start_audio(lba, m_readcount);
|
m_cdda->start_audio(lba, m_readcount);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
// construction/destruction
|
// construction/destruction
|
||||||
pc11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
pc11_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual const char *image_interface() const noexcept override { return "pdp11_ptap"; }
|
virtual const char *image_interface() const noexcept override { return "pdp11_ptap"; }
|
||||||
virtual const char *file_extensions() const noexcept override { return "bin,bim,lda"; }
|
virtual const char *file_extensions() const noexcept override { return "bin,bim,lda"; }
|
||||||
|
|
||||||
@ -47,11 +47,11 @@ public:
|
|||||||
void write(offs_t offset, uint16_t data);
|
void write(offs_t offset, uint16_t data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
|
|
||||||
// device_z80daisy_interface overrides
|
// device_z80daisy_interface implementation
|
||||||
virtual int z80daisy_irq_state() override;
|
virtual int z80daisy_irq_state() override;
|
||||||
virtual int z80daisy_irq_ack() override;
|
virtual int z80daisy_irq_ack() override;
|
||||||
virtual void z80daisy_irq_reti() override;
|
virtual void z80daisy_irq_reti() override;
|
||||||
@ -81,4 +81,4 @@ private:
|
|||||||
// device type definition
|
// device type definition
|
||||||
DECLARE_DEVICE_TYPE(DEC_PC11, pc11_device)
|
DECLARE_DEVICE_TYPE(DEC_PC11, pc11_device)
|
||||||
|
|
||||||
#endif
|
#endif // MAME_BUS_QBUS_PC11_H
|
||||||
|
@ -145,10 +145,9 @@ std::error_condition sat_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
// from fullpath, only ROM carts
|
// from fullpath, only ROM carts
|
||||||
uint32_t len = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
uint32_t len = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
||||||
uint32_t *ROM;
|
|
||||||
|
|
||||||
m_cart->rom_alloc(len);
|
m_cart->rom_alloc(len);
|
||||||
ROM = m_cart->get_rom_base();
|
uint32_t *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (loaded_through_softlist())
|
if (loaded_through_softlist())
|
||||||
memcpy(ROM, get_software_region("rom"), len);
|
memcpy(ROM, get_software_region("rom"), len);
|
||||||
@ -157,15 +156,7 @@ std::error_condition sat_cart_slot_device::call_load()
|
|||||||
|
|
||||||
// fix endianness....
|
// fix endianness....
|
||||||
for (int i = 0; i < len/4; i ++)
|
for (int i = 0; i < len/4; i ++)
|
||||||
ROM[i] = bitswap<32>(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
|
ROM[i] = big_endianize_int32(ROM[i]);
|
||||||
// {
|
|
||||||
// uint8_t tempa = ROM[i+0];
|
|
||||||
// uint8_t tempb = ROM[i+1];
|
|
||||||
// ROM[i+1] = ROM[i+2];
|
|
||||||
// ROM[i+0] = ROM[i+3];
|
|
||||||
// ROM[i+3] = tempa;
|
|
||||||
// ROM[i+2] = tempb;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -177,7 +168,6 @@ std::error_condition sat_cart_slot_device::call_load()
|
|||||||
if (get_software_region("dram1"))
|
if (get_software_region("dram1"))
|
||||||
m_cart->dram1_alloc(get_software_region_length("dram1"));
|
m_cart->dram1_alloc(get_software_region_length("dram1"));
|
||||||
}
|
}
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -151,9 +151,8 @@ std::error_condition scv_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint8_t *ROM;
|
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||||
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
bool const has_ram = loaded_through_softlist() && get_software_region("ram");
|
||||||
bool has_ram = loaded_through_softlist() && get_software_region("ram");
|
|
||||||
|
|
||||||
if (len > 0x20000)
|
if (len > 0x20000)
|
||||||
{
|
{
|
||||||
@ -165,7 +164,7 @@ std::error_condition scv_cart_slot_device::call_load()
|
|||||||
if (has_ram)
|
if (has_ram)
|
||||||
m_cart->ram_alloc(get_software_region_length("ram"));
|
m_cart->ram_alloc(get_software_region_length("ram"));
|
||||||
|
|
||||||
ROM = m_cart->get_rom_base();
|
uint8_t *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
fread(ROM, len);
|
fread(ROM, len);
|
||||||
@ -189,8 +188,6 @@ std::error_condition scv_cart_slot_device::call_load()
|
|||||||
m_type = SCV_128K_RAM;
|
m_type = SCV_128K_RAM;
|
||||||
|
|
||||||
//printf("Type: %s\n", scv_get_slot(m_type));
|
//printf("Type: %s\n", scv_get_slot(m_type));
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -24,11 +24,11 @@ sdk85_romexp_device::sdk85_romexp_device(const machine_config &mconfig, const ch
|
|||||||
|
|
||||||
std::error_condition sdk85_romexp_device::call_load()
|
std::error_condition sdk85_romexp_device::call_load()
|
||||||
{
|
{
|
||||||
if (get_card_device() != nullptr)
|
if (get_card_device())
|
||||||
{
|
{
|
||||||
u32 size = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
u32 const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
||||||
u8 *base = get_card_device()->get_rom_base(size);
|
u8 *const base = get_card_device()->get_rom_base(size);
|
||||||
if (base == nullptr)
|
if (!base)
|
||||||
return image_error::INTERNAL;
|
return image_error::INTERNAL;
|
||||||
|
|
||||||
if (loaded_through_softlist())
|
if (loaded_through_softlist())
|
||||||
|
@ -395,8 +395,6 @@ std::error_condition sega8_cart_slot_device::call_load()
|
|||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||||
uint32_t offset = 0;
|
|
||||||
uint8_t *ROM;
|
|
||||||
|
|
||||||
if (m_is_card && len > 0x8000)
|
if (m_is_card && len > 0x8000)
|
||||||
{
|
{
|
||||||
@ -405,18 +403,19 @@ std::error_condition sega8_cart_slot_device::call_load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for header
|
// check for header
|
||||||
|
uint32_t offset = 0;
|
||||||
if ((len % 0x4000) == 512)
|
if ((len % 0x4000) == 512)
|
||||||
{
|
{
|
||||||
offset = 512;
|
offset = 512;
|
||||||
len -= 512;
|
len -= 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure that we only get complete (0x4000) rom banks
|
// make sure that we only get complete (0x4000) ROM banks
|
||||||
if (len & 0x3fff)
|
if (len & 0x3fff)
|
||||||
len = ((len >> 14) + 1) << 14;
|
len = ((len >> 14) + 1) << 14;
|
||||||
|
|
||||||
m_cart->rom_alloc(len);
|
m_cart->rom_alloc(len);
|
||||||
ROM = m_cart->get_rom_base();
|
uint8_t *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
@ -426,7 +425,7 @@ std::error_condition sega8_cart_slot_device::call_load()
|
|||||||
else
|
else
|
||||||
memcpy(ROM, get_software_region("rom"), get_software_region_length("rom"));
|
memcpy(ROM, get_software_region("rom"), get_software_region_length("rom"));
|
||||||
|
|
||||||
/* check the image */
|
// check the image
|
||||||
if (verify_cart(ROM, len))
|
if (verify_cart(ROM, len))
|
||||||
logerror("Warning loading image: verify_cart failed\n");
|
logerror("Warning loading image: verify_cart failed\n");
|
||||||
|
|
||||||
@ -455,8 +454,6 @@ std::error_condition sega8_cart_slot_device::call_load()
|
|||||||
//printf("Type: %s\n", sega8_get_slot(type));
|
//printf("Type: %s\n", sega8_get_slot(type));
|
||||||
|
|
||||||
internal_header_logging(ROM + offset, len, m_cart->get_ram_size());
|
internal_header_logging(ROM + offset, len, m_cart->get_ram_size());
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -653,11 +653,8 @@ std::error_condition base_sns_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint8_t *ROM;
|
// Check for a header (512 bytes), and skip it if found
|
||||||
uint32_t len, offset = 0;
|
uint32_t offset = 0;
|
||||||
const char *slot_name;
|
|
||||||
|
|
||||||
/* Check for a header (512 bytes), and skip it if found */
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
uint32_t tmplen = length();
|
uint32_t tmplen = length();
|
||||||
@ -667,10 +664,10 @@ std::error_condition base_sns_cart_slot_device::call_load()
|
|||||||
fseek(offset, SEEK_SET);
|
fseek(offset, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = !loaded_through_softlist() ? (length() - offset) : get_software_region_length("rom");
|
uint32_t const len = !loaded_through_softlist() ? (length() - offset) : get_software_region_length("rom");
|
||||||
|
|
||||||
m_cart->rom_alloc(len);
|
m_cart->rom_alloc(len);
|
||||||
ROM = m_cart->get_rom_base();
|
uint8_t *const ROM = m_cart->get_rom_base();
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
fread(ROM, len);
|
fread(ROM, len);
|
||||||
else
|
else
|
||||||
@ -693,13 +690,14 @@ std::error_condition base_sns_cart_slot_device::call_load()
|
|||||||
get_cart_type_addon(ROM, len, m_type, m_addon);
|
get_cart_type_addon(ROM, len, m_type, m_addon);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
const char *slot_name;
|
||||||
if ((slot_name = get_feature("slot")) == nullptr)
|
if ((slot_name = get_feature("slot")) == nullptr)
|
||||||
m_type = SNES_MODE20;
|
m_type = SNES_MODE20;
|
||||||
else
|
else
|
||||||
m_type = sns_get_pcb_id(slot_name);
|
m_type = sns_get_pcb_id(slot_name);
|
||||||
|
|
||||||
if (m_type == SNES_DSP && len > 0x100000)
|
if (m_type == SNES_DSP && len > 0x100000)
|
||||||
m_type = SNES_DSP_2MB;
|
m_type = SNES_DSP_2MB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
@ -725,8 +723,6 @@ std::error_condition base_sns_cart_slot_device::call_load()
|
|||||||
//printf("Type %d\n", m_type);
|
//printf("Type %d\n", m_type);
|
||||||
|
|
||||||
internal_header_logging(ROM, len);
|
internal_header_logging(ROM, len);
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -96,7 +96,7 @@ void spectrum_intf2_device::device_start()
|
|||||||
|
|
||||||
DEVICE_IMAGE_LOAD_MEMBER(spectrum_intf2_device::cart_load)
|
DEVICE_IMAGE_LOAD_MEMBER(spectrum_intf2_device::cart_load)
|
||||||
{
|
{
|
||||||
uint32_t size = m_cart->common_get_size("rom");
|
uint32_t const size = m_cart->common_get_size("rom");
|
||||||
|
|
||||||
if (size != 0x4000)
|
if (size != 0x4000)
|
||||||
{
|
{
|
||||||
|
@ -895,14 +895,14 @@ public:
|
|||||||
// construction/destruction
|
// construction/destruction
|
||||||
ti990_tape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
ti990_tape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual const char *file_extensions() const noexcept override { return "tap"; }
|
virtual const char *file_extensions() const noexcept override { return "tap"; }
|
||||||
|
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -172,7 +172,7 @@ std::error_condition vc4000_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||||
|
|
||||||
if (size > 0x1800)
|
if (size > 0x1800)
|
||||||
{
|
{
|
||||||
@ -210,8 +210,6 @@ std::error_condition vc4000_cart_slot_device::call_load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//printf("Type: %s\n", vc4000_get_slot(m_type));
|
//printf("Type: %s\n", vc4000_get_slot(m_type));
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -226,7 +226,7 @@ std::error_condition vcs_cart_slot_device::call_load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_cart->rom_alloc(len, tag());
|
m_cart->rom_alloc(len, tag());
|
||||||
uint8_t *ROM = m_cart->get_rom_base();
|
uint8_t *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (loaded_through_softlist())
|
if (loaded_through_softlist())
|
||||||
{
|
{
|
||||||
@ -310,8 +310,6 @@ std::error_condition vcs_cart_slot_device::call_load()
|
|||||||
m_cart->setup_addon_ptr((uint8_t *)m_cart->get_rom_base() + 0x2000);
|
m_cart->setup_addon_ptr((uint8_t *)m_cart->get_rom_base() + 0x2000);
|
||||||
|
|
||||||
m_cart->install_memory_handlers(m_address_space.target());
|
m_cart->install_memory_handlers(m_address_space.target());
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
|
|
||||||
template <typename T> void set_address_space(T &&tag, int no) { m_address_space.set_tag(std::forward<T>(tag), no); }
|
template <typename T> void set_address_space(T &&tag, int no) { m_address_space.set_tag(std::forward<T>(tag), no); }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -39,18 +39,18 @@ public:
|
|||||||
virtual const char *image_interface() const noexcept override { return "a2600_cart"; }
|
virtual const char *image_interface() const noexcept override { return "a2600_cart"; }
|
||||||
virtual const char *file_extensions() const noexcept override { return "bin,a26"; }
|
virtual const char *file_extensions() const noexcept override { return "bin,a26"; }
|
||||||
|
|
||||||
// slot interface overrides
|
// device_slot_interface implementation
|
||||||
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
||||||
|
|
||||||
int get_cart_type() { return m_type; }
|
int get_cart_type() { return m_type; }
|
||||||
static int identify_cart_type(const uint8_t *ROM, uint32_t len);
|
static int identify_cart_type(const uint8_t *ROM, uint32_t len);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_vcs_cart_interface* m_cart;
|
device_vcs_cart_interface *m_cart;
|
||||||
int m_type;
|
int m_type;
|
||||||
optional_address_space m_address_space;
|
optional_address_space m_address_space;
|
||||||
|
|
||||||
|
@ -140,8 +140,7 @@ std::error_condition vectrex_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||||
uint8_t *ROM;
|
|
||||||
|
|
||||||
if (size > 0x10000)
|
if (size > 0x10000)
|
||||||
{
|
{
|
||||||
@ -150,7 +149,7 @@ std::error_condition vectrex_cart_slot_device::call_load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_cart->rom_alloc((size < 0x1000) ? 0x1000 : size);
|
m_cart->rom_alloc((size < 0x1000) ? 0x1000 : size);
|
||||||
ROM = m_cart->get_rom_base();
|
uint8_t *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
fread(ROM, size);
|
fread(ROM, size);
|
||||||
|
@ -90,11 +90,9 @@ std::error_condition vic10_expansion_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_card)
|
if (m_card)
|
||||||
{
|
{
|
||||||
size_t size;
|
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
size = length();
|
size_t const size = length();
|
||||||
|
|
||||||
if (is_filetype("80"))
|
if (is_filetype("80"))
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@ std::error_condition vic20_expansion_slot_device::call_load()
|
|||||||
// read the header
|
// read the header
|
||||||
uint8_t header[2];
|
uint8_t header[2];
|
||||||
fread(&header, 2);
|
fread(&header, 2);
|
||||||
uint16_t address = (header[1] << 8) | header[0];
|
uint16_t const address = (header[1] << 8) | header[0];
|
||||||
|
|
||||||
switch (address)
|
switch (address)
|
||||||
{
|
{
|
||||||
|
@ -109,21 +109,21 @@ std::error_condition videobrain_expansion_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
size_t size;
|
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
size = length();
|
size_t const romsize = length();
|
||||||
|
|
||||||
fread(m_cart->videobrain_rom_pointer(machine(), size), size);
|
fread(m_cart->videobrain_rom_pointer(machine(), romsize), romsize);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = get_software_region_length("rom");
|
size_t const romsize = get_software_region_length("rom");
|
||||||
if (size) memcpy(m_cart->videobrain_rom_pointer(machine(), size), get_software_region("rom"), size);
|
if (romsize)
|
||||||
|
memcpy(m_cart->videobrain_rom_pointer(machine(), romsize), get_software_region("rom"), romsize);
|
||||||
|
|
||||||
size = get_software_region_length("ram");
|
size_t const ramsize = get_software_region_length("ram");
|
||||||
if (size) memset(m_cart->videobrain_ram_pointer(machine(), size), 0, size);
|
if (ramsize)
|
||||||
|
memset(m_cart->videobrain_ram_pointer(machine(), ramsize), 0, ramsize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,15 +136,15 @@ std::error_condition vsmile_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint32_t size = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
uint32_t const size = loaded_through_softlist() ? get_software_region_length("rom") : length();
|
||||||
if (size > 0x1000000)
|
if (size > 0x100'0000)
|
||||||
{
|
{
|
||||||
osd_printf_error("%s: Attempted loading a cart larger than 16MB\n", basename());
|
osd_printf_error("%s: Attempted loading a cart larger than 16MB\n", basename());
|
||||||
return image_error::INVALIDLENGTH;
|
return image_error::INVALIDLENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_cart->rom_alloc(size);
|
m_cart->rom_alloc(size);
|
||||||
uint8_t *rom = (uint8_t *)m_cart->get_rom_base();
|
uint8_t *const rom = (uint8_t *)m_cart->get_rom_base();
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
@ -164,16 +164,10 @@ std::error_condition vsmile_cart_slot_device::call_load()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_type == VSMILE_NVRAM)
|
if (m_type == VSMILE_NVRAM)
|
||||||
{
|
m_cart->nvram_alloc(0x20'0000);
|
||||||
m_cart->nvram_alloc(0x200000);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_cart->get_nvram_size())
|
if (m_cart->get_nvram_size())
|
||||||
{
|
|
||||||
battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
|
battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00);
|
||||||
}
|
|
||||||
|
|
||||||
return std::error_condition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
|
@ -154,18 +154,17 @@ std::error_condition ws_cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
u16 *ROM;
|
u32 const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
||||||
u32 size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
|
|
||||||
u32 nvram_size = 0;
|
|
||||||
|
|
||||||
m_cart->rom_alloc(size);
|
m_cart->rom_alloc(size);
|
||||||
ROM = m_cart->get_rom_base();
|
u16 *const ROM = m_cart->get_rom_base();
|
||||||
|
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
fread(ROM, size);
|
fread(ROM, size);
|
||||||
else
|
else
|
||||||
memcpy(ROM, get_software_region("rom"), size);
|
memcpy(ROM, get_software_region("rom"), size);
|
||||||
|
|
||||||
|
u32 nvram_size = 0;
|
||||||
if (!loaded_through_softlist())
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
// get cart type and nvram length
|
// get cart type and nvram length
|
||||||
|
@ -145,7 +145,7 @@ public:
|
|||||||
ws_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
ws_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
virtual ~ws_cart_slot_device();
|
virtual ~ws_cart_slot_device();
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public:
|
|||||||
virtual const char *image_interface() const noexcept override { return "wswan_cart"; }
|
virtual const char *image_interface() const noexcept override { return "wswan_cart"; }
|
||||||
virtual const char *file_extensions() const noexcept override { return "ws,wsc,bin"; }
|
virtual const char *file_extensions() const noexcept override { return "ws,wsc,bin"; }
|
||||||
|
|
||||||
// slot interface overrides
|
// device_slot_interface implementation
|
||||||
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
||||||
|
|
||||||
int get_type() { return m_type; }
|
int get_type() { return m_type; }
|
||||||
@ -172,11 +172,11 @@ public:
|
|||||||
virtual void write_io(offs_t offset, u16 data, u16 mem_mask);
|
virtual void write_io(offs_t offset, u16 data, u16 mem_mask);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
|
||||||
int m_type;
|
int m_type;
|
||||||
device_ws_cart_interface* m_cart;
|
device_ws_cart_interface *m_cart;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,24 +99,19 @@ std::error_condition z88cart_slot_device::call_load()
|
|||||||
{
|
{
|
||||||
if (m_cart)
|
if (m_cart)
|
||||||
{
|
{
|
||||||
uint8_t *cart_base = m_cart->get_cart_base();
|
uint8_t *const cart_base = m_cart->get_cart_base();
|
||||||
|
if (!cart_base)
|
||||||
|
return image_error::INTERNAL;
|
||||||
|
|
||||||
if (cart_base != nullptr)
|
if (!loaded_through_softlist())
|
||||||
{
|
{
|
||||||
if (!loaded_through_softlist())
|
offs_t read_length = length();
|
||||||
{
|
fread(cart_base + (m_cart->get_cart_size() - read_length), read_length);
|
||||||
offs_t read_length = length();
|
|
||||||
fread(cart_base + (m_cart->get_cart_size() - read_length), read_length);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offs_t read_length = get_software_region_length("rom");
|
|
||||||
memcpy(cart_base + (m_cart->get_cart_size() - read_length), get_software_region("rom"), read_length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return image_error::INTERNAL;
|
offs_t read_length = get_software_region_length("rom");
|
||||||
|
memcpy(cart_base + (m_cart->get_cart_size() - read_length), get_software_region("rom"), read_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public:
|
|||||||
|
|
||||||
auto out_flp_callback() { return m_out_flp_cb.bind(); }
|
auto out_flp_callback() { return m_out_flp_cb.bind(); }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ public:
|
|||||||
virtual const char *image_interface() const noexcept override { return "z88_cart"; }
|
virtual const char *image_interface() const noexcept override { return "z88_cart"; }
|
||||||
virtual const char *file_extensions() const noexcept override { return "epr,bin"; }
|
virtual const char *file_extensions() const noexcept override { return "epr,bin"; }
|
||||||
|
|
||||||
// slot interface overrides
|
// device_slot_interface implementation
|
||||||
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
|
||||||
|
|
||||||
// reading and writing
|
// reading and writing
|
||||||
@ -122,7 +122,7 @@ public:
|
|||||||
uint8_t* get_cart_base();
|
uint8_t* get_cart_base();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
|
||||||
TIMER_CALLBACK_MEMBER(close_flap);
|
TIMER_CALLBACK_MEMBER(close_flap);
|
||||||
|
@ -26,8 +26,8 @@ DEFINE_DEVICE_TYPE(IMAGE_AVIVIDEO, avivideo_image_device, "avivideo_image", "AVI
|
|||||||
avivideo_image_device::avivideo_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
avivideo_image_device::avivideo_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||||
device_t(mconfig, IMAGE_AVIVIDEO, tag, owner, clock),
|
device_t(mconfig, IMAGE_AVIVIDEO, tag, owner, clock),
|
||||||
device_image_interface(mconfig, *this),
|
device_image_interface(mconfig, *this),
|
||||||
m_frame(nullptr),
|
m_frame(),
|
||||||
m_avi(nullptr),
|
m_avi(),
|
||||||
m_frame_timer(nullptr),
|
m_frame_timer(nullptr),
|
||||||
m_frame_count(0),
|
m_frame_count(0),
|
||||||
m_frame_num(0)
|
m_frame_num(0)
|
||||||
@ -60,7 +60,7 @@ void avivideo_image_device::device_reset()
|
|||||||
|
|
||||||
TIMER_CALLBACK_MEMBER(avivideo_image_device::frame_timer)
|
TIMER_CALLBACK_MEMBER(avivideo_image_device::frame_timer)
|
||||||
{
|
{
|
||||||
if (m_avi != nullptr)
|
if (m_avi)
|
||||||
{
|
{
|
||||||
avi_file::error avierr = m_avi->read_uncompressed_video_frame(m_frame_num, *m_frame);
|
avi_file::error avierr = m_avi->read_uncompressed_video_frame(m_frame_num, *m_frame);
|
||||||
if (avierr != avi_file::error::NONE)
|
if (avierr != avi_file::error::NONE)
|
||||||
@ -82,12 +82,11 @@ TIMER_CALLBACK_MEMBER(avivideo_image_device::frame_timer)
|
|||||||
|
|
||||||
std::error_condition avivideo_image_device::call_load()
|
std::error_condition avivideo_image_device::call_load()
|
||||||
{
|
{
|
||||||
m_frame = new bitmap_argb32;
|
m_frame.reset(new bitmap_argb32);
|
||||||
avi_file::error avierr = avi_file::open(filename(), m_avi);
|
avi_file::error avierr = avi_file::open(filename(), m_avi);
|
||||||
if (avierr != avi_file::error::NONE)
|
if (avierr != avi_file::error::NONE)
|
||||||
{
|
{
|
||||||
delete m_frame;
|
m_frame.reset();
|
||||||
m_frame = nullptr;
|
|
||||||
return image_error::UNSPECIFIED;
|
return image_error::UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,14 +101,6 @@ std::error_condition avivideo_image_device::call_load()
|
|||||||
|
|
||||||
void avivideo_image_device::call_unload()
|
void avivideo_image_device::call_unload()
|
||||||
{
|
{
|
||||||
if (m_frame)
|
m_frame.reset();
|
||||||
{
|
m_avi.reset();
|
||||||
delete m_frame;
|
|
||||||
m_frame = nullptr;
|
|
||||||
}
|
|
||||||
if (m_avi)
|
|
||||||
{
|
|
||||||
m_avi.release();
|
|
||||||
m_avi = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "bitmap.h"
|
|
||||||
#include "aviio.h"
|
#include "aviio.h"
|
||||||
|
#include "bitmap.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
@ -51,7 +57,7 @@ protected:
|
|||||||
TIMER_CALLBACK_MEMBER(frame_timer);
|
TIMER_CALLBACK_MEMBER(frame_timer);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bitmap_argb32 *m_frame;
|
std::unique_ptr<bitmap_argb32> m_frame;
|
||||||
avi_file::ptr m_avi;
|
avi_file::ptr m_avi;
|
||||||
|
|
||||||
emu_timer *m_frame_timer;
|
emu_timer *m_frame_timer;
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
void set_default_state(cassette_state default_state) { m_default_state = default_state; }
|
void set_default_state(cassette_state default_state) { m_default_state = default_state; }
|
||||||
void set_interface(const char *interface) { m_interface = interface; }
|
void set_interface(const char *interface) { m_interface = interface; }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
|
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
@ -105,7 +105,7 @@ public:
|
|||||||
device_sound_interface& set_stereo() { m_stereo = true; return *this; }
|
device_sound_interface& set_stereo() { m_stereo = true; return *this; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_config_complete() override;
|
virtual void device_config_complete() override;
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual bool use_software_list_file_extension_for_filetype() const noexcept override { return true; }
|
virtual bool use_software_list_file_extension_for_filetype() const noexcept override { return true; }
|
||||||
|
@ -27,11 +27,11 @@ cdrom_image_device::cdrom_image_device(const machine_config &mconfig, const char
|
|||||||
}
|
}
|
||||||
|
|
||||||
cdrom_image_device::cdrom_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
cdrom_image_device::cdrom_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: device_t(mconfig, type, tag, owner, clock),
|
: device_t(mconfig, type, tag, owner, clock)
|
||||||
device_image_interface(mconfig, *this),
|
, device_image_interface(mconfig, *this)
|
||||||
m_cdrom_handle(nullptr),
|
, m_cdrom_handle()
|
||||||
m_extension_list(nullptr),
|
, m_extension_list(nullptr)
|
||||||
m_interface(nullptr)
|
, m_interface(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -62,22 +62,17 @@ void cdrom_image_device::device_config_complete()
|
|||||||
void cdrom_image_device::device_start()
|
void cdrom_image_device::device_start()
|
||||||
{
|
{
|
||||||
// try to locate the CHD from a DISK_REGION
|
// try to locate the CHD from a DISK_REGION
|
||||||
chd_file *chd = machine().rom_load().get_disk_handle(owner()->tag() );
|
chd_file *chd = machine().rom_load().get_disk_handle(owner()->tag());
|
||||||
if( chd != nullptr )
|
if (chd)
|
||||||
{
|
m_cdrom_handle.reset(new cdrom_file(chd));
|
||||||
m_cdrom_handle = new cdrom_file( chd );
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
m_cdrom_handle.reset();
|
||||||
m_cdrom_handle = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cdrom_image_device::device_stop()
|
void cdrom_image_device::device_stop()
|
||||||
{
|
{
|
||||||
if (m_cdrom_handle)
|
m_cdrom_handle.reset();
|
||||||
delete m_cdrom_handle;
|
if (m_self_chd.opened())
|
||||||
if( m_self_chd.opened() )
|
|
||||||
m_self_chd.close();
|
m_self_chd.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +81,7 @@ std::error_condition cdrom_image_device::call_load()
|
|||||||
std::error_condition err;
|
std::error_condition err;
|
||||||
chd_file *chd = nullptr;
|
chd_file *chd = nullptr;
|
||||||
|
|
||||||
if (m_cdrom_handle)
|
m_cdrom_handle.reset();
|
||||||
delete m_cdrom_handle;
|
|
||||||
|
|
||||||
if (!loaded_through_softlist()) {
|
if (!loaded_through_softlist()) {
|
||||||
if (is_filetype("chd") && is_loaded()) {
|
if (is_filetype("chd") && is_loaded()) {
|
||||||
@ -103,12 +97,12 @@ std::error_condition cdrom_image_device::call_load()
|
|||||||
chd = device().machine().rom_load().get_disk_handle(device().subtag("cdrom").c_str());
|
chd = device().machine().rom_load().get_disk_handle(device().subtag("cdrom").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open the CHD file */
|
// open the CHD file
|
||||||
if (chd) {
|
if (chd)
|
||||||
m_cdrom_handle = new cdrom_file(chd);
|
m_cdrom_handle.reset(new cdrom_file(chd));
|
||||||
} else {
|
else
|
||||||
m_cdrom_handle = new cdrom_file(filename());
|
m_cdrom_handle.reset(new cdrom_file(filename()));
|
||||||
}
|
|
||||||
if (!m_cdrom_handle)
|
if (!m_cdrom_handle)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -126,8 +120,7 @@ error:
|
|||||||
void cdrom_image_device::call_unload()
|
void cdrom_image_device::call_unload()
|
||||||
{
|
{
|
||||||
assert(m_cdrom_handle);
|
assert(m_cdrom_handle);
|
||||||
delete m_cdrom_handle;
|
m_cdrom_handle.reset();
|
||||||
m_cdrom_handle = nullptr;
|
if (m_self_chd.opened())
|
||||||
if( m_self_chd.opened() )
|
|
||||||
m_self_chd.close();
|
m_self_chd.close();
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cdrom.h"
|
|
||||||
#include "softlist_dev.h"
|
#include "softlist_dev.h"
|
||||||
|
|
||||||
|
#include "cdrom.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -32,7 +39,7 @@ public:
|
|||||||
|
|
||||||
void set_interface(const char *interface) { m_interface = interface; }
|
void set_interface(const char *interface) { m_interface = interface; }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -46,12 +53,12 @@ public:
|
|||||||
virtual const char *image_brief_type_name() const noexcept override { return "cdrm"; }
|
virtual const char *image_brief_type_name() const noexcept override { return "cdrm"; }
|
||||||
|
|
||||||
// specific implementation
|
// specific implementation
|
||||||
cdrom_file *get_cdrom_file() { return m_cdrom_handle; }
|
cdrom_file *get_cdrom_file() { return m_cdrom_handle.get(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
cdrom_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
cdrom_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_config_complete() override;
|
virtual void device_config_complete() override;
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_stop() override;
|
virtual void device_stop() override;
|
||||||
@ -60,7 +67,7 @@ protected:
|
|||||||
virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
|
virtual const software_list_loader &get_software_list_loader() const override { return rom_software_list_loader::instance(); }
|
||||||
|
|
||||||
chd_file m_self_chd;
|
chd_file m_self_chd;
|
||||||
cdrom_file *m_cdrom_handle;
|
std::unique_ptr<cdrom_file> m_cdrom_handle;
|
||||||
const char *m_extension_list;
|
const char *m_extension_list;
|
||||||
const char *m_interface;
|
const char *m_interface;
|
||||||
};
|
};
|
||||||
|
@ -35,12 +35,12 @@ DEFINE_DEVICE_TYPE(DIABLO, diablo_image_device, "diablo_image", "Diablo")
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
diablo_image_device::diablo_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
diablo_image_device::diablo_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: harddisk_image_base_device(mconfig, DIABLO, tag, owner, clock),
|
: harddisk_image_base_device(mconfig, DIABLO, tag, owner, clock)
|
||||||
m_chd(nullptr),
|
, m_chd(nullptr)
|
||||||
m_hard_disk_handle(nullptr),
|
, m_hard_disk_handle()
|
||||||
m_device_image_load(*this),
|
, m_device_image_load(*this)
|
||||||
m_device_image_unload(*this),
|
, m_device_image_unload(*this)
|
||||||
m_interface(nullptr)
|
, m_interface(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,20 +81,15 @@ void diablo_image_device::device_start()
|
|||||||
|
|
||||||
// try to locate the CHD from a DISK_REGION
|
// try to locate the CHD from a DISK_REGION
|
||||||
chd_file *handle = machine().rom_load().get_disk_handle(tag());
|
chd_file *handle = machine().rom_load().get_disk_handle(tag());
|
||||||
if (handle != nullptr)
|
if (handle)
|
||||||
{
|
m_hard_disk_handle.reset(new hard_disk_file(handle));
|
||||||
m_hard_disk_handle = new hard_disk_file(handle);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
m_hard_disk_handle.reset();
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void diablo_image_device::device_stop()
|
void diablo_image_device::device_stop()
|
||||||
{
|
{
|
||||||
if (m_hard_disk_handle)
|
m_hard_disk_handle.reset();
|
||||||
delete m_hard_disk_handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_condition diablo_image_device::call_load()
|
std::error_condition diablo_image_device::call_load()
|
||||||
@ -146,17 +141,11 @@ std::error_condition diablo_image_device::call_create(int create_format, util::o
|
|||||||
|
|
||||||
void diablo_image_device::call_unload()
|
void diablo_image_device::call_unload()
|
||||||
{
|
{
|
||||||
/* Check if there is an image_unload callback defined */
|
// Check if there is an image_unload callback defined
|
||||||
if ( !m_device_image_unload.isnull() )
|
if (!m_device_image_unload.isnull())
|
||||||
{
|
|
||||||
m_device_image_unload(*this);
|
m_device_image_unload(*this);
|
||||||
}
|
|
||||||
|
|
||||||
if (m_hard_disk_handle != nullptr)
|
m_hard_disk_handle.reset();
|
||||||
{
|
|
||||||
delete m_hard_disk_handle;
|
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_origchd.close();
|
m_origchd.close();
|
||||||
m_diffchd.close();
|
m_diffchd.close();
|
||||||
@ -212,10 +201,9 @@ std::error_condition diablo_image_device::internal_load_dsk()
|
|||||||
|
|
||||||
m_chd = nullptr;
|
m_chd = nullptr;
|
||||||
|
|
||||||
if (m_hard_disk_handle)
|
m_hard_disk_handle.reset();
|
||||||
delete m_hard_disk_handle;
|
|
||||||
|
|
||||||
/* open the CHD file */
|
// open the CHD file
|
||||||
if (loaded_through_softlist())
|
if (loaded_through_softlist())
|
||||||
{
|
{
|
||||||
m_chd = device().machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
|
m_chd = device().machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
|
||||||
@ -246,21 +234,18 @@ std::error_condition diablo_image_device::internal_load_dsk()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_chd != nullptr)
|
if (m_chd)
|
||||||
{
|
{
|
||||||
/* open the hard disk file */
|
// open the hard disk file
|
||||||
m_hard_disk_handle = new hard_disk_file(m_chd);
|
m_hard_disk_handle.reset(new hard_disk_file(m_chd));
|
||||||
if (m_hard_disk_handle != nullptr)
|
if (m_hard_disk_handle)
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we had an error, close out the CHD */
|
// if we had an error, close out the CHD
|
||||||
m_origchd.close();
|
m_origchd.close();
|
||||||
m_diffchd.close();
|
m_diffchd.close();
|
||||||
m_chd = nullptr;
|
m_chd = nullptr;
|
||||||
|
|
||||||
if (err)
|
return err ? err : image_error::UNSPECIFIED;
|
||||||
return err;
|
|
||||||
else
|
|
||||||
return image_error::UNSPECIFIED;
|
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,16 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "harddriv.h"
|
|
||||||
#include "softlist_dev.h"
|
#include "softlist_dev.h"
|
||||||
|
|
||||||
|
#include "harddriv.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
#define DIABLO_TAG(id) "diablo"#id
|
#define DIABLO_TAG(id) "diablo"#id
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -45,7 +52,7 @@ public:
|
|||||||
virtual const util::option_guide &create_option_guide() const override;
|
virtual const util::option_guide &create_option_guide() const override;
|
||||||
|
|
||||||
// specific implementation
|
// specific implementation
|
||||||
hard_disk_file *get_hard_disk_file() { return m_hard_disk_handle; }
|
hard_disk_file *get_hard_disk_file() { return m_hard_disk_handle.get(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device_t implementation
|
// device_t implementation
|
||||||
@ -59,9 +66,9 @@ protected:
|
|||||||
std::error_condition internal_load_dsk();
|
std::error_condition internal_load_dsk();
|
||||||
|
|
||||||
chd_file *m_chd;
|
chd_file *m_chd;
|
||||||
chd_file m_origchd; /* handle to the original CHD */
|
chd_file m_origchd; // handle to the original CHD
|
||||||
chd_file m_diffchd; /* handle to the diff CHD */
|
chd_file m_diffchd; // handle to the diff CHD
|
||||||
hard_disk_file *m_hard_disk_handle;
|
std::unique_ptr<hard_disk_file> m_hard_disk_handle;
|
||||||
|
|
||||||
load_delegate m_device_image_load;
|
load_delegate m_device_image_load;
|
||||||
unload_delegate m_device_image_unload;
|
unload_delegate m_device_image_unload;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "flopdrv.h"
|
#include "flopdrv.h"
|
||||||
|
|
||||||
#include "softlist_dev.h"
|
#include "softlist_dev.h"
|
||||||
|
|
||||||
#include "formats/imageutl.h"
|
#include "formats/imageutl.h"
|
||||||
@ -22,9 +23,9 @@
|
|||||||
#include "util/ioprocs.h"
|
#include "util/ioprocs.h"
|
||||||
#include "util/ioprocsfilter.h"
|
#include "util/ioprocsfilter.h"
|
||||||
|
|
||||||
|
//#define VERBOSE 1
|
||||||
|
#include "logmacro.h"
|
||||||
|
|
||||||
#define VERBOSE 0
|
|
||||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
CONSTANTS
|
CONSTANTS
|
||||||
@ -255,7 +256,7 @@ int legacy_floppy_image_device::floppy_drive_get_flag_state(int flag)
|
|||||||
|
|
||||||
void legacy_floppy_image_device::floppy_drive_seek(signed int signed_tracks)
|
void legacy_floppy_image_device::floppy_drive_seek(signed int signed_tracks)
|
||||||
{
|
{
|
||||||
LOG(("seek from: %d delta: %d\n",m_current_track, signed_tracks));
|
LOG("seek from: %d delta: %d\n", m_current_track, signed_tracks);
|
||||||
|
|
||||||
/* update position */
|
/* update position */
|
||||||
m_current_track+=signed_tracks;
|
m_current_track+=signed_tracks;
|
||||||
|
@ -165,7 +165,7 @@ private:
|
|||||||
protected:
|
protected:
|
||||||
legacy_floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
legacy_floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// device overrides
|
// device_t implementation
|
||||||
virtual void device_config_complete() override;
|
virtual void device_config_complete() override;
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public:
|
|||||||
|
|
||||||
void init_fs(const fs_info *fs, const fs::meta_data &meta);
|
void init_fs(const fs_info *fs, const fs::meta_data &meta);
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
|
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
|
||||||
@ -166,7 +166,7 @@ protected:
|
|||||||
|
|
||||||
floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
floppy_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
virtual void device_config_complete() override;
|
virtual void device_config_complete() override;
|
||||||
|
@ -44,8 +44,8 @@ DEFINE_DEVICE_TYPE(HARDDISK, harddisk_image_device, "harddisk_image", "Harddisk"
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
harddisk_image_base_device::harddisk_image_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
harddisk_image_base_device::harddisk_image_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: device_t(mconfig, type, tag, owner, clock),
|
: device_t(mconfig, type, tag, owner, clock)
|
||||||
device_image_interface(mconfig, *this)
|
, device_image_interface(mconfig, *this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,12 +63,12 @@ harddisk_image_device::harddisk_image_device(const machine_config &mconfig, cons
|
|||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
harddisk_image_device::harddisk_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
harddisk_image_device::harddisk_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: harddisk_image_base_device(mconfig, type, tag, owner, clock),
|
: harddisk_image_base_device(mconfig, type, tag, owner, clock)
|
||||||
m_chd(nullptr),
|
, m_chd(nullptr)
|
||||||
m_hard_disk_handle(nullptr),
|
, m_hard_disk_handle()
|
||||||
m_device_image_load(*this),
|
, m_device_image_load(*this)
|
||||||
m_device_image_unload(*this),
|
, m_device_image_unload(*this)
|
||||||
m_interface(nullptr)
|
, m_interface(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,33 +109,25 @@ void harddisk_image_device::device_start()
|
|||||||
|
|
||||||
// try to locate the CHD from a DISK_REGION
|
// try to locate the CHD from a DISK_REGION
|
||||||
chd_file *handle = machine().rom_load().get_disk_handle(tag());
|
chd_file *handle = machine().rom_load().get_disk_handle(tag());
|
||||||
if (handle != nullptr)
|
if (handle)
|
||||||
{
|
m_hard_disk_handle.reset(new hard_disk_file(handle));
|
||||||
m_hard_disk_handle = new hard_disk_file(handle);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
m_hard_disk_handle.reset();
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void harddisk_image_device::device_stop()
|
void harddisk_image_device::device_stop()
|
||||||
{
|
{
|
||||||
if (m_hard_disk_handle != nullptr)
|
m_hard_disk_handle.reset();
|
||||||
{
|
|
||||||
delete m_hard_disk_handle;
|
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::error_condition harddisk_image_device::call_load()
|
std::error_condition harddisk_image_device::call_load()
|
||||||
{
|
{
|
||||||
std::error_condition our_result = internal_load_hd();
|
std::error_condition our_result = internal_load_hd();
|
||||||
|
|
||||||
/* Check if there is an image_load callback defined */
|
// Check if there is an image_load callback defined
|
||||||
if (!our_result && !m_device_image_load.isnull())
|
if (!our_result && !m_device_image_load.isnull())
|
||||||
{
|
{
|
||||||
/* Let the override do some additional work/checks */
|
// Let the override do some additional work/checks
|
||||||
our_result = m_device_image_load(*this);
|
our_result = m_device_image_load(*this);
|
||||||
}
|
}
|
||||||
return our_result;
|
return our_result;
|
||||||
@ -155,7 +147,7 @@ std::error_condition harddisk_image_device::call_create(int create_format, util:
|
|||||||
|
|
||||||
const uint32_t totalsectors = cylinders * heads * sectors;
|
const uint32_t totalsectors = cylinders * heads * sectors;
|
||||||
|
|
||||||
/* create the CHD file */
|
// create the CHD file
|
||||||
chd_codec_type compression[4] = { CHD_CODEC_NONE };
|
chd_codec_type compression[4] = { CHD_CODEC_NONE };
|
||||||
util::core_file::ptr proxy;
|
util::core_file::ptr proxy;
|
||||||
std::error_condition err = util::core_file::open_proxy(image_core_file(), proxy);
|
std::error_condition err = util::core_file::open_proxy(image_core_file(), proxy);
|
||||||
@ -164,7 +156,7 @@ std::error_condition harddisk_image_device::call_create(int create_format, util:
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* if we created the image and hence, have metadata to set, set the metadata */
|
// if we created the image and hence, have metadata to set, set the metadata
|
||||||
err = m_origchd.write_metadata(HARD_DISK_METADATA_TAG, 0, string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize));
|
err = m_origchd.write_metadata(HARD_DISK_METADATA_TAG, 0, string_format(HARD_DISK_METADATA_FORMAT, cylinders, heads, sectors, sectorsize));
|
||||||
m_origchd.close();
|
m_origchd.close();
|
||||||
|
|
||||||
@ -176,15 +168,11 @@ std::error_condition harddisk_image_device::call_create(int create_format, util:
|
|||||||
|
|
||||||
void harddisk_image_device::call_unload()
|
void harddisk_image_device::call_unload()
|
||||||
{
|
{
|
||||||
/* Check if there is an image_unload callback defined */
|
// Check if there is an image_unload callback defined
|
||||||
if (!m_device_image_unload.isnull())
|
if (!m_device_image_unload.isnull())
|
||||||
m_device_image_unload(*this);
|
m_device_image_unload(*this);
|
||||||
|
|
||||||
if (m_hard_disk_handle)
|
m_hard_disk_handle.reset();
|
||||||
{
|
|
||||||
delete m_hard_disk_handle;
|
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_chd)
|
if (m_chd)
|
||||||
{
|
{
|
||||||
@ -243,13 +231,9 @@ std::error_condition harddisk_image_device::internal_load_hd()
|
|||||||
m_chd = nullptr;
|
m_chd = nullptr;
|
||||||
uint8_t header[64];
|
uint8_t header[64];
|
||||||
|
|
||||||
if (m_hard_disk_handle)
|
m_hard_disk_handle.reset();
|
||||||
{
|
|
||||||
delete m_hard_disk_handle;
|
|
||||||
m_hard_disk_handle = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* open the CHD file */
|
// open the CHD file
|
||||||
if (loaded_through_softlist())
|
if (loaded_through_softlist())
|
||||||
{
|
{
|
||||||
m_chd = machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
|
m_chd = machine().rom_load().get_disk_handle(device().subtag("harddriv").c_str());
|
||||||
@ -291,8 +275,8 @@ std::error_condition harddisk_image_device::internal_load_hd()
|
|||||||
|
|
||||||
if (m_chd)
|
if (m_chd)
|
||||||
{
|
{
|
||||||
/* open the hard disk file */
|
// open the hard disk file
|
||||||
m_hard_disk_handle = new hard_disk_file(m_chd);
|
m_hard_disk_handle.reset(new hard_disk_file(m_chd));
|
||||||
if (m_hard_disk_handle)
|
if (m_hard_disk_handle)
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
@ -323,7 +307,7 @@ std::error_condition harddisk_image_device::internal_load_hd()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hard_disk_handle = new hard_disk_file(image_core_file(), skip);
|
m_hard_disk_handle.reset(new hard_disk_file(image_core_file(), skip));
|
||||||
if (m_hard_disk_handle)
|
if (m_hard_disk_handle)
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,16 @@
|
|||||||
#ifndef MAME_DEVICES_IMAGEDEV_HARDDRIV_H
|
#ifndef MAME_DEVICES_IMAGEDEV_HARDDRIV_H
|
||||||
#define MAME_DEVICES_IMAGEDEV_HARDDRIV_H
|
#define MAME_DEVICES_IMAGEDEV_HARDDRIV_H
|
||||||
|
|
||||||
|
#include "softlist_dev.h"
|
||||||
|
|
||||||
#include "chd.h"
|
#include "chd.h"
|
||||||
#include "harddisk.h"
|
#include "harddisk.h"
|
||||||
#include "softlist_dev.h"
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
@ -27,7 +34,7 @@ protected:
|
|||||||
// construction/destruction
|
// construction/destruction
|
||||||
harddisk_image_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
harddisk_image_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual bool is_readable() const noexcept override { return true; }
|
virtual bool is_readable() const noexcept override { return true; }
|
||||||
virtual bool is_writeable() const noexcept override { return true; }
|
virtual bool is_writeable() const noexcept override { return true; }
|
||||||
virtual bool is_creatable() const noexcept override { return false; }
|
virtual bool is_creatable() const noexcept override { return false; }
|
||||||
@ -57,7 +64,7 @@ public:
|
|||||||
template <typename... T> void set_device_unload(T &&... args) { m_device_image_unload.set(std::forward<T>(args)...); }
|
template <typename... T> void set_device_unload(T &&... args) { m_device_image_unload.set(std::forward<T>(args)...); }
|
||||||
void set_interface(const char *interface) { m_interface = interface; }
|
void set_interface(const char *interface) { m_interface = interface; }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual std::error_condition call_create(int create_format, util::option_resolution *create_args) override;
|
virtual std::error_condition call_create(int create_format, util::option_resolution *create_args) override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
@ -68,12 +75,12 @@ public:
|
|||||||
virtual const util::option_guide &create_option_guide() const override;
|
virtual const util::option_guide &create_option_guide() const override;
|
||||||
|
|
||||||
// specific implementation
|
// specific implementation
|
||||||
hard_disk_file *get_hard_disk_file() { return m_hard_disk_handle; }
|
hard_disk_file *get_hard_disk_file() { return m_hard_disk_handle.get(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
harddisk_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
harddisk_image_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||||
|
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_config_complete() override;
|
virtual void device_config_complete() override;
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_stop() override;
|
virtual void device_stop() override;
|
||||||
@ -84,9 +91,9 @@ protected:
|
|||||||
std::error_condition internal_load_hd();
|
std::error_condition internal_load_hd();
|
||||||
|
|
||||||
chd_file *m_chd;
|
chd_file *m_chd;
|
||||||
chd_file m_origchd; /* handle to the original CHD */
|
chd_file m_origchd; // handle to the original CHD
|
||||||
chd_file m_diffchd; /* handle to the diff CHD */
|
chd_file m_diffchd; // handle to the diff CHD
|
||||||
hard_disk_file *m_hard_disk_handle;
|
std::unique_ptr<hard_disk_file> m_hard_disk_handle;
|
||||||
|
|
||||||
load_delegate m_device_image_load;
|
load_delegate m_device_image_load;
|
||||||
unload_delegate m_device_image_unload;
|
unload_delegate m_device_image_unload;
|
||||||
|
@ -425,10 +425,10 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto io = util::random_read_write_fill(image_core_file(), 0xff);
|
auto io = util::random_read_write_fill(image_core_file(), 0xff);
|
||||||
if(!io) {
|
if (!io)
|
||||||
return std::errc::not_enough_memory;
|
return std::errc::not_enough_memory;
|
||||||
}
|
|
||||||
m_chd = new chd_file;
|
m_chd = new chd_file; // FIXME: this is never deleted
|
||||||
err = m_chd->open(std::move(io), true);
|
err = m_chd->open(std::move(io), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
{
|
{
|
||||||
std::string metadata;
|
std::string metadata;
|
||||||
|
|
||||||
if (m_chd==nullptr)
|
if (!m_chd)
|
||||||
{
|
{
|
||||||
LOG("m_chd is null\n");
|
LOG("m_chd is null\n");
|
||||||
return image_error::UNSPECIFIED;
|
return image_error::UNSPECIFIED;
|
||||||
@ -472,6 +472,7 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
|
|
||||||
if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads))
|
if (m_max_cylinders != 0 && (param.cylinders != m_max_cylinders || param.heads != m_max_heads))
|
||||||
{
|
{
|
||||||
|
// TODO: does this really need to be a fatal error?
|
||||||
throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, param.cylinders, param.heads);
|
throw emu_fatalerror("Image geometry does not fit this kind of hard drive: drive=(%d,%d), image=(%d,%d)", m_max_cylinders, m_max_heads, param.cylinders, param.heads);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -484,13 +485,9 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
|
|
||||||
state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata);
|
state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 0, metadata);
|
||||||
if (state)
|
if (state)
|
||||||
{
|
|
||||||
LOGMASKED(LOG_WARN, "Failed to read CHD sector arrangement/recording specs, applying defaults\n");
|
LOGMASKED(LOG_WARN, "Failed to read CHD sector arrangement/recording specs, applying defaults\n");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sscanf(metadata.c_str(), MFMHD_REC_METADATA_FORMAT, ¶m.interleave, ¶m.cylskew, ¶m.headskew, ¶m.write_precomp_cylinder, ¶m.reduced_wcurr_cylinder);
|
sscanf(metadata.c_str(), MFMHD_REC_METADATA_FORMAT, ¶m.interleave, ¶m.cylskew, ¶m.headskew, ¶m.write_precomp_cylinder, ¶m.reduced_wcurr_cylinder);
|
||||||
}
|
|
||||||
|
|
||||||
if (!param.sane_rec())
|
if (!param.sane_rec())
|
||||||
{
|
{
|
||||||
@ -498,18 +495,17 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
param.reset_rec();
|
param.reset_rec();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOGMASKED(LOG_CONFIG, "MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
|
{
|
||||||
param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder);
|
LOGMASKED(LOG_CONFIG,
|
||||||
|
"MFM HD rec specs: interleave=%d, cylskew=%d, headskew=%d, wpcom=%d, rwc=%d\n",
|
||||||
|
param.interleave, param.cylskew, param.headskew, param.write_precomp_cylinder, param.reduced_wcurr_cylinder);
|
||||||
|
}
|
||||||
|
|
||||||
state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata);
|
state = m_chd->read_metadata(MFM_HARD_DISK_METADATA_TAG, 1, metadata);
|
||||||
if (state)
|
if (state)
|
||||||
{
|
|
||||||
LOGMASKED(LOG_WARN, "Failed to read CHD track gap specs, applying defaults\n");
|
LOGMASKED(LOG_WARN, "Failed to read CHD track gap specs, applying defaults\n");
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
sscanf(metadata.c_str(), MFMHD_GAP_METADATA_FORMAT, ¶m.gap1, ¶m.gap2, ¶m.gap3, ¶m.sync, ¶m.headerlen, ¶m.ecctype);
|
sscanf(metadata.c_str(), MFMHD_GAP_METADATA_FORMAT, ¶m.gap1, ¶m.gap2, ¶m.gap3, ¶m.sync, ¶m.headerlen, ¶m.ecctype);
|
||||||
}
|
|
||||||
|
|
||||||
if (!param.sane_gap())
|
if (!param.sane_gap())
|
||||||
{
|
{
|
||||||
@ -517,8 +513,11 @@ std::error_condition mfm_harddisk_device::call_load()
|
|||||||
param.reset_gap();
|
param.reset_gap();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOGMASKED(LOG_CONFIG, "MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
|
{
|
||||||
param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype);
|
LOGMASKED(LOG_CONFIG,
|
||||||
|
"MFM HD gap specs: gap1=%d, gap2=%d, gap3=%d, sync=%d, headerlen=%d, ecctype=%d\n",
|
||||||
|
param.gap1, param.gap2, param.gap3, param.sync, param.headerlen, param.ecctype);
|
||||||
|
}
|
||||||
|
|
||||||
m_format->set_layout_params(param);
|
m_format->set_layout_params(param);
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
#include "formats/mfm_hd.h"
|
#include "formats/mfm_hd.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
class mfm_harddisk_device;
|
class mfm_harddisk_device;
|
||||||
@ -262,7 +264,7 @@ private:
|
|||||||
mfmhd_enc_t m_encoding;
|
mfmhd_enc_t m_encoding;
|
||||||
int m_spinupms;
|
int m_spinupms;
|
||||||
int m_cachesize;
|
int m_cachesize;
|
||||||
mfmhd_image_format_t* m_format;
|
mfmhd_image_format_t *m_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_DEVICE_TYPE(MFM_HD_CONNECTOR, mfm_harddisk_connector)
|
DECLARE_DEVICE_TYPE(MFM_HD_CONNECTOR, mfm_harddisk_connector)
|
||||||
|
@ -49,16 +49,16 @@ INPUT_PORTS_END
|
|||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
midiin_device::midiin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
midiin_device::midiin_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: device_t(mconfig, MIDIIN, tag, owner, clock),
|
: device_t(mconfig, MIDIIN, tag, owner, clock)
|
||||||
device_image_interface(mconfig, *this),
|
, device_image_interface(mconfig, *this)
|
||||||
device_serial_interface(mconfig, *this),
|
, device_serial_interface(mconfig, *this)
|
||||||
m_midi(),
|
, m_midi()
|
||||||
m_config(*this, "CFG"),
|
, m_config(*this, "CFG")
|
||||||
m_timer(nullptr),
|
, m_timer(nullptr)
|
||||||
m_input_cb(*this),
|
, m_input_cb(*this)
|
||||||
m_xmit_read(0),
|
, m_xmit_read(0)
|
||||||
m_xmit_write(0),
|
, m_xmit_write(0)
|
||||||
m_tx_busy(false)
|
, m_tx_busy(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
#include "diserial.h"
|
#include "diserial.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
@ -31,7 +36,7 @@ public:
|
|||||||
|
|
||||||
auto input_callback() { return m_input_cb.bind(); }
|
auto input_callback() { return m_input_cb.bind(); }
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -46,12 +51,12 @@ public:
|
|||||||
virtual const char *image_brief_type_name() const noexcept override { return "min"; }
|
virtual const char *image_brief_type_name() const noexcept override { return "min"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual ioport_constructor device_input_ports() const override;
|
virtual ioport_constructor device_input_ports() const override;
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
|
|
||||||
// serial overrides
|
// device_serial_interface implementation
|
||||||
virtual void tra_complete() override; // Tx completed sending byte
|
virtual void tra_complete() override; // Tx completed sending byte
|
||||||
virtual void tra_callback() override; // Tx send bit
|
virtual void tra_callback() override; // Tx send bit
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ DEFINE_DEVICE_TYPE(MIDIOUT, midiout_device, "midiout", "MIDI Out image device")
|
|||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
|
|
||||||
midiout_device::midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
midiout_device::midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||||
: device_t(mconfig, MIDIOUT, tag, owner, clock),
|
: device_t(mconfig, MIDIOUT, tag, owner, clock)
|
||||||
device_image_interface(mconfig, *this),
|
, device_image_interface(mconfig, *this)
|
||||||
device_serial_interface(mconfig, *this),
|
, device_serial_interface(mconfig, *this)
|
||||||
m_midi()
|
, m_midi()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,11 @@
|
|||||||
|
|
||||||
#include "diserial.h"
|
#include "diserial.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
#include <system_error>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
@ -29,7 +34,7 @@ public:
|
|||||||
midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
midiout_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
~midiout_device();
|
~midiout_device();
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -46,11 +51,11 @@ public:
|
|||||||
virtual void tx(uint8_t state) { rx_w(state); }
|
virtual void tx(uint8_t state) { rx_w(state); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
|
|
||||||
// serial overrides
|
// device_serial_interface implementation
|
||||||
virtual void rcv_complete() override; // Rx completed receiving byte
|
virtual void rcv_complete() override; // Rx completed receiving byte
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -70,8 +70,5 @@ std::error_condition picture_image_device::call_load()
|
|||||||
|
|
||||||
void picture_image_device::call_unload()
|
void picture_image_device::call_unload()
|
||||||
{
|
{
|
||||||
if (m_picture.valid())
|
m_picture.reset();
|
||||||
{
|
|
||||||
m_picture.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -78,11 +78,11 @@ std::error_condition printer_image_device::call_create(int format_type, util::op
|
|||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
std::error_condition printer_image_device::call_load()
|
std::error_condition printer_image_device::call_load()
|
||||||
{
|
{
|
||||||
/* send notify that the printer is now online */
|
// send notify that the printer is now online
|
||||||
if (!m_online_cb.isnull())
|
if (!m_online_cb.isnull())
|
||||||
m_online_cb(true);
|
m_online_cb(true);
|
||||||
|
|
||||||
/* we don't need to do anything special */
|
// we don't need to do anything special
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ void snapshot_image_device::device_start()
|
|||||||
{
|
{
|
||||||
m_load.resolve();
|
m_load.resolve();
|
||||||
|
|
||||||
/* allocate a timer */
|
// allocate a timer
|
||||||
m_timer = timer_alloc(FUNC(snapshot_image_device::process_snapshot_or_quickload), this);
|
m_timer = timer_alloc(FUNC(snapshot_image_device::process_snapshot_or_quickload), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ void snapshot_image_device::device_start()
|
|||||||
-------------------------------------------------*/
|
-------------------------------------------------*/
|
||||||
std::error_condition snapshot_image_device::call_load()
|
std::error_condition snapshot_image_device::call_load()
|
||||||
{
|
{
|
||||||
/* adjust the timer */
|
// adjust the timer
|
||||||
m_timer->adjust(m_delay, 0);
|
m_timer->adjust(m_delay, 0);
|
||||||
return std::error_condition();
|
return std::error_condition();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
DEFINE_DEVICE_TYPE(WAFADRIVE_IMAGE, wafadrive_image_device, "wafadrive_image", "Sinclair Wafadrive Image")
|
DEFINE_DEVICE_TYPE(WAFADRIVE_IMAGE, wafadrive_image_device, "wafadrive_image", "Sinclair Wafadrive Image")
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// microdrive_image_device - constructor
|
// wafadrive_image_device - constructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
wafadrive_image_device::wafadrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
wafadrive_image_device::wafadrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||||
@ -29,7 +29,7 @@ wafadrive_image_device::wafadrive_image_device(const machine_config &mconfig, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// microdrive_image_device - destructor
|
// wafadrive_image_device - destructor
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
|
|
||||||
wafadrive_image_device::~wafadrive_image_device()
|
wafadrive_image_device::~wafadrive_image_device()
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
wafadrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
wafadrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||||
virtual ~wafadrive_image_device();
|
virtual ~wafadrive_image_device();
|
||||||
|
|
||||||
// image-level overrides
|
// device_image_interface implementation
|
||||||
virtual std::error_condition call_load() override;
|
virtual std::error_condition call_load() override;
|
||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public:
|
|||||||
virtual const char *file_extensions() const noexcept override { return "wdr"; }
|
virtual const char *file_extensions() const noexcept override { return "wdr"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// device-level overrides
|
// device_t implementation
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ std::error_condition pccard_centennial_sram_device::call_create(int format_type,
|
|||||||
// clear ram
|
// clear ram
|
||||||
std::fill_n(&m_sram[0], m_sram.length(), 0);
|
std::fill_n(&m_sram[0], m_sram.length(), 0);
|
||||||
|
|
||||||
// initialize eeprom data from default data
|
// initialize EEPROM data from default data
|
||||||
std::copy_n(m_eeprom_default->base(), m_eeprom.length(), &m_eeprom[0]);
|
std::copy_n(m_eeprom_default->base(), m_eeprom.length(), &m_eeprom[0]);
|
||||||
|
|
||||||
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
|
if (fwrite(&m_sram[0], m_sram.bytes()) != m_sram.bytes())
|
||||||
|
@ -219,9 +219,8 @@ std::error_condition smartmedia_image_device::smartmedia_format_2()
|
|||||||
std::error_condition smartmedia_image_device::call_load()
|
std::error_condition smartmedia_image_device::call_load()
|
||||||
{
|
{
|
||||||
std::error_condition result;
|
std::error_condition result;
|
||||||
uint64_t position;
|
|
||||||
// try format 1
|
// try format 1
|
||||||
position = ftell();
|
uint64_t const position = ftell();
|
||||||
result = smartmedia_format_1();
|
result = smartmedia_format_1();
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ public:
|
|||||||
virtual void call_unload() override;
|
virtual void call_unload() override;
|
||||||
|
|
||||||
// Because nand_device is a NVRAM device now, stub these to make it not do anything (read only)
|
// Because nand_device is a NVRAM device now, stub these to make it not do anything (read only)
|
||||||
virtual void nvram_default() override {};
|
virtual void nvram_default() override { }
|
||||||
virtual bool nvram_read(util::read_stream &file) override { return true; };
|
virtual bool nvram_read(util::read_stream &file) override { return true; };
|
||||||
virtual bool nvram_write(util::write_stream &file) override { return false; };
|
virtual bool nvram_write(util::write_stream &file) override { return false; };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user