summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
committer ImJezze <jezze@gmx.net>2016-03-12 12:31:13 +0100
commita026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch)
treee31573822f2359677de519f9f3b600d98e8764cd /src/emu
parent477d2abd43984f076b7e45f5527591fa8fd0d241 (diff)
parentdcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff)
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/cheat.cpp3
-rw-r--r--src/emu/cheat.h2
-rw-r--r--src/emu/clifront.cpp2
-rw-r--r--src/emu/diexec.cpp29
-rw-r--r--src/emu/diexec.h13
-rw-r--r--src/emu/diimage.cpp31
-rw-r--r--src/emu/diimage.h23
-rw-r--r--src/emu/drawgfx.cpp27
-rw-r--r--src/emu/drivers/xtal.h2
-rw-r--r--src/emu/emu.h1
-rw-r--r--src/emu/emuopts.cpp14
-rw-r--r--src/emu/emuopts.h3
-rw-r--r--src/emu/emupal.cpp65
-rw-r--r--src/emu/emupal.h38
-rw-r--r--src/emu/fileio.cpp97
-rw-r--r--src/emu/fileio.h18
-rw-r--r--src/emu/ioport.cpp60
-rw-r--r--src/emu/ioport.h164
-rw-r--r--src/emu/layout/LICENSE116
-rw-r--r--src/emu/layout/README.md6
-rw-r--r--src/emu/luaengine.cpp26
-rw-r--r--src/emu/machine.cpp1
-rw-r--r--src/emu/mame.cpp2
-rw-r--r--src/emu/schedule.h2
-rw-r--r--src/emu/screen.cpp13
-rw-r--r--src/emu/screen.h9
-rw-r--r--src/emu/tilemap.cpp46
-rw-r--r--src/emu/tilemap.h16
-rw-r--r--src/emu/ui/custui.cpp10
-rw-r--r--src/emu/ui/datfile.h5
-rw-r--r--src/emu/ui/datmenu.cpp14
-rw-r--r--src/emu/ui/dirmenu.cpp12
-rw-r--r--src/emu/ui/filesel.cpp4
-rw-r--r--src/emu/ui/mainmenu.cpp2
-rw-r--r--src/emu/ui/menu.cpp25
-rw-r--r--src/emu/ui/menu.h9
-rw-r--r--src/emu/ui/miscmenu.cpp8
-rw-r--r--src/emu/ui/optsmenu.cpp16
-rw-r--r--src/emu/ui/selector.cpp2
-rw-r--r--src/emu/ui/selgame.cpp88
-rw-r--r--src/emu/ui/selsoft.cpp18
-rw-r--r--src/emu/ui/ui.cpp4
-rw-r--r--src/emu/uismall.pngbin0 -> 1488 bytes
-rw-r--r--src/emu/validity.cpp24
44 files changed, 589 insertions, 481 deletions
diff --git a/src/emu/cheat.cpp b/src/emu/cheat.cpp
index 6b24b22fc35..0a799ca6f13 100644
--- a/src/emu/cheat.cpp
+++ b/src/emu/cheat.cpp
@@ -1031,6 +1031,9 @@ std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state)
// CHEAT MANAGER
//**************************************************************************
+const int cheat_manager::CHEAT_VERSION;
+
+
//-------------------------------------------------
// cheat_manager - constructor
//-------------------------------------------------
diff --git a/src/emu/cheat.h b/src/emu/cheat.h
index 6badabd14d6..20772e25640 100644
--- a/src/emu/cheat.h
+++ b/src/emu/cheat.h
@@ -329,7 +329,7 @@ private:
symbol_table m_symtable; // global symbol table
// constants
- static const int CHEAT_VERSION = 1;
+ static constexpr int CHEAT_VERSION = 1;
};
diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp
index 4476e4e0151..7c6c974cce7 100644
--- a/src/emu/clifront.cpp
+++ b/src/emu/clifront.cpp
@@ -1880,7 +1880,7 @@ void media_identifier::identify_file(const char *name)
// load the file and process if it opens and has a valid length
UINT32 length;
void *data;
- file_error filerr = core_fload(name, &data, &length);
+ const file_error filerr = util::core_file::load(name, &data, length);
if (filerr == FILERR_NONE && length > 0)
{
identify_data(name, reinterpret_cast<UINT8 *>(data), length);
diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp
index ac72ce768d7..02684095b04 100644
--- a/src/emu/diexec.cpp
+++ b/src/emu/diexec.cpp
@@ -272,7 +272,7 @@ void device_execute_interface::spin_until_time(const attotime &duration)
suspend_until_trigger(TRIGGER_SUSPENDTIME + timetrig, true);
// then set a timer for it
- m_scheduler->timer_set(duration, FUNC(static_timed_trigger_callback), TRIGGER_SUSPENDTIME + timetrig, this);
+ m_scheduler->timer_set(duration, timer_expired_delegate(FUNC(device_execute_interface::timed_trigger_callback),this), TRIGGER_SUSPENDTIME + timetrig, this);
timetrig = (timetrig + 1) % 256;
}
@@ -484,7 +484,7 @@ void device_execute_interface::interface_pre_start()
// allocate timers if we need them
if (m_timed_interrupt_period != attotime::zero)
- m_timedint_timer = m_scheduler->timer_alloc(FUNC(static_trigger_periodic_interrupt), (void *)this);
+ m_timedint_timer = m_scheduler->timer_alloc(timer_expired_delegate(FUNC(device_execute_interface::trigger_periodic_interrupt), this));
}
@@ -653,10 +653,9 @@ attoseconds_t device_execute_interface::minimum_quantum() const
// trigger
//-------------------------------------------------
-TIMER_CALLBACK( device_execute_interface::static_timed_trigger_callback )
+TIMER_CALLBACK_MEMBER( device_execute_interface::timed_trigger_callback )
{
- device_execute_interface *device = reinterpret_cast<device_execute_interface *>(ptr);
- device->trigger(param);
+ trigger(param);
}
@@ -681,16 +680,11 @@ void device_execute_interface::on_vblank(screen_device &screen, bool vblank_stat
//-------------------------------------------------
-// static_trigger_periodic_interrupt - timer
+// trigger_periodic_interrupt - timer
// callback for timed interrupts
//-------------------------------------------------
-TIMER_CALLBACK( device_execute_interface::static_trigger_periodic_interrupt )
-{
- reinterpret_cast<device_execute_interface *>(ptr)->trigger_periodic_interrupt();
-}
-
-void device_execute_interface::trigger_periodic_interrupt()
+TIMER_CALLBACK_MEMBER(device_execute_interface::trigger_periodic_interrupt)
{
// bail if there is no routine
if (!suspended(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE | SUSPEND_REASON_CLOCK))
@@ -781,7 +775,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_execute->device().tag(), m_linen
if (event_index >= ARRAY_LENGTH(m_queue))
{
m_qindex--;
- empty_event_queue();
+ empty_event_queue(nullptr,0);
event_index = m_qindex++;
m_execute->device().logerror("Exceeded pending input line event queue on device '%s'!\n", m_execute->device().tag());
}
@@ -795,7 +789,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_execute->device().tag(), m_linen
// if this is the first one, set the timer
if (event_index == 0)
- m_execute->scheduler().synchronize(FUNC(static_empty_event_queue), 0, (void *)this);
+ m_execute->scheduler().synchronize(timer_expired_delegate(FUNC(device_execute_interface::device_input::empty_event_queue),this), 0, this);
}
}
@@ -804,12 +798,7 @@ if (TEMPLOG) printf("setline(%s,%d,%d,%d)\n", m_execute->device().tag(), m_linen
// empty_event_queue - empty our event queue
//-------------------------------------------------
-TIMER_CALLBACK( device_execute_interface::device_input::static_empty_event_queue )
-{
- reinterpret_cast<device_input *>(ptr)->empty_event_queue();
-}
-
-void device_execute_interface::device_input::empty_event_queue()
+TIMER_CALLBACK_MEMBER(device_execute_interface::device_input::empty_event_queue)
{
if (TEMPLOG) printf("empty_queue(%s,%d,%d)\n", m_execute->device().tag(), m_linenum, m_qindex);
// loop over all events
diff --git a/src/emu/diexec.h b/src/emu/diexec.h
index 3a5cc0405f9..4fd379b5dae 100644
--- a/src/emu/diexec.h
+++ b/src/emu/diexec.h
@@ -71,12 +71,13 @@ enum
// MACROS
//**************************************************************************
+#define TIMER_CALLBACK(name) void name(running_machine &machine, void *ptr, int param)
+#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, INT32 param)
+
// IRQ callback to be called by device implementations when an IRQ is actually taken
-#define IRQ_CALLBACK(func) int func(device_t *device, int irqline)
#define IRQ_CALLBACK_MEMBER(func) int func(device_t &device, int irqline)
// interrupt generator callback called as a VBLANK or periodic interrupt
-#define INTERRUPT_GEN(func) void func(device_t *device)
#define INTERRUPT_GEN_MEMBER(func) void func(device_t &device)
@@ -246,8 +247,7 @@ protected:
int m_qindex; // index within the queue
private:
- static void static_empty_event_queue(running_machine &machine, void *ptr, int param);
- void empty_event_queue();
+ TIMER_CALLBACK_MEMBER(empty_event_queue);
};
// scheduler
@@ -292,12 +292,11 @@ protected:
private:
// callbacks
- static void static_timed_trigger_callback(running_machine &machine, void *ptr, int param);
+ TIMER_CALLBACK_MEMBER(timed_trigger_callback);
void on_vblank(screen_device &screen, bool vblank_state);
- static void static_trigger_periodic_interrupt(running_machine &machine, void *ptr, int param);
- void trigger_periodic_interrupt();
+ TIMER_CALLBACK_MEMBER(trigger_periodic_interrupt);
void suspend_resume_changed();
attoseconds_t minimum_quantum() const;
diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp
index d43cfe02fed..704f7d987e8 100644
--- a/src/emu/diimage.cpp
+++ b/src/emu/diimage.cpp
@@ -57,8 +57,8 @@ const image_device_type_info device_image_interface::m_device_info_array[] =
device_image_interface::device_image_interface(const machine_config &mconfig, device_t &device)
: device_interface(device, "image"),
m_err(),
- m_file(nullptr),
- m_mame_file(nullptr),
+ m_file(),
+ m_mame_file(),
m_software_info_ptr(nullptr),
m_software_part_ptr(nullptr),
m_supported(0),
@@ -611,12 +611,11 @@ bool device_image_interface::is_loaded()
image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, const char *path)
{
- file_error filerr;
image_error_t err;
std::string revised_path;
/* attempt to read the file */
- filerr = zippath_fopen(path, open_flags, m_file, revised_path);
+ auto const filerr = zippath_fopen(path, open_flags, m_file, revised_path);
/* did the open succeed? */
switch(filerr)
@@ -662,15 +661,13 @@ image_error_t device_image_interface::load_image_by_path(UINT32 open_flags, cons
int device_image_interface::reopen_for_write(const char *path)
{
- if(m_file)
- core_fclose(m_file);
+ m_file.reset();
- file_error filerr;
image_error_t err;
std::string revised_path;
/* attempt to open the file for writing*/
- filerr = zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path);
+ auto const filerr = zippath_fopen(path, OPEN_FLAG_READ|OPEN_FLAG_WRITE|OPEN_FLAG_CREATE, m_file, revised_path);
/* did the open succeed? */
switch(filerr)
@@ -876,10 +873,9 @@ bool device_image_interface::load_software(software_list_device &swlist, const c
warningcount += verify_length_and_hash(m_mame_file.get(),ROM_GETNAME(romp),ROM_GETLENGTH(romp),hash_collection(ROM_GETHASHDATA(romp)));
if (filerr == FILERR_NONE)
- {
- m_file = *m_mame_file;
+ filerr = util::core_file::open_proxy(*m_mame_file, m_file);
+ if (filerr == FILERR_NONE)
retVal = TRUE;
- }
break; // load first item for start
}
@@ -1118,17 +1114,8 @@ bool device_image_interface::create(const char *path, const image_device_format
void device_image_interface::clear()
{
- if (m_mame_file)
- {
- m_mame_file = nullptr;
- m_file = nullptr;
- } else {
- if (m_file)
- {
- core_fclose(m_file);
- m_file = nullptr;
- }
- }
+ m_mame_file.reset();
+ m_file.reset();
m_image_name.clear();
m_readonly = false;
diff --git a/src/emu/diimage.h b/src/emu/diimage.h
index b1a8a16ad70..f15e0e555a9 100644
--- a/src/emu/diimage.h
+++ b/src/emu/diimage.h
@@ -178,21 +178,22 @@ public:
const char *basename() { if (m_basename.empty()) return nullptr; else return m_basename.c_str(); }
const char *basename_noext() { if (m_basename_noext.empty()) return nullptr; else return m_basename_noext.c_str(); }
const char *filetype() { if (m_filetype.empty()) return nullptr; else return m_filetype.c_str(); }
- core_file *image_core_file() { return m_file; }
- UINT64 length() { check_for_file(); return core_fsize(m_file); }
+ bool is_open() const { return bool(m_file); }
+ util::core_file &image_core_file() { return *m_file; }
+ UINT64 length() { check_for_file(); return m_file->size(); }
bool is_readonly() { return m_readonly; }
bool has_been_created() { return m_created; }
void make_readonly() { m_readonly = true; }
- UINT32 fread(void *buffer, UINT32 length) { check_for_file(); return core_fread(m_file, buffer, length); }
+ UINT32 fread(void *buffer, UINT32 length) { check_for_file(); return m_file->read(buffer, length); }
UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length) { ptr.allocate(length); return fread(ptr.target(), length); }
UINT32 fread(optional_shared_ptr<UINT8> &ptr, UINT32 length, offs_t offset) { ptr.allocate(length); return fread(ptr + offset, length - offset); }
- UINT32 fwrite(const void *buffer, UINT32 length) { check_for_file(); return core_fwrite(m_file, buffer, length); }
- int fseek(INT64 offset, int whence) { check_for_file(); return core_fseek(m_file, offset, whence); }
- UINT64 ftell() { check_for_file(); return core_ftell(m_file); }
+ UINT32 fwrite(const void *buffer, UINT32 length) { check_for_file(); return m_file->write(buffer, length); }
+ int fseek(INT64 offset, int whence) { check_for_file(); return m_file->seek(offset, whence); }
+ UINT64 ftell() { check_for_file(); return m_file->tell(); }
int fgetc() { char ch; if (fread(&ch, 1) != 1) ch = '\0'; return ch; }
- char *fgets(char *buffer, UINT32 length) { check_for_file(); return core_fgets(buffer, length, m_file); }
- int image_feof() { check_for_file(); return core_feof(m_file); }
- void *ptr() {check_for_file(); return (void *) core_fbuffer(m_file); }
+ char *fgets(char *buffer, UINT32 length) { check_for_file(); return m_file->gets(buffer, length); }
+ int image_feof() { check_for_file(); return m_file->eof(); }
+ void *ptr() {check_for_file(); return const_cast<void *>(m_file->buffer()); }
// configuration access
void set_init_phase() { m_init_phase = TRUE; }
@@ -250,7 +251,7 @@ protected:
void clear_error();
- void check_for_file() { assert_always(m_file != nullptr, "Illegal operation on unmounted image"); }
+ void check_for_file() { assert_always(m_file, "Illegal operation on unmounted image"); }
void setup_working_directory();
bool try_change_working_directory(const char *subdir);
@@ -274,7 +275,7 @@ protected:
std::string m_err_message;
/* variables that are only non-zero when an image is mounted */
- core_file *m_file;
+ util::core_file::ptr m_file;
std::unique_ptr<emu_file> m_mame_file;
std::string m_image_name;
std::string m_basename;
diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp
index 30bde314664..8ca9b1d7aea 100644
--- a/src/emu/drawgfx.cpp
+++ b/src/emu/drawgfx.cpp
@@ -86,33 +86,6 @@ gfxdecode_device::gfxdecode_device(const machine_config &mconfig, const char *ta
// gfx_element - constructor
//-------------------------------------------------
-#ifdef UNUSED_FUNCTION
-gfx_element::gfx_element()
- : m_palette(nullptr),
- m_width(0),
- m_height(0),
- m_startx(0),
- m_starty(0),
- m_origwidth(0),
- m_origheight(0),
- m_total_elements(0),
- m_color_base(0),
- m_color_depth(0),
- m_color_granularity(0),
- m_total_colors(0),
- m_line_modulo(0),
- m_char_modulo(0),
- m_srcdata(nullptr),
- m_dirtyseq(1),
- m_gfxdata(nullptr),
- m_layout_is_raw(false),
- m_layout_planes(0),
- m_layout_xormask(0),
- m_layout_charincrement(0)
-{
-}
-#endif
-
gfx_element::gfx_element(palette_device &palette, UINT8 *base, UINT32 width, UINT32 height, UINT32 rowbytes, UINT32 total_colors, UINT32 color_base, UINT32 color_granularity)
: m_palette(&palette),
m_width(width),
diff --git a/src/emu/drivers/xtal.h b/src/emu/drivers/xtal.h
index 6cc8cbe32c0..476db5e99ab 100644
--- a/src/emu/drivers/xtal.h
+++ b/src/emu/drivers/xtal.h
@@ -80,7 +80,7 @@ enum
XTAL_5_911MHz = 5911000, /* Philips Videopac Plus G7400 */
XTAL_5_9904MHz = 5990400, /* Luxor ABC 800 keyboard (Keytronic custom part #48-300-008 is equivalent) */
XTAL_6MHz = 6000000, /* American Poker II */
- XTAL_6_144MHz = 6144000, /* Used on Alpha Denshi early 80's games sound board and Casio FP-200 main CPU */
+ XTAL_6_144MHz = 6144000, /* Used on Alpha Denshi early 80's games sound board, Casio FP-200 and Namco System 16 */
XTAL_6_5MHz = 6500000, /* Jupiter Ace */
XTAL_6_9MHz = 6900000, /* BBN BitGraph CPU */
XTAL_7MHz = 7000000, /* Jaleco Mega System PCBs */
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 0cf7b7c1384..e978bbe44d5 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -18,7 +18,6 @@
#ifndef __EMU_H__
#define __EMU_H__
-#include <stdio.h> // must be here otherwise issues with I64FMT in MINGW
#include <list>
#include <vector>
#include <memory>
diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp
index 079080c08a3..332c9c2d787 100644
--- a/src/emu/emuopts.cpp
+++ b/src/emu/emuopts.cpp
@@ -32,7 +32,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_READCONFIG ";rc", "1", OPTION_BOOLEAN, "enable loading of configuration files" },
{ OPTION_WRITECONFIG ";wc", "0", OPTION_BOOLEAN, "writes configuration to (driver).ini on exit" },
- // seach path options
+ // search path options
{ nullptr, nullptr, OPTION_HEADER, "CORE SEARCH PATH OPTIONS" },
{ OPTION_MEDIAPATH ";rp;biospath;bp", "roms", OPTION_STRING, "path to ROMsets and hard disk images" },
{ OPTION_HASHPATH ";hash_directory;hash", "hash", OPTION_STRING, "path to hash files" },
@@ -190,7 +190,7 @@ const options_entry emu_options::s_option_entries[] =
{ OPTION_CONFIRM_QUIT, "0", OPTION_BOOLEAN, "display confirm quit screen on exit" },
{ OPTION_UI_MOUSE, "1", OPTION_BOOLEAN, "display ui mouse cursor" },
{ OPTION_AUTOBOOT_COMMAND ";ab", nullptr, OPTION_STRING, "command to execute after machine boot" },
- { OPTION_AUTOBOOT_DELAY, "2", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },
+ { OPTION_AUTOBOOT_DELAY, "0", OPTION_INTEGER, "timer delay in sec to trigger command execution on autoboot" },
{ OPTION_AUTOBOOT_SCRIPT ";script", nullptr, OPTION_STRING, "lua script to execute after machine boot" },
{ OPTION_CONSOLE, "0", OPTION_BOOLEAN, "enable emulator LUA console" },
{ OPTION_LANGUAGE ";lang", "English", OPTION_STRING, "display language" },
@@ -270,7 +270,11 @@ bool emu_options::add_slot_options(const software_part *swpart)
std::string featurename = std::string(name).append("_default");
const char *value = swpart->feature(featurename.c_str());
if (value != nullptr && (*value == '\0' || slot->option(value) != nullptr))
- set_default_value(name, value);
+ {
+ // set priority above INIs but below actual command line
+ std::string error;
+ set_value(name, value, OPTION_PRIORITY_SUBCMD, error);
+ }
}
}
return (options_count() != starting_count);
@@ -391,7 +395,7 @@ bool emu_options::parse_slot_devices(int argc, char *argv[], std::string &error_
m_device_options = 0;
add_device_options();
if (name != nullptr && exists(name))
- set_value(name, value, OPTION_PRIORITY_CMDLINE, error_string);
+ set_value(name, value, OPTION_PRIORITY_SUBCMD, error_string);
core_options::parse_command_line(argc, argv, OPTION_PRIORITY_CMDLINE, error_string);
int num;
@@ -571,7 +575,7 @@ bool emu_options::parse_one_ini(const char *basename, int priority, std::string
// parse the file
osd_printf_verbose("Parsing %s.ini\n", basename);
std::string error;
- bool result = parse_ini_file((core_file&)file, priority, OPTION_PRIORITY_DRIVER_INI, error);
+ bool result = parse_ini_file((util::core_file&)file, priority, OPTION_PRIORITY_DRIVER_INI, error);
// append errors if requested
if (!error.empty() && error_string)
diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h
index 79df39c7438..0512924dd59 100644
--- a/src/emu/emuopts.h
+++ b/src/emu/emuopts.h
@@ -23,7 +23,8 @@
enum
{
// command-line options are HIGH priority
- OPTION_PRIORITY_CMDLINE = OPTION_PRIORITY_HIGH,
+ OPTION_PRIORITY_SUBCMD = OPTION_PRIORITY_HIGH,
+ OPTION_PRIORITY_CMDLINE,
// INI-based options are NORMAL priority, in increasing order:
OPTION_PRIORITY_INI = OPTION_PRIORITY_NORMAL,
diff --git a/src/emu/emupal.cpp b/src/emu/emupal.cpp
index e3d2dcd97a1..ccd0b26d324 100644
--- a/src/emu/emupal.cpp
+++ b/src/emu/emupal.cpp
@@ -744,79 +744,44 @@ void palette_device::configure_rgb_shadows(int mode, float factor)
void palette_device::palette_init_all_black(palette_device &palette)
{
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- palette.set_pen_color(i,rgb_t::black); // black
+ palette.set_pen_color(i, rgb_t::black);
}
}
/*-------------------------------------------------
- black_and_white - basic 2-color black & white
--------------------------------------------------*/
-
-void palette_device::palette_init_black_and_white(palette_device &palette)
-{
- palette.set_pen_color(0,rgb_t::black); // black
- palette.set_pen_color(1,rgb_t::white); // white
-}
-
-
-/*-------------------------------------------------
- white_and_black - basic 2-color white & black
--------------------------------------------------*/
-
-void palette_device::palette_init_white_and_black(palette_device &palette)
-{
- palette.set_pen_color(0,rgb_t::white); // white
- palette.set_pen_color(1,rgb_t::black); // black
-}
-
-
-/*-------------------------------------------------
- monochrome_amber - 2-color black & amber
--------------------------------------------------*/
-
-void palette_device::palette_init_monochrome_amber(palette_device &palette)
-{
- palette.set_pen_color(0, rgb_t::black); // black
- palette.set_pen_color(1, rgb_t(0xf7, 0xaa, 0x00)); // amber
-}
-
-
-/*-------------------------------------------------
- monochrome_green - 2-color black & green
+ monochrome - 2-color black & white
-------------------------------------------------*/
-void palette_device::palette_init_monochrome_green(palette_device &palette)
+void palette_device::palette_init_monochrome(palette_device &palette)
{
- palette.set_pen_color(0, rgb_t::black); // black
- palette.set_pen_color(1, rgb_t(0x00, 0xff, 0x00)); // green
+ palette.set_pen_color(0, rgb_t::black);
+ palette.set_pen_color(1, rgb_t::white);
}
/*-------------------------------------------------
- monochrome_green_highlight - 3-color black & green
+ monochrome_inverted - 2-color white & black
-------------------------------------------------*/
-void palette_device::palette_init_monochrome_green_highlight(palette_device &palette)
+void palette_device::palette_init_monochrome_inverted(palette_device &palette)
{
- palette.set_pen_color(0, rgb_t::black); // black
- palette.set_pen_color(1, rgb_t(0x00, 0xc0, 0x00)); // green
- palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // green
+ palette.set_pen_color(0, rgb_t::white);
+ palette.set_pen_color(1, rgb_t::black);
}
/*-------------------------------------------------
- monochrome_yellow - 2-color black & yellow
+ monochrome_highlight - 3-color
-------------------------------------------------*/
-void palette_device::palette_init_monochrome_yellow(palette_device &palette)
+void palette_device::palette_init_monochrome_highlight(palette_device &palette)
{
- palette.set_pen_color(0, rgb_t::black); // black
- palette.set_pen_color(1, rgb_t(0xff, 0xff, 0x00)); // yellow
+ palette.set_pen_color(0, rgb_t::black);
+ palette.set_pen_color(1, rgb_t(0xc0, 0xc0, 0xc0));
+ palette.set_pen_color(2, rgb_t::white);
}
diff --git a/src/emu/emupal.h b/src/emu/emupal.h
index b06a5b43d7f..57b6cecebdc 100644
--- a/src/emu/emupal.h
+++ b/src/emu/emupal.h
@@ -217,31 +217,20 @@
palette_device::static_enable_hilights(*device);
-// standard palettes
-#define MCFG_PALETTE_ADD_BLACK_AND_WHITE(_tag) \
+// monochrome palettes
+#define MCFG_PALETTE_ADD_MONOCHROME(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_black_and_white), downcast<palette_device *>(device)));
+ palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome), downcast<palette_device *>(device)));
-#define MCFG_PALETTE_ADD_WHITE_AND_BLACK(_tag) \
+#define MCFG_PALETTE_ADD_MONOCHROME_INVERTED(_tag) \
MCFG_PALETTE_ADD(_tag, 2) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_white_and_black), downcast<palette_device *>(device)));
+ palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_inverted), downcast<palette_device *>(device)));
-#define MCFG_PALETTE_ADD_MONOCHROME_AMBER(_tag) \
- MCFG_PALETTE_ADD(_tag, 2) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_amber), downcast<palette_device *>(device)));
-
-#define MCFG_PALETTE_ADD_MONOCHROME_GREEN(_tag) \
- MCFG_PALETTE_ADD(_tag, 2) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_green), downcast<palette_device *>(device)));
-
-#define MCFG_PALETTE_ADD_MONOCHROME_GREEN_HIGHLIGHT(_tag) \
+#define MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT(_tag) \
MCFG_PALETTE_ADD(_tag, 3) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_green_highlight), downcast<palette_device *>(device)));
-
-#define MCFG_PALETTE_ADD_MONOCHROME_YELLOW(_tag) \
- MCFG_PALETTE_ADD(_tag, 2) \
- palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_yellow), downcast<palette_device *>(device)));
+ palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_monochrome_highlight), downcast<palette_device *>(device)));
+// 8-bit palettes
#define MCFG_PALETTE_ADD_3BIT_RGB(_tag) \
MCFG_PALETTE_ADD(_tag, 8) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_3bit_rgb), downcast<palette_device *>(device)));
@@ -266,10 +255,12 @@
MCFG_PALETTE_ADD(_tag, 8) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_3bit_bgr), downcast<palette_device *>(device)));
+// 15-bit palettes
#define MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB), downcast<palette_device *>(device)));
+// 16-bit palettes
#define MCFG_PALETTE_ADD_BBBBBGGGGGRRRRR(_tag) \
MCFG_PALETTE_ADD(_tag, 32768) \
palette_device::static_set_init(*device, palette_init_delegate(FUNC(palette_device::palette_init_BBBBBGGGGGRRRRR), downcast<palette_device *>(device)));
@@ -437,12 +428,9 @@ public:
// generic palette init routines
void palette_init_all_black(palette_device &palette);
- void palette_init_black_and_white(palette_device &palette);
- void palette_init_white_and_black(palette_device &palette);
- void palette_init_monochrome_amber(palette_device &palette);
- void palette_init_monochrome_green(palette_device &palette);
- void palette_init_monochrome_green_highlight(palette_device &palette);
- void palette_init_monochrome_yellow(palette_device &palette);
+ void palette_init_monochrome(palette_device &palette);
+ void palette_init_monochrome_inverted(palette_device &palette);
+ void palette_init_monochrome_highlight(palette_device &palette);
void palette_init_3bit_rgb(palette_device &palette);
void palette_init_3bit_rbg(palette_device &palette);
void palette_init_3bit_brg(palette_device &palette);
diff --git a/src/emu/fileio.cpp b/src/emu/fileio.cpp
index d13e162f990..79bf746fbfa 100644
--- a/src/emu/fileio.cpp
+++ b/src/emu/fileio.cpp
@@ -187,21 +187,11 @@ emu_file::~emu_file()
//-------------------------------------------------
-// operator core_file - automatically convert
-// ourselves to a core_file pointer
+// operator util::core_file - automatically
+// convert ourselves to a core_file reference
//-------------------------------------------------
-emu_file::operator core_file *()
-{
- // load the ZIP file now if we haven't yet
- if (compressed_file_ready())
- return nullptr;
-
- // return the core file
- return m_file;
-}
-
-emu_file::operator core_file &()
+emu_file::operator util::core_file &()
{
// load the ZIP file now if we haven't yet
if (compressed_file_ready())
@@ -251,12 +241,12 @@ hash_collection &emu_file::hashes(const char *types)
}
// read the data if we can
- const UINT8 *filedata = (const UINT8 *)core_fbuffer(m_file);
+ const UINT8 *filedata = (const UINT8 *)m_file->buffer();
if (filedata == nullptr)
return m_hashes;
// compute the hash
- m_hashes.compute(filedata, core_fsize(m_file), needed.c_str());
+ m_hashes.compute(filedata, m_file->size(), needed.c_str());
return m_hashes;
}
@@ -348,7 +338,7 @@ file_error emu_file::open_next()
while (m_iterator.next(m_fullpath, m_filename.c_str()))
{
// attempt to open the file directly
- filerr = core_fopen(m_fullpath.c_str(), m_openflags, &m_file);
+ filerr = util::core_file::open(m_fullpath.c_str(), m_openflags, m_file);
if (filerr == FILERR_NONE)
break;
@@ -384,7 +374,7 @@ file_error emu_file::open_ram(const void *data, UINT32 length)
m_crc = 0;
// use the core_file's built-in RAM support
- return core_fopen_ram(data, length, m_openflags, &m_file);
+ return util::core_file::open_ram(data, length, m_openflags, m_file);
}
@@ -404,9 +394,7 @@ void emu_file::close()
zip_file_close(m_zipfile);
m_zipfile = nullptr;
- if (m_file != nullptr)
- core_fclose(m_file);
- m_file = nullptr;
+ m_file.reset();
m__7zdata.clear();
m_zipdata.clear();
@@ -429,7 +417,7 @@ void emu_file::close()
file_error emu_file::compress(int level)
{
- return core_fcompress(m_file, level);
+ return m_file->compress(level);
}
@@ -461,8 +449,8 @@ int emu_file::seek(INT64 offset, int whence)
return 1;
// seek if we can
- if (m_file != nullptr)
- return core_fseek(m_file, offset, whence);
+ if (m_file)
+ return m_file->seek(offset, whence);
return 1;
}
@@ -479,8 +467,8 @@ UINT64 emu_file::tell()
return 0;
// tell if we can
- if (m_file != nullptr)
- return core_ftell(m_file);
+ if (m_file)
+ return m_file->tell();
return 0;
}
@@ -497,8 +485,8 @@ bool emu_file::eof()
return 0;
// return EOF if we can
- if (m_file != nullptr)
- return core_feof(m_file);
+ if (m_file)
+ return m_file->eof();
return 0;
}
@@ -518,8 +506,8 @@ UINT64 emu_file::size()
return m_ziplength;
// return length if we can
- if (m_file != nullptr)
- return core_fsize(m_file);
+ if (m_file)
+ return m_file->size();
return 0;
}
@@ -536,8 +524,8 @@ UINT32 emu_file::read(void *buffer, UINT32 length)
return 0;
// read the data if we can
- if (m_file != nullptr)
- return core_fread(m_file, buffer, length);
+ if (m_file)
+ return m_file->read(buffer, length);
return 0;
}
@@ -554,8 +542,8 @@ int emu_file::getc()
return EOF;
// read the data if we can
- if (m_file != nullptr)
- return core_fgetc(m_file);
+ if (m_file)
+ return m_file->getc();
return EOF;
}
@@ -572,8 +560,8 @@ int emu_file::ungetc(int c)
return 1;
// read the data if we can
- if (m_file != nullptr)
- return core_ungetc(c, m_file);
+ if (m_file)
+ return m_file->ungetc(c);
return 1;
}
@@ -590,8 +578,8 @@ char *emu_file::gets(char *s, int n)
return nullptr;
// read the data if we can
- if (m_file != nullptr)
- return core_fgets(s, n, m_file);
+ if (m_file)
+ return m_file->gets(s, n);
return nullptr;
}
@@ -604,8 +592,8 @@ char *emu_file::gets(char *s, int n)
UINT32 emu_file::write(const void *buffer, UINT32 length)
{
// write the data if we can
- if (m_file != nullptr)
- return core_fwrite(m_file, buffer, length);
+ if (m_file)
+ return m_file->write(buffer, length);
return 0;
}
@@ -618,8 +606,8 @@ UINT32 emu_file::write(const void *buffer, UINT32 length)
int emu_file::puts(const char *s)
{
// write the data if we can
- if (m_file != nullptr)
- return core_fputs(m_file, s);
+ if (m_file)
+ return m_file->puts(s);
return 0;
}
@@ -629,25 +617,10 @@ int emu_file::puts(const char *s)
// vfprintf - vfprintf to a text file
//-------------------------------------------------
-int emu_file::vprintf(const char *fmt, va_list va)
+int emu_file::vprintf(util::format_argument_pack<std::ostream> const &args)
{
// write the data if we can
- return (m_file != nullptr) ? core_vfprintf(m_file, fmt, va) : 0;
-}
-
-
-//-------------------------------------------------
-// printf - vfprintf to a text file
-//-------------------------------------------------
-
-int CLIB_DECL emu_file::printf(const char *fmt, ...)
-{
- int rc;
- va_list va;
- va_start(va, fmt);
- rc = vprintf(fmt, va);
- va_end(va);
- return rc;
+ return m_file ? m_file->vprintf(args) : 0;
}
@@ -658,8 +631,8 @@ int CLIB_DECL emu_file::printf(const char *fmt, ...)
void emu_file::flush()
{
// flush the buffers if we can
- if (m_file != nullptr)
- core_fflush(m_file);
+ if (m_file)
+ m_file->flush();
}
@@ -778,7 +751,7 @@ file_error emu_file::load_zipped_file()
}
// convert to RAM file
- file_error filerr = core_fopen_ram(&m_zipdata[0], m_zipdata.size(), m_openflags, &m_file);
+ file_error filerr = util::core_file::open_ram(&m_zipdata[0], m_zipdata.size(), m_openflags, m_file);
if (filerr != FILERR_NONE)
{
m_zipdata.clear();
@@ -907,7 +880,7 @@ file_error emu_file::load__7zped_file()
}
// convert to RAM file
- file_error filerr = core_fopen_ram(&m__7zdata[0], m__7zdata.size(), m_openflags, &m_file);
+ file_error filerr = util::core_file::open_ram(&m__7zdata[0], m__7zdata.size(), m_openflags, m_file);
if (filerr != FILERR_NONE)
{
m__7zdata.clear();
diff --git a/src/emu/fileio.h b/src/emu/fileio.h
index 60111304abc..22f36f5362e 100644
--- a/src/emu/fileio.h
+++ b/src/emu/fileio.h
@@ -90,9 +90,8 @@ public:
virtual ~emu_file();
// getters
- operator core_file *();
- operator core_file &();
- bool is_open() const { return (m_file != nullptr); }
+ operator util::core_file &();
+ bool is_open() const { return bool(m_file); }
const char *filename() const { return m_filename.c_str(); }
const char *fullpath() const { return m_fullpath.c_str(); }
UINT32 openflags() const { return m_openflags; }
@@ -102,7 +101,7 @@ public:
// setters
void remove_on_close() { m_remove_on_close = true; }
- void set_openflags(UINT32 openflags) { assert(m_file == nullptr); m_openflags = openflags; }
+ void set_openflags(UINT32 openflags) { assert(!m_file); m_openflags = openflags; }
void set_restrict_to_mediapath(bool rtmp = true) { m_restrict_to_mediapath = rtmp; }
// open/close
@@ -136,8 +135,11 @@ public:
// writing
UINT32 write(const void *buffer, UINT32 length);
int puts(const char *s);
- int vprintf(const char *fmt, va_list va);
- int printf(const char *fmt, ...) ATTR_PRINTF(2,3);
+ int vprintf(util::format_argument_pack<std::ostream> const &args);
+ template <typename Format, typename... Params> int printf(Format &&fmt, Params &&...args)
+ {
+ return vprintf(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
+ }
// buffers
void flush();
@@ -157,9 +159,9 @@ private:
// internal state
std::string m_filename; // original filename provided
std::string m_fullpath; // full filename
- core_file * m_file; // core file pointer
+ util::core_file::ptr m_file; // core file pointer
path_iterator m_iterator; // iterator for paths
- path_iterator m_mediapaths; // media-path iterator
+ path_iterator m_mediapaths; // media-path iterator
UINT32 m_crc; // file's CRC
UINT32 m_openflags; // flags we used for the open
hash_collection m_hashes; // collection of hashes
diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp
index a9ac5682b04..2b00cabb94b 100644
--- a/src/emu/ioport.cpp
+++ b/src/emu/ioport.cpp
@@ -103,6 +103,9 @@
#include <ctype.h>
#include <time.h>
+
+namespace {
+
// temporary: set this to 1 to enable the originally defined behavior that
// a field specified via PORT_MODIFY which intersects a previously-defined
// field completely wipes out the previous definition
@@ -142,7 +145,6 @@ struct char_info
};
-
//**************************************************************************
// INLINE FUNCTIONS
//**************************************************************************
@@ -186,10 +188,10 @@ inline INT32 apply_scale(INT32 value, INT64 scale)
//**************************************************************************
// XML attributes for the different types
-static const char *const seqtypestrings[] = { "standard", "increment", "decrement" };
+const char *const seqtypestrings[] = { "standard", "increment", "decrement" };
// master character info table
-static const char_info charinfo[] =
+const char_info charinfo[] =
{
{ 0x0008, "Backspace", nullptr }, // Backspace
{ 0x0009, "Tab", " " }, // Tab
@@ -489,7 +491,7 @@ static const char_info charinfo[] =
// COMMON SHARED STRINGS
//**************************************************************************
-static const struct
+const struct
{
UINT32 id;
const char *string;
@@ -616,6 +618,11 @@ static const struct
{ INPUT_STRING_None, "None" },
};
+} // anonymous namespace
+
+
+std::uint8_t const inp_header::MAGIC[inp_header::OFFS_BASETIME - inp_header::OFFS_MAGIC] = { 'M', 'A', 'M', 'E', 'I', 'N', 'P', 0 };
+
//**************************************************************************
@@ -3404,25 +3411,25 @@ time_t ioport_manager::playback_init()
assert_always(filerr == FILERR_NONE, "Failed to open file for playback");
// read the header and verify that it is a modern version; if not, print an error
- UINT8 header[INP_HEADER_SIZE];
- if (m_playback_file.read(header, sizeof(header)) != sizeof(header))
+ inp_header header;
+ if (!header.read(m_playback_file))
fatalerror("Input file is corrupt or invalid (missing header)\n");
- if (memcmp(header, "MAMEINP\0", 8) != 0)
+ if (!header.check_magic())
fatalerror("Input file invalid or in an older, unsupported format\n");
- if (header[0x10] != INP_HEADER_MAJVERSION)
+ if (header.get_majversion() != inp_header::MAJVERSION)
fatalerror("Input file format version mismatch\n");
// output info to console
osd_printf_info("Input file: %s\n", filename);
- osd_printf_info("INP version %d.%d\n", header[0x10], header[0x11]);
- time_t basetime = header[0x08] | (header[0x09] << 8) | (header[0x0a] << 16) | (header[0x0b] << 24) |
- ((UINT64)header[0x0c] << 32) | ((UINT64)header[0x0d] << 40) | ((UINT64)header[0x0e] << 48) | ((UINT64)header[0x0f] << 56);
+ osd_printf_info("INP version %u.%u\n", header.get_majversion(), header.get_minversion());
+ time_t basetime = header.get_basetime();
osd_printf_info("Created %s\n", ctime(&basetime));
- osd_printf_info("Recorded using %s\n", header + 0x20);
+ osd_printf_info("Recorded using %s\n", header.get_appdesc().c_str());
// verify the header against the current game
- if (memcmp(machine().system().name, header + 0x14, strlen(machine().system().name) + 1) != 0)
- osd_printf_info("Input file is for machine '%s', not for current machine '%s'\n", header + 0x14, machine().system().name);
+ std::string const sysname = header.get_sysname();
+ if (sysname != machine().system().name)
+ osd_printf_info("Input file is for machine '%s', not for current machine '%s'\n", sysname.c_str(), machine().system().name);
// enable compression
m_playback_file.compress(FCOMPRESS_MEDIUM);
@@ -3447,7 +3454,8 @@ void ioport_manager::playback_end(const char *message)
machine().popmessage("Playback Ended\nReason: %s", message);
// display speed stats
- m_playback_accumulated_speed /= m_playback_accumulated_frames;
+ if (m_playback_accumulated_speed > 0)
+ m_playback_accumulated_speed /= m_playback_accumulated_frames;
osd_printf_info("Total playback frames: %d\n", UINT32(m_playback_accumulated_frames));
osd_printf_info("Average recorded speed: %d%%\n", UINT32((m_playback_accumulated_speed * 200 + 1) >> 21));
@@ -3582,23 +3590,15 @@ void ioport_manager::record_init()
machine().base_datetime(systime);
// fill in the header
- UINT8 header[INP_HEADER_SIZE] = { 0 };
- memcpy(header, "MAMEINP\0", 8);
- header[0x08] = systime.time >> 0;
- header[0x09] = systime.time >> 8;
- header[0x0a] = systime.time >> 16;
- header[0x0b] = systime.time >> 24;
- header[0x0c] = systime.time >> 32;
- header[0x0d] = systime.time >> 40;
- header[0x0e] = systime.time >> 48;
- header[0x0f] = systime.time >> 56;
- header[0x10] = INP_HEADER_MAJVERSION;
- header[0x11] = INP_HEADER_MINVERSION;
- strcpy((char *)header + 0x14, machine().system().name);
- sprintf((char *)header + 0x20, "%s %s", emulator_info::get_appname(), build_version);
+ inp_header header;
+ header.set_magic();
+ header.set_basetime(systime.time);
+ header.set_version();
+ header.set_sysname(machine().system().name);
+ header.set_appdesc(util::string_format("%s %s", emulator_info::get_appname(), build_version));
// write it
- m_record_file.write(header, sizeof(header));
+ header.write(m_record_file);
// enable compression
m_record_file.compress(FCOMPRESS_MEDIUM);
diff --git a/src/emu/ioport.h b/src/emu/ioport.h
index bc8dab543be..8d16f7e4fa8 100644
--- a/src/emu/ioport.h
+++ b/src/emu/ioport.h
@@ -17,6 +17,8 @@
#ifndef __INPTPORT_H__
#define __INPTPORT_H__
+#include <cstdint>
+#include <cstring>
#include <time.h>
@@ -34,11 +36,6 @@ const ioport_value IP_ACTIVE_LOW = 0xffffffff;
// maximum number of players supported
const int MAX_PLAYERS = 8;
-// INP file parameters
-const UINT32 INP_HEADER_SIZE = 64;
-const UINT32 INP_HEADER_MAJVERSION = 3;
-const UINT32 INP_HEADER_MINVERSION = 0;
-
// unicode constants
const unicode_char UCHAR_PRIVATE = 0x100000;
const unicode_char UCHAR_SHIFT_1 = UCHAR_PRIVATE + 0;
@@ -697,15 +694,110 @@ typedef delegate<bool ()> ioport_charqueue_empty_delegate;
// ======================> inp_header
// header at the front of INP files
-struct inp_header
+class inp_header
{
- char header[8]; // +00: 8 byte header - must be "MAMEINP\0"
- UINT64 basetime; // +08: base time of recording
- UINT8 majversion; // +10: major INP version
- UINT8 minversion; // +11: minor INP version
- UINT8 reserved[2]; // +12: must be zero
- char gamename[12]; // +14: game name string, NULL-terminated
- char version[32]; // +20: system version string, NULL-terminated
+public:
+ // parameters
+ static constexpr unsigned MAJVERSION = 3;
+ static constexpr unsigned MINVERSION = 0;
+
+ bool read(emu_file &f)
+ {
+ return f.read(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+ bool write(emu_file &f) const
+ {
+ return f.write(m_data, sizeof(m_data)) == sizeof(m_data);
+ }
+
+ bool check_magic() const
+ {
+ return 0 == std::memcmp(MAGIC, m_data + OFFS_MAGIC, OFFS_BASETIME - OFFS_MAGIC);
+ }
+ std::uint64_t get_basetime() const
+ {
+ return
+ (std::uint64_t(m_data[OFFS_BASETIME + 0]) << (0 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 1]) << (1 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 2]) << (2 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 3]) << (3 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 4]) << (4 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 5]) << (5 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 6]) << (6 * 8)) |
+ (std::uint64_t(m_data[OFFS_BASETIME + 7]) << (7 * 8));
+ }
+ unsigned get_majversion() const
+ {
+ return m_data[OFFS_MAJVERSION];
+ }
+ unsigned get_minversion() const
+ {
+ return m_data[OFFS_MINVERSION];
+ }
+ std::string get_sysname() const
+ {
+ return get_string<OFFS_SYSNAME, OFFS_APPDESC>();
+ }
+ std::string get_appdesc() const
+ {
+ return get_string<OFFS_APPDESC, OFFS_END>();
+ }
+
+ void set_magic()
+ {
+ std::memcpy(m_data + OFFS_MAGIC, MAGIC, OFFS_BASETIME - OFFS_MAGIC);
+ }
+ void set_basetime(std::uint64_t time)
+ {
+ m_data[OFFS_BASETIME + 0] = std::uint8_t((time >> (0 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 1] = std::uint8_t((time >> (1 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 2] = std::uint8_t((time >> (2 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 3] = std::uint8_t((time >> (3 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 4] = std::uint8_t((time >> (4 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 5] = std::uint8_t((time >> (5 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 6] = std::uint8_t((time >> (6 * 8)) & 0x00ff);
+ m_data[OFFS_BASETIME + 7] = std::uint8_t((time >> (7 * 8)) & 0x00ff);
+ }
+ void set_version()
+ {
+ m_data[OFFS_MAJVERSION] = MAJVERSION;
+ m_data[OFFS_MINVERSION] = MINVERSION;
+ }
+ void set_sysname(std::string const &name)
+ {
+ set_string<OFFS_SYSNAME, OFFS_APPDESC>(name);
+ }
+ void set_appdesc(std::string const &desc)
+ {
+ set_string<OFFS_APPDESC, OFFS_END>(desc);
+ }
+
+private:
+ template <std::size_t BEGIN, std::size_t END> void set_string(std::string const &str)
+ {
+ std::size_t const used = (std::min<std::size_t>)(str.size() + 1, END - BEGIN);
+ std::memcpy(m_data + BEGIN, str.c_str(), used);
+ if ((END - BEGIN) > used)
+ std::memset(m_data + BEGIN + used, 0, (END - BEGIN) - used);
+ }
+ template <std::size_t BEGIN, std::size_t END> std::string get_string() const
+ {
+ char const *const begin = reinterpret_cast<char const *>(m_data + BEGIN);
+ return std::string(begin, std::find(begin, reinterpret_cast<char const *>(m_data + END), '\0'));
+ }
+
+ static constexpr std::size_t OFFS_MAGIC = 0x00; // 0x08 bytes
+ static constexpr std::size_t OFFS_BASETIME = 0x08; // 0x08 bytes (little-endian binary integer)
+ static constexpr std::size_t OFFS_MAJVERSION = 0x10; // 0x01 bytes (binary integer)
+ static constexpr std::size_t OFFS_MINVERSION = 0x11; // 0x01 bytes (binary integer)
+ // 0x02 bytes reserved
+ static constexpr std::size_t OFFS_SYSNAME = 0x14; // 0x0c bytes (ASCII)
+ static constexpr std::size_t OFFS_APPDESC = 0x20; // 0x20 bytes (ASCII)
+ static constexpr std::size_t OFFS_END = 0x40;
+
+ static std::uint8_t const MAGIC[OFFS_BASETIME - OFFS_MAGIC];
+
+ std::uint8_t m_data[OFFS_END];
};
@@ -1580,7 +1672,6 @@ private:
#define DECLARE_INPUT_CHANGED_MEMBER(name) void name(ioport_field &field, void *param, ioport_value oldval, ioport_value newval)
// macro for port changed callback functions (PORT_CROSSHAIR_MAPPER)
-#define CROSSHAIR_MAPPER(name) float name(device_t &device, ioport_field &field, float linear_value)
#define CROSSHAIR_MAPPER_MEMBER(name) float name(ioport_field &field, float linear_value)
#define DECLARE_CROSSHAIR_MAPPER_MEMBER(name) float name(ioport_field &field, float linear_value)
@@ -1727,9 +1818,6 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s
configurer.field_set_analog_invert();
// read callbacks
-#define PORT_CUSTOM(_callback, _param) \
- configurer.field_set_dynamic_read(ioport_field_read_delegate(_callback, #_callback, DEVICE_SELF, (device_t *)NULL), (void *)(_param));
-
#define PORT_CUSTOM_MEMBER(_device, _class, _member, _param) \
configurer.field_set_dynamic_read(ioport_field_read_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)NULL), (void *)(_param));
@@ -1738,18 +1826,12 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s
configurer.field_set_dynamic_write(ioport_field_write_delegate(&_class::_member, #_class "::" #_member, _device, (_class *)NULL), (void *)(_param));
// input device handler
-#define PORT_READ_LINE_DEVICE(_device, _read_line_device) \
- configurer.field_set_dynamic_read(ioport_field_read_delegate(&ioport_read_line_wrapper<_read_line_device>, #_read_line_device, _device, (device_t *)NULL));
-
#define PORT_READ_LINE_DEVICE_MEMBER(_device, _class, _member) \
- configurer.field_set_dynamic_read(ioport_field_read_delegate(&ioport_read_line_wrapper<_class, &_class::_member>, #_class "::" #_member, _device, (_class *)NULL));
+ configurer.field_set_dynamic_read(ioport_field_read_delegate([](_class &device, ioport_field &field, void *param)->ioport_value { return (device._member() & 1) ? ~ioport_value(0) : 0; } , #_class "::" #_member, _device, (_class *)NULL));
// output device handler
-#define PORT_WRITE_LINE_DEVICE(_device, _write_line_device) \
- configurer.field_set_dynamic_write(ioport_field_write_delegate(&ioport_write_line_wrapper<_write_line_device>, #_write_line_device, _device, (device_t *)NULL));
-
#define PORT_WRITE_LINE_DEVICE_MEMBER(_device, _class, _member) \
- configurer.field_set_dynamic_write(ioport_field_write_delegate(&ioport_write_line_wrapper<_class, &_class::_member>, #_class "::" #_member, _device, (_class *)NULL));
+ configurer.field_set_dynamic_write(ioport_field_write_delegate([](_class &device, ioport_field &field, void *param, ioport_value oldval, ioport_value newval) { device._member(newval); }, #_class "::" #_member, _device, (_class *)NULL));
// dip switch definition
#define PORT_DIPNAME(_mask, _default, _name) \
@@ -1829,38 +1911,6 @@ ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, s
#define PORT_HBLANK(_screen) \
PORT_READ_LINE_DEVICE_MEMBER(_screen, screen_device, hblank)
-
-
-//**************************************************************************
-// INLINE TEMPLATES
-//**************************************************************************
-
-template<int (*_FunctionPointer)(device_t *)>
-ioport_value ioport_read_line_wrapper(device_t &device, ioport_field &field, void *param)
-{
- return ((*_FunctionPointer)(&device) & 1) ? ~ioport_value(0) : 0;
-}
-
-template<class _FunctionClass, int (_FunctionClass::*_FunctionPointer)()>
-ioport_value ioport_read_line_wrapper(_FunctionClass &device, ioport_field &field, void *param)
-{
- return ((device.*_FunctionPointer)() & 1) ? ~ioport_value(0) : 0;
-}
-
-template<void (*_FunctionPointer)(device_t *, int)>
-void ioport_write_line_wrapper(device_t &device, ioport_field &field, void *param, ioport_value oldval, ioport_value newval)
-{
- return (*_FunctionPointer)(&device, newval);
-}
-
-template<class _FunctionClass, void (_FunctionClass::*_FunctionPointer)(int)>
-void ioport_write_line_wrapper(_FunctionClass &device, ioport_field &field, void *param, ioport_value oldval, ioport_value newval)
-{
- return (device.*_FunctionPointer)(newval);
-}
-
-
-
//**************************************************************************
// INLINE FUNCTIONS
//**************************************************************************
diff --git a/src/emu/layout/LICENSE b/src/emu/layout/LICENSE
new file mode 100644
index 00000000000..670154e3538
--- /dev/null
+++ b/src/emu/layout/LICENSE
@@ -0,0 +1,116 @@
+CC0 1.0 Universal
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator and
+subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for the
+purpose of contributing to a commons of creative, cultural and scientific
+works ("Commons") that the public can reliably and without fear of later
+claims of infringement build upon, modify, incorporate in other works, reuse
+and redistribute as freely as possible in any form whatsoever and for any
+purposes, including without limitation commercial purposes. These owners may
+contribute to the Commons to promote the ideal of a free culture and the
+further production of creative, cultural and scientific works, or to gain
+reputation or greater distribution for their Work in part through the use and
+efforts of others.
+
+For these and/or other purposes and motivations, and without any expectation
+of additional consideration or compensation, the person associating CC0 with a
+Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
+and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
+and publicly distribute the Work under its terms, with knowledge of his or her
+Copyright and Related Rights in the Work and the meaning and intended legal
+effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not limited
+to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
+ and translate a Work;
+
+ ii. moral rights retained by the original author(s) and/or performer(s);
+
+ iii. publicity and privacy rights pertaining to a person's image or likeness
+ depicted in a Work;
+
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+
+ v. rights protecting the extraction, dissemination, use and reuse of data in
+ a Work;
+
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation thereof,
+ including any amended or successor version of such directive); and
+
+ vii. other similar, equivalent or corresponding rights throughout the world
+ based on applicable law or treaty, and any national implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention of,
+applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
+unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
+and Related Rights and associated claims and causes of action, whether now
+known or unknown (including existing as well as future claims and causes of
+action), in the Work (i) in all territories worldwide, (ii) for the maximum
+duration provided by applicable law or treaty (including future time
+extensions), (iii) in any current or future medium and for any number of
+copies, and (iv) for any purpose whatsoever, including without limitation
+commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
+the Waiver for the benefit of each member of the public at large and to the
+detriment of Affirmer's heirs and successors, fully intending that such Waiver
+shall not be subject to revocation, rescission, cancellation, termination, or
+any other legal or equitable action to disrupt the quiet enjoyment of the Work
+by the public as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason be
+judged legally invalid or ineffective under applicable law, then the Waiver
+shall be preserved to the maximum extent permitted taking into account
+Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
+is so judged Affirmer hereby grants to each affected person a royalty-free,
+non transferable, non sublicensable, non exclusive, irrevocable and
+unconditional license to exercise Affirmer's Copyright and Related Rights in
+the Work (i) in all territories worldwide, (ii) for the maximum duration
+provided by applicable law or treaty (including future time extensions), (iii)
+in any current or future medium and for any number of copies, and (iv) for any
+purpose whatsoever, including without limitation commercial, advertising or
+promotional purposes (the "License"). The License shall be deemed effective as
+of the date CC0 was applied by Affirmer to the Work. Should any part of the
+License for any reason be judged legally invalid or ineffective under
+applicable law, such partial invalidity or ineffectiveness shall not
+invalidate the remainder of the License, and in such case Affirmer hereby
+affirms that he or she will not (i) exercise any of his or her remaining
+Copyright and Related Rights in the Work or (ii) assert any associated claims
+and causes of action with respect to the Work, in either case contrary to
+Affirmer's express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+
+ b. Affirmer offers the Work as-is and makes no representations or warranties
+ of any kind concerning the Work, express, implied, statutory or otherwise,
+ including without limitation warranties of title, merchantability, fitness
+ for a particular purpose, non infringement, or the absence of latent or
+ other defects, accuracy, or the present or absence of errors, whether or not
+ discoverable, all to the greatest extent permissible under applicable law.
+
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without limitation
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
+ disclaims responsibility for obtaining any necessary consents, permissions
+ or other rights required for any use of the Work.
+
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to this
+ CC0 or use of the Work.
+
+For more information, please see
+<http://creativecommons.org/publicdomain/zero/1.0/>
diff --git a/src/emu/layout/README.md b/src/emu/layout/README.md
new file mode 100644
index 00000000000..78ef2e5e6ad
--- /dev/null
+++ b/src/emu/layout/README.md
@@ -0,0 +1,6 @@
+# **Layout** #
+
+Layouts files are definiton files to describe look and fell of emulated machines, and are product
+of many different contributors.
+
+Licensed under [CC0 1.0 Universal (CC0 1.0)](https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file
diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp
index ecf1b418de5..4ffee509693 100644
--- a/src/emu/luaengine.cpp
+++ b/src/emu/luaengine.cpp
@@ -19,9 +19,6 @@
#include "ui/ui.h"
#include "luaengine.h"
#include <mutex>
-#if !defined(NO_LIBUV)
-#include "libuv/include/uv.h"
-#endif
//**************************************************************************
// LUA ENGINE
@@ -52,10 +49,6 @@ extern "C" {
int luaopen_lsqlite3(lua_State *L);
int luaopen_zlib(lua_State *L);
int luaopen_lfs(lua_State *L);
-#if !defined(NO_LIBUV)
- int luaopen_luv(lua_State *L);
- uv_loop_t* luv_loop(lua_State* L);
-#endif
}
static void lstop(lua_State *L, lua_Debug *ar)
@@ -1199,12 +1192,6 @@ lua_engine::lua_engine()
lua_getfield(m_lua_state, -1, "preload");
lua_remove(m_lua_state, -2); // Remove package
-#if !defined(NO_LIBUV)
- // Store uv module definition at preload.uv
- lua_pushcfunction(m_lua_state, luaopen_luv);
- lua_setfield(m_lua_state, -2, "luv");
-#endif
-
lua_pushcfunction(m_lua_state, luaopen_zlib);
lua_setfield(m_lua_state, -2, "zlib");
@@ -1670,11 +1657,6 @@ void lua_engine::periodic_check()
msg.ready = 0;
msg.done = 1;
}
-#if !defined(NO_LIBUV)
- auto loop = luv_loop(m_lua_state);
- if (loop!=nullptr)
- uv_run(loop, UV_RUN_NOWAIT);
-#endif
}
//-------------------------------------------------
@@ -1727,13 +1709,13 @@ void lua_engine::start()
namespace luabridge {
template <>
- struct Stack <UINT64> {
- static inline void push (lua_State* L, UINT64 value) {
+ struct Stack <unsigned long long> {
+ static inline void push (lua_State* L, unsigned long long value) {
lua_pushunsigned(L, static_cast <lua_Unsigned> (value));
}
- static inline UINT64 get (lua_State* L, int index) {
- return static_cast <UINT64> (luaL_checkunsigned (L, index));
+ static inline unsigned long long get (lua_State* L, int index) {
+ return static_cast <unsigned long long> (luaL_checkunsigned (L, index));
}
};
}
diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp
index 70c3f2f1569..b3ac263473e 100644
--- a/src/emu/machine.cpp
+++ b/src/emu/machine.cpp
@@ -1011,6 +1011,7 @@ void running_machine::logfile_callback(const running_machine &machine, const cha
if (machine.m_logfile != nullptr)
{
machine.m_logfile->puts(buffer);
+
machine.m_logfile->flush();
}
}
diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp
index 513300553d6..5e93623498d 100644
--- a/src/emu/mame.cpp
+++ b/src/emu/mame.cpp
@@ -259,7 +259,7 @@ int machine_manager::execute()
sw_instance = sw_load.substr(right + 1);
sw_load.assign(sw_load.substr(0, right));
- char arg[] = "ume";
+ char arg[] = "mame";
char *argv = &arg[0];
m_options.set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string);
m_options.parse_slot_devices(1, &argv, option_errors, sw_instance.c_str(), sw_load.c_str());
diff --git a/src/emu/schedule.h b/src/emu/schedule.h
index 2f3a7f8a23a..5ed0c049bdb 100644
--- a/src/emu/schedule.h
+++ b/src/emu/schedule.h
@@ -33,8 +33,6 @@
#define PERIOD_OF_555_MONOSTABLE(r,c) attotime::from_nsec(PERIOD_OF_555_MONOSTABLE_NSEC(r,c))
#define PERIOD_OF_555_ASTABLE(r1,r2,c) attotime::from_nsec(PERIOD_OF_555_ASTABLE_NSEC(r1,r2,c))
-#define TIMER_CALLBACK(name) void name(running_machine &machine, void *ptr, int param)
-#define TIMER_CALLBACK_MEMBER(name) void name(void *ptr, INT32 param)
//**************************************************************************
// TYPE DEFINITIONS
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 2ae1269cdd8..c286788ea37 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -240,6 +240,19 @@ void screen_device::static_set_video_attributes(device_t &device, UINT32 flags)
screen_device &screen = downcast<screen_device &>(device);
screen.m_video_attributes = flags;
}
+
+
+//-------------------------------------------------
+// static_set_color - set the screen global color
+//-------------------------------------------------
+
+void screen_device::static_set_color(device_t &device, rgb_t color)
+{
+ screen_device &screen = downcast<screen_device &>(device);
+ screen.m_color = color;
+}
+
+
//-------------------------------------------------
// device_validity_check - verify device
// configuration
diff --git a/src/emu/screen.h b/src/emu/screen.h
index 6a38b72f377..711602b0395 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -193,6 +193,7 @@ public:
static void static_set_screen_vblank(device_t &device, screen_vblank_delegate callback);
static void static_set_palette(device_t &device, const char *tag);
static void static_set_video_attributes(device_t &device, UINT32 flags);
+ static void static_set_color(device_t &device, rgb_t color);
// information getters
render_container &container() const { assert(m_container != nullptr); return *m_container; }
@@ -365,6 +366,12 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
#define MCFG_SCREEN_ADD(_tag, _type) \
MCFG_DEVICE_ADD(_tag, SCREEN, 0) \
MCFG_SCREEN_TYPE(_type)
+
+#define MCFG_SCREEN_ADD_MONOCHROME(_tag, _type, _color) \
+ MCFG_DEVICE_ADD(_tag, SCREEN, 0) \
+ MCFG_SCREEN_TYPE(_type) \
+ MCFG_SCREEN_COLOR(_color)
+
#define MCFG_SCREEN_MODIFY(_tag) \
MCFG_DEVICE_MODIFY(_tag)
@@ -442,6 +449,8 @@ typedef device_type_iterator<&device_creator<screen_device>, screen_device> scre
screen_device::static_set_palette(*device, FINDER_DUMMY_TAG);
#define MCFG_SCREEN_VIDEO_ATTRIBUTES(_flags) \
screen_device::static_set_video_attributes(*device, _flags);
+#define MCFG_SCREEN_COLOR(_color) \
+ screen_device::static_set_color(*device, _color);
//**************************************************************************
diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp
index 8df29a29e09..807c1b30cf8 100644
--- a/src/emu/tilemap.cpp
+++ b/src/emu/tilemap.cpp
@@ -558,22 +558,22 @@ void tilemap_t::configure_groups(gfx_element &gfx, int transcolor)
// order with optional flipping
//-------------------------------------------------
-tilemap_memory_index tilemap_t::scan_rows(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return row * num_cols + col;
}
-tilemap_memory_index tilemap_t::scan_rows_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_x(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return row * num_cols + (num_cols - 1 - col);
}
-tilemap_memory_index tilemap_t::scan_rows_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_y(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_rows - 1 - row) * num_cols + col;
}
-tilemap_memory_index tilemap_t::scan_rows_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_rows_flip_xy(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_rows - 1 - row) * num_cols + (num_cols - 1 - col);
}
@@ -587,22 +587,22 @@ tilemap_memory_index tilemap_t::scan_rows_flip_xy(driver_device &device, UINT32
// major order with optional flipping
//-------------------------------------------------
-tilemap_memory_index tilemap_t::scan_cols(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return col * num_rows + row;
}
-tilemap_memory_index tilemap_t::scan_cols_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_x(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_cols - 1 - col) * num_rows + row;
}
-tilemap_memory_index tilemap_t::scan_cols_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_y(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return col * num_rows + (num_rows - 1 - row);
}
-tilemap_memory_index tilemap_t::scan_cols_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
+tilemap_memory_index tilemap_t::scan_cols_flip_xy(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows)
{
return (num_cols - 1 - col) * num_rows + (num_rows - 1 - row);
}
@@ -1519,22 +1519,6 @@ tilemap_manager::~tilemap_manager()
// tilemaps
//-------------------------------------------------
-static const struct
-{
- tilemap_memory_index (*func)(driver_device &, UINT32, UINT32, UINT32, UINT32);
- const char *name;
-} s_standard_mappers[TILEMAP_STANDARD_COUNT] =
-{
- { FUNC(tilemap_t::scan_rows) },
- { FUNC(tilemap_t::scan_rows_flip_x) },
- { FUNC(tilemap_t::scan_rows_flip_y) },
- { FUNC(tilemap_t::scan_rows_flip_xy) },
- { FUNC(tilemap_t::scan_cols) },
- { FUNC(tilemap_t::scan_cols_flip_x) },
- { FUNC(tilemap_t::scan_cols_flip_y) },
- { FUNC(tilemap_t::scan_cols_flip_xy) }
-};
-
tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_info_delegate tile_get_info, tilemap_mapper_delegate mapper, int tilewidth, int tileheight, int cols, int rows, tilemap_t *allocated)
{
if (allocated == nullptr)
@@ -1546,7 +1530,19 @@ tilemap_t &tilemap_manager::create(device_gfx_interface &decoder, tilemap_get_in
{
if (allocated == nullptr)
allocated = global_alloc(tilemap_t);
- return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(s_standard_mappers[mapper].func, s_standard_mappers[mapper].name, machine().driver_data()), tilewidth, tileheight, cols, rows));
+
+ switch (mapper)
+ {
+ case TILEMAP_SCAN_ROWS :return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_rows), allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_ROWS_FLIP_X:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_rows_flip_x), allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_ROWS_FLIP_Y:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_rows_flip_y), allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_ROWS_FLIP_XY:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_rows_flip_xy),allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_COLS:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_cols),allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_COLS_FLIP_X:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_cols_flip_x),allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_COLS_FLIP_Y:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_cols_flip_y),allocated), tilewidth, tileheight, cols, rows));
+ case TILEMAP_SCAN_COLS_FLIP_XY:return m_tilemap_list.append(allocated->init(*this, decoder, tile_get_info, tilemap_mapper_delegate(FUNC(tilemap_t::scan_cols_flip_xy),allocated), tilewidth, tileheight, cols, rows));
+ default: throw emu_fatalerror("Tilemap manager create unknown mapper %d", mapper);
+ }
}
diff --git a/src/emu/tilemap.h b/src/emu/tilemap.h
index 0f7dcf93c1b..6e4308d6052 100644
--- a/src/emu/tilemap.h
+++ b/src/emu/tilemap.h
@@ -550,16 +550,16 @@ public:
// mappers
// scan in row-major order with optional flipping
- static tilemap_memory_index scan_rows(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_rows_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_rows(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_rows_flip_x(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_rows_flip_y(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_rows_flip_xy(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
// scan in column-major order with optional flipping
- static tilemap_memory_index scan_cols(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_x(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_y(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
- static tilemap_memory_index scan_cols_flip_xy(driver_device &device, UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_cols(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_cols_flip_x(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_cols_flip_y(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
+ tilemap_memory_index scan_cols_flip_xy(UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows);
// optional memory accessors
UINT32 basemem_read(int index) { return m_basemem.read(index); }
diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp
index 6aaed9105df..a6279ac5b54 100644
--- a/src/emu/ui/custui.cpp
+++ b/src/emu/ui/custui.cpp
@@ -588,7 +588,7 @@ void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom
// bottom text
// get the text for 'UI Select'
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
- topbuf.assign(_("Double click or press ")).append(ui_select_text.c_str()).append(_(" to change the color value"));
+ topbuf = string_format(_("Double click or press %1$s to change the color value"), ui_select_text);
mui.draw_text_full(container, topbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
@@ -857,7 +857,7 @@ void ui_menu_rgb_ui::populate()
if (m_lock_ref != RGB_ALPHA)
{
arrow_flags = get_arrow_flags(0, 255, m_color->a());
- item_append(_("Alpha"), string_format("%3d", m_color->a()).c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA);
+ item_append(_("Alpha"), string_format("%3u", m_color->a()).c_str(), arrow_flags, (void *)(FPTR)RGB_ALPHA);
}
else
item_append(_("Alpha"), s_text.c_str(), 0, (void *)(FPTR)RGB_ALPHA);
@@ -865,7 +865,7 @@ void ui_menu_rgb_ui::populate()
if (m_lock_ref != RGB_RED)
{
arrow_flags = get_arrow_flags(0, 255, m_color->r());
- item_append(_("Red"), string_format("%3d", m_color->r()).c_str(), arrow_flags, (void *)(FPTR)RGB_RED);
+ item_append(_("Red"), string_format("%3u", m_color->r()).c_str(), arrow_flags, (void *)(FPTR)RGB_RED);
}
else
item_append(_("Red"), s_text.c_str(), 0, (void *)(FPTR)RGB_RED);
@@ -873,7 +873,7 @@ void ui_menu_rgb_ui::populate()
if (m_lock_ref != RGB_GREEN)
{
arrow_flags = get_arrow_flags(0, 255, m_color->g());
- item_append(_("Green"), string_format("%3d", m_color->g()).c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN);
+ item_append(_("Green"), string_format("%3u", m_color->g()).c_str(), arrow_flags, (void *)(FPTR)RGB_GREEN);
}
else
item_append(_("Green"), s_text.c_str(), 0, (void *)(FPTR)RGB_GREEN);
@@ -881,7 +881,7 @@ void ui_menu_rgb_ui::populate()
if (m_lock_ref != RGB_BLUE)
{
arrow_flags = get_arrow_flags(0, 255, m_color->b());
- item_append(_("Blue"), string_format("%3d", m_color->b()).c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE);
+ item_append(_("Blue"), string_format("%3u", m_color->b()).c_str(), arrow_flags, (void *)(FPTR)RGB_BLUE);
}
else
item_append(_("Blue"), s_text.c_str(), 0, (void *)(FPTR)RGB_BLUE);
diff --git a/src/emu/ui/datfile.h b/src/emu/ui/datfile.h
index 66d76d17501..7b38599ba21 100644
--- a/src/emu/ui/datfile.h
+++ b/src/emu/ui/datfile.h
@@ -31,7 +31,6 @@ public:
void load_software_info(std::string &softlist, std::string &buffer, std::string &softname, std::string &parentname);
void command_sub_menu(const game_driver *drv, std::vector<std::string> &menuitems);
void reset_run() { first_run = true; }
- bool has_software(std::string &softlist, std::string &softname, std::string &parentname);
std::string rev_history() const { return m_history_rev; }
std::string rev_mameinfo() const { return m_mame_rev; }
@@ -45,9 +44,11 @@ public:
bool has_command(const game_driver *driver) { return (m_cmdidx.find(driver) != m_cmdidx.end()); }
bool has_sysinfo(const game_driver *driver) { return (m_sysidx.find(driver) != m_sysidx.end()); }
bool has_story(const game_driver *driver) { return (m_storyidx.find(driver) != m_storyidx.end()); }
+ bool has_software(std::string &softlist, std::string &softname, std::string &parentname);
- bool has_data(const game_driver *d)
+ bool has_data(const game_driver *a = nullptr)
{
+ const game_driver *d = (a != nullptr) ? a : &machine().system();
return (has_history(d) || has_mameinfo(d) || has_messinfo(d) || has_command(d) || has_sysinfo(d) || has_story(d));
}
private:
diff --git a/src/emu/ui/datmenu.cpp b/src/emu/ui/datmenu.cpp
index 6c240311c62..93c776f3e51 100644
--- a/src/emu/ui/datmenu.cpp
+++ b/src/emu/ui/datmenu.cpp
@@ -99,10 +99,7 @@ void ui_menu_dats_view::handle()
void ui_menu_dats_view::populate()
{
machine().pause();
- if (!issoft)
- get_data();
- else
- get_data_sw();
+ (issoft == true) ? get_data_sw() : get_data();
item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr);
customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER;
@@ -119,12 +116,7 @@ void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom
ui_manager &mui = machine().ui();
float maxwidth = origx2 - origx1;
float width;
- std::string driver;
-
- if (issoft)
- driver = m_swinfo->longname;
- else
- driver = m_driver->description;
+ std::string driver = (issoft == true) ? m_swinfo->longname : m_driver->description;
mui.draw_text_full(container, driver.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
@@ -251,7 +243,6 @@ void ui_menu_dats_view::get_data()
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1));
-
}
}
@@ -276,7 +267,6 @@ void ui_menu_dats_view::get_data_sw()
{
std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x]));
item_append(tempbuf.c_str(), nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_DISABLE), (void *)(FPTR)(x + 1));
-
}
}
diff --git a/src/emu/ui/dirmenu.cpp b/src/emu/ui/dirmenu.cpp
index a24a0041653..8ae0372af30 100644
--- a/src/emu/ui/dirmenu.cpp
+++ b/src/emu/ui/dirmenu.cpp
@@ -180,7 +180,7 @@ void ui_menu_display_actual::handle()
void ui_menu_display_actual::populate()
{
- m_tempbuf.assign(_("Current ")).append(_(s_folders[m_ref].name)).append(_(" Folders"));
+ m_tempbuf = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name));
if (machine().ui().options().exists(s_folders[m_ref].option))
m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option));
else
@@ -494,8 +494,12 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa
float width, maxwidth = origx2 - origx1;
ui_manager &mui = machine().ui();
std::string tempbuf[2];
- tempbuf[0] = (m_change) ? _("Change)") : _("Add");
- tempbuf[0].append(" ").append(_(s_folders[m_ref].name)).append(_(" Folder - Search: ")).append(m_search).append("_");
+ tempbuf[0] = string_format(
+ (m_change)
+ ? _("Change %1$s Folder - Search: %2$s_")
+ : _("Add %1$s Folder - Search: %2$s_"),
+ _(s_folders[m_ref].name),
+ m_search);
tempbuf[1] = m_current_path;
// get the size of the text
@@ -636,7 +640,7 @@ void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bo
{
float width;
ui_manager &mui = machine().ui();
- std::string tempbuf = std::string(_("Remove ")).append(_(s_folders[m_ref].name)).append(_(" Folder"));
+ std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name));
// get the size of the text
mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
diff --git a/src/emu/ui/filesel.cpp b/src/emu/ui/filesel.cpp
index 18555c4809b..ec8d4c2ea22 100644
--- a/src/emu/ui/filesel.cpp
+++ b/src/emu/ui/filesel.cpp
@@ -712,7 +712,7 @@ void ui_menu_file_selector::handle()
// from current entry to the end
for (entry = cur_selected; entry != nullptr; entry = entry->next)
{
- if (entry->basename != nullptr && m_filename_buffer != nullptr)
+ if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
{
int match = 0;
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
@@ -731,7 +731,7 @@ void ui_menu_file_selector::handle()
// and from the first entry to current one
for (entry = m_entrylist; entry != cur_selected; entry = entry->next)
{
- if (entry->basename != nullptr && m_filename_buffer != nullptr)
+ if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
{
int match = 0;
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
diff --git a/src/emu/ui/mainmenu.cpp b/src/emu/ui/mainmenu.cpp
index 66381a3df1f..0cf449e8f84 100644
--- a/src/emu/ui/mainmenu.cpp
+++ b/src/emu/ui/mainmenu.cpp
@@ -132,7 +132,7 @@ void ui_menu_main::populate()
item_append(_("Cheat"), nullptr, 0, (void *)CHEAT);
// add dats menu
- if (machine().ui().options().enabled_dats() && machine().datfile().has_data(&machine().system()))
+ if (machine().ui().options().enabled_dats() && machine().datfile().has_data())
item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS);
item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr);
diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp
index f6154c41638..ccc73f55002 100644
--- a/src/emu/ui/menu.cpp
+++ b/src/emu/ui/menu.cpp
@@ -544,7 +544,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
// determine the first visible line based on the current selection
- if (selected > top_line + visible_lines)
+ if (selected > top_line + visible_lines || selected < top_line - visible_lines)
top_line = selected - (visible_lines / 2);
if (top_line < 0 || selected == 0)
top_line = 0;
@@ -1891,6 +1891,21 @@ void ui_menu::handle_main_events(UINT32 flags)
bool stop = false;
ui_event local_menu_event;
+ if (m_pressed)
+ {
+ bool pressed = mouse_pressed();
+ INT32 m_target_x, m_target_y;
+ bool m_button;
+ render_target *mouse_target = machine().ui_input().find_mouse(&m_target_x, &m_target_y, &m_button);
+ if (mouse_target != nullptr && m_button && (hover == HOVER_ARROW_DOWN || hover == HOVER_ARROW_UP))
+ {
+ if (pressed)
+ machine().ui_input().push_mouse_down_event(mouse_target, m_target_x, m_target_y);
+ }
+ else
+ reset_pressed();
+ }
+
// loop while we have interesting events
while (!stop && machine().ui_input().pop_event(&local_menu_event))
{
@@ -1919,6 +1934,7 @@ void ui_menu::handle_main_events(UINT32 flags)
if (selected < 0)
selected = 0;
top_line -= visitems - (top_line + visible_lines == visible_items);
+ set_pressed();
}
else if (hover == HOVER_ARROW_DOWN)
{
@@ -1926,6 +1942,7 @@ void ui_menu::handle_main_events(UINT32 flags)
if (selected >= visible_items)
selected = visible_items - 1;
top_line += visible_lines - 2;
+ set_pressed();
}
else if (hover == HOVER_UI_RIGHT)
menu_event.iptkey = IPT_UI_RIGHT;
@@ -2820,3 +2837,9 @@ void ui_menu::draw_dats_menu()
// return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow
visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != visible_items);
}
+
+void ui_menu::set_pressed()
+{
+ (m_repeat == 0) ? m_repeat = osd_ticks() + osd_ticks_per_second() / 2 : m_repeat = osd_ticks() + osd_ticks_per_second() / 4;
+ m_pressed = true;
+} \ No newline at end of file
diff --git a/src/emu/ui/menu.h b/src/emu/ui/menu.h
index 562650d0e51..4a788c612c7 100644
--- a/src/emu/ui/menu.h
+++ b/src/emu/ui/menu.h
@@ -266,8 +266,15 @@ protected:
static std::unique_ptr<bitmap_rgb32> hilight_main_bitmap;
static render_texture *hilight_main_texture;
private:
+
+ // mouse button held down
+ bool m_pressed = false;
+ osd_ticks_t m_repeat = 0;
+ void reset_pressed() { m_pressed = false; m_repeat = 0; }
+ bool mouse_pressed() { return (osd_ticks() >= m_repeat); }
+ void set_pressed();
+
static std::unique_ptr<bitmap_argb32> no_avail_bitmap, bgrnd_bitmap, star_bitmap;
-// static std::unique_ptr<bitmap_rgb32> hilight_main_bitmap;
static render_texture *bgrnd_texture, *star_texture;
static bitmap_argb32 *icons_bitmap[];
static render_texture *icons_texture[];
diff --git a/src/emu/ui/miscmenu.cpp b/src/emu/ui/miscmenu.cpp
index 89bf4182ffd..2145069bfab 100644
--- a/src/emu/ui/miscmenu.cpp
+++ b/src/emu/ui/miscmenu.cpp
@@ -574,7 +574,10 @@ ui_menu_misc_options::misc_option ui_menu_misc_options::m_options[] = {
ui_menu_misc_options::ui_menu_misc_options(running_machine &machine, render_container *container) : ui_menu(machine, container)
{
for (int d = 1; d < ARRAY_LENGTH(m_options); ++d)
- m_options[d].status = machine.ui().options().bool_value(m_options[d].option);
+ if (machine.ui().options().exists(m_options[d].option))
+ m_options[d].status = machine.ui().options().bool_value(m_options[d].option);
+ else
+ m_options[d].status = machine.options().bool_value(m_options[d].option);
}
ui_menu_misc_options::~ui_menu_misc_options()
@@ -585,7 +588,8 @@ ui_menu_misc_options::~ui_menu_misc_options()
{
machine().ui().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
}
- else {
+ else
+ {
if (machine().options().bool_value(m_options[d].option) != m_options[d].status)
{
machine().options().set_value(m_options[d].option, m_options[d].status, OPTION_PRIORITY_CMDLINE, error_string);
diff --git a/src/emu/ui/optsmenu.cpp b/src/emu/ui/optsmenu.cpp
index b643fcef883..f93bdbf4652 100644
--- a/src/emu/ui/optsmenu.cpp
+++ b/src/emu/ui/optsmenu.cpp
@@ -217,7 +217,7 @@ void ui_menu_game_options::populate()
item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU);
// add category subitem
- if (main_filters::actual == FILTER_CATEGORY && !machine().inifile().ini_index.empty())
+ if (m_main == FILTER_CATEGORY && !machine().inifile().ini_index.empty())
{
inifile_manager &inif = machine().inifile();
int afile = inif.current_file;
@@ -233,7 +233,7 @@ void ui_menu_game_options::populate()
item_append(fbuff.c_str(), inif.actual_category().c_str(), arrow_flags, (void *)(FPTR)CATEGORY_FILTER);
}
// add manufacturer subitem
- else if (main_filters::actual == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0)
+ else if (m_main == FILTER_MANUFACTURER && c_mnfct::ui.size() > 0)
{
arrow_flags = get_arrow_flags(0, c_mnfct::ui.size() - 1, c_mnfct::actual);
fbuff = _("^!Manufacturer");
@@ -241,7 +241,7 @@ void ui_menu_game_options::populate()
item_append(fbuff.c_str(), c_mnfct::ui[c_mnfct::actual].c_str(), arrow_flags, (void *)(FPTR)MANUFACT_CAT_FILTER);
}
// add year subitem
- else if (main_filters::actual == FILTER_YEAR && c_year::ui.size() > 0)
+ else if (m_main == FILTER_YEAR && c_year::ui.size() > 0)
{
arrow_flags = get_arrow_flags(0, c_year::ui.size() - 1, c_year::actual);
fbuff.assign(_("^!Year"));
@@ -249,7 +249,7 @@ void ui_menu_game_options::populate()
item_append(fbuff.c_str(), c_year::ui[c_year::actual].c_str(), arrow_flags, (void *)(FPTR)YEAR_CAT_FILTER);
}
// add custom subitem
- else if (main_filters::actual == FILTER_CUSTOM)
+ else if (m_main == FILTER_CUSTOM)
{
fbuff = _("^!Setup custom filter");
convert_command_glyph(fbuff);
@@ -322,7 +322,7 @@ void save_ui_options(running_machine &machine)
file.close();
}
else
- machine.popmessage(_("**Error to save ui.ini**"));
+ machine.popmessage(_("**Error saving ui.ini**"));
}
//-------------------------------------------------
@@ -341,10 +341,10 @@ void save_main_option(running_machine &machine)
emu_file file(machine.options().ini_path(), OPEN_FLAG_READ);
if (file.open(emulator_info::get_configname(), ".ini") == FILERR_NONE)
{
- bool result = options.parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error);
+ bool result = options.parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error);
if (!result)
{
- osd_printf_error(_("**Error to load %s.ini**"), emulator_info::get_configname());
+ osd_printf_error("**Error loading %s.ini**", emulator_info::get_configname());
return;
}
}
@@ -369,7 +369,7 @@ void save_main_option(running_machine &machine)
file.close();
}
else {
- machine.popmessage(_("**Error to save %s.ini**"), emulator_info::get_configname());
+ machine.popmessage(_("**Error saving %s.ini**"), emulator_info::get_configname());
return;
}
}
diff --git a/src/emu/ui/selector.cpp b/src/emu/ui/selector.cpp
index ae786dd1834..330694fd497 100644
--- a/src/emu/ui/selector.cpp
+++ b/src/emu/ui/selector.cpp
@@ -178,7 +178,7 @@ void ui_menu_selector::custom_render(void *selectedref, float top, float bottom,
// bottom text
// get the text for 'UI Select'
std::string ui_select_text = machine().input().seq_name(machine().ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD));
- tempbuf.assign(_("Double click or press ")).append(ui_select_text).append(_(" to select"));
+ tempbuf = string_format(_("Double click or press %1$s to select"), ui_select_text);
mui.draw_text_full(container, tempbuf.c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr);
diff --git a/src/emu/ui/selgame.cpp b/src/emu/ui/selgame.cpp
index 34fdab6d64e..dcc9e1d2d68 100644
--- a/src/emu/ui/selgame.cpp
+++ b/src/emu/ui/selgame.cpp
@@ -299,10 +299,31 @@ void ui_menu_select_game::handle()
}
// Infos
- else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view > UI_FIRST_LOAD)
+ else if (ui_globals::rpanel == RP_INFOS)
{
- ui_globals::curdats_view--;
- topline_datsview = 0;
+ if (!isfavorite())
+ {
+ const game_driver *drv = (const game_driver *)m_event->itemref;
+ if ((FPTR)drv > skip_main_items && ui_globals::curdats_view > UI_FIRST_LOAD)
+ {
+ ui_globals::curdats_view--;
+ topline_datsview = 0;
+ }
+ }
+ else
+ {
+ ui_software_info *drv = (ui_software_info *)m_event->itemref;
+ if (drv->startempty == 1 && ui_globals::curdats_view > UI_FIRST_LOAD)
+ {
+ ui_globals::curdats_view--;
+ topline_datsview = 0;
+ }
+ else if ((FPTR)drv > skip_main_items && ui_globals::cur_sw_dats_view > 0)
+ {
+ ui_globals::cur_sw_dats_view--;
+ topline_datsview = 0;
+ }
+ }
}
}
@@ -318,10 +339,31 @@ void ui_menu_select_game::handle()
}
// Infos
- else if (ui_globals::rpanel == RP_INFOS && ui_globals::curdats_view < UI_LAST_LOAD)
+ else if (ui_globals::rpanel == RP_INFOS)
{
- ui_globals::curdats_view++;
- topline_datsview = 0;
+ if (!isfavorite())
+ {
+ const game_driver *drv = (const game_driver *)m_event->itemref;
+ if ((FPTR)drv > skip_main_items && ui_globals::curdats_view < UI_LAST_LOAD)
+ {
+ ui_globals::curdats_view++;
+ topline_datsview = 0;
+ }
+ }
+ else
+ {
+ ui_software_info *drv = (ui_software_info *)m_event->itemref;
+ if (drv->startempty == 1 && ui_globals::curdats_view < UI_LAST_LOAD)
+ {
+ ui_globals::curdats_view++;
+ topline_datsview = 0;
+ }
+ else if ((FPTR)drv > skip_main_items && ui_globals::cur_sw_dats_view < 1)
+ {
+ ui_globals::cur_sw_dats_view++;
+ topline_datsview = 0;
+ }
+ }
}
}
@@ -358,18 +400,20 @@ void ui_menu_select_game::handle()
if (!isfavorite())
{
const game_driver *driver = (const game_driver *)m_event->itemref;
- if ((FPTR)driver > 3 && machine().datfile().has_data(driver))
+ if ((FPTR)driver > skip_main_items && machine().datfile().has_data(driver))
ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, driver));
}
else
{
- ui_software_info *swinfo = (ui_software_info *)m_event->itemref;
- if ((FPTR)swinfo > 3 && machine().datfile().has_data(swinfo->driver))
+ ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
+ datfile_manager &mdat = machine().datfile();
+
+ if ((FPTR)ui_swinfo > skip_main_items)
{
- if (swinfo->startempty == 1)
- ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, swinfo->driver));
- else
- ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, swinfo));
+ if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
+ ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver));
+ else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
+ ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo));
}
}
}
@@ -380,7 +424,7 @@ void ui_menu_select_game::handle()
if (!isfavorite())
{
const game_driver *driver = (const game_driver *)m_event->itemref;
- if ((FPTR)driver > 3)
+ if ((FPTR)driver > skip_main_items)
{
if (!machine().favorite().isgame_favorite(driver))
{
@@ -398,7 +442,7 @@ void ui_menu_select_game::handle()
else
{
ui_software_info *swinfo = (ui_software_info *)m_event->itemref;
- if ((FPTR)swinfo > 3)
+ if ((FPTR)swinfo > skip_main_items)
{
machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str());
machine().favorite().remove_favorite_game(*swinfo);
@@ -534,24 +578,26 @@ void ui_menu_select_game::populate()
}
// iterate over entries
- for (size_t curitem = 0; curitem < m_displaylist.size(); ++curitem)
+ int curitem = 0;
+ for (auto & elem : m_displaylist)
{
UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
- if (old_item_selected == -1 && m_displaylist[curitem]->name == reselect_last::driver)
+ if (old_item_selected == -1 && elem->name == reselect_last::driver)
old_item_selected = curitem;
- bool cloneof = strcmp(m_displaylist[curitem]->parent, "0");
+ bool cloneof = strcmp(elem->parent, "0");
if (cloneof)
{
- int cx = driver_list::find(m_displaylist[curitem]->parent);
+ int cx = driver_list::find(elem->parent);
if (cx != -1 && ((driver_list::driver(cx).flags & MACHINE_IS_BIOS_ROOT) != 0))
cloneof = false;
}
if (cloneof)
flags_ui |= MENU_FLAG_INVERT;
- item_append(m_displaylist[curitem]->description, nullptr, flags_ui, (void *)m_displaylist[curitem]);
+ item_append(elem->description, nullptr, flags_ui, (void *)elem);
+ curitem++;
}
}
}
@@ -1556,7 +1602,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b
util::stream_format(str, _("Support Cocktail: %1$s\n"), ((driver->flags & MACHINE_NO_COCKTAIL) ? _("Yes") : _("No")));
util::stream_format(str, _("Driver is Bios: %1$s\n"), ((driver->flags & MACHINE_IS_BIOS_ROOT) ? _("Yes") : _("No")));
util::stream_format(str, _("Support Save: %1$s\n"), ((driver->flags & MACHINE_SUPPORTS_SAVE) ? _("Yes") : _("No")));
- util::stream_format(str, _("Screen Orentation: %1$s\n"), ((driver->flags & ORIENTATION_SWAP_XY) ? _("Vertical") : _("Horizontal")));
+ util::stream_format(str, _("Screen Orientation: %1$s\n"), ((driver->flags & ORIENTATION_SWAP_XY) ? _("Vertical") : _("Horizontal")));
bool found = false;
for (const rom_entry *rom = driver->rom; !ROMENTRY_ISEND(rom); ++rom)
if (ROMENTRY_ISREGION(rom) && ROMREGION_ISDISKDATA(rom))
diff --git a/src/emu/ui/selsoft.cpp b/src/emu/ui/selsoft.cpp
index 2c8fa5135ea..3bf2e237553 100644
--- a/src/emu/ui/selsoft.cpp
+++ b/src/emu/ui/selsoft.cpp
@@ -242,14 +242,12 @@ void ui_menu_select_software::handle()
else if (m_event->iptkey == IPT_UI_DATS && machine().ui().options().enabled_dats())
{
ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref;
+ datfile_manager &mdat = machine().datfile();
- if ((FPTR)ui_swinfo > 1 && machine().datfile().has_data(ui_swinfo->driver))
- {
- if (ui_swinfo->startempty == 1)
- ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver));
- else
- ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo));
- }
+ if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver))
+ ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver));
+ else if (mdat.has_software(ui_swinfo->listname, ui_swinfo->shortname, ui_swinfo->parentname) || !ui_swinfo->usage.empty())
+ ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo));
}
// handle UI_LEFT_PANEL
@@ -826,7 +824,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float
size_t found = copyright.find("\n");
tempbuf[0].clear();
- tempbuf[1].assign(emulator_info::get_appname()).append(" ").append(build_version);
+ tempbuf[1] = string_format("%s %s", emulator_info::get_appname(), build_version);
tempbuf[2] = copyright.substr(0, found);
tempbuf[3] = copyright.substr(found + 1);
tempbuf[4].clear();
@@ -2040,7 +2038,7 @@ void ui_bios_selection::handle()
{
// process the menu
const ui_menu_event *event = process(0);
- ui_options &moptions = machine().ui().options();
+ emu_options &moptions = machine().options();
if (event != nullptr && event->iptkey == IPT_UI_SELECT && event->itemref != nullptr)
for (auto & elem : m_bios)
if ((void*)&elem.name == event->itemref)
@@ -2073,7 +2071,7 @@ void ui_bios_selection::handle()
drivlist.next();
software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str());
software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str());
- if (!moptions.skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
+ if (!machine().ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str()))
{
std::unordered_map<std::string, std::string> parts;
for (const software_part *swpart = swinfo->first_part(); swpart != nullptr; swpart = swpart->next())
diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp
index 4104ff88308..839e7c2d7a2 100644
--- a/src/emu/ui/ui.cpp
+++ b/src/emu/ui/ui.cpp
@@ -171,9 +171,9 @@ static void load_ui_options(running_machine &machine)
emu_file file(machine.options().ini_path(), OPEN_FLAG_READ);
if (file.open("ui.ini") == FILERR_NONE)
{
- bool result = machine.ui().options().parse_ini_file((core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error);
+ bool result = machine.ui().options().parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error);
if (!result)
- osd_printf_error("**Error to load ui.ini**");
+ osd_printf_error("**Error loading ui.ini**");
}
}
diff --git a/src/emu/uismall.png b/src/emu/uismall.png
new file mode 100644
index 00000000000..5d391640f62
--- /dev/null
+++ b/src/emu/uismall.png
Binary files differ
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp
index e4f1ef738e0..7feb39a1a71 100644
--- a/src/emu/validity.cpp
+++ b/src/emu/validity.cpp
@@ -15,19 +15,6 @@
//**************************************************************************
-// COMPILE-TIME VALIDATION
-//**************************************************************************
-
-// if the following lines error during compile, your PTR64 switch is set incorrectly in the makefile
-#ifdef PTR64
-UINT8 your_ptr64_flag_is_wrong[(int)(sizeof(void *) - 7)];
-#else
-UINT8 your_ptr64_flag_is_wrong[(int)(5 - sizeof(void *))];
-#endif
-
-
-
-//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -350,9 +337,9 @@ void validity_checker::validate_core()
// check pointer size
#ifdef PTR64
- if (sizeof(void *) != 8) osd_printf_error("PTR64 flag enabled, but was compiled for 32-bit target\n");
+ static_assert(sizeof(void *) == 8, "PTR64 flag enabled, but was compiled for 32-bit target\n");
#else
- if (sizeof(void *) != 4) osd_printf_error("PTR64 flag not enabled, but was compiled for 64-bit target\n");
+ static_assert(sizeof(void *) == 4, "PTR64 flag not enabled, but was compiled for 64-bit target\n");
#endif
// TODO: check if this is actually working
@@ -377,9 +364,6 @@ void validity_checker::validate_inlines()
#undef rand
volatile UINT64 testu64a = rand() ^ (rand() << 15) ^ ((UINT64)rand() << 30) ^ ((UINT64)rand() << 45);
volatile INT64 testi64a = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
-#ifdef PTR64
- volatile INT64 testi64b = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
-#endif
volatile UINT32 testu32a = rand() ^ (rand() << 15);
volatile UINT32 testu32b = rand() ^ (rand() << 15);
volatile INT32 testi32a = rand() ^ (rand() << 15);
@@ -395,10 +379,6 @@ void validity_checker::validate_inlines()
if (testu64a == 0) testu64a++;
if (testi64a == 0) testi64a++;
else if (testi64a < 0) testi64a = -testi64a;
-#ifdef PTR64
- if (testi64b == 0) testi64b++;
- else if (testi64b < 0) testi64b = -testi64b;
-#endif
if (testu32a == 0) testu32a++;
if (testu32b == 0) testu32b++;
if (testi32a == 0) testi32a++;