Merge remote-tracking branch 'origin/master' into netlist_dev

This commit is contained in:
couriersud 2016-05-28 17:49:41 +02:00
commit 35c1cddf7a
24 changed files with 809 additions and 263 deletions

View File

@ -27,7 +27,7 @@ script:
else make -j4 OPTIMIZE=0 OVERRIDE_CC="gcc-5" OVERRIDE_CXX="g++-5" && ./$MAME -validate;
fi
elif [ $TRAVIS_OS_NAME == 'osx' ]; then
unset LDOPTS && make -j2 OPTIMIZE=0 MACOSX_USE_LIBSDL=1 && ./$MAME -validate;
unset LDOPTS && make -j2 OPTIMIZE=0 USE_LIBSDL=1 && ./$MAME -validate;
fi
sudo: required
before_install:

View File

@ -85,7 +85,7 @@ static void eof_timer_close_cb(uv_handle_t* handle);
static void uv_unique_pipe_name(char* ptr, char* name, size_t size) {
snprintf(name, size, "\\\\?\\pipe\\uv\\%p-%u", ptr, GetCurrentProcessId());
snprintf(name, size, "\\\\?\\pipe\\uv\\%p-%lu", ptr, GetCurrentProcessId());
}

View File

@ -2705,6 +2705,111 @@ User/save disks that can be created from the game itself are not included.
</part>
</software>
<software name="nihonrki">
<description>Nihon no Rekishi: Kizoku-hen</description>
<year>1990</year>
<publisher>CRI</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nihon no rekishi - kizoku-hen" sha1="1bf433fc57cba5d452088b69c3b63d1be8ff9e1c" />
</diskarea>
</part>
</software>
<software name="nihonrko">
<description>Nihon no Rekishi: Kodai-hen</description>
<year>1990</year>
<publisher>CRI</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nihon no rekishi - kodai-hen" sha1="994b5f62b4c1ff2cd439948f12c52fa6d63cb8dc" />
</diskarea>
</part>
</software>
<software name="nihonya">
<description>Nihon no Yachou</description>
<year>1990</year>
<publisher>Fujitsu</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nihon no yachou" sha1="561a61de28e33c514f7e661632cdb58c5dc2eddf" />
</diskarea>
</part>
</software>
<software name="ningyou">
<description>Ningyou Tsukai</description>
<year>1993</year>
<publisher>Forest</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="ningyou tsukai" sha1="d2e93204d3cc2557f26ee72c07d0ab1109bf5846" />
</diskarea>
</part>
</software>
<software name="nobunagh">
<description>Nobunaga no Yabou: Haouden</description>
<year>1993</year>
<publisher>Koei</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="nobunaga no yabou - haou-den.hdm" size="1261568" crc="d426a880" sha1="4194c61909c37fdf83daae77dcd84ad996237b0c" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nobunaga no yabou - haou-den" sha1="0e2f9b942ba4f72961fc7dd5c3c9678eaa24b12d" />
</diskarea>
</part>
</software>
<!-- Originally labeled as "mp3 source". It probably needs a redump. -->
<software name="nobunagt">
<description>Nobunaga no Yabou: Tenshouki</description>
<year>1995</year>
<publisher>Koei</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nobunaga no yabou - tenshouki" sha1="fe1ca3991c5a1399cd720ae177644ca314b5d004" />
</diskarea>
</part>
</software>
<software name="nova">
<description>Nova</description>
<year>1993</year>
<publisher>Cat's Pro</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="nova" sha1="1e9dad67f2b4c242f655976e05abafc97c804bd6" />
</diskarea>
</part>
</software>
<software name="oasyswin">
<description>OASYS/Win v2.0</description>
<year>1994</year>
<publisher>Fujitsu</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="oasys-win" sha1="6db75f509d91ffe754f5188cd7a03f646631a6ba" />
</diskarea>
</part>
</software>
<software name="okitgear">
<description>Okiraku TownsGEAR</description>
<year>1994</year>
<publisher>Softbank</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="okiraku towns gear" sha1="a614a4471c91a19fe33bf903a5f699907bad813e" />
</diskarea>
</part>
</software>
<software name="opwolf">
<description>Operation Wolf</description>
<year>1990</year>
@ -2716,6 +2821,28 @@ User/save disks that can be created from the game itself are not included.
</part>
</software>
<software name="oshacook">
<description>Oshare Cooking</description>
<year>1989</year>
<publisher>Misawa Home</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="oshare cooking" sha1="d6175d9a81760fbd9e497e6a396dbaf2aad6d57c" />
</diskarea>
</part>
</software>
<software name="ourashin">
<description>Ougon no Rashinban</description>
<year>1990</year>
<publisher>Riverhill Soft</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="ougon no rashimban" sha1="192ab79d6cd44db18a8410d35891fe4bc1f74528" />
</diskarea>
</part>
</software>
<software name="panzrdiv">
<description>Panzer Division / Kikou Shidan</description>
<year>1990</year>
@ -2738,6 +2865,39 @@ User/save disks that can be created from the game itself are not included.
</part>
</software>
<software name="planedge">
<description>Planet's Edge</description>
<year>1993</year>
<publisher>Ving</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="planet's edge" sha1="41c000e9a1f73d76437ab56bee363d481f56b58f" />
</diskarea>
</part>
</software>
<software name="pmaker2">
<description>Princess Maker 2</description>
<year>1994</year>
<publisher>Gainax</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="princess maker 2" sha1="a0ed8d1a394ccfc109c3afdc6fdc6fd6a095643d" />
</diskarea>
</part>
</software>
<software name="ponkan">
<description>Ponkan</description>
<year>1994</year>
<publisher>Ponytail Soft</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="ponkan" sha1="2e02fbd3cafbfc385d21c97c8b91d771fdd22cc2" />
</diskarea>
</part>
</software>
<software name="populous">
<description>Populous &amp; The Promised Lands</description>
<year>1990</year>
@ -2749,6 +2909,45 @@ User/save disks that can be created from the game itself are not included.
</part>
</software>
<!--
It should be possible to recreate the user disk by running the ユーザーディスク作成 program
on the CD, but it doesn't seem to work. Not sure if it's an emulation issue or
something else.
The system disk is needed only for installing the game into a hard disk.
-->
<software name="powrdoll">
<description>Power Dolls</description>
<year>1994</year>
<publisher>Kogado</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="power dolls (user disk).hdm" size="1261568" crc="7b90b036" sha1="8cc2d7cdf2ffde4133cddd039f6620ba17b1e553" offset="000000" />
</dataarea>
</part>
<part name="flop2" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="power dolls (system disk).hdm" size="1261568" crc="5f6c44c7" sha1="721dd113dc6bedfb2d212e3a4de15260c41805f7" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="power dolls" sha1="22c895ef1b29fe4f01b1956d323657fe67a9c832" />
</diskarea>
</part>
</software>
<software name="powrdol2">
<description>Power Dolls 2</description>
<year>1995</year>
<publisher>Kogado</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="power dolls 2" sha1="248ec3f239e8d069490867d437ac0465dbf878b4" />
</diskarea>
</part>
</software>
<software name="powermon">
<description>Powermonger</description>
<year>1992</year>
@ -2792,6 +2991,141 @@ User/save disks that can be created from the game itself are not included.
</part>
</software>
<software name="prostudg">
<description>Pro Student G</description>
<year>1993</year>
<publisher>Alice Soft</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="pro student g (boot disk).hdm" size="1261568" crc="a068feeb" sha1="fa5e5b185cc452e9fa252eac61eb6f8a133cc080" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="pro student g" sha1="a7675c732045804fbaf292a191eb1967f98894a4" />
</diskarea>
</part>
</software>
<software name="provvdnz">
<description>Provvidenza: Legenda la Spada di Alfa</description>
<year>1991</year>
<publisher>Sofcom</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="provvidenza" sha1="a104b48ade5fbe34b324f0c7f3a3fa0de7b482fc" />
</diskarea>
</part>
</software>
<software name="psydet1">
<description>Psychic Detective Series Vol. 1: Invitation</description>
<year>1989</year>
<publisher>Data West</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series vol. 1 - invitation" sha1="4d53507fe063ae02cb1db77a0bf591dd62d5a014" />
</diskarea>
</part>
</software>
<software name="psydet2">
<description>Psychic Detective Series Vol. 2: Memories</description>
<year>1989</year>
<publisher>Data West</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series vol. 2 - memories" sha1="dc3d92414e77cf0220e10f46a92e2c24d07daa82" />
</diskarea>
</part>
</software>
<software name="psydet3">
<description>Psychic Detective Series Vol. 3: Aya</description>
<year>1990</year>
<publisher>Data West</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series vol. 3 - aya" sha1="2ee820e859d4a6120ed6940a318d45c1101b4140" />
</diskarea>
</part>
</software>
<software name="psydet4">
<description>Psychic Detective Series Vol. 4: Orgel</description>
<year>1991</year>
<publisher>Data West</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="psychic detective series vol. 4 - orgel.hdm" size="1261568" crc="81a557bf" sha1="e32d7a6b60a2265a7035a05f8272ac7938cf82bf" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series vol. 4 - orgel" sha1="f1bef6f55415b869685c157acae67f8afb9dfdd3" />
</diskarea>
</part>
</software>
<software name="psydet5">
<description>Psychic Detective Series Vol. 5: Nightmare</description>
<year>1991</year>
<publisher>Data West</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="psychic detective series vol. 5 - nightmare (system disk).hdm" size="1261568" crc="10de4174" sha1="9222ef4d56b96879dc26bcd99d4b61777556aeee" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series vol. 5 - nightmare" sha1="ec31d635bb4cbdb7f8b4b4dfc48d690a61ab602e" />
</diskarea>
</part>
</software>
<software name="psydetf1">
<description>Psychic Detective Series Final: Solitude Joukan</description>
<year>1992</year>
<publisher>Data West</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="psychic detective series final - solitude joukan.hdm" size="1261568" crc="9dd1bf09" sha1="36f9557b45a606f54cebb180f88e37207a854e37" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series final - solitude joukan" sha1="66736198f2507efba5967f7af0b7f98255a38cca" />
</diskarea>
</part>
</software>
<software name="psydetf2">
<description>Psychic Detective Series Final: Solitude Gekan</description>
<year>1993</year>
<publisher>Data West</publisher>
<part name="flop1" interface="floppy_3_5">
<dataarea name="flop" size="1261568">
<rom name="psychic detective series final - solitude gekan.hdm" size="1261568" crc="1e6f92b3" sha1="a0c3e96599e546c0c212091f52d42adbb2dbbb5b" offset="000000" />
</dataarea>
</part>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="psychic detective series final - solitude gekan" sha1="7268bbc2f30212f658a52442db1cdd860c47bba6" />
</diskarea>
</part>
</software>
<software name="pulirula">
<description>Pu-Li-Ru-La</description>
<year>1994</year>
<publisher>Ving</publisher>
<part name="cdrom" interface="fmt_cdrom">
<diskarea name="cdrom">
<disk name="pu-li-ru-la" sha1="eb21c2d89c6a01570af580985b1b3771d0f151d0" />
</diskarea>
</part>
</software>
<software name="puyopuyo">
<description>Puyo Puyo</description>
<year>1994</year>

View File

@ -1376,7 +1376,7 @@ render_primitive_list &render_target::get_primitives()
// if there is no associated element, it must be a screen element
if (curitem.screen() != nullptr)
add_container_primitives(list, item_xform, curitem.screen()->container(), blendmode);
add_container_primitives(list, root_xform, item_xform, curitem.screen()->container(), blendmode);
else
add_element_primitives(list, item_xform, *curitem.element(), curitem.state(), blendmode);
}
@ -1418,7 +1418,7 @@ render_primitive_list &render_target::get_primitives()
ui_xform.no_center = true;
// add UI elements
add_container_primitives(list, ui_xform, debug, BLENDMODE_ALPHA);
add_container_primitives(list, root_xform, ui_xform, debug, BLENDMODE_ALPHA);
}
// process the UI if we are the UI target
@ -1435,7 +1435,7 @@ render_primitive_list &render_target::get_primitives()
ui_xform.no_center = false;
// add UI elements
add_container_primitives(list, ui_xform, m_manager.ui_container(), BLENDMODE_ALPHA);
add_container_primitives(list, root_xform, ui_xform, m_manager.ui_container(), BLENDMODE_ALPHA);
}
// optimize the list before handing it off
@ -1745,7 +1745,7 @@ bool render_target::load_layout_file(const char *dirname, const char *filename)
// based on the container
//-------------------------------------------------
void render_target::add_container_primitives(render_primitive_list &list, const object_transform &xform, render_container &container, int blendmode)
void render_target::add_container_primitives(render_primitive_list &list, const object_transform &root_xform, const object_transform &xform, render_container &container, int blendmode)
{
// first update the palette for the container, if it is dirty
container.update_palette();
@ -1758,6 +1758,16 @@ void render_target::add_container_primitives(render_primitive_list &list, const
cliprect.y1 = xform.yoffs + xform.yscale;
sect_render_bounds(&cliprect, &m_bounds);
float root_xoffs = root_xform.xoffs + abs(root_xform.xscale - xform.xscale) * 0.5f;
float root_yoffs = root_xform.yoffs + abs(root_xform.yscale - xform.yscale) * 0.5f;
render_bounds root_cliprect;
root_cliprect.x0 = root_xoffs;
root_cliprect.y0 = root_yoffs;
root_cliprect.x1 = root_xoffs + root_xform.xscale;
root_cliprect.y1 = root_yoffs + root_xform.yscale;
sect_render_bounds(&root_cliprect, &m_bounds);
// compute the container transform
object_transform container_xform;
container_xform.orientation = orientation_add(container.orientation(), xform.orientation);
@ -1797,22 +1807,32 @@ void render_target::add_container_primitives(render_primitive_list &list, const
render_bounds bounds = curitem.bounds();
apply_orientation(bounds, container_xform.orientation);
float xscale = container_xform.xscale;
float yscale = container_xform.yscale;
float xoffs = container_xform.xoffs;
float yoffs = container_xform.yoffs;
if (!m_transform_container && PRIMFLAG_GET_VECTOR(curitem.flags()))
{
xoffs = root_xoffs;
yoffs = root_yoffs;
}
// allocate the primitive and set the transformed bounds/color data
render_primitive *prim = list.alloc(render_primitive::INVALID);
prim->container = &container; /* pass the container along for access to user_settings */
prim->bounds.x0 = render_round_nearest(container_xform.xoffs + bounds.x0 * container_xform.xscale);
prim->bounds.y0 = render_round_nearest(container_xform.yoffs + bounds.y0 * container_xform.yscale);
prim->bounds.x0 = render_round_nearest(xoffs + bounds.x0 * xscale);
prim->bounds.y0 = render_round_nearest(yoffs + bounds.y0 * yscale);
if (curitem.internal() & INTERNAL_FLAG_CHAR)
{
prim->bounds.x1 = prim->bounds.x0 + render_round_nearest((bounds.x1 - bounds.x0) * container_xform.xscale);
prim->bounds.y1 = prim->bounds.y0 + render_round_nearest((bounds.y1 - bounds.y0) * container_xform.yscale);
prim->bounds.x1 = prim->bounds.x0 + render_round_nearest((bounds.x1 - bounds.x0) * xscale);
prim->bounds.y1 = prim->bounds.y0 + render_round_nearest((bounds.y1 - bounds.y0) * yscale);
}
else
{
prim->bounds.x1 = render_round_nearest(container_xform.xoffs + bounds.x1 * container_xform.xscale);
prim->bounds.y1 = render_round_nearest(container_xform.yoffs + bounds.y1 * container_xform.yscale);
prim->bounds.x1 = render_round_nearest(xoffs + bounds.x1 * xscale);
prim->bounds.y1 = render_round_nearest(yoffs + bounds.y1 * yscale);
}
// compute the color of the primitive
@ -1841,7 +1861,14 @@ void render_target::add_container_primitives(render_primitive_list &list, const
prim->flags |= curitem.flags();
// clip the primitive
clipped = render_clip_line(&prim->bounds, &cliprect);
if (!m_transform_container && PRIMFLAG_GET_VECTOR(curitem.flags()))
{
clipped = render_clip_line(&prim->bounds, &root_cliprect);
}
else
{
clipped = render_clip_line(&prim->bounds, &cliprect);
}
break;
case CONTAINER_ITEM_QUAD:

View File

@ -979,7 +979,7 @@ private:
void load_layout_files(const internal_layout *layoutfile, bool singlefile);
bool load_layout_file(const char *dirname, const char *filename);
bool load_layout_file(const char *dirname, const internal_layout *layout_data);
void add_container_primitives(render_primitive_list &list, const object_transform &xform, render_container &container, int blendmode);
void add_container_primitives(render_primitive_list &list, const object_transform &root_xform, const object_transform &xform, render_container &container, int blendmode);
void add_element_primitives(render_primitive_list &list, const object_transform &xform, layout_element &element, int state, int blendmode);
bool map_point_internal(INT32 target_x, INT32 target_y, render_container *container, float &mapped_x, float &mapped_y, ioport_port *&mapped_input_port, ioport_value &mapped_input_mask);

View File

@ -14,16 +14,19 @@
#ifndef __UI_SLIDER__
#define __UI_SLIDER__
#include <functional>
#include "emu.h"
#include "sliderchangednotifier.h"
#define SLIDER_NOCHANGE 0x12345678
typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
typedef std::function<INT32(running_machine&, void*, int, std::string*, INT32)> slider_update;
struct slider_state
{
slider_state * next; /* pointer to next slider */
slider_update update; /* callback */
slider_update update; /* callback */
void * arg; /* argument */
INT32 minval; /* minimum value */
INT32 defval; /* default value */

View File

@ -0,0 +1,29 @@
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//======================================================================
//
// sliderchangednotifier.cpp - Interface for a slider-changed callback
//
//======================================================================
#pragma once
#ifndef __SLIDER_CHANGED_NOTIFIER__
#define __SLIDER_CHANGED_NOTIFIER__
#include <cstdint>
#include <string>
using INT32 = std::int32_t;
class running_machine;
class slider_changed_notifier
{
public:
virtual ~slider_changed_notifier() { }
virtual INT32 slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval) = 0;
};
#endif // __SLIDER_CHANGED_NOTIFIER__

View File

@ -43,7 +43,7 @@ void menu_sliders::handle()
if (menu_event->itemref != nullptr && menu_event->type == menu_item_type::SLIDER)
{
const slider_state *slider = (const slider_state *)menu_event->itemref;
INT32 curvalue = (*slider->update)(machine(), slider->arg, slider->id, nullptr, SLIDER_NOCHANGE);
INT32 curvalue = slider->update(machine(), slider->arg, slider->id, nullptr, SLIDER_NOCHANGE);
INT32 increment = 0;
bool alt_pressed = machine().input().code_pressed(KEYCODE_LALT) || machine().input().code_pressed(KEYCODE_RALT);
bool ctrl_pressed = machine().input().code_pressed(KEYCODE_LCONTROL) || machine().input().code_pressed(KEYCODE_RCONTROL);
@ -105,7 +105,7 @@ void menu_sliders::handle()
newvalue = slider->maxval;
/* update the slider and recompute the menu */
(*slider->update)(machine(), slider->arg, slider->id, nullptr, newvalue);
slider->update(machine(), slider->arg, slider->id, nullptr, newvalue);
reset(reset_options::REMEMBER_REF);
}
}
@ -147,7 +147,7 @@ void menu_sliders::populate()
if (item.type == menu_item_type::SLIDER)
{
slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
INT32 curval = slider->update(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
UINT32 flags = 0;
if (curval > slider->minval)
flags |= FLAG_LEFT_ARROW;
@ -170,7 +170,7 @@ void menu_sliders::populate()
if (item.type == menu_item_type::SLIDER)
{
slider_state* slider = reinterpret_cast<slider_state *>(item.ref);
INT32 curval = (*slider->update)(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
INT32 curval = slider->update(machine(), slider->arg, slider->id, &tempstring, SLIDER_NOCHANGE);
UINT32 flags = 0;
if (curval > slider->minval)
flags |= FLAG_LEFT_ARROW;
@ -205,7 +205,7 @@ void menu_sliders::custom_render(void *selectedref, float top, float bottom, flo
INT32 curval;
/* determine the current value and text */
curval = (*curslider->update)(machine(), curslider->arg, curslider->id, &tempstring, SLIDER_NOCHANGE);
curval = curslider->update(machine(), curslider->arg, curslider->id, &tempstring, SLIDER_NOCHANGE);
/* compute the current and default percentages */
percentage = (float)(curval - curslider->minval) / (float)(curslider->maxval - curslider->minval);

View File

@ -125,39 +125,6 @@ std::vector<ui::menu_item> mame_ui_manager::slider_list;
slider_state *mame_ui_manager::slider_current;
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
// slider controls
static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg);
static INT32 slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static std::string slider_get_screen_desc(screen_device &screen);
#ifdef MAME_DEBUG
static INT32 slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
static INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
#endif
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
@ -1896,7 +1863,7 @@ std::vector<ui::menu_item>& mame_ui_manager::get_slider_list(void)
// slider_alloc - allocate a new slider entry
//-------------------------------------------------
static slider_state *slider_alloc(running_machine &machine, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg)
slider_state* mame_ui_manager::slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, void *arg)
{
int size = sizeof(slider_state) + strlen(title);
slider_state *state = (slider_state *)auto_alloc_array_clear(machine, UINT8, size);
@ -1905,9 +1872,12 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I
state->defval = defval;
state->maxval = maxval;
state->incval = incval;
state->update = update;
using namespace std::placeholders;
state->update = std::bind(&mame_ui_manager::slider_changed, this, _1, _2, _3, _4, _5);
state->arg = arg;
state->id = -1;
state->id = id;
strcpy(state->description, title);
return state;
@ -1924,7 +1894,7 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
std::vector<slider_state *> sliders;
// add overall volume
sliders.push_back(slider_alloc(machine, _("Master Volume"), -32, 0, 0, 1, slider_volume, nullptr));
sliders.push_back(slider_alloc(machine, SLIDER_ID_VOLUME, _("Master Volume"), -32, 0, 0, 1, nullptr));
// add per-channel volume
mixer_input info;
@ -1934,34 +1904,37 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
INT32 defval = 1000;
std::string str = string_format(_("%1$s Volume"), info.stream->input_name(info.inputnum));
sliders.push_back(slider_alloc(machine, str.c_str(), 0, defval, maxval, 20, slider_mixervol, (void *)(FPTR)item));
sliders.push_back(slider_alloc(machine, SLIDER_ID_MIXERVOL + item, str.c_str(), 0, defval, maxval, 20, (void *)(FPTR)item));
}
// add analog adjusters
int slider_index = 0;
for (ioport_port &port : machine.ioport().ports())
{
for (ioport_field &field : port.fields())
{
if (field.type() == IPT_ADJUSTER)
{
sliders.push_back(slider_alloc(machine, field.name(), field.minval(), field.defvalue(), field.maxval(), 1, slider_adjuster, (void *)&field));
sliders.push_back(slider_alloc(machine, SLIDER_ID_ADJUSTER + slider_index++, field.name(), field.minval(), field.defvalue(), field.maxval(), 1, (void *)&field));
}
}
}
// add CPU overclocking (cheat only)
slider_index = 0;
if (machine.options().cheat())
{
for (device_execute_interface &exec : execute_interface_iterator(machine.root_device()))
{
void *param = (void *)&exec.device();
std::string str = string_format(_("Overclock CPU %1$s"), exec.device().tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 10, 1000, 2000, 1, slider_overclock, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_OVERCLOCK + slider_index++, str.c_str(), 10, 1000, 2000, 1, param));
}
}
// add screen parameters
screen_device_iterator scriter(machine.root_device());
slider_index = 0;
for (screen_device &screen : scriter)
{
int defxscale = floor(screen.xscale() * 1000.0f + 0.5f);
@ -1975,28 +1948,30 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
if (machine.options().cheat())
{
std::string str = string_format(_("%1$s Refresh Rate"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), -10000, 0, 10000, 1000, slider_refresh, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_REFRESH + slider_index, str.c_str(), -10000, 0, 10000, 1000, param));
}
// add standard brightness/contrast/gamma controls per-screen
std::string str = string_format(_("%1$s Brightness"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 2000, 10, slider_brightness, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_BRIGHTNESS + slider_index, str.c_str(), 100, 1000, 2000, 10, param));
str = string_format(_("%1$s Contrast"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 2000, 50, slider_contrast, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_CONTRAST + slider_index, str.c_str(), 100, 1000, 2000, 50, param));
str = string_format(_("%1$s Gamma"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), 100, 1000, 3000, 50, slider_gamma, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_GAMMA + slider_index, str.c_str(), 100, 1000, 3000, 50, param));
// add scale and offset controls per-screen
str = string_format(_("%1$s Horiz Stretch"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), 500, defxscale, 1500, 2, slider_xscale, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_XSCALE + slider_index, str.c_str(), 500, defxscale, 1500, 2, param));
str = string_format(_("%1$s Horiz Position"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_xoffset, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_XOFFSET + slider_index, str.c_str(), -500, defxoffset, 500, 2, param));
str = string_format(_("%1$s Vert Stretch"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), 500, defyscale, 1500, 2, slider_yscale, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_YSCALE + slider_index, str.c_str(), 500, defyscale, 1500, 2, param));
str = string_format(_("%1$s Vert Position"), screen_desc);
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_yoffset, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_YOFFSET + slider_index, str.c_str(), -500, defyoffset, 500, 2, param));
slider_index++;
}
slider_index = 0;
for (laserdisc_device &laserdisc : laserdisc_device_iterator(machine.root_device()))
{
if (laserdisc.overlay_configured())
@ -2011,30 +1986,34 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
// add scale and offset controls per-overlay
std::string str = string_format(_("Laserdisc '%1$s' Horiz Stretch"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, slider_overxscale, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_OVERLAY_XSCALE + slider_index, str.c_str(), 500, (defxscale == 0) ? 1000 : defxscale, 1500, 2, param));
str = string_format(_("Laserdisc '%1$s' Horiz Position"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defxoffset, 500, 2, slider_overxoffset, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_OVERLAY_YSCALE + slider_index, str.c_str(), -500, defxoffset, 500, 2, param));
str = string_format(_("Laserdisc '%1$s' Vert Stretch"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, slider_overyscale, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_OVERLAY_XOFFSET + slider_index, str.c_str(), 500, (defyscale == 0) ? 1000 : defyscale, 1500, 2, param));
str = string_format(_("Laserdisc '%1$s' Vert Position"), laserdisc.tag());
sliders.push_back(slider_alloc(machine, str.c_str(), -500, defyoffset, 500, 2, slider_overyoffset, param));
sliders.push_back(slider_alloc(machine, SLIDER_ID_OVERLAY_YOFFSET + slider_index, str.c_str(), -500, defyoffset, 500, 2, param));
slider_index++;
}
}
slider_index = 0;
for (screen_device &screen : scriter)
{
if (screen.screen_type() == SCREEN_TYPE_VECTOR)
{
// add vector control
sliders.push_back(slider_alloc(machine, _("Vector Flicker"), 0, 0, 1000, 10, slider_flicker, nullptr));
sliders.push_back(slider_alloc(machine, _("Beam Width Minimum"), 1, 100, 1000, 1, slider_beam_width_min, nullptr));
sliders.push_back(slider_alloc(machine, _("Beam Width Maximum"), 1, 100, 1000, 1, slider_beam_width_max, nullptr));
sliders.push_back(slider_alloc(machine, _("Beam Intensity Weight"), -1000, 0, 1000, 10, slider_beam_intensity_weight, nullptr));
sliders.push_back(slider_alloc(machine, SLIDER_ID_FLICKER + slider_index, _("Vector Flicker"), 0, 0, 1000, 10, nullptr));
sliders.push_back(slider_alloc(machine, SLIDER_ID_BEAM_WIDTH_MIN + slider_index, _("Beam Width Minimum"), 1, 100, 1000, 1, nullptr));
sliders.push_back(slider_alloc(machine, SLIDER_ID_BEAM_WIDTH_MAX + slider_index, _("Beam Width Maximum"), 1, 100, 1000, 1, nullptr));
sliders.push_back(slider_alloc(machine, SLIDER_ID_BEAM_INTENSITY + slider_index, _("Beam Intensity Weight"), -1000, 0, 1000, 10, nullptr));
slider_index++;
break;
}
}
#ifdef MAME_DEBUG
slider_index = 0;
// add crosshair adjusters
for (ioport_port &port : machine.ioport().ports())
{
@ -2043,9 +2022,9 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
if (field.crosshair_axis() != CROSSHAIR_AXIS_NONE && field.player() == 0)
{
std::string str = string_format(_("Crosshair Scale %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
sliders.push_back(slider_alloc(machine, str.c_str(), -3000, 1000, 3000, 100, slider_crossscale, (void *)&field));
sliders.push_back(slider_alloc(machine, SLIDER_ID_CROSSHAIR_SCALE + slider_index, str.c_str(), -3000, 1000, 3000, 100, (void *)&field));
str = string_format(_("Crosshair Offset %1$s"), (field.crosshair_axis() == CROSSHAIR_AXIS_X) ? _("X") : _("Y"));
sliders.push_back(slider_alloc(machine, str.c_str(), -3000, 0, 3000, 100, slider_crossoffset, (void *)&field));
sliders.push_back(slider_alloc(machine, SLIDER_ID_CROSSHAIR_OFFSET + slider_index, str.c_str(), -3000, 0, 3000, 100, (void *)&field));
}
}
}
@ -2066,12 +2045,92 @@ std::vector<ui::menu_item> mame_ui_manager::slider_init(running_machine &machine
return items;
}
//----------------------------------------------------
// slider_changed - global slider-modified callback
//----------------------------------------------------
INT32 mame_ui_manager::slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
switch (id)
{
case SLIDER_ID_VOLUME:
return slider_volume(machine, arg, id, str, newval);
case SLIDER_ID_MIXERVOL ... SLIDER_ID_MIXERVOL_LAST:
return slider_mixervol(machine, arg, id, str, newval);
case SLIDER_ID_ADJUSTER ... SLIDER_ID_ADJUSTER_LAST:
return slider_adjuster(machine, arg, id, str, newval);
case SLIDER_ID_OVERCLOCK ... SLIDER_ID_OVERCLOCK_LAST:
return slider_overclock(machine, arg, id, str, newval);
case SLIDER_ID_REFRESH ... SLIDER_ID_REFRESH_LAST:
return slider_refresh(machine, arg, id, str, newval);
case SLIDER_ID_BRIGHTNESS ... SLIDER_ID_BRIGHTNESS_LAST:
return slider_brightness(machine, arg, id, str, newval);
case SLIDER_ID_CONTRAST ... SLIDER_ID_CONTRAST_LAST:
return slider_contrast(machine, arg, id, str, newval);
case SLIDER_ID_GAMMA ... SLIDER_ID_GAMMA_LAST:
return slider_gamma(machine, arg, id, str, newval);
case SLIDER_ID_XSCALE ... SLIDER_ID_XSCALE_LAST:
return slider_xscale(machine, arg, id, str, newval);
case SLIDER_ID_YSCALE ... SLIDER_ID_YSCALE_LAST:
return slider_yscale(machine, arg, id, str, newval);
case SLIDER_ID_XOFFSET ... SLIDER_ID_XOFFSET_LAST:
return slider_xoffset(machine, arg, id, str, newval);
case SLIDER_ID_YOFFSET ... SLIDER_ID_YOFFSET_LAST:
return slider_yoffset(machine, arg, id, str, newval);
case SLIDER_ID_OVERLAY_XSCALE ... SLIDER_ID_OVERLAY_XSCALE_LAST:
return slider_overxscale(machine, arg, id, str, newval);
case SLIDER_ID_OVERLAY_YSCALE ... SLIDER_ID_OVERLAY_YSCALE_LAST:
return slider_overyscale(machine, arg, id, str, newval);
case SLIDER_ID_OVERLAY_XOFFSET ... SLIDER_ID_OVERLAY_XOFFSET_LAST:
return slider_overxoffset(machine, arg, id, str, newval);
case SLIDER_ID_OVERLAY_YOFFSET ... SLIDER_ID_OVERLAY_YOFFSET_LAST:
return slider_overyoffset(machine, arg, id, str, newval);
case SLIDER_ID_FLICKER ... SLIDER_ID_FLICKER_LAST:
return slider_flicker(machine, arg, id, str, newval);
case SLIDER_ID_BEAM_WIDTH_MIN ... SLIDER_ID_BEAM_WIDTH_MIN_LAST:
return slider_beam_width_min(machine, arg, id, str, newval);
case SLIDER_ID_BEAM_WIDTH_MAX ... SLIDER_ID_BEAM_WIDTH_MAX_LAST:
return slider_beam_width_max(machine, arg, id, str, newval);
case SLIDER_ID_BEAM_INTENSITY ... SLIDER_ID_BEAM_INTENSITY_LAST:
return slider_beam_intensity_weight(machine, arg, id, str, newval);
#ifdef MAME_DEBUG
case SLIDER_ID_CROSSHAIR_SCALE ... SLIDER_ID_CROSSHAIR_SCALE_LAST:
return slider_crossscale(machine, arg, id, str, newval);
case SLIDER_ID_CROSSHAIR_OFFSET ... SLIDER_ID_CROSSHAIR_OFFSET_LAST:
return slider_crossoffset(machine, arg, id, str, newval);
#endif
}
return 0;
}
//-------------------------------------------------
// slider_volume - global volume slider callback
//-------------------------------------------------
static INT32 slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
machine.sound().set_attenuation(newval);
@ -2086,7 +2145,7 @@ static INT32 slider_volume(running_machine &machine, void *arg, int id, std::str
// slider callback
//-------------------------------------------------
static INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
mixer_input info;
if (!machine.sound().indexed_mixer_input((FPTR)arg, info))
@ -2108,7 +2167,7 @@ static INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::s
// callback
//-------------------------------------------------
static INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;
ioport_field::user_settings settings;
@ -2130,7 +2189,7 @@ static INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::s
// callback
//-------------------------------------------------
static INT32 slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
device_t *cpu = (device_t *)arg;
if (newval != SLIDER_NOCHANGE)
@ -2145,7 +2204,7 @@ static INT32 slider_overclock(running_machine &machine, void *arg, int id, std::
// slider_refresh - refresh rate slider callback
//-------------------------------------------------
static INT32 slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
double defrefresh = ATTOSECONDS_TO_HZ(screen->refresh_attoseconds());
@ -2170,7 +2229,7 @@ static INT32 slider_refresh(running_machine &machine, void *arg, int id, std::st
// callback
//-------------------------------------------------
static INT32 slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2192,7 +2251,7 @@ static INT32 slider_brightness(running_machine &machine, void *arg, int id, std:
// callback
//-------------------------------------------------
static INT32 slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2213,7 +2272,7 @@ static INT32 slider_contrast(running_machine &machine, void *arg, int id, std::s
// slider_gamma - screen gamma slider callback
//-------------------------------------------------
static INT32 slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2235,7 +2294,7 @@ static INT32 slider_gamma(running_machine &machine, void *arg, int id, std::stri
// callback
//-------------------------------------------------
static INT32 slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2257,7 +2316,7 @@ static INT32 slider_xscale(running_machine &machine, void *arg, int id, std::str
// callback
//-------------------------------------------------
static INT32 slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2279,7 +2338,7 @@ static INT32 slider_yscale(running_machine &machine, void *arg, int id, std::str
// slider callback
//-------------------------------------------------
static INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2301,7 +2360,7 @@ static INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::st
// slider callback
//-------------------------------------------------
static INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container::user_settings settings;
@ -2323,7 +2382,7 @@ static INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::st
// callback
//-------------------------------------------------
static INT32 slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@ -2345,7 +2404,7 @@ static INT32 slider_overxscale(running_machine &machine, void *arg, int id, std:
// callback
//-------------------------------------------------
static INT32 slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@ -2367,7 +2426,7 @@ static INT32 slider_overyscale(running_machine &machine, void *arg, int id, std:
// slider callback
//-------------------------------------------------
static INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@ -2389,7 +2448,7 @@ static INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std
// slider callback
//-------------------------------------------------
static INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
laserdisc_device *laserdisc = (laserdisc_device *)arg;
laserdisc_overlay_config settings;
@ -2411,7 +2470,7 @@ static INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std
// callback
//-------------------------------------------------
static INT32 slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
vector_options::s_flicker = (float)newval * 0.001f;
@ -2426,7 +2485,7 @@ static INT32 slider_flicker(running_machine &machine, void *arg, int id, std::st
// callback
//-------------------------------------------------
static INT32 slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
vector_options::s_beam_width_min = MIN((float)newval * 0.01f, vector_options::s_beam_width_max);
@ -2441,7 +2500,7 @@ static INT32 slider_beam_width_min(running_machine &machine, void *arg, int id,
// callback
//-------------------------------------------------
static INT32 slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
vector_options::s_beam_width_max = MAX((float)newval * 0.01f, vector_options::s_beam_width_min);
@ -2456,7 +2515,7 @@ static INT32 slider_beam_width_max(running_machine &machine, void *arg, int id,
// callback
//-------------------------------------------------
static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
vector_options::s_beam_intensity_weight = (float)newval * 0.001f;
@ -2471,7 +2530,7 @@ static INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, i
// description for a given screen
//-------------------------------------------------
static std::string slider_get_screen_desc(screen_device &screen)
std::string mame_ui_manager::slider_get_screen_desc(screen_device &screen)
{
if (screen_device_iterator(screen.machine().root_device()).count() > 1)
return string_format(_("Screen '%1$s'"), screen.tag());
@ -2485,7 +2544,7 @@ static std::string slider_get_screen_desc(screen_device &screen)
//-------------------------------------------------
#ifdef MAME_DEBUG
static INT32 slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;
@ -2504,7 +2563,7 @@ static INT32 slider_crossscale(running_machine &machine, void *arg, int id, std:
//-------------------------------------------------
#ifdef MAME_DEBUG
static INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 mame_ui_manager::slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
ioport_field *field = (ioport_field *)arg;

View File

@ -93,6 +93,59 @@ enum
DRAW_OPAQUE
};
#define SLIDER_DEVICE_SPACING 0x0ff
#define SLIDER_SCREEN_SPACING 0x0f
#define SLIDER_INPUT_SPACING 0x0f
enum
{
SLIDER_ID_VOLUME = 0,
SLIDER_ID_MIXERVOL,
SLIDER_ID_MIXERVOL_LAST = SLIDER_ID_MIXERVOL + SLIDER_DEVICE_SPACING,
SLIDER_ID_ADJUSTER,
SLIDER_ID_ADJUSTER_LAST = SLIDER_ID_ADJUSTER + SLIDER_DEVICE_SPACING,
SLIDER_ID_OVERCLOCK,
SLIDER_ID_OVERCLOCK_LAST = SLIDER_ID_OVERCLOCK + SLIDER_DEVICE_SPACING,
SLIDER_ID_REFRESH,
SLIDER_ID_REFRESH_LAST = SLIDER_ID_REFRESH + SLIDER_SCREEN_SPACING,
SLIDER_ID_BRIGHTNESS,
SLIDER_ID_BRIGHTNESS_LAST = SLIDER_ID_BRIGHTNESS + SLIDER_SCREEN_SPACING,
SLIDER_ID_CONTRAST,
SLIDER_ID_CONTRAST_LAST = SLIDER_ID_CONTRAST + SLIDER_SCREEN_SPACING,
SLIDER_ID_GAMMA,
SLIDER_ID_GAMMA_LAST = SLIDER_ID_GAMMA + SLIDER_SCREEN_SPACING,
SLIDER_ID_XSCALE,
SLIDER_ID_XSCALE_LAST = SLIDER_ID_XSCALE + SLIDER_SCREEN_SPACING,
SLIDER_ID_YSCALE,
SLIDER_ID_YSCALE_LAST = SLIDER_ID_YSCALE + SLIDER_SCREEN_SPACING,
SLIDER_ID_XOFFSET,
SLIDER_ID_XOFFSET_LAST = SLIDER_ID_XOFFSET + SLIDER_SCREEN_SPACING,
SLIDER_ID_YOFFSET,
SLIDER_ID_YOFFSET_LAST = SLIDER_ID_YOFFSET + SLIDER_SCREEN_SPACING,
SLIDER_ID_OVERLAY_XSCALE,
SLIDER_ID_OVERLAY_XSCALE_LAST = SLIDER_ID_OVERLAY_XSCALE + SLIDER_SCREEN_SPACING,
SLIDER_ID_OVERLAY_YSCALE,
SLIDER_ID_OVERLAY_YSCALE_LAST = SLIDER_ID_OVERLAY_YSCALE + SLIDER_SCREEN_SPACING,
SLIDER_ID_OVERLAY_XOFFSET,
SLIDER_ID_OVERLAY_XOFFSET_LAST = SLIDER_ID_OVERLAY_XOFFSET + SLIDER_SCREEN_SPACING,
SLIDER_ID_OVERLAY_YOFFSET,
SLIDER_ID_OVERLAY_YOFFSET_LAST = SLIDER_ID_OVERLAY_YOFFSET + SLIDER_SCREEN_SPACING,
SLIDER_ID_FLICKER,
SLIDER_ID_FLICKER_LAST = SLIDER_ID_FLICKER + SLIDER_SCREEN_SPACING,
SLIDER_ID_BEAM_WIDTH_MIN,
SLIDER_ID_BEAM_WIDTH_MIN_LAST = SLIDER_ID_BEAM_WIDTH_MIN + SLIDER_SCREEN_SPACING,
SLIDER_ID_BEAM_WIDTH_MAX,
SLIDER_ID_BEAM_WIDTH_MAX_LAST = SLIDER_ID_BEAM_WIDTH_MAX + SLIDER_SCREEN_SPACING,
SLIDER_ID_BEAM_INTENSITY,
SLIDER_ID_BEAM_INTENSITY_LAST = SLIDER_ID_BEAM_INTENSITY + SLIDER_SCREEN_SPACING,
SLIDER_ID_CROSSHAIR_SCALE,
SLIDER_ID_CROSSHAIR_SCALE_LAST = SLIDER_ID_CROSSHAIR_SCALE + SLIDER_INPUT_SPACING,
SLIDER_ID_CROSSHAIR_OFFSET,
SLIDER_ID_CROSSHAIR_OFFSET_LAST = SLIDER_ID_CROSSHAIR_OFFSET + SLIDER_INPUT_SPACING,
SLIDER_ID_CORE_LAST = SLIDER_ID_CROSSHAIR_OFFSET,
SLIDER_ID_CORE_COUNT
};
/***************************************************************************
TYPE DEFINITIONS
@ -103,7 +156,7 @@ typedef UINT32 (*ui_callback)(mame_ui_manager &, render_container *, UINT32);
// ======================> mame_ui_manager
class mame_ui_manager : public ui_manager
class mame_ui_manager : public ui_manager, public slider_changed_notifier
{
public:
// construction/destruction
@ -179,6 +232,7 @@ public:
virtual void image_display(const device_type &type, device_image_interface *image) override;
virtual void menu_reset() override;
private:
// instance variables
render_font * m_font;
@ -215,6 +269,36 @@ private:
// private methods
void exit();
slider_state* slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, void *arg);
// slider controls
virtual INT32 slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval) override;
INT32 slider_volume(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_mixervol(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_adjuster(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_overclock(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_refresh(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_brightness(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_contrast(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_gamma(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_xscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_yscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_xoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_yoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_overxscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_overyscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_overxoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_overyoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_flicker(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_beam_width_min(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_beam_width_max(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_beam_intensity_weight(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
std::string slider_get_screen_desc(screen_device &screen);
#ifdef MAME_DEBUG
INT32 slider_crossscale(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std::string *str, INT32 newval);
#endif
};

View File

@ -31,12 +31,12 @@
//**************************************************************************
// global allocation helpers -- use these instead of new and delete
#define global_alloc(_type) new _type
#define global_alloc_nothrow(_type) new (std::nothrow) _type
#define global_alloc_array(_type, _num) new _type[_num]
#define global_alloc_array_nothrow(_type, _num) new (std::nothrow) _type[_num]
#define global_free(_ptr) do { delete _ptr; } while (0)
#define global_free_array(_ptr) do { delete[] _ptr; } while (0)
#define global_alloc(Type) new Type
#define global_alloc_nothrow(Type) new (std::nothrow) Type
#define global_alloc_array(Type, Num) new Type[Num]
#define global_alloc_array_nothrow(Type, Num) new (std::nothrow) Type[Num]
#define global_free(Ptr) do { delete Ptr; } while (0)
#define global_free_array(Ptr) do { delete[] Ptr; } while (0)
@ -59,54 +59,42 @@ inline T* global_alloc_array_clear(std::size_t num)
template<typename _Tp>
struct _MakeUniqClear
{
typedef std::unique_ptr<_Tp> __single_object;
};
template<typename Tp> struct MakeUniqClearT { typedef std::unique_ptr<Tp> single_object; };
template<typename _Tp>
struct _MakeUniqClear<_Tp[]>
{
typedef std::unique_ptr<_Tp[]> __array;
};
template<typename Tp> struct MakeUniqClearT<Tp[]> { typedef std::unique_ptr<Tp[]> array; };
template<typename _Tp, size_t _Bound>
struct _MakeUniqClear<_Tp[_Bound]>
{
struct __invalid_type { };
};
template<typename Tp, size_t Bound> struct MakeUniqClearT<Tp[Bound]> { struct invalid_type { }; };
/// make_unique_clear for single objects
template<typename _Tp, typename... _Args>
inline typename _MakeUniqClear<_Tp>::__single_object make_unique_clear(_Args&&... __args)
template<typename Tp, typename... Params>
inline typename MakeUniqClearT<Tp>::single_object make_unique_clear(Params&&... args)
{
unsigned char* ptr = new unsigned char[sizeof(_Tp)]; // allocate memory
memset(ptr, 0, sizeof(_Tp));
return std::unique_ptr<_Tp>(new(ptr) _Tp(std::forward<_Args>(__args)...));
void *const ptr = ::operator new(sizeof(Tp)); // allocate memory
std::memset(ptr, 0, sizeof(Tp));
return std::unique_ptr<Tp>(new(ptr) Tp(std::forward<Params>(args)...));
}
/// make_unique_clear for arrays of unknown bound
template<typename _Tp>
inline typename _MakeUniqClear<_Tp>::__array make_unique_clear(size_t __num)
template<typename Tp>
inline typename MakeUniqClearT<Tp>::array make_unique_clear(size_t num)
{
auto size = sizeof(std::remove_extent_t<_Tp>) * __num;
auto size = sizeof(std::remove_extent_t<Tp>) * num;
unsigned char* ptr = new unsigned char[size]; // allocate memory
memset(ptr, 0, size);
return std::unique_ptr<_Tp>(new(ptr) std::remove_extent_t<_Tp>[__num]());
std::memset(ptr, 0, size);
return std::unique_ptr<Tp>(new(ptr) std::remove_extent_t<Tp>[num]());
}
template<typename _Tp, unsigned char _F>
inline typename _MakeUniqClear<_Tp>::__array make_unique_clear(size_t __num)
template<typename Tp, unsigned char F>
inline typename MakeUniqClearT<Tp>::array make_unique_clear(size_t num)
{
auto size = sizeof(std::remove_extent_t<_Tp>) * __num;
auto size = sizeof(std::remove_extent_t<Tp>) * num;
unsigned char* ptr = new unsigned char[size]; // allocate memory
memset(ptr, _F, size);
return std::unique_ptr<_Tp>(new(ptr) std::remove_extent_t<_Tp>[__num]());
std::memset(ptr, F, size);
return std::unique_ptr<Tp>(new(ptr) std::remove_extent_t<Tp>[num]());
}
/// Disable make_unique_clear for arrays of known bound
template<typename _Tp, typename... _Args>
inline typename _MakeUniqClear<_Tp>::__invalid_type make_unique_clear(_Args&&...) = delete;
template<typename Tp, typename... Params>
inline typename MakeUniqClearT<Tp>::invalid_type make_unique_clear(Params&&...) = delete;
#endif // MAME_LIB_UTIL_COREALLOC_H

View File

@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Roberto Fresca
// thanks-to:Iris Falbala,Rob Ragon
// thanks-to:Iris Falbala, Rob Ragon
/******************************************************************************
MAGIC FLY
@ -66,103 +66,108 @@
PCB Layout:
_________________________________________________________________
.-----------------------------------------------------------------.
| |
| |
| _________ _________ |
| | 74LS08N | | 74LS32 | |
| |_________| |_________| |
| _________ _________ |
| POWER .---------. .---------. |
| SUPPLY | 74LS08N | | 74LS32 | |
| '---------' '---------' |
| .---------. .---------. |
| | 74LS138 | | 74HC00 | |
| |_________| |_________| |
| ______________ ______________________ |
| | | | | ____|
| | MK48Z02B-20 | | R6502P | |
| |______________| |______________________| |
| ________________ _________ ______________________ |
| | | | 74LS157 | | | |____
| | AM27128 | |_________| | MC6845P | ____|
| |________________| _________ |______________________| ____|
| | 74LS157 | ________ _________ ____|
| |_________| | 74LS14 | | 74LS374 | ____|
| ____________ _________ |________| |_________| ____|
| | 74LS245 | | 74LS157 | _________ ____|
| |____________| |_________| | 74HC244 | ____|
| ____________ _________ |_________| ____|
| | 74LS245 | | 74LS32 | _______ ____| 30x2
| |____________| |_________| | | | | | ____| connector
| ______________ |4|3|2|1| ____|
| | HM6116 | |_|_|_|_| ____|
| | o MSM2128 | ____|
| |______________| DIP SW x4 ____|
| ______________ ____|
| | HM6116 | ________ _________ ____|
| | o MSM2128 | | 74LS08 | | 74LS174 | ____|
| |______________| |________| |_________| ____|
| ________________ __________ ______ ____|
| | | | PAL16R4A | | TDA |- ____|
| | 2764 | |__________| | 2002 |- ____|
| |________________| __________ |______|- ____|
| ________________ | 74LS166 | ____|
| | | |__________| _ |
| | 2764 | __________ / \ |
| |________________| | 74LS166 | | pot | |____
| ________________ |__________| \ _ / __|
| | | __________ _________ ______| |
| | 2764 | | 74LS166 | | 74LS05 | _ |ss112d|8 | 10
| |________________| |__________| |_________| / \ |______|8 | pins
| ________ ______ __________ _________ | pot ||ss112d|8 | male
| | 74LS04 || osc. | | 74LS193 | | 74LS86 | \ _ / |______|8 | connector
| |________||10 MHz| |__________| |_________| |ss112d|8 |
| |______| |______|__|
|_________________________________________________________________|
| '---------' '---------' |
| .--------------. .----------------------. |
| | MK48Z02B-20 | | R6502P | .----'
| | | | | |
| '--------------' '----------------------' |
| .----------------. .---------. .----------------------. |
| | AM27128 | | 74LS157 | | MC6845P | '----.
| | | '---------' | | ----|
| '----------------' .---------. '----------------------' ----|
| | 74LS157 | .--------. .---------. ----|
| '---------' | 74LS14 | | 74LS374 | ----|
| .------------. .---------. '--------' '---------' ----|
| | 74LS245 | | 74LS157 | .---------. ----|
| '------------' '---------' | 74HC244 | ----|
| .------------. .---------. '---------' ----|
| | 74LS245 | | 74LS32 | .-------. ----| 30x2
| '------------' '---------' | | | | | ----| connector
| .--------------. |4|3|2|1| ----|
| | HM6116 | | | | | | ----|
| | o MSM2128 | '-------' ----|
| '--------------' DIP SW x4 ----|
| .--------------. ----|
| | HM6116 | .--------. .---------. ----|
| | o MSM2128 | | 74LS08 | | 74LS174 | ----|
| '--------------' '--------' '---------' ----|
| .----------------. .----------. .------. ----|
| | 2764 | | PAL16R4A | | TDA | ----|
| | | '----------' | 2002 | ----|
| '----------------' .----------. '------' ----|
| .----------------. | 74LS166 | .---. .----'
| | 2764 | '----------' / POT \ |
| | | .----------. \ / |
| '----------------' | 74LS166 | '---' '----.
| .----------------. '----------' .--|
| | 2764 | .----------. .---------. .------| |
| | | | 74LS166 | | 74LS05 | .---. |SS112D|8 | 10
| '----------------' '----------' '---------' / POT \|------|8 | pins
| .--------..------. .----------. .---------. \ /|SS112D|8 | male
| | 74LS04 ||10 MHz| | 74LS193 | | 74LS86 | '---' |------|8 | connector
| '--------'| XTAL | '----------' '---------' |SS112D|8 |
| '------' '------| |
| '--|
'-----------------------------------------------------------------'
Pinouts (from 7mezzo pinout sheet)
----------------------------------
Pinouts (from almost unreadable 7mezzo pinout sheet + PCB trace)
----------------------------------------------------------------
*********** Edge connector ************
solder side connector parts side
Solder side |Conn| Components side
----------------+----+---------------------
GND | 30 | GND
+10V. AC | 29 | +10V. AC
+10V. AC | 28 | +10V. AC
unused | 27 | unused
unused | 26 | unused
GND | 25 | GND
+12V. AC | 24 | +12V. AC
+12V. AC | 23 | +12V. AC
unused | 22 | unused
Common C (3) | 21 | Common A (1)
Common D (4) | 20 | Common B (2)
Deal | 19 | Double
Hold 1 | 18 | Cancel
Hold 2 | 17 | Hold 5
Hold 3 | 16 | Hold 4
Meters | 15 | Bet
Coupon | 14 |
| 13 | Coin 1
(unreadable) | 12 | Coin 2
Take | 11 | Payout
Small (play1) | 10 | Big (play3)
unused | 09 | unused
unused | 08 | unused
unused | 07 | unused
Green | 06 | Red
Sync | 05 | Blue
GND | 04 | GND
Speaker+ | 03 | Speaker+
Speaker- (GND) | 02 | Speaker- (GND)
+5V. | 01 | +5V.
GND 30 GND
+10v. 29 +10v.
+10v. 28 +10v.
unused 27 unused
unused 26 unused
GND 25 GND
+12v. 24 +12v.
+12v. 23 +12v.
unused 22 unused
common C (3) 21 common A (1)
common D (4) 20 common B (2)
DEAL 19 DOUBLE
HOLD 1 18 (unreadable)
HOLD 2 17 HOLD 5
HOLD 3 16 HOLD 4
METER 15 BET
COUPON 14
13 COIN 1
(unreadable) 12 COIN 2
TAKE 11 PAY
SMALL (play1) 10 BIG (play3)
unused 09 unused
unused 08 unused
unused 07 unused
(unreadable) 06 (unreadable)
sync 05 (unreadable)
GND 04 GND
speaker+ 03 speaker+
speaker- (GND) 02 speaker- (GND)
+5v. 01 +5v.
(1) = Double, Deal, Cancel, Bet, Meters.
(2) = Take, Small, Big, Pay.
(3) = Hold 1, Hold 2, Hold 3, Hold 4, Hold 5.
(4) = Coin 1, Coin 2, Coupon.
(1) = DOUBLE, DEAL, (unreadable), BET, METER
(2) = TAKE, SMALL, BIG, PAY
(3) = HOLD 1, HOLD 2, HOLD 3, HOLD 4, HOLD 5
(4) = COIN 1, COIN 2, COUPON
Note: Each Common GND (A-B-C-D) are for their respective
multiplexed groups of inputs, since there are 4 groups
with 5 valid inputs each one.
**** Pins connector ****
**** 10-Pins connector ****
pin 01: (soldered to pin 05)
pin 02:
@ -242,7 +247,7 @@
Counters. ; Bits 4-5-6 are used for Coin1, Coin2, and Payout counters.
Sound DAC, ; Bit 7 is used to transmit DAC data.
$C000 - $FFFF ROM space ; Program ROMs.
$C000 - $FFFF ROM space ; Program ROM.
*******************************************************************************

View File

@ -4986,8 +4986,8 @@ void segas32_state::radm_sw2_output( int which, UINT16 data )
{
if (which == 0)
{
machine().output().set_value("Wiper_lamp", BIT(data, 0));
machine().output().set_value("Lights_lamp", BIT(data, 1));
machine().output().set_value("Lights_lamp", BIT(data, 0));
machine().output().set_value("Wiper_lamp", BIT(data, 1));
}
}

View File

@ -19,6 +19,7 @@ advision.cpp
aim65.cpp
aim65_40.cpp
alesis.cpp
alesis_qs.cpp
alphasma.cpp
alphatro.cpp
altair.cpp

View File

@ -364,16 +364,7 @@ void chain_manager::update_screen_count(uint32_t screen_count)
}
}
static INT32 update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
return reinterpret_cast<chain_manager*>(arg)->chain_changed(id, str, newval);
}
return 0;
}
int32_t chain_manager::chain_changed(int32_t id, std::string *str, int32_t newval)
INT32 chain_manager::slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (newval != SLIDER_NOCHANGE)
{
@ -409,7 +400,9 @@ void chain_manager::create_selection_slider(uint32_t screen_index)
state->defval = m_current_chain[screen_index];
state->maxval = m_available_chains.size() - 1;
state->incval = 1;
state->update = update_trampoline;
using namespace std::placeholders;
state->update = std::bind(&chain_manager::slider_changed, this, _1, _2, _3, _4, _5);
state->arg = this;
state->id = screen_index;
strcpy(state->description, description.c_str());
@ -461,7 +454,7 @@ uint32_t chain_manager::handle_screen_chains(uint32_t view, render_primitive *st
}
}
}
process_screen_quad(view + used_views, screen_index, prim, window);
used_views += screen_chain(screen_index)->applicable_passes();

View File

@ -22,6 +22,7 @@
#include "targetmanager.h"
#include "effectmanager.h"
#include "../frontend/mame/ui/menuitem.h"
#include "../frontend/mame/ui/sliderchangednotifier.h"
class running_machine;
class osd_window;
@ -44,14 +45,13 @@ public:
const std::string m_path;
};
class chain_manager
class chain_manager : public slider_changed_notifier
{
public:
chain_manager(running_machine& machine, osd_options& options, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t window_index, slider_dirty_notifier& slider_notifier);
~chain_manager();
uint32_t handle_screen_chains(uint32_t view, render_primitive *starting_prim, osd_window& window);
int32_t chain_changed(int32_t index, std::string *str, int32_t newval);
// Getters
running_machine& machine() const { return m_machine; }
@ -83,6 +83,8 @@ private:
std::vector<std::string> split_option_string(std::string chain_str) const;
void update_screen_count(uint32_t screen_count);
virtual INT32 slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval) override;
void create_selection_slider(uint32_t screen_index);
bool needs_sliders();

View File

@ -55,13 +55,9 @@ void bgfx_input_pair::bind(bgfx_effect *effect, const int32_t screen) const
bgfx::setTexture(m_index, effect->uniform(m_sampler)->handle(), chains().textures().handle(name));
}
static INT32 update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 bgfx_input_pair::slider_changed(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
return reinterpret_cast<bgfx_input_pair*>(arg)->texture_changed(id, str, newval);
}
return 0;
return texture_changed(id, str, newval);
}
int32_t bgfx_input_pair::texture_changed(int32_t id, std::string *str, int32_t newval)
@ -106,7 +102,9 @@ void bgfx_input_pair::create_selection_slider(uint32_t screen_index)
state->defval = m_current_texture;
state->maxval = m_available_textures.size() - 1;
state->incval = 1;
state->update = update_trampoline;
using namespace std::placeholders;
state->update = std::bind(&bgfx_input_pair::slider_changed, this, _1, _2, _3, _4, _5);
state->arg = this;
state->id = screen_index;
strcpy(state->description, description.c_str());

View File

@ -17,11 +17,12 @@
#include <string>
#include "../frontend/mame/ui/menuitem.h"
#include "../frontend/mame/ui/sliderchangednotifier.h"
class bgfx_effect;
class chain_manager;
class bgfx_input_pair
class bgfx_input_pair : public slider_changed_notifier
{
public:
bgfx_input_pair(int index, std::string sampler, std::string texture, std::vector<std::string> available_textures, std::string selection, chain_manager& chains, uint32_t screen_index);
@ -36,6 +37,7 @@ public:
std::vector<ui::menu_item> get_slider_list();
private:
virtual INT32 slider_changed(running_machine &machine, void *arg, int /*id*/, std::string *str, INT32 newval) override;
void create_selection_slider(uint32_t screen_index);
bool needs_sliders();

View File

@ -37,7 +37,7 @@ bgfx_slider::~bgfx_slider()
{
}
static INT32 update_trampoline(running_machine &machine, void *arg, int /*id*/, std::string *str, INT32 newval)
INT32 bgfx_slider::slider_changed(running_machine& /*machine*/, void *arg, int /*id*/, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
@ -49,7 +49,7 @@ static INT32 update_trampoline(running_machine &machine, void *arg, int /*id*/,
void bgfx_slider::import(float val)
{
m_value = val;
update_trampoline(m_machine, this, m_slider_state->id, nullptr, int32_t(floor(m_value / m_step + 0.5f)));
slider_changed(m_machine, this, m_slider_state->id, nullptr, int32_t(floor(m_value / m_step + 0.5f)));
}
slider_state* bgfx_slider::create_core_slider(running_machine& machine)
@ -61,7 +61,10 @@ slider_state* bgfx_slider::create_core_slider(running_machine& machine)
state->defval = int32_t(floor(m_default / m_step + 0.5f));
state->maxval = int32_t(floor(m_max / m_step + 0.5f));
state->incval = int32_t(floor(m_step / m_step + 0.5f));
state->update = update_trampoline;
using namespace std::placeholders;
state->update = std::bind(&bgfx_slider::slider_changed, this, _1, _2, _3, _4, _5);
state->arg = this;
state->id = 0;
strcpy(state->description, m_description.c_str());

View File

@ -19,7 +19,7 @@
#include "emu.h"
#include "../frontend/mame/ui/slider.h"
class bgfx_slider
class bgfx_slider : public slider_changed_notifier
{
public:
enum slider_type
@ -44,7 +44,7 @@ public:
};
bgfx_slider(running_machine& machine, std::string name, float min, float def, float max, float step, slider_type type, screen_type screen, std::string format, std::string description, std::vector<std::string>& strings);
~bgfx_slider();
virtual ~bgfx_slider();
int32_t update(std::string *str, int32_t newval);
@ -61,6 +61,7 @@ public:
void import(float val);
protected:
virtual INT32 slider_changed(running_machine &machine, void *arg, int /*id*/, std::string *str, INT32 newval) override;
slider_state* create_core_slider(running_machine &machine);
int32_t as_int() const { return int32_t(floor(m_value / m_step + 0.5f)); }

View File

@ -2184,7 +2184,7 @@ static void get_vector(const char *data, int count, float *out, bool report_erro
// be done in a more ideal way.
//============================================================
static slider_state *slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg)
slider_state* shaders::slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, void *arg)
{
int size = sizeof(slider_state) + strlen(title);
slider_state *state = reinterpret_cast<slider_state *>(auto_alloc_array_clear(machine, UINT8, size));
@ -2193,7 +2193,10 @@ static slider_state *slider_alloc(running_machine &machine, int id, const char *
state->defval = defval;
state->maxval = maxval;
state->incval = incval;
state->update = update;
using namespace std::placeholders;
state->update = std::bind(&shaders::slider_changed, this, _1, _2, _3, _4, _5);
state->arg = arg;
state->id = id;
strcpy(state->description, title);
@ -2267,7 +2270,7 @@ INT32 slider::update(std::string *str, INT32 newval)
return 0;
}
static INT32 slider_update_trampoline(running_machine &machine, void *arg, int id, std::string *str, INT32 newval)
INT32 shaders::slider_changed(running_machine& /*machine*/, void *arg, int /*id*/, std::string *str, INT32 newval)
{
if (arg != nullptr)
{
@ -2558,7 +2561,7 @@ std::vector<ui::menu_item> shaders::init_slider_list()
break;
}
slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_update_trampoline, slider_arg);
slider_state* core_slider = slider_alloc(*machine, desc->id, name.c_str(), desc->minval, desc->defval, desc->maxval, desc->step, slider_arg);
ui::menu_item item;
item.text = core_slider->description;

View File

@ -12,6 +12,7 @@
#include <vector>
#include "aviio.h"
#include "../frontend/mame/ui/menuitem.h"
#include "../frontend/mame/ui/slider.h"
//============================================================
// CONSTANTS
@ -290,7 +291,7 @@ private:
bool * m_dirty;
};
class shaders
class shaders : public slider_changed_notifier
{
friend class effect;
friend class uniform;
@ -342,6 +343,8 @@ public:
void delete_resources(bool reset);
// slider-related functions
virtual INT32 slider_changed(running_machine &machine, void *arg, int /*id*/, std::string *str, INT32 newval) override;
slider_state* slider_alloc(running_machine &machine, int id, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, void *arg);
std::vector<ui::menu_item> init_slider_list();
void *get_slider_option(int id, int index = 0);

View File

@ -17,6 +17,8 @@
#include <stdio.h>
#include <string.h>
#include <cstdint>
#include <type_traits>
/***************************************************************************
COMPILER-SPECIFIC NASTINESS
@ -131,6 +133,15 @@ using FPTR = uintptr_t;
// Highly useful template for compile-time knowledge of an array size
template <typename T, size_t N> constexpr inline size_t ARRAY_LENGTH(T (&)[N]) { return N;}
// For declaring an array of the same dimensions as another array (including multi-dimensional arrays)
template <typename T, typename U> struct equivalent_array_or_type { typedef T type; };
template <typename T, typename U, std::size_t N> struct equivalent_array_or_type<T, U[N]> { typedef typename equivalent_array_or_type<T, U>::type type[N]; };
template <typename T, typename U> using equivalent_array_or_type_t = typename equivalent_array_or_type<T, U>::type;
template <typename T, typename U> struct equivalent_array { };
template <typename T, typename U, std::size_t N> struct equivalent_array<T, U[N]> { typedef equivalent_array_or_type_t<T, U> type[N]; };
template <typename T, typename U> using equivalent_array_t = typename equivalent_array<T, U>::type;
#define EQUIVALENT_ARRAY(a, T) equivalent_array_t<T, std::remove_reference_t<decltype(a)> >
/* Macros for normalizing data into big or little endian formats */
#define FLIPENDIAN_INT16(x) (((((UINT16) (x)) >> 8) | ((x) << 8)) & 0xffff)

View File

@ -471,7 +471,7 @@ public:
// loop over channels and read the samples
int channels = MIN(m_info.channels, ARRAY_LENGTH(m_audio));
INT16 *samplesptr[ARRAY_LENGTH(m_audio)];
EQUIVALENT_ARRAY(m_audio, INT16 *) samplesptr;
for (int chnum = 0; chnum < channels; chnum++)
{
// read the sound samples