diff options
Diffstat (limited to 'src')
125 files changed, 7150 insertions, 3434 deletions
diff --git a/src/emu/clifront.cpp b/src/emu/clifront.cpp index 2643fd3e5db..6b75841df83 100644 --- a/src/emu/clifront.cpp +++ b/src/emu/clifront.cpp @@ -89,7 +89,6 @@ cli_frontend::~cli_frontend() m_options.remove_device_options(); } - //------------------------------------------------- // execute - execute a game via the standard // command line interface @@ -109,6 +108,9 @@ int cli_frontend::execute(int argc, char **argv) m_options.parse_standard_inis(option_errors); + //load_translation(); + load_translation(m_options); + manager->start_luaengine(); if (*(m_options.software_name()) != 0) diff --git a/src/emu/emu.h b/src/emu/emu.h index 4e78d67282f..d45c08b3fef 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -92,6 +92,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ // the running machine #include "mame.h" +#include "language.h" #include "machine.h" #include "driver.h" diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 97e107ebb49..ccb7c5d9487 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -44,6 +44,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_CHEATPATH, "cheat", OPTION_STRING, "path to cheat files" }, { OPTION_CROSSHAIRPATH, "crosshair", OPTION_STRING, "path to crosshair files" }, { OPTION_PLUGINSPATH, "plugins", OPTION_STRING, "path to plugin files" }, + { OPTION_LANGUAGEPATH, "language", OPTION_STRING, "path to language files" }, // output directory options { nullptr, nullptr, OPTION_HEADER, "CORE OUTPUT DIRECTORY OPTIONS" }, @@ -188,6 +189,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_AUTOBOOT_DELAY, "2", 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" }, { nullptr } }; diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index c8bbc58435a..c0aefb6ac28 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -57,6 +57,7 @@ enum #define OPTION_CHEATPATH "cheatpath" #define OPTION_CROSSHAIRPATH "crosshairpath" #define OPTION_PLUGINSPATH "pluginspath" +#define OPTION_LANGUAGEPATH "languagepath" // core directory options #define OPTION_CFG_DIRECTORY "cfg_directory" @@ -190,6 +191,8 @@ enum #define OPTION_CONSOLE "console" +#define OPTION_LANGUAGE "language" + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -233,6 +236,7 @@ public: const char *cheat_path() const { return value(OPTION_CHEATPATH); } const char *crosshair_path() const { return value(OPTION_CROSSHAIRPATH); } const char *plugins_path() const { return value(OPTION_PLUGINSPATH); } + const char *language_path() const { return value(OPTION_LANGUAGEPATH); } // core directory options const char *cfg_directory() const { return value(OPTION_CFG_DIRECTORY); } @@ -363,6 +367,8 @@ public: const char *autoboot_script() const { return value(OPTION_AUTOBOOT_SCRIPT); } bool console() const { return bool_value(OPTION_CONSOLE); } + + const char *language() const { return value(OPTION_LANGUAGE); } // FIXME: Couriersud: This should be in image_device_exit void remove_device_options(); diff --git a/src/emu/language.cpp b/src/emu/language.cpp new file mode 100644 index 00000000000..e5e224b891c --- /dev/null +++ b/src/emu/language.cpp @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + language.cpp + + Multi-language support. + +***************************************************************************/ + +#include "emu.h" + +static std::unordered_map<std::string, std::string> g_translation; + +const char *lang_translate(const char *word) +{ + if (g_translation.find(word) == g_translation.end()) + { + return word; + } + return g_translation[word].c_str(); +} + +const UINT32 MO_MAGIC = 0x950412de; +const UINT32 MO_MAGIC_REVERSED = 0xde120495; + +inline UINT32 endianchange(UINT32 value) { + UINT32 b0 = (value >> 0) & 0xff; + UINT32 b1 = (value >> 8) & 0xff; + UINT32 b2 = (value >> 16) & 0xff; + UINT32 b3 = (value >> 24) & 0xff; + + return (b0 << 24) | (b1 << 16) | (b2 << 8) | b3; +} + +void load_translation(emu_options &m_options) +{ + g_translation.clear(); + emu_file file(m_options.language_path(), OPEN_FLAG_READ); + auto name = std::string(m_options.language()); + strreplace(name, " ", "_"); + if (file.open(name.c_str(), PATH_SEPARATOR "strings.mo") == FILERR_NONE) + { + UINT64 size = file.size(); + UINT32 *buffer = global_alloc_array(UINT32, size / 4 + 1); + file.read(buffer, size); + file.close(); + + if (buffer[0] != MO_MAGIC && buffer[0] != MO_MAGIC_REVERSED) + { + global_free_array(buffer); + return; + } + if (buffer[0] == MO_MAGIC_REVERSED) + { + for (auto i = 0; i < (size / 4) + 1; ++i) + { + buffer[i] = endianchange(buffer[i]); + } + } + + UINT32 number_of_strings = buffer[2]; + UINT32 original_table_offset = buffer[3] >> 2; + UINT32 translation_table_offset = buffer[4] >> 2; + + const char *data = reinterpret_cast<const char*>(buffer); + + for (auto i = 1; i < number_of_strings; ++i) + { + std::string original = (const char *)data + buffer[original_table_offset + 2 * i + 1]; + std::string translation = (const char *)data + buffer[translation_table_offset + 2 * i + 1]; + g_translation.insert(std::pair<std::string, std::string>(original, translation)); + } + global_free_array(buffer); + } +}
\ No newline at end of file diff --git a/src/emu/language.h b/src/emu/language.h new file mode 100644 index 00000000000..ce536531d89 --- /dev/null +++ b/src/emu/language.h @@ -0,0 +1,32 @@ +// license:BSD-3-Clause +// copyright-holders:Miodrag Milanovic +/*************************************************************************** + + language.h + + Multi-language support. + +***************************************************************************/ +#pragma once + +#ifndef __EMU_H__ +#error Dont include this file directly; include emu.h instead. +#endif + +#ifndef __LANGUAGE_H__ +#define __LANGUAGE_H__ + +//************************************************************************** +// LOCALIZATION SUPPORT +//************************************************************************** + +#define _(param) lang_translate(param) +// Fake one to make possible using it in static text definitions, on those +// lang_translate must be called afterwards +#define __(param) param + +void load_translation(emu_options &option); +const char *lang_translate(const char *word); + +#endif /*__LANGUAGE_H__*/ + diff --git a/src/emu/ui/barcode.cpp b/src/emu/ui/barcode.cpp index 5b3b15d7ad0..e9f779737a8 100644 --- a/src/emu/ui/barcode.cpp +++ b/src/emu/ui/barcode.cpp @@ -115,7 +115,7 @@ void ui_menu_barcode_reader::handle() std::string tmp_file(m_barcode_buffer); //printf("code %s\n", m_barcode_buffer); if (!current_device()->is_valid(tmp_file.length())) - machine().ui().popup_time(5, _("Barcode length invalid!")); + machine().ui().popup_time(5, "%s", _("Barcode length invalid!")); else { current_device()->write_code(tmp_file.c_str(), tmp_file.length()); diff --git a/src/emu/ui/ctrlmenu.cpp b/src/emu/ui/ctrlmenu.cpp index 74b35abd8e3..f954a596f7a 100644 --- a/src/emu/ui/ctrlmenu.cpp +++ b/src/emu/ui/ctrlmenu.cpp @@ -17,14 +17,14 @@ const char *ui_menu_controller_mapping::m_device_status[] = { "none", "keyboard" ui_menu_controller_mapping::ctrl_option ui_menu_controller_mapping::m_options[] = { { 0, nullptr, nullptr }, - { 0, "Lightgun Device Assignment", OPTION_LIGHTGUN_DEVICE }, - { 0, "Trackball Device Assignment", OPTION_TRACKBALL_DEVICE }, - { 0, "Pedal Device Assignment", OPTION_PEDAL_DEVICE }, - { 0, "Adstick Device Assignment", OPTION_ADSTICK_DEVICE }, - { 0, "Paddle Device Assignment", OPTION_PADDLE_DEVICE }, - { 0, "Dial Device Assignment", OPTION_DIAL_DEVICE }, - { 0, "Positional Device Assignment", OPTION_POSITIONAL_DEVICE }, - { 0, "Mouse Device Assignment", OPTION_MOUSE_DEVICE } + { 0, __("Lightgun Device Assignment"), OPTION_LIGHTGUN_DEVICE }, + { 0, __("Trackball Device Assignment"), OPTION_TRACKBALL_DEVICE }, + { 0, __("Pedal Device Assignment"), OPTION_PEDAL_DEVICE }, + { 0, __("Adstick Device Assignment"), OPTION_ADSTICK_DEVICE }, + { 0, __("Paddle Device Assignment"), OPTION_PADDLE_DEVICE }, + { 0, __("Dial Device Assignment"), OPTION_DIAL_DEVICE }, + { 0, __("Positional Device Assignment"), OPTION_POSITIONAL_DEVICE }, + { 0, __("Mouse Device Assignment"), OPTION_MOUSE_DEVICE } }; //------------------------------------------------- @@ -88,7 +88,7 @@ void ui_menu_controller_mapping::populate() for (int d = 1; d < ARRAY_LENGTH(m_options); ++d) { UINT32 arrow_flags = get_arrow_flags(0, ARRAY_LENGTH(m_device_status) - 1, m_options[d].status); - item_append(m_options[d].description, m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d); + item_append(_(m_options[d].description), m_device_status[m_options[d].status], arrow_flags, (void *)(FPTR)d); } item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); diff --git a/src/emu/ui/custui.cpp b/src/emu/ui/custui.cpp index 355f486918a..4793f10d904 100644 --- a/src/emu/ui/custui.cpp +++ b/src/emu/ui/custui.cpp @@ -24,6 +24,21 @@ const char *ui_menu_custom_ui::hide_status[] = { "Show All", "Hide Filters", "Hi ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) { + // load languages + file_enumerator path(machine.options().language_path()); + const char *lang = machine.options().language(); + const osd_directory_entry *dirent; + int cnt = 0; + for (int x = 0; (dirent = path.next()) != nullptr; ++x) + if (dirent->type == ENTTYPE_DIR && strcmp(dirent->name, ".") != 0 && strcmp(dirent->name, "..") != 0) + { + auto name = std::string(dirent->name); + strreplace(name, "_", " "); + m_lang.push_back(name); + if (strcmp(name.c_str(), lang) == 0) + m_currlang = cnt; + ++cnt; + } } //------------------------------------------------- @@ -34,6 +49,12 @@ ui_menu_custom_ui::~ui_menu_custom_ui() { std::string error_string; machine().ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + if (!m_lang.empty()) + { + machine().options().set_value(OPTION_LANGUAGE, m_lang[m_currlang].c_str(), OPTION_PRIORITY_CMDLINE, error_string); + machine().options().mark_changed(OPTION_LANGUAGE); + load_translation(machine().options()); + } ui_globals::reset = true; } @@ -50,25 +71,24 @@ void ui_menu_custom_ui::handle() if (m_event != nullptr && m_event->itemref != nullptr) { - if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) - { - changed = true; - (m_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--; - } - - - else if (m_event->iptkey == IPT_UI_SELECT) + switch ((FPTR)m_event->itemref) { - switch ((FPTR)m_event->itemref) - { - case FONT_MENU: + case FONT_MENU: + if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear<ui_menu_font_ui>(machine(), container)); - break; - - case COLORS_MENU: + break; + case COLORS_MENU: + if (m_event->iptkey == IPT_UI_SELECT) ui_menu::stack_push(global_alloc_clear<ui_menu_colors_ui>(machine(), container)); - break; - case HIDE_MENU: + break; + case HIDE_MENU: + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + changed = true; + (m_event->iptkey == IPT_UI_RIGHT) ? ui_globals::panels_status++ : ui_globals::panels_status--; + } + else if (m_event->iptkey == IPT_UI_SELECT) { int total = ARRAY_LENGTH(hide_status); std::vector<std::string> s_sel(total); @@ -78,6 +98,23 @@ void ui_menu_custom_ui::handle() ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, ui_globals::panels_status)); } } + case LANGUAGE_MENU: + { + if (m_event->iptkey == IPT_UI_LEFT || m_event->iptkey == IPT_UI_RIGHT) + { + changed = true; + (m_event->iptkey == IPT_UI_RIGHT) ? m_currlang++ : m_currlang--; + } + else if (m_event->iptkey == IPT_UI_SELECT) + { + int total = m_lang.size(); + std::vector<std::string> s_sel(total); + for (int index = 0; index < total; ++index) + s_sel[index] = m_lang[index]; + + ui_menu::stack_push(global_alloc_clear<ui_menu_selector>(machine(), container, s_sel, m_currlang)); + } + } } } @@ -91,11 +128,18 @@ void ui_menu_custom_ui::handle() void ui_menu_custom_ui::populate() { + UINT32 arrow_flags; item_append("Fonts", nullptr, 0, (void *)(FPTR)FONT_MENU); item_append("Colors", nullptr, 0, (void *)(FPTR)COLORS_MENU); - UINT32 arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status); - item_append("Filters and Info/Image", hide_status[ui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); + if (!m_lang.empty()) + { + arrow_flags = get_arrow_flags(0, m_lang.size() - 1, m_currlang); + item_append("Language", m_lang[m_currlang].c_str(), arrow_flags, (void *)(FPTR)LANGUAGE_MENU); + } + + arrow_flags = get_arrow_flags(0, (int)HIDE_BOTH, ui_globals::panels_status); + item_append("Show side panels", hide_status[ui_globals::panels_status], arrow_flags, (void *)(FPTR)HIDE_MENU); item_append(MENU_SEPARATOR_ITEM, nullptr, 0, nullptr); customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; diff --git a/src/emu/ui/custui.h b/src/emu/ui/custui.h index 79f45cc3a6e..0a2caf8de8c 100644 --- a/src/emu/ui/custui.h +++ b/src/emu/ui/custui.h @@ -34,11 +34,14 @@ public: private: enum { - FONT_MENU = 1, + LANGUAGE_MENU = 1, + FONT_MENU, COLORS_MENU, HIDE_MENU }; static const char *hide_status[]; + std::vector<std::string> m_lang; + UINT16 m_currlang; }; //------------------------------------------------- diff --git a/src/emu/ui/menu.cpp b/src/emu/ui/menu.cpp index 547030298bb..3803790c359 100644 --- a/src/emu/ui/menu.cpp +++ b/src/emu/ui/menu.cpp @@ -537,6 +537,8 @@ 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) + top_line = selected - (visible_lines / 2); if (top_line < 0 || selected == 0) top_line = 0; if (top_line + visible_lines >= item.size()) diff --git a/src/emu/ui/sliders.cpp b/src/emu/ui/sliders.cpp index e494213aa1b..d53ad402943 100644 --- a/src/emu/ui/sliders.cpp +++ b/src/emu/ui/sliders.cpp @@ -17,9 +17,9 @@ #include "ui/sliders.h" -ui_menu_sliders::ui_menu_sliders(running_machine &machine, render_container *container, bool _menuless_mode) : ui_menu(machine, container) +ui_menu_sliders::ui_menu_sliders(running_machine &machine, render_container *container, bool menuless_mode) : ui_menu(machine, container) { - menuless_mode = hidden = _menuless_mode; + m_menuless_mode = m_hidden = menuless_mode; } ui_menu_sliders::~ui_menu_sliders() @@ -35,7 +35,7 @@ void ui_menu_sliders::handle() const ui_menu_event *menu_event; /* process the menu */ - menu_event = process(UI_MENU_PROCESS_LR_REPEAT | (hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0)); + menu_event = process(UI_MENU_PROCESS_LR_REPEAT | (m_hidden ? UI_MENU_PROCESS_CUSTOM_ONLY : 0)); if (menu_event != nullptr) { /* handle keys if there is a valid item selected */ @@ -49,10 +49,10 @@ void ui_menu_sliders::handle() { /* toggle visibility */ case IPT_UI_ON_SCREEN_DISPLAY: - if (menuless_mode) + if (m_menuless_mode) ui_menu::stack_pop(machine()); else - hidden = !hidden; + m_hidden = !m_hidden; break; /* decrease value */ @@ -103,19 +103,25 @@ void ui_menu_sliders::handle() } /* if we are selecting an invalid item and we are hidden, skip to the next one */ - else if (hidden) + else if (m_hidden) { /* if we got here via up or page up, select the previous item */ if (menu_event->iptkey == IPT_UI_UP || menu_event->iptkey == IPT_UI_PAGE_UP) { - selected = (selected + item.size() - 1) % item.size(); + do + { + selected = (selected + item.size() - 1) % item.size(); + } while(((slider_state&)item[selected]).hidden); validate_selection(-1); } /* otherwise select the next item */ else if (menu_event->iptkey == IPT_UI_DOWN || menu_event->iptkey == IPT_UI_PAGE_DOWN) { - selected = (selected + 1) % item.size(); + do + { + selected = (selected + 1) % item.size(); + } while(((slider_state&)item[selected]).hidden); validate_selection(1); } } @@ -252,5 +258,5 @@ UINT32 ui_menu_sliders::ui_handler(running_machine &machine, render_container *c ui_menu::stack_pop(machine); ui_menu_sliders *uim = dynamic_cast<ui_menu_sliders *>(menu_stack); - return uim && uim->menuless_mode ? 0 : UI_HANDLER_CANCEL; + return uim && uim->m_menuless_mode ? 0 : UI_HANDLER_CANCEL; } diff --git a/src/emu/ui/sliders.h b/src/emu/ui/sliders.h index d76a24c1671..c21555dc336 100644 --- a/src/emu/ui/sliders.h +++ b/src/emu/ui/sliders.h @@ -13,6 +13,8 @@ #ifndef __UI_SLIDERS_H__ #define __UI_SLIDERS_H__ +#include <map> + class ui_menu_sliders : public ui_menu { public: ui_menu_sliders(running_machine &machine, render_container *container, bool menuless_mode = false); @@ -25,7 +27,8 @@ public: static UINT32 ui_handler(running_machine &machine, render_container *container, UINT32 state); private: - bool menuless_mode, hidden; + bool m_menuless_mode; + bool m_hidden; }; diff --git a/src/emu/ui/ui.cpp b/src/emu/ui/ui.cpp index b002560382c..6652bf0b8e8 100644 --- a/src/emu/ui/ui.cpp +++ b/src/emu/ui/ui.cpp @@ -1954,6 +1954,8 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I state->incval = incval; state->update = update; state->arg = arg; + state->hidden = false; + state->id = -1; strcpy(state->description, title); return state; @@ -2771,7 +2773,7 @@ rgb_t decode_ui_color(int id, running_machine *machine) if (machine != nullptr) { ui_options option; - for (int x = 0; x < ARRAY_LENGTH(s_color_list); x++) { + for (int x = 0; x < ARRAY_LENGTH(s_color_list); ++x) { const char *o_default = option.value(s_color_list[x]); const char *s_option = machine->ui().options().value(s_color_list[x]); int len = strlen(s_option); diff --git a/src/emu/ui/ui.h b/src/emu/ui/ui.h index 31f52b46134..ffd2fddc371 100644 --- a/src/emu/ui/ui.h +++ b/src/emu/ui/ui.h @@ -85,10 +85,6 @@ enum #define SLIDER_NOCHANGE 0x12345678 -/*************************************************************************** - FOR FUTURE LOCALIZATION -***************************************************************************/ -#define _(param) param /*************************************************************************** TYPE DEFINITIONS @@ -107,7 +103,9 @@ struct slider_state INT32 defval; /* default value */ INT32 maxval; /* maximum value */ INT32 incval; /* increment value */ - char description[1]; /* textual description */ + bool hidden; /* hidden or not */ + INT32 id; /* unique identifier */ + char description[1]; /* textual description */ }; @@ -125,7 +123,7 @@ public: running_machine &machine() const { return m_machine; } bool single_step() const { return m_single_step; } ui_options &options() { return m_ui_options; } - + // setters void set_single_step(bool single_step) { m_single_step = single_step; } @@ -228,5 +226,5 @@ private: FUNCTION PROTOTYPES ***************************************************************************/ rgb_t decode_ui_color(int id, running_machine *machine = nullptr); -int get_font_rows(running_machine *machine = NULL); +int get_font_rows(running_machine *machine = nullptr); #endif /* __USRINTRF_H__ */ diff --git a/src/mame/debug.lst b/src/mame/debug.lst new file mode 100644 index 00000000000..ad631a8af76 --- /dev/null +++ b/src/mame/debug.lst @@ -0,0 +1,328 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +/****************************************************************************** + + arcade.lst + + List of all enabled drivers in the system. This file is parsed by + makelist.exe, sorted, and output as C code describing the drivers. + +******************************************************************************/ + + +// Neo Geo games +// the four digits number is the game ID stored at address 0x0108 of the program ROM +// info on prototypes taken from http://www.members.tripod.com/fresa/proto/puzzle.htm +neogeo +nam1975 // 0001 (c) 1990 SNK +bstars // 0002 (c) 1990 SNK +bstarsh // 0002 (c) 1990 SNK +tpgolf // 0003 (c) 1990 SNK +mahretsu // 0004 (c) 1990 SNK +maglord // 0005 (c) 1990 Alpha Denshi Co. +maglordh // 0005 (c) 1990 Alpha Denshi Co. +ridhero // 0006 (c) 1990 SNK +ridheroh // 0006 (c) 1990 SNK +alpham2 // 0007 (c) 1991 SNK +alpham2p // 0007 (c) 1991 SNK (prototype) + // 0008 Sunshine (prototype) 1990 SNK +ncombat // 0009 (c) 1990 Alpha Denshi Co. +ncombath // 0009 (c) 1990 Alpha Denshi Co. +cyberlip // 0010 (c) 1990 SNK +superspy // 0011 (c) 1990 SNK + // 0012 + // 0013 +mutnat // 0014 (c) 1992 SNK + // 0015 +kotm // 0016 (c) 1991 SNK +kotmh // 0016 (c) 1991 SNK +sengoku // 0017 (c) 1991 SNK +sengokuh // 0017 (c) 1991 SNK +burningf // 0018 (c) 1991 SNK +burningfh // 0018 (c) 1991 SNK +burningfp // 0018 (c) 1991 SNK (prototype) +lbowling // 0019 (c) 1990 SNK +gpilots // 0020 (c) 1991 SNK +gpilotsh // 0020 (c) 1991 SNK +joyjoy // 0021 (c) 1990 SNK +bjourney // 0022 (c) 1990 Alpha Denshi Co. +quizdais // 0023 (c) 1991 SNK +quizdaisk // 0123 (c) 1991 SNK +lresort // 0024 (c) 1992 SNK +eightman // 0025 (c) 1991 SNK / Pallas + // 0026 Fun Fun Brothers (prototype) 1991 Alpha +minasan // 0027 (c) 1990 Monolith Corp. + // 0028 Dunk Star (prototype) Sammy +legendos // 0029 (c) 1991 SNK +2020bb // 0030 (c) 1991 SNK / Pallas +2020bba // 0030 (c) 1991 SNK / Pallas +2020bbh // 0030 (c) 1991 SNK / Pallas +socbrawl // 0031 (c) 1991 SNK +socbrawlh // 0031 (c) 1991 SNK +roboarmy // 0032 (c) 1991 SNK +fatfury1 // 0033 (c) 1991 SNK +fbfrenzy // 0034 (c) 1992 SNK + // 0035 Mystic Wand (prototype) 1991 Alpha +bakatono // 0036 (c) 1991 Monolith Corp. +crsword // 0037 (c) 1991 Alpha Denshi Co. +trally // 0038 (c) 1991 Alpha Denshi Co. +kotm2 // 0039 (c) 1992 SNK +kotm2p // 0039 (c) 1992 SNK (prototype) +sengoku2 // 0040 (c) 1993 SNK +bstars2 // 0041 (c) 1992 SNK +quizdai2 // 0042 (c) 1992 SNK +3countb // 0043 (c) 1993 SNK +aof // 0044 (c) 1992 SNK +samsho // 0045 (c) 1993 SNK +samshoh // 0045 (c) 1993 SNK +tophuntr // 0046 (c) 1994 SNK +tophuntrh // 0046 (c) 1994 SNK +fatfury2 // 0047 (c) 1992 SNK +janshin // 0048 (c) 1994 Aicom +androdun // 0049 (c) 1992 Visco +ncommand // 0050 (c) 1992 Alpha Denshi Co. +viewpoin // 0051 (c) 1992 Sammy +ssideki // 0052 (c) 1992 SNK +wh1 // 0053 (c) 1992 Alpha Denshi Co. +wh1h // 0053 (c) 1992 Alpha Denshi Co. +wh1ha // 0053 (c) 1992 Alpha Denshi Co. + // 0054 Crossed Swords 2 (CD only? not confirmed, MVS might exist) +kof94 // 0055 (c) 1994 SNK +aof2 // 0056 (c) 1994 SNK +aof2a // 0056 (c) 1994 SNK +wh2 // 0057 (c) 1993 ADK +fatfursp // 0058 (c) 1993 SNK +fatfurspa // 0058 (c) 1993 SNK +savagere // 0059 (c) 1995 SNK +fightfev // 0060 (c) 1994 Viccom +fightfeva // 0060 (c) 1994 Viccom +ssideki2 // 0061 (c) 1994 SNK +spinmast // 0062 (c) 1993 Data East Corporation +samsho2 // 0063 (c) 1994 SNK +samsho2k // 0063 (c) 1994 SNK (Korean hack) +wh2j // 0064 (c) 1994 ADK / SNK +wjammers // 0065 (c) 1994 Data East Corporation +karnovr // 0066 (c) 1994 Data East Corporation +gururin // 0067 (c) 1994 Face +pspikes2 // 0068 (c) 1994 Video System Co. + // Super Volley '94 was once released in Mar.1994, and recalled. Then released as Power Spikes 2 (with some tweaks). +fatfury3 // 0069 (c) 1995 SNK +zupapa // 0070 Zupapa - released in 2001, 1994 prototype probably exists + // 0071 Bang Bang Busters (prototype) 1994 Visco + // 0072 Last Odyssey Pinball Fantasia (prototype) 1995 Monolith +panicbom // 0073 (c) 1994 Eighting / Hudson +aodk // 0074 (c) 1994 ADK / SNK +sonicwi2 // 0075 (c) 1994 Video System Co. +zedblade // 0076 (c) 1994 NMK + // 0077 The Warlocks of the Fates (prototype) 1995 Astec +galaxyfg // 0078 (c) 1995 Sunsoft +strhoop // 0079 (c) 1994 Data East Corporation +quizkof // 0080 (c) 1995 Saurus +quizkofk // 0080 (c) 1995 Saurus +ssideki3 // 0081 (c) 1995 SNK +doubledr // 0082 (c) 1995 Technos +pbobblen // 0083 (c) 1994 Taito +pbobblenb // bootleg +kof95 // 0084 (c) 1995 SNK +kof95a // 0084 (c) 1995 SNK, alternate board +kof95h // 0084 (c) 1995 SNK + // 0085 Shinsetsu Samurai Spirits Bushidoretsuden / Samurai Shodown RPG (CD only) +tws96 // 0086 (c) 1996 Tecmo +samsho3 // 0087 (c) 1995 SNK +samsho3h // 0087 (c) 1995 SNK +fswords // 0187 Korean hack of samsho3 +stakwin // 0088 (c) 1995 Saurus +pulstar // 0089 (c) 1995 Aicom +whp // 0090 (c) 1995 ADK / SNK + // 0091 +kabukikl // 0092 (c) 1995 Hudson +neobombe // 0093 (c) 1997 Hudson +gowcaizr // 0094 (c) 1995 Technos +rbff1 // 0095 (c) 1995 SNK +rbff1a // 0095 (c) 1995 SNK +aof3 // 0096 (c) 1996 SNK +aof3k // 0196 Censored Korean release of aof3 +sonicwi3 // 0097 (c) 1995 Video System Co. + // 0098 Idol Mahjong - final romance 2 (CD only? not confirmed, MVS might exist) + // 0099 Neo Pool Masters +turfmast // 0200 (c) 1996 Nazca +mslug // 0201 (c) 1996 Nazca +puzzledp // 0202 (c) 1995 Taito (Visco license) +mosyougi // 0203 (c) 1995 ADK / SNK + // 0204 QP (prototype) + // 0205 Neo-Geo CD Special (CD only) +marukodq // 0206 (c) 1995 Takara +neomrdo // 0207 (c) 1996 Visco +sdodgeb // 0208 (c) 1996 Technos +goalx3 // 0209 (c) 1995 Visco + // 0210 Karate Ninja Sho (prototype) 1995 Yumekobo + // 0211 Oshidashi Zintrick (CD only? not confirmed, MVS might exist) 1996 SNK/ADK +zintrckb // 0211 hack - this is not a genuine MVS proto, its a bootleg made from the CD version +overtop // 0212 (c) 1996 ADK +neodrift // 0213 (c) 1996 Visco +kof96 // 0214 (c) 1996 SNK +kof96h // 0214 (c) 1996 SNK +ssideki4 // 0215 (c) 1996 SNK +kizuna // 0216 (c) 1996 SNK +kizuna4p // 0216 (c) 1996 SNK - same cartridge as kizuna, needs extension board and a compatible MVS to enable 4p mode +ninjamas // 0217 (c) 1996 ADK / SNK +ragnagrd // 0218 (c) 1996 Saurus +pgoal // 0219 (c) 1996 Saurus +ironclad // 0220 (c) 1996 Saurus - Choutetsu Brikin'ger - Iron clad (protoype) +ironclado // 0220 (c) 1996 Saurus - Choutetsu Brikin'ger - Iron clad (protoype, older) +magdrop2 // 0221 (c) 1996 Data East Corporation +samsho4 // 0222 (c) 1996 SNK +samsho4k // Censored Korean release of samsho4 +rbffspec // 0223 (c) 1996 SNK +rbffspeck // 0124 (c) 1996 SNK +twinspri // 0224 (c) 1996 ADK +wakuwak7 // 0225 (c) 1996 Sunsoft + // 0226 Pair Pair Wars (prototype) 1996 Sunsoft? +stakwin2 // 0227 (c) 1996 Saurus +ghostlop // 0228 GhostLop (prototype) 1996? Data East + // 0229 King of Fighters '96 CD Collection (CD only) +breakers // 0230 (c) 1996 Visco +miexchng // 0231 (c) 1997 Face +kof97 // 0232 (c) 1997 SNK +kof97h // 0232 (c) 1997 SNK +kof97k // 0232 (c) 1997 SNK +kof97pls // bootleg of kof97 +kof97oro // bootleg of kof97 +kog // bootleg of kof97 +magdrop3 // 0233 (c) 1997 Data East Corporation +lastblad // 0234 (c) 1997 SNK +lastbladh // 0234 (c) 1997 SNK +lastsold // 0196 Censored Korean release of lastblad +puzzldpr // 0235 (c) 1997 Taito (Visco license) +irrmaze // 0236 (c) 1997 SNK / Saurus +popbounc // 0237 (c) 1997 Video System Co. +shocktro // 0238 (c) 1997 Saurus +shocktroa // 0238 (c) 1997 Saurus +blazstar // 0239 (c) 1998 Yumekobo +rbff2 // 0240 (c) 1998 SNK +rbff2h // 0240 (c) 1998 SNK +rbff2k // 0140 Censored Korean release of rbff2 +mslug2 // 0241 (c) 1998 SNK +kof98 // 0242 (c) 1998 SNK +kof98a // 0242 (c) 1998 SNK, alternate board +kof98k // 0242 (c) 1998 SNK +kof98ka // 0242 (c) 1998 SNK +kof98h // 0242 (c) 1998 SNK +lastbld2 // 0243 (c) 1998 SNK +neocup98 // 0244 (c) 1998 SNK +breakrev // 0245 (c) 1998 Visco +shocktr2 // 0246 (c) 1998 Saurus +lans2004 // bootleg of shocktr2 +flipshot // 0247 (c) 1998 Visco +pbobbl2n // 0248 (c) 1999 Taito (SNK license) +ctomaday // 0249 (c) 1999 Visco +mslugx // 0250 (c) 1999 SNK +kof99 // 0251 (c) 1999 SNK +kof99h // 0251 (c) 1999 SNK +kof99e // 0251 (c) 1999 SNK +kof99k // 0152 (c) 1999 SNK +kof99p // 0251 (c) 1999 SNK +ganryu // 0252 (c) 1999 Visco +garou // 0253 (c) 1999 SNK +garouh // 0253 (c) 1999 SNK +garoup // 0253 (c) 1999 SNK +garoubl // bootleg +s1945p // 0254 (c) 1999 Psikyo +preisle2 // 0255 (c) 1999 Yumekobo +mslug3 // 0256 (c) 2000 SNK +mslug3h // 0256 (c) 2000 SNK +mslug3b6 // bootleg +kof2000 // 0257 (c) 2000 SNK +kof2000n // 0257 (c) 2000 SNK + // 0258 SNK vs. Capcom? +bangbead // 0259 (c) 2000 Visco +b2b // 0071 (c) 2000 Visco (released by NCI in 2010) +nitd // 0260 (c) 2000 Eleven / Gavaking +nitdbl // bootleg +sengoku3 // 0261 (c) 2001 Noise Factory / SNK +kof2001 // 0262 (c) 2001 Eolith / SNK +kof2001h // 0262 (c) 2001 Eolith / SNK +cthd2003 // bootleg of kof2001 +ct2k3sp // bootleg of kof2001 +ct2k3sa // bootleg of kof2001 +mslug4 // 0263 (c) 2002 Mega Enterprise +mslug4h // 0263 (c) 2002 Mega Enterprise +ms4plus // bootleg +rotd // 0264 (c) 2002 Evoga +kof2002 // 0265 (c) 2002 Eolith / Playmore +kof2002b // bootleg +kf2k2pls // bootleg +kf2k2pla // bootleg +kf2k2mp // bootleg +kf2k2mp2 // bootleg +kof10th // bootleg of kof2002 +kf2k5uni // bootleg of kof2002 +kf10thep // bootleg of kof2002 +kof2k4se // bootleg of kof2002 +matrim // 0266 (c) 2002 Atlus +matrimbl // bootleg +pnyaa // 0267 (c) 2003 Aiky / Taito +ms5pcb // 0268 (c) 2003 Playmore +mslug5 // 0268 (c) 2003 Playmore +mslug5h // 0268 (c) 2003 Playmore +ms5plus // bootleg +svcpcb // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB +svcpcba // 0269 (c) 2003 Playmore / Capcom - JAMMA PCB +svc // 0269 (c) 2003 Playmore / Capcom +svcboot // bootleg +svcplus // bootleg +svcplusa // bootleg +svcsplus // bootleg +samsho5 // 0270 (c) 2003 Playmore +samsho5h // 0270 (c) 2003 Playmore +samsho5b // bootleg +kf2k3pcb // 0271 (c) 2003 Playmore - JAMMA PCB +kof2003 // 0271 (c) 2003 Playmore +kof2003h // 0271 (c) 2003 Playmore +kf2k3bl // bootleg +kf2k3bla // bootleg +kf2k3pl // bootleg +kf2k3upl // bootleg +samsh5sp // 0272 (c) 2004 Playmore +samsh5sph // 0272 (c) 2004 Playmore +samsh5spho // 0272 (c) 2004 Playmore + +// Psikyo games +// 68020 board +samuraia // (c) 1993 (World) +sngkace // (c) 1993 (Japan) +gunbird // (c) 1994 +gunbirdk // (c) 1994 +gunbirdj // (c) 1994 +btlkroad // (c) 1994 +btlkroadk // (c) 1994 +s1945 // (c) 1995 +s1945a // (c) 1995 +s1945j // (c) 1995 +s1945jn // (c) 1995 +s1945bl // (c) 1995 (Hong Kong bootleg) +s1945k // (c) 1995 +tengai // (c) 1996 +tengaij // (c) 1996 + +// SH2 board +s1945ii // (c) 1997 +soldivid // (c) 1997 +sbomber // (c) 1998 +sbombera // (c) 1998 +daraku // (c) 1998 +gunbird2 // (c) 1998 +s1945iii // (c) 1999 +dragnblz // (c) 2000 +tgm2 // (c) 2000 +tgm2p // (c) 2000 +gnbarich // (c) 2001 +mjgtaste // (c) 2002 +hotgmck // (c) 1997 +hgkairak // (c) 1998 +hotgmck3 // (c) 1999 +hotgm4ev // (c) 2000 +hotgmcki // (c) 2001 +loderndf // (c) 2000 +loderndfa // (c) 2000 +hotdebut // (c) 2000
\ No newline at end of file diff --git a/src/mame/drivers/avigo.cpp b/src/mame/drivers/avigo.cpp index f8d23276a8b..e7b301eea5c 100644 --- a/src/mame/drivers/avigo.cpp +++ b/src/mame/drivers/avigo.cpp @@ -77,43 +77,6 @@ #define LOG(x) do { if (AVIGO_LOG) logerror x; } while (0) -/* memory 0x0000-0x03fff */ -READ8_MEMBER(avigo_state::flash_0x0000_read_handler) -{ - return m_flashes[0]->read(offset); -} - -/* memory 0x0000-0x03fff */ -WRITE8_MEMBER(avigo_state::flash_0x0000_write_handler) -{ - m_flashes[0]->write(offset, data); -} - -/* memory 0x04000-0x07fff */ -READ8_MEMBER(avigo_state::flash_0x4000_read_handler) -{ - return m_flashes[m_flash_at_0x4000]->read((m_bank1_l<<14) | offset); -} - -/* memory 0x04000-0x07fff */ -WRITE8_MEMBER(avigo_state::flash_0x4000_write_handler) -{ - m_flashes[m_flash_at_0x4000]->write((m_bank1_l<<14) | offset, data); -} - -/* memory 0x08000-0x0bfff */ -READ8_MEMBER(avigo_state::flash_0x8000_read_handler) -{ - return m_flashes[m_flash_at_0x8000]->read((m_bank2_l<<14) | offset); -} - -/* memory 0x08000-0x0bfff */ -WRITE8_MEMBER(avigo_state::flash_0x8000_write_handler) -{ - m_flashes[m_flash_at_0x8000]->write((m_bank2_l<<14) | offset, data); -} - - /* IRQ bits (port 3) ordered by priority: @@ -150,58 +113,6 @@ WRITE_LINE_MEMBER( avigo_state::tc8521_alarm_int ) //#endif } -void avigo_state::refresh_memory(UINT8 bank, UINT8 chip_select) -{ - address_space& space = m_maincpu->space(AS_PROGRAM); - int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); - char bank_tag[6]; - - LOG(("Chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff)); - - switch (chip_select) - { - case 0x06: // videoram - space.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, read8_delegate(FUNC(avigo_state::vid_memory_r), this), write8_delegate(FUNC(avigo_state::vid_memory_w), this)); - active_flash = -1; - break; - - case 0x01: // banked RAM - sprintf(bank_tag,"bank%d", bank); - membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1_l : m_bank2_l) & 0x07)<<14)); - space.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); - active_flash = -1; - break; - - case 0x00: // flash 0 - case 0x03: // flash 1 - case 0x05: // flash 2 - case 0x07: // flash 0 - if (active_flash < 0) // to avoid useless calls to install_readwrite_handler that cause slowdowns - { - if (bank == 1) - space.install_readwrite_handler(0x4000, 0x7fff, read8_delegate(FUNC(avigo_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x4000_write_handler), this)); - else - space.install_readwrite_handler(0x8000, 0xbfff, read8_delegate(FUNC(avigo_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(avigo_state::flash_0x8000_write_handler), this)); - } - - switch (chip_select) - { - case 0x00: - case 0x07: active_flash = 0; break; - case 0x03: active_flash = 1; break; - case 0x05: active_flash = 2; break; - } - break; - - default: - logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); - space.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); - active_flash = -1; - break; - } -} - - WRITE_LINE_MEMBER( avigo_state::com_interrupt ) { LOG(("com int\r\n")); @@ -218,38 +129,21 @@ WRITE_LINE_MEMBER( avigo_state::com_interrupt ) void avigo_state::machine_reset() { - /* if is a cold start initialize flash contents */ - if (!m_warm_start) - { - memcpy(m_flashes[0]->space().get_read_ptr(0), memregion("bios")->base() + 0x000000, 0x100000); - memcpy(m_flashes[1]->space().get_read_ptr(0), memregion("bios")->base() + 0x100000, 0x100000); - } - m_irq = 0; m_bank1_l = 0; m_bank1_h = 0; m_bank2_l = 0; m_bank2_h = 0; - m_flash_at_0x4000 = -1; - m_flash_at_0x8000 = -1; - refresh_memory(1, m_bank1_h & 0x07); - refresh_memory(2, m_bank2_h & 0x07); + m_bankdev1->set_bank(0); + m_bankdev2->set_bank(0); } void avigo_state::machine_start() { - m_ram_base = (UINT8*)m_ram->pointer(); - // bank3 always first ram bank - membank("bank3")->set_base(m_ram_base); - - /* keep machine pointers to flash devices */ - m_flashes[0] = machine().device<intelfsh8_device>("flash0"); - m_flashes[1] = machine().device<intelfsh8_device>("flash1"); - m_flashes[2] = machine().device<intelfsh8_device>("flash2"); + membank("bank2")->set_base(m_nvram); - machine().device<nvram_device>("nvram")->set_base(m_ram_base, m_ram->size()); m_warm_start = 1; // register for state saving @@ -261,33 +155,27 @@ void avigo_state::machine_start() save_item(NAME(m_bank1_l)); save_item(NAME(m_bank1_h)); save_item(NAME(m_ad_control_status)); - save_item(NAME(m_flash_at_0x4000)); - save_item(NAME(m_flash_at_0x8000)); save_item(NAME(m_ad_value)); save_item(NAME(m_screen_column)); save_item(NAME(m_warm_start)); +} - // save all flash contents - save_pointer(NAME((UINT8*)m_flashes[0]->space().get_read_ptr(0)), 0x100000); - save_pointer(NAME((UINT8*)m_flashes[1]->space().get_read_ptr(0)), 0x100000); - save_pointer(NAME((UINT8*)m_flashes[2]->space().get_read_ptr(0)), 0x100000); +static ADDRESS_MAP_START(avigo_banked_map, AS_PROGRAM, 8, avigo_state) + AM_RANGE(0x0000000, 0x00fffff) AM_MIRROR(0x0300000) AM_DEVREADWRITE("flash0", intelfsh8_device, read, write) + AM_RANGE(0x0400000, 0x041ffff) AM_MIRROR(0x03e0000) AM_RAM AM_SHARE("nvram") - // register postload callback - machine().save().register_postload(save_prepost_delegate(FUNC(avigo_state::postload), this)); -} + AM_RANGE(0x0c00000, 0x0cfffff) AM_MIRROR(0x0300000) AM_DEVREADWRITE("flash1", intelfsh8_device, read, write) + AM_RANGE(0x1400000, 0x14fffff) AM_MIRROR(0x0300000) AM_DEVREADWRITE("flash2", intelfsh8_device, read, write) + AM_RANGE(0x1c00000, 0x1cfffff) AM_MIRROR(0x0300000) AM_DEVREADWRITE("flash0", intelfsh8_device, read, write) -void avigo_state::postload() -{ - // refresh the bankswitch - refresh_memory(1, m_bank1_h & 0x07); - refresh_memory(2, m_bank2_h & 0x07); -} + AM_RANGE(0x1800000, 0x1803fff) AM_MIRROR(0x03fc000) AM_READWRITE(vid_memory_r, vid_memory_w) +ADDRESS_MAP_END static ADDRESS_MAP_START( avigo_mem , AS_PROGRAM, 8, avigo_state) - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("bank3") + AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("flash0", intelfsh8_device, read, write) + AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank0", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("bank2") ADDRESS_MAP_END @@ -378,7 +266,7 @@ WRITE8_MEMBER(avigo_state::bank1_w) m_bank1_l = data & 0x3f; } - refresh_memory(1, m_bank1_h & 0x07); + m_bankdev1->set_bank(((m_bank1_h & 0x07) << 8) | m_bank1_l); } WRITE8_MEMBER(avigo_state::bank2_w) @@ -394,7 +282,7 @@ WRITE8_MEMBER(avigo_state::bank2_w) m_bank2_l = data & 0x3f; } - refresh_memory(2, m_bank2_h & 0x07); + m_bankdev2->set_bank(((m_bank2_h & 0x07) << 8) | m_bank2_l); } READ8_MEMBER(avigo_state::ad_control_status_r) @@ -775,12 +663,12 @@ static const gfx_layout avigo_6_by_8 = }; static GFXDECODE_START( avigo ) - GFXDECODE_ENTRY( "bios", 0x08992, avigo_charlayout, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x0c020, avigo_8_by_14, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x0c020, avigo_16_by_15, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x14020, avigo_15_by_16, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x1c020, avigo_8_by_8, 0, 1 ) - GFXDECODE_ENTRY( "bios", 0x1e020, avigo_6_by_8, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x08992, avigo_charlayout, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x0c020, avigo_8_by_14, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x0c020, avigo_16_by_15, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x14020, avigo_15_by_16, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x1c020, avigo_8_by_8, 0, 1 ) + GFXDECODE_ENTRY( "flash0", 0x1e020, avigo_6_by_8, 0, 1 ) GFXDECODE_END @@ -800,7 +688,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(avigo_state::avigo_1hz_timer) QUICKLOAD_LOAD_MEMBER( avigo_state,avigo) { - address_space& flash1 = m_flashes[1]->space(0); + address_space& flash1 = m_flash1->space(0); const char *systemname = machine().system().name; UINT32 first_app_page = (0x50000>>14); int app_page; @@ -833,7 +721,7 @@ QUICKLOAD_LOAD_MEMBER( avigo_state,avigo) logerror("Application loaded at 0x%05x-0x%05x\n", app_page<<14, (app_page<<14) + (UINT32)image.length()); // copy app file into flash memory - image.fread((UINT8*)m_flashes[1]->space().get_read_ptr(app_page<<14), image.length()); + image.fread((UINT8*)flash1.get_read_ptr(app_page<<14), image.length()); // update the application ID flash1.write_byte((app_page<<14) + 0x1a5, 0x80 + (app_page - (first_app_page>>14))); @@ -907,6 +795,18 @@ static MACHINE_CONFIG_START( avigo, avigo_state ) MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_DEVICE_ADD("bank0", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(avigo_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(avigo_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + MCFG_NVRAM_ADD_CUSTOM_DRIVER("nvram", avigo_state, nvram_init) // IRQ 1 is used for scan the pen and for cursor blinking @@ -926,87 +826,78 @@ MACHINE_CONFIG_END ***************************************************************************/ ROM_START(avigo) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - + ROM_REGION(0x100000, "flash0", ROMREGION_ERASEFF) ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("english_1004.rom", 0x100000, 0x050000, CRC(c9c3a225) SHA1(7939993a5615ca59ff2047e69b6d85122d437dca), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("english_1002.rom", 0x100000, 0x050000, CRC(31cab0ac) SHA1(87d337830506a12514a4beb9a8502a0de94816f2), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("english_100.rom", 0x100000, 0x050000, CRC(e2824b44) SHA1(3252454b05c3d3a4d7df1cb48dc3441ae82f2b1c), ROM_BIOS(3)) + ROM_REGION(0x100000, "flash1", ROMREGION_ERASEFF) + ROMX_LOAD("english_1004.rom", 0x000000, 0x050000, CRC(c9c3a225) SHA1(7939993a5615ca59ff2047e69b6d85122d437dca), ROM_BIOS(1)) + ROMX_LOAD("english_1002.rom", 0x000000, 0x050000, CRC(31cab0ac) SHA1(87d337830506a12514a4beb9a8502a0de94816f2), ROM_BIOS(2)) + ROMX_LOAD("english_100.rom", 0x000000, 0x050000, CRC(e2824b44) SHA1(3252454b05c3d3a4d7df1cb48dc3441ae82f2b1c), ROM_BIOS(3)) ROM_END ROM_START(avigo_de) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - + ROM_REGION(0x100000, "flash0", ROMREGION_ERASEFF) ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("german_1004.rom", 0x100000, 0x060000, CRC(0fa437b3) SHA1(e9352aa8fee6d93b898412bd129452b82baa9a21), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("german_1002.rom", 0x100000, 0x060000, CRC(c6bf07ba) SHA1(d3185687aa510f6c3b3ab3baaabe7e8ce1a79e3b), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("german_100.rom", 0x100000, 0x060000, CRC(117d9189) SHA1(7e959ab1381ba831821fcf87973b25d87f12d34e), ROM_BIOS(3)) + ROM_REGION(0x100000, "flash1", ROMREGION_ERASEFF) + ROMX_LOAD("german_1004.rom", 0x000000, 0x060000, CRC(0fa437b3) SHA1(e9352aa8fee6d93b898412bd129452b82baa9a21), ROM_BIOS(1)) + ROMX_LOAD("german_1002.rom", 0x000000, 0x060000, CRC(c6bf07ba) SHA1(d3185687aa510f6c3b3ab3baaabe7e8ce1a79e3b), ROM_BIOS(2)) + ROMX_LOAD("german_100.rom", 0x000000, 0x060000, CRC(117d9189) SHA1(7e959ab1381ba831821fcf87973b25d87f12d34e), ROM_BIOS(3)) ROM_END ROM_START(avigo_fr) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - + ROM_REGION(0x100000, "flash0", ROMREGION_ERASEFF) ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("french_1004.rom", 0x100000, 0x050000, CRC(5e4d90f7) SHA1(07df3af8a431ba65e079d6c987fb5d544f6541d8), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("french_1002.rom", 0x100000, 0x050000,CRC(caa3eb91) SHA1(ab199986de301d933f069a5e1f5150967e1d7f59), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("french_100.rom", 0x100000, 0x050000, CRC(fffa2345) SHA1(399447cede3cdd0be768952cb24f7e4431147e3d), ROM_BIOS(3)) + ROM_REGION(0x100000, "flash1", ROMREGION_ERASEFF) + ROMX_LOAD("french_1004.rom", 0x000000, 0x050000, CRC(5e4d90f7) SHA1(07df3af8a431ba65e079d6c987fb5d544f6541d8), ROM_BIOS(1)) + ROMX_LOAD("french_1002.rom", 0x000000, 0x050000,CRC(caa3eb91) SHA1(ab199986de301d933f069a5e1f5150967e1d7f59), ROM_BIOS(2)) + ROMX_LOAD("french_100.rom", 0x000000, 0x050000, CRC(fffa2345) SHA1(399447cede3cdd0be768952cb24f7e4431147e3d), ROM_BIOS(3)) ROM_END ROM_START(avigo_es) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - + ROM_REGION(0x100000, "flash0", ROMREGION_ERASEFF) ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("spanish_1004.rom", 0x100000, 0x060000, CRC(235a7f8d) SHA1(94da4ecafb54dcd5d80bc5063cb4024e66e6a21f), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("spanish_1002.rom", 0x100000, 0x060000, CRC(a6e80cc4) SHA1(e741657558c11f7bce646ba3d7b5f845bfa275b7), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("spanish_100.rom", 0x100000, 0x060000, CRC(953a5276) SHA1(b9ba1dbdc2127b1ef419c911ef66313024a7351a), ROM_BIOS(3)) + ROM_REGION(0x100000, "flash1", ROMREGION_ERASEFF) + ROMX_LOAD("spanish_1004.rom", 0x000000, 0x060000, CRC(235a7f8d) SHA1(94da4ecafb54dcd5d80bc5063cb4024e66e6a21f), ROM_BIOS(1)) + ROMX_LOAD("spanish_1002.rom", 0x000000, 0x060000, CRC(a6e80cc4) SHA1(e741657558c11f7bce646ba3d7b5f845bfa275b7), ROM_BIOS(2)) + ROMX_LOAD("spanish_100.rom", 0x000000, 0x060000, CRC(953a5276) SHA1(b9ba1dbdc2127b1ef419c911ef66313024a7351a), ROM_BIOS(3)) ROM_END ROM_START(avigo_it) - ROM_REGION(0x200000, "bios", ROMREGION_ERASEFF) - + ROM_REGION(0x100000, "flash0", ROMREGION_ERASEFF) ROM_SYSTEM_BIOS( 0, "v1004", "v1.004" ) ROMX_LOAD("os_1004.rom", 0x000000, 0x0100000, CRC(62acd55c) SHA1(b2be12f5cc1053b6026bff2a265146ba831a7ffa), ROM_BIOS(1)) - ROMX_LOAD("italian_1004.rom", 0x100000, 0x050000, CRC(fb7941ec) SHA1(230e8346a3b0da1ee24568ec090ce6860ebfe995), ROM_BIOS(1)) - ROM_SYSTEM_BIOS( 1, "v1002", "v1.002" ) ROMX_LOAD("os_1002.rom", 0x000000, 0x0100000, CRC(484bb95c) SHA1(ddc28f22f8cbc99f60f91c58ee0e2d15170024fb), ROM_BIOS(2)) - ROMX_LOAD("italian_1002.rom", 0x100000, 0x050000, CRC(093bc032) SHA1(2c75d950d356a7fd1d058808e5f0be8e15b8ea2a), ROM_BIOS(2)) - ROM_SYSTEM_BIOS( 2, "v100", "v1.00" ) ROMX_LOAD("os_100.rom", 0x000000, 0x0100000, CRC(13ea7b38) SHA1(85566ff142d86d504ac72613f169d8758e2daa09), ROM_BIOS(3)) - ROMX_LOAD("italian_100.rom", 0x100000, 0x050000, CRC(de359218) SHA1(6185727aba8ffc98723f2df74dda388fd0d70cc9), ROM_BIOS(3)) + + ROM_REGION(0x100000, "flash1", ROMREGION_ERASEFF) + ROMX_LOAD("italian_1004.rom", 0x000000, 0x050000, CRC(fb7941ec) SHA1(230e8346a3b0da1ee24568ec090ce6860ebfe995), ROM_BIOS(1)) + ROMX_LOAD("italian_1002.rom", 0x000000, 0x050000, CRC(093bc032) SHA1(2c75d950d356a7fd1d058808e5f0be8e15b8ea2a), ROM_BIOS(2)) + ROMX_LOAD("italian_100.rom", 0x000000, 0x050000, CRC(de359218) SHA1(6185727aba8ffc98723f2df74dda388fd0d70cc9), ROM_BIOS(3)) ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ diff --git a/src/mame/drivers/esq5505.cpp b/src/mame/drivers/esq5505.cpp index 9b3e2493894..928ccee913c 100644 --- a/src/mame/drivers/esq5505.cpp +++ b/src/mame/drivers/esq5505.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:R. Belmont +// copyright-holders:R. Belmont, Parduz /*************************************************************************** esq5505.c - Ensoniq ES5505 + ES5510 based synthesizers and samplers @@ -10,7 +10,7 @@ The Taito sound system in taito_en.c is directly derived from the 32-voice version of the SD-1. - Driver by R. Belmont with thanks to Parduz, Christian Brunschen, and Phil Bennett + Driver by R. Belmont and Parduz with thanks to Christian Brunschen, and Phil Bennett Memory map: @@ -138,6 +138,7 @@ #include "machine/hd63450.h" // compatible with MC68450, which is what these really have #include "formats/esq16_dsk.h" #include "machine/esqvfd.h" +#include "machine/esqlcd.h" #include "machine/esqpanel.h" #define GENERIC (0) @@ -259,7 +260,7 @@ IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback) vector = duart_irq_vector; break; default: - printf("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline); + logerror("\nUnexpected IRQ ACK Callback: IRQ %d\n", irqline); return 0; } update_irq_to_maincpu(); @@ -516,7 +517,7 @@ WRITE8_MEMBER(esq5505_state::dma_end) { if (data != 0) { - printf("DMAC IRQ, vector = %x\n", m_dmac->get_vector(offset)); + //printf("DMAC IRQ, vector = %x\n", m_dmac->get_vector(offset)); dmac_irq_state = 1; dmac_irq_vector = m_dmac->get_vector(offset); } @@ -532,7 +533,7 @@ WRITE8_MEMBER(esq5505_state::dma_error) { if(data != 0) { - printf("DMAC error, vector = %x\n", m_dmac->get_error_vector(offset)); + logerror("DMAC error, vector = %x\n", m_dmac->get_error_vector(offset)); dmac_irq_state = 1; dmac_irq_vector = m_dmac->get_vector(offset); } @@ -558,8 +559,14 @@ WRITE8_MEMBER(esq5505_state::fdc_write_byte) INPUT_CHANGED_MEMBER(esq5505_state::key_stroke) { int val = (UINT8)(FPTR)param; + int cmp = 0x60; - if (val < 0x60) + if (m_system_type == SQ1) + { + cmp = 10; + } + + if (val < cmp) { if (oldval == 0 && newval == 1) { @@ -575,7 +582,7 @@ INPUT_CHANGED_MEMBER(esq5505_state::key_stroke) } else if (val == 0x02) { - printf("Analog tests!\n"); +// printf("Analog tests!\n"); m_panel->xmit_char(54 | 0x80); m_panel->xmit_char(0); // Preset down m_panel->xmit_char(8 | 0x80); m_panel->xmit_char(0); // Compare down m_panel->xmit_char(8); m_panel->xmit_char(0); // Compare up @@ -585,10 +592,10 @@ INPUT_CHANGED_MEMBER(esq5505_state::key_stroke) } else { - val += shift; + if (val < 20) val += shift; if (oldval == 0 && newval == 1) { - printf("key pressed %d\n", val&0x7f); + // printf("key pressed %d\n", val); m_panel->xmit_char(val); m_panel->xmit_char(0x00); } @@ -733,7 +740,7 @@ static MACHINE_CONFIG_DERIVED(sq1, vfx) MCFG_CPU_PROGRAM_MAP(sq1_map) MCFG_ESQPANEL_2x40_REMOVE("panel") - MCFG_ESQPANEL2x40_SQ1_ADD("panel") + MCFG_ESQPANEL2x16_SQ1_ADD("panel") MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) MCFG_ESQPANEL_ANALOG_CALLBACK(WRITE16(esq5505_state, analog_w)) MACHINE_CONFIG_END @@ -784,6 +791,53 @@ static INPUT_PORTS_START( vfx ) #endif INPUT_PORTS_END +static INPUT_PORTS_START( sq1 ) +#if KEYBOARD_HACK + PORT_START("KEY0") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 148) PORT_NAME("PITCH") // 148=PITCH (lo 1) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 149) PORT_NAME("CONTROL") // 149=CONTROL (hi 1) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) PORT_CHAR('w') PORT_CHAR('W') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 132) PORT_NAME("ENV1") // 132=ENV1 (lo 2) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 133) PORT_NAME("CLICK") // 133=CLICK (hi 2) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) PORT_CHAR('e') PORT_CHAR('E') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 182) PORT_NAME("LFO") // 182=LFO (lo 3) + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) PORT_CHAR('3') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 183) PORT_NAME("SONG") // 183=SONG (hi 3) + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) PORT_CHAR('r') PORT_CHAR('R') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 134) PORT_NAME("FILTER") // 134=FILTER (lo 4) + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 135) PORT_NAME("SEQ") // 135=SEQ (hi 4) + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) PORT_CHAR('t') PORT_CHAR('T') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 142) PORT_NAME("ENV2") // 142=ENV2 (lo 5) + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 143) PORT_NAME("EVENT") // 143=EVENT (hi 5) + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 150) PORT_NAME("AMP") // 150=AMP (lo 6) + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 151) PORT_NAME("PARAM") // 151=PARAM (hi 6) + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) PORT_CHAR('u') PORT_CHAR('U') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 166) PORT_NAME("OUTPUT") // 166=OUTPUT (lo 7) + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 167) PORT_NAME("MIX") // 167=MIX (hi 7) + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) PORT_CHAR('i') PORT_CHAR('I') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 158) PORT_NAME("P. EFFECT") // 158=P.EFFECT (lo 8) + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 159) PORT_NAME("S. EFFECT") // 159=S.EFFECT (hi 8) + PORT_START("KEY1") + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) PORT_CHAR('o') PORT_CHAR('O') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 174) PORT_NAME("MIDI") // 174=MIDI (lo 9) + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 175) PORT_NAME("SYSTEM") // 175=SYSTEM (hi 9) + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) PORT_CHAR('p') PORT_CHAR('P') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 164) PORT_NAME("WAVE") // 164=WAVE (lo 0) + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) PORT_CHAR('0') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 165) PORT_NAME("LOCATE") // 165=LOCATE (hi 0) + PORT_BIT(0x0010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) PORT_CHAR('g') PORT_CHAR('G') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 144) PORT_NAME("TRACK 1") // 144=Track 1 + PORT_BIT(0x0020, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) PORT_CHAR('h') PORT_CHAR('H') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 160) PORT_NAME("TRACK 2") // 160=Track 2 + PORT_BIT(0x0040, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) PORT_CHAR('j') PORT_CHAR('J') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 152) PORT_NAME("TRACK 3") // 152=Track 3 + PORT_BIT(0x0080, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) PORT_CHAR('k') PORT_CHAR('K') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 168) PORT_NAME("TRACK 4") // 168=Track 4 + PORT_BIT(0x0100, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) PORT_CHAR('v') PORT_CHAR('V') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 145) PORT_NAME("TRACK 5") // 145=Track 5 + PORT_BIT(0x0200, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('b') PORT_CHAR('B') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 161) PORT_NAME("TRACK 6") // 161=Track 6 + PORT_BIT(0x0400, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) PORT_CHAR('n') PORT_CHAR('N') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 136) PORT_NAME("TRACK 7") // 136=Track 7 + PORT_BIT(0x0800, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_CHAR('m') PORT_CHAR('M') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 176) PORT_NAME("TRACK 8") // 176=Track 8 + PORT_BIT(0x1000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 172) PORT_NAME("ENTER") // 172=ENTER + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 173) PORT_NAME("COMPARE") // 173=COMPARE + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 140) PORT_NAME("PROG DN") // 140=ProgDn + PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 141) PORT_NAME("PROG UP") // 141=ProgUp + PORT_START("KEY2") + PORT_BIT(0x2000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 156) PORT_NAME("ROM/INT SELECT +") // 156=ROM/INT Select 189=track + + PORT_BIT(0x4000, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 157) PORT_NAME("ROM/INT SELECT -") // 157=ROM/INT Select 190=track - + PORT_BIT(0x0001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 180) PORT_NAME("SOUND SELECT") // 180=SOUND Select + PORT_BIT(0x0002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) PORT_CHAR('a') PORT_CHAR('A') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 181) PORT_NAME("SOUND EDIT") // 181=SOUND Edit + PORT_BIT(0x0004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) PORT_CHAR('s') PORT_CHAR('S') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 184) PORT_NAME("SEQ EDIT") // 184=SEQ Edit + PORT_BIT(0x0008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) PORT_CHAR('x') PORT_CHAR('X') PORT_CHANGED_MEMBER(DEVICE_SELF, esq5505_state, key_stroke, 153) PORT_NAME("SEQ SELECT") // 153=SEQ Select + PORT_START("KEY3") +#endif +INPUT_PORTS_END + #define ROM_LOAD16_BYTE_BIOS(bios,name,offset,length,hash) \ ROMX_LOAD(name, offset, length, hash, ROM_SKIP(1) | ROM_BIOS(bios+1)) /* Note '+1' */ @@ -923,6 +977,7 @@ DRIVER_INIT_MEMBER(esq5505_state,sq1) { DRIVER_INIT_CALL(common); m_system_type = SQ1; + shift = 60; } DRIVER_INIT_MEMBER(esq5505_state,denib) @@ -950,6 +1005,6 @@ CONS( 1989, vfx, 0, 0, vfx, vfx, esq5505_state, denib, "Ensoniq", "VFX", CONS( 1989, vfxsd, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "VFX-SD", MACHINE_NOT_WORKING ) // 2x40 VFD CONS( 1990, eps16p,eps, 0, eps, vfx, esq5505_state, eps, "Ensoniq", "EPS-16 Plus", MACHINE_NOT_WORKING ) // custom VFD: one alphanumeric 22-char row, one graphics-capable row (alpha row can also do bar graphs) CONS( 1990, sd1, 0, 0, vfxsd, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (21 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD -CONS( 1990, sq1, 0, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD -CONS( 1990, sqrack,sq1, 0, sq1, vfx, esq5505_state, sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD +CONS( 1990, sq1, 0, 0, sq1, sq1, esq5505_state, sq1, "Ensoniq", "SQ-1", MACHINE_NOT_WORKING ) // 2x16 LCD +CONS( 1990, sqrack,sq1, 0, sq1, sq1, esq5505_state, sq1, "Ensoniq", "SQ-Rack", MACHINE_NOT_WORKING ) // 2x16 LCD CONS( 1991, sd132, sd1,0, vfx32, vfx, esq5505_state, denib, "Ensoniq", "SD-1 (32 voice)", MACHINE_NOT_WORKING ) // 2x40 VFD diff --git a/src/mame/drivers/esqkt.cpp b/src/mame/drivers/esqkt.cpp index b1a40fbb732..a541f74ad67 100644 --- a/src/mame/drivers/esqkt.cpp +++ b/src/mame/drivers/esqkt.cpp @@ -110,7 +110,7 @@ public: required_device<m68ec020_device> m_maincpu; required_device<es5510_device> m_esp; required_device<mc68681_device> m_duart; - required_device<esqpanel2x40_sq1_device> m_sq1panel; + required_device<esqpanel2x16_sq1_device> m_sq1panel; required_device<midi_port_device> m_mdout; virtual void machine_reset() override; @@ -203,7 +203,7 @@ static MACHINE_CONFIG_START( kt, esqkt_state ) MCFG_CPU_ADD("esp", ES5510, XTAL_10MHz) MCFG_DEVICE_DISABLE() - MCFG_ESQPANEL2x40_SQ1_ADD("sq1panel") + MCFG_ESQPANEL2x16_SQ1_ADD("sq1panel") MCFG_ESQPANEL_TX_CALLBACK(DEVWRITELINE("duart", mc68681_device, rx_b_w)) MCFG_MC68681_ADD("duart", 4000000) diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 8a4c83f039a..570b990c5fd 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -13487,6 +13487,28 @@ DRIVER_INIT_MEMBER(cmaster_state, rp36c3) m_maincpu->space(AS_IO).install_read_handler(0x17, 0x17, read8_delegate(FUNC(cmaster_state::fixedval48_r),this)); } +DRIVER_INIT_MEMBER(cmaster_state, rp96sub) // 95 33 95 33 70 6C 70 6C... XORs seem ok. need bitswap and handler. +{ + int i; + UINT8 *ROM = memregion("maincpu")->base(); + for (i = 0;i < 0x10000;i++) + { + UINT8 x = ROM[i]; + + switch(i & 5) + { + case 0: x = BITSWAP8(x^0x6a, 7,6,5,4,3,2,1,0); break; + case 1: x = BITSWAP8(x^0xcc, 7,6,5,4,3,2,1,0); break; + case 4: x = BITSWAP8(x^0x8f, 7,6,5,4,3,2,1,0); break; + case 5: x = BITSWAP8(x^0x93, 7,6,5,4,3,2,1,0); break; + } + + ROM[i] = x; + } + +// m_maincpu->space(AS_IO).install_read_handler(0x34, 0x34, read8_delegate(FUNC(cmaster_state::fixedvalb2_r),this)); +} + DRIVER_INIT_MEMBER(cmaster_state, po33) { @@ -13813,7 +13835,7 @@ GAME( 2009, fb2010, 0, amcoe2, nfb96tx, cmaster_state, fb2010, GAMEL( 1996, roypok96, 0, amcoe2, roypok96, cmaster_state, rp35, ROT0, "Amcoe", "Royal Poker '96 (set 1, v97-3.5)", 0, layout_roypok96 ) GAMEL( 1996, roypok96a, roypok96, amcoe2, roypok96a, cmaster_state, rp36, ROT0, "Amcoe", "Royal Poker '96 (set 2, v98-3.6)", 0, layout_roypok96 ) GAMEL( 1996, roypok96b, roypok96, amcoe2, roypok96a, cmaster_state, rp36c3, ROT0, "Amcoe", "Royal Poker '96 (set 3, v98-3.6?)", 0, layout_roypok96 ) -GAME( 1996, roypok96c, roypok96, amcoe2, roypok96a, driver_device, 0, ROT0, "Amcoe", "Royal Poker '96 (set 4, C3 board)", MACHINE_NOT_WORKING ) +GAME( 1996, roypok96c, roypok96, amcoe2, roypok96a, cmaster_state, rp96sub, ROT0, "Amcoe", "Royal Poker '96 (set 4, C3 board)", MACHINE_NOT_WORKING ) /* these all appear to be graphic hacks of 'New Fruit Bonus '96', they can run with the same program rom diff --git a/src/mame/drivers/m5.cpp b/src/mame/drivers/m5.cpp index 6c48e8786d0..08ae31888d9 100644 --- a/src/mame/drivers/m5.cpp +++ b/src/mame/drivers/m5.cpp @@ -2,12 +2,12 @@ // copyright-holders:Curt Coder, Ales Dlabac /*************************************************************************** - Sord m.5 + Sord m.5 - http://www.retropc.net/mm/m5/ - http://www.museo8bits.es/wiki/index.php/Sord_M5 not working - http://k5.web.klfree.net/content/view/10/11/ not working - http://k5.web.klfree.net/images/stories/sord/m5heap.htm not working + http://www.retropc.net/mm/m5/ + http://www.museo8bits.es/wiki/index.php/Sord_M5 not working + http://k5.web.klfree.net/content/view/10/11/ not working + http://k5.web.klfree.net/images/stories/sord/m5heap.htm not working http://k5.klfree.net/index.php?option=com_content&task=view&id=5&Itemid=3 http://k5.klfree.net/index.php?option=com_content&task=view&id=10&Itemid=11 http://k5.klfree.net/index.php?option=com_content&task=view&id=14&Itemid=3 @@ -19,21 +19,32 @@ /*************************************************************************** - TODO: +TODO: - - fd5 floppy - - SI-5 serial interface (8251, ROM) - - ramdisk for KRX Memory expansion - - add to brno mod support for lzr floppy disc format - - move dipswitch declaration to sofwarelist file? - - in brno mod include basic-i + - fd5 floppy + - SI-5 serial interface (8251, ROM) + - ramdisk for KRX Memory expansion + - rewrite fd5 floppy as unpluggable device + - move dipswitch declaration to softwarelist file? - 64krx: get windows ROM version with cpm & ramdisk support (Stuchlik S.E.I. version) + - brno mod: make the dsk image writeable + - brno mod: in console version lost data on RAMDISK after soft reset + - brno mod: add support for lzr floppy disc format + - brno mod: include basic-i - CHANGELOG: -5.2.2016 +CHANGELOG: + +10.02.2016 + - fixed bug: crash if rom card was only cart + - fixed bug: when em-5 selected monitor rom wasn't paged in + - brno mod: spin motor on upon restart + - brno mod: windowed boot as default rom + - brno mod: fixed bug: tape command in menu now works + +05.02.2016 - added BRNO modification - 1024kB Ramdisk + CP/M support - 32/64KB RAM expansions EM-5, 64KBI, 64KBF, 64KRX - since now own version of rom and slot handlers @@ -144,7 +155,7 @@ M5 |\\\\\\\|\\\\\\\|\\\\\\\|\\\|XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| +-------+-------+-------+---+---+-------+-------+-------+-------+ M6 |\\\\\\\|\\\\\\\|\\\\\\\|\\\|XXX|XXXXXXX|XXXXXXX|XXXXXXX|XXXXXXX| +-------+-------+-------+---+---+-------+-------+-------+-------+ - |///////|///////|///| + |///////|///////|///| +-------+-------+---+ +-------+-------------------+ @@ -209,19 +220,19 @@ using OUT (7FH),A, where each bit of A means 8KB memory chunk ( state: 0=RAM, ************************************************************* * BRNO MOD * ************************************************************* -HW and SW was originaly created by Pavel Brychta with help of Jiri Kubin and L. Novak +HW and SW was originally created by Pavel Brychta with help of Jiri Kubin and L. Novak This driver mod was implemented by Ales Dlabac with great help of Pavel Brychta. Without him this would never happen This mod exists in two versions. First one is "windows"(brno_rom12.rom) version and was created by Ladislav Novak. -Second version vesion is "pure text" and was created by Pavel Brychta and Jiri Kubin +Second version version is "pure text" and was created by Pavel Brychta and Jiri Kubin Function: Whole Sord's address area (0000-FFFF) is divided to 16 4kB banks. To this 16 banks you can map any of possible 256 ramdisc blocks what allows user to have 1024kB large ramdisc. -Ofcourse to be able to realise this is necessary page out all roms +Of course to be able to realise this is necessary page out all roms As pagination port MMU(page select) is used. For RAM write protection port CASEN is used. 0=access to ramdisk enabled, 0xff=ramdisk access disabled(data protection), &80=ROM2+48k RAM, &81=ROM2+4k RAM(this is not implemented) -For ROM detaching port RAMEN is used. 0=rom enable; 0xff=rom+sord ram disabled (ramdisk visible) +For ROM page out port RAMEN is used. 0=rom enable; 0xff=rom+sord ram disabled (ramdisk visible) SORD M5 RAM memory map in address area 7000H-7FFFH 7000H 7300H 7800H 7E00H 7FFFH @@ -234,10 +245,11 @@ d. Reserved for memory tests and ramdisk mapping(pagination). After boot is used type of floppy and so on. Area consists of: 7FFFH .... bootloader version -7FFEH .... identification byte of floppy - is transfered from EPROM, it might be changed by SETUP -7FFDH .... namber of last Ramdisk segment of RAM +7FFEH .... identification byte of floppy - is transferred from EPROM, it might be changed by SETUP +7FFDH .... number of last Ramdisk segment of RAM 7FFBH .... address of cursor in VRAM in 40 columns CRT. For 80 columns CRT both bytes are zero 7FF9H .... X,Y cursor actual position for 40 columns CRTs. In case of 80 columns CRT both bytes are zero +7203H .... Actual memory bank buffer System floppy disk header on track 00 of 1st sector byte 0-1 ... system disk identification SY @@ -249,8 +261,7 @@ System floppy disk header on track 00 of 1st sector In case of HOOK, bytes 8 and 9 contains characters 'H' and 'O' for HOOK testing Few other notes: - Ramdisc warm boot is provided by pressing Ctrl+C - Against real HW/SW is possible to store ramdisc dump to file by pressing Ctrl+S which could be loaded back in as snapshot + Ramdisc warm boot is provided by pressing Ctrl+C Floppy formats as follows: @@ -513,8 +524,8 @@ WRITE8_MEMBER( m5_state::mem64KBI_w ) //out 0x6c //if AUTOSTART is on don't load any ROM cart if (m_cart && (m_DIPS->read() & 2) != 2) { - program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom), (m5_cart_slot_device*)m_cart)); //m_cart pointer to rom cart - program.unmap_write(0x2000, 0x3fff); + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom), (m5_cart_slot_device*)m_cart)); //m_cart pointer to rom cart + program.unmap_write(0x2000, 0x3fff); } else program.unmap_readwrite(0x2000, 0x3fff); @@ -545,13 +556,13 @@ WRITE8_MEMBER( m5_state::mem64KBF_w ) //out 0x30 switch(m_ram_mode) { case 0: - program.unmap_write(0x0000, 0x6fff); - membank("bank1r")->set_base(memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x6fff); + membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank2r")->set_base(m_cart_rom->base()); - membank("bank3r")->set_base(m_cart_rom->base()+0x2000); - membank("bank4r")->set_base(m_cart_rom->base()+0x4000); - membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); - membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); + membank("bank4r")->set_base(m_cart_rom->base()+0x4000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 1: program.install_write_bank(0x0000,0x1fff,"bank1w"); @@ -560,10 +571,10 @@ WRITE8_MEMBER( m5_state::mem64KBF_w ) //out 0x30 program.install_write_bank(0x6000,0x6fff,"bank4w"); membank("bank1r")->set_base(ram_region->base()+0x0000); membank("bank1w")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(ram_region->base()+0x2000); membank("bank2w")->set_base(ram_region->base()+0x2000); - membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); - membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); - membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 2: program.install_write_bank(0x0000,0x1fff,"bank1w"); @@ -572,19 +583,19 @@ WRITE8_MEMBER( m5_state::mem64KBF_w ) //out 0x30 program.install_write_bank(0x6000,0x6fff,"bank4w"); membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(ram_region->base()+0x2000); membank("bank2w")->set_base(ram_region->base()+0x2000); - membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); - membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); - membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 3: program.unmap_write(0x0000, 0x6fff); membank("bank1r")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(ram_region->base()+0x2000); - membank("bank3r")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(ram_region->base()+0x6000); - membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); - membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + membank("bank3r")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 4: program.unmap_write(0x0000, 0x3fff); @@ -593,44 +604,44 @@ WRITE8_MEMBER( m5_state::mem64KBF_w ) //out 0x30 membank("bank1r")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(ram_region->base()+0x2000); membank("bank3r")->set_base(ram_region->base()+0x4000); membank("bank3w")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); - membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); - membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); + membank("bank4r")->set_base(ram_region->base()+0x6000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); + membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 5: - program.install_write_bank(0x0000,0x1fff,"bank1w"); - program.install_write_bank(0x2000,0x3fff,"bank2w"); - program.install_write_bank(0x4000,0x5fff,"bank3w"); - program.install_write_bank(0x6000,0x6fff,"bank4w"); + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(m_cart_rom->base()); membank("bank2w")->set_base(ram_region->base()+0x2000); - membank("bank3r")->set_base(m_cart_rom->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(m_cart_rom->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank3r")->set_base(m_cart_rom->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(m_cart_rom->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 6: - program.install_write_bank(0x0000,0x1fff,"bank1w"); - program.install_write_bank(0x2000,0x3fff,"bank2w"); - program.install_write_bank(0x4000,0x5fff,"bank3w"); - program.install_write_bank(0x6000,0x6fff,"bank4w"); + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x6000,0x6fff,"bank4w"); membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()+0x0000); membank("bank2r")->set_base(rom_region->base()+0x0000); membank("bank2w")->set_base(ram_region->base()+0x2000); - membank("bank3r")->set_base(rom_region->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); - membank("bank4r")->set_base(rom_region->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); + membank("bank3r")->set_base(rom_region->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); + membank("bank4r")->set_base(rom_region->base()+0x4000); membank("bank4w")->set_base(ram_region->base()+0x6000); membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; case 7: //probably this won't work - it should redirect rw to another ram module - program.install_write_bank(0x0000,0x1fff,"bank1w"); - program.install_write_bank(0x2000,0x3fff,"bank2w"); - program.install_write_bank(0x4000,0x5fff,"bank3w"); + program.install_write_bank(0x0000,0x1fff,"bank1w"); + program.install_write_bank(0x2000,0x3fff,"bank2w"); + program.install_write_bank(0x4000,0x5fff,"bank3w"); program.install_write_bank(0x6000,0x6fff,"bank4w"); program.install_readwrite_bank(0x7000,0x7fff,"sram"); membank("bank1r")->set_base(rom_region->base()+0x0000); membank("bank1w")->set_base(rom_region->base()+0x0000); membank("bank2r")->set_base(rom_region->base()+0x2000); membank("bank2w")->set_base(rom_region->base()+0x2000); - membank("bank3r")->set_base(rom_region->base()+0x4000); membank("bank3w")->set_base(rom_region->base()+0x4000); - membank("bank4r")->set_base(rom_region->base()+0x6000); membank("bank4w")->set_base(rom_region->base()+0x6000); + membank("bank3r")->set_base(rom_region->base()+0x4000); membank("bank3w")->set_base(rom_region->base()+0x4000); + membank("bank4r")->set_base(rom_region->base()+0x6000); membank("bank4w")->set_base(rom_region->base()+0x6000); membank("sram")->set_base(rom_region->base()+0x7000); membank("bank5r")->set_base(rom_region->base()+0x8000); membank("bank5w")->set_base(rom_region->base()+0x8000); membank("bank6r")->set_base(rom_region->base()+0xc000); membank("bank6w")->set_base(rom_region->base()+0xc000); @@ -656,11 +667,11 @@ WRITE8_MEMBER( m5_state::mem64KRX_w ) //out 0x7f memory_region *ram_region=memregion(region_tag.assign(m_cart_ram->tag()).append(":ram").c_str()); m_ram_mode = data; - + BIT(m_ram_mode, 0) ? membank("bank1r")->set_base(memregion(Z80_TAG)->base()) : membank("bank1r")->set_base(ram_region->base()); BIT(m_ram_mode, 1) ? membank("bank2r")->set_base(m_cart_rom->base()) : membank("bank2r")->set_base(ram_region->base()+0x2000); BIT(m_ram_mode, 2) ? membank("bank3r")->set_base(m_cart_rom->base()+0x2000) : membank("bank3r")->set_base(ram_region->base()+0x4000); - + if ((m_DIPS->read() & 0x01)) { BIT(m_ram_mode, 4) ? membank("bank5r")->set_base(m_cart_rom->base()+0x6000) : membank("bank5r")->set_base(ram_region->base()+0x8000); @@ -671,7 +682,7 @@ WRITE8_MEMBER( m5_state::mem64KRX_w ) //out 0x7f BIT(m_ram_mode, 6) ? membank("bank5r")->set_base(m_cart_rom->base()+0xe000) : membank("bank5r")->set_base(ram_region->base()+0x8000); BIT(m_ram_mode, 7) ? membank("bank6r")->set_base(m_cart_rom->base()+0x12000): membank("bank6r")->set_base(ram_region->base()+0xc000); } - + //if KRX ROM is paged out page in cart ROM if any if (m_cart && BIT(m_ram_mode, 1) == 0 ) { @@ -1118,8 +1129,8 @@ WRITE8_MEMBER( brno_state::romsel_w ) //out 6c if (!data) { - program.install_rom(0x0000, 0x6fff, memregion(Z80_TAG)->base()); - program.unmap_write(0x0000, 0x6fff); + program.install_rom(0x0000, 0x3fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x3fff); m_romen=true; } @@ -1205,45 +1216,6 @@ static SLOT_INTERFACE_START( brno_floppies ) SLOT_INTERFACE_END -//------------------------------------------------- -// SNAPSHOT LOADER - BRNO -//------------------------------------------------- - -SNAPSHOT_LOAD_MEMBER( brno_state, brno ) -{ - - - UINT8* rmd = memregion(RAMDISK)->base(); - - - popmessage("Loading file %s\r\n", image.filename()); - //image.message(" aaaaa:%s",image.basename_noext()); - - - - if (strcmp(image.basename_noext(), "ramdump") == 0) - { - logerror("Dumping ramdisk to file.\r\n"); - } - - if (strcmp(image.filetype(), "rmd") == 0) - { - - - image.fread( rmd+0x10000, snapshot_size-0x10000); - - - // image.seterror(IMAGE_ERROR_INVALIDIMAGE, "Not a Z1013 image"); - // image.message(" Not a Z1013 image"); - } - else - return IMAGE_INIT_FAIL; - - - - return IMAGE_INIT_PASS; -} - //************************************************************************** // MACHINE INITIALIZATION //************************************************************************** @@ -1287,13 +1259,13 @@ void m5_state::machine_reset() { membank("bank1r")->set_base(memregion(Z80_TAG)->base()); program.unmap_write(0x0000, 0x1fff); - // program.unmap_readwrite(0x2000, 0x6fff); //if you uncomment this line Sord starts cassete loading but it is not correct on real hw + // program.unmap_readwrite(0x2000, 0x6fff); //if you uncomment this line Sord starts cassette loading but it is not correct on real hw program.unmap_readwrite(0x8000, 0xffff); return; } //cart is ram module - if (m_cart_ram->exists()) + if (m_cart_ram) { m_ram_type=m_cart_ram->get_type(); @@ -1302,7 +1274,9 @@ void m5_state::machine_reset() switch (m_ram_type) { - case EM_5: + case EM_5: + program.install_rom(0x0000, 0x1fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x1fff); program.install_readwrite_handler(0x8000, 0xffff, read8_delegate(FUNC(m5_cart_slot_device::read_ram),(m5_cart_slot_device*)m_cart_ram), write8_delegate(FUNC(m5_cart_slot_device::write_ram),(m5_cart_slot_device*)m_cart_ram)); if (m_cart) { @@ -1334,7 +1308,7 @@ void m5_state::machine_reset() membank("bank5r")->set_base(ram_region->base()+0x8000); membank("bank5w")->set_base(ram_region->base()+0x8000); membank("bank6r")->set_base(ram_region->base()+0xc000); membank("bank6w")->set_base(ram_region->base()+0xc000); break; - case MEM64KRX: + case MEM64KRX: membank("bank1r")->set_base(memregion(Z80_TAG)->base()); membank("bank1w")->set_base(ram_region->base()); membank("bank2r")->set_base(m_cart_rom->base()); membank("bank2w")->set_base(ram_region->base()+0x2000); membank("bank3r")->set_base(m_cart_rom->base()+0x2000); membank("bank3w")->set_base(ram_region->base()+0x4000); @@ -1358,7 +1332,15 @@ void m5_state::machine_reset() //I don't have idea what to do with savestates, please someone take care of it //m_cart_ram->save_ram(); } - + else + //ram cart wasn't found so if rom cart present install it + if (m_cart) + { + program.install_rom(0x0000, 0x1fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x1fff); + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x6fff); + } m_ram_mode=0; } @@ -1374,8 +1356,9 @@ void brno_state::machine_reset() /* enable ROM1+ROM2 */ address_space &program = m_maincpu->space(AS_PROGRAM); - program.install_rom(0x0000, 0x5fff, memregion(Z80_TAG)->base()); - program.unmap_write(0x0000, 0x5fff); + program.install_rom(0x0000, 0x3fff, memregion(Z80_TAG)->base()); + program.unmap_write(0x0000, 0x3fff); + //is ram/rom cart plugged in? if (m_cart1->exists()) @@ -1395,12 +1378,17 @@ void brno_state::machine_reset() if (m_cart) { - program.install_read_handler(0x2000, 0x5fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); - program.unmap_write(0x2000, 0x5fff); + program.install_read_handler(0x2000, 0x6fff, read8_delegate(FUNC(m5_cart_slot_device::read_rom),(m5_cart_slot_device*)m_cart)); + program.unmap_write(0x2000, 0x6fff); } m_romen=true; - m_ramen=false; + m_ramen=false; + + floppy_image_device *floppy = NULL; + floppy = m_floppy0->get_device(); + m_fdc->set_floppy(floppy); + floppy->mon_w(0); } //************************************************************************** @@ -1533,7 +1521,7 @@ static MACHINE_CONFIG_DERIVED_CLASS( brno, m5, brno_state ) // only one floppy drive //MCFG_DEVICE_REMOVE(WD2797_TAG":1") - MCFG_SNAPSHOT_ADD("snapshot", brno_state, brno, "rmd", 0) + //MCFG_SNAPSHOT_ADD("snapshot", brno_state, brno, "rmd", 0) // software list MCFG_SOFTWARE_LIST_ADD("flop_list","m5_flop") @@ -1577,9 +1565,9 @@ ROM_END ROM_START( m5p_brno ) ROM_REGION( 0x10000, Z80_TAG, ROMREGION_ERASEFF ) ROM_LOAD( "sordint.ic21", 0x0000, 0x2000, CRC(78848d39) SHA1(ac042c4ae8272ad6abe09ae83492ef9a0026d0b2)) // monitor rom - //ROM_LOAD( "brno_rom1.rom", 0x2000, 0x2000, CRC(f4cfb2ee) SHA1(23f41d2d9ac915545409dd0163f3dc298f04eea2)) //windows + ROM_LOAD( "brno_win.rom", 0x2000, 0x2000, CRC(f4cfb2ee) SHA1(23f41d2d9ac915545409dd0163f3dc298f04eea2)) //windows //ROM_LOAD( "brno_rom12.rom", 0x2000, 0x4000, CRC(cac52406) SHA1(91f6ba97e85a2b3a317689635d425ee97413bbe3)) //windows+BI - ROM_LOAD( "brno_boot.rom", 0x2000, 0xd80, CRC(60008729) SHA1(FB26E2AE9F74B0AE0D723B417A038A8EF3D72782)) + //ROM_LOAD( "brno_boot.rom", 0x2000, 0xd80, CRC(60008729) SHA1(FB26E2AE9F74B0AE0D723B417A038A8EF3D72782)) //Ramdisc area (maximum is 1024kB 256x 4kB banks) ROM_REGION(1024*1024,RAMDISK,0) diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp index f1aa281aeb2..b7c1ac7af09 100644 --- a/src/mame/drivers/mstation.cpp +++ b/src/mame/drivers/mstation.cpp @@ -28,6 +28,7 @@ #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/bankdev.h" #include "machine/intelfsh.h" #include "machine/rp5c01.h" #include "machine/ram.h" @@ -39,30 +40,28 @@ public: mstation_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_ram(*this, RAM_TAG) + m_ram(*this, RAM_TAG), + m_bankdev1(*this, "bank0"), + m_bankdev2(*this, "bank1"), + m_keyboard(*this, "LINE"), + m_nvram(*this, "nvram") { } required_device<cpu_device> m_maincpu; required_device<ram_device> m_ram; + required_device<address_map_bank_device> m_bankdev1; + required_device<address_map_bank_device> m_bankdev2; + required_ioport_array<10> m_keyboard; + required_shared_ptr<UINT8> m_nvram; - intelfsh8_device *m_flashes[2]; UINT8 m_bank1[2]; UINT8 m_bank2[2]; - UINT8 *m_ram_base; - int m_flash_at_0x4000; - int m_flash_at_0x8000; UINT8 *m_vram; UINT8 m_screen_column; UINT8 m_port2; UINT8 m_irq; UINT16 m_kb_matrix; - DECLARE_READ8_MEMBER( flash_0x0000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x0000_write_handler ); - DECLARE_READ8_MEMBER( flash_0x4000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x4000_write_handler ); - DECLARE_READ8_MEMBER( flash_0x8000_read_handler ); - DECLARE_WRITE8_MEMBER( flash_0x8000_write_handler ); DECLARE_READ8_MEMBER( modem_r ); DECLARE_WRITE8_MEMBER( modem_w ); @@ -73,7 +72,6 @@ public: DECLARE_READ8_MEMBER( lcd_left_r ); DECLARE_WRITE8_MEMBER( lcd_left_w ); - void refresh_memory(UINT8 bank, UINT8 chip_select); DECLARE_READ8_MEMBER( bank1_r ); DECLARE_WRITE8_MEMBER( bank1_w ); DECLARE_READ8_MEMBER( bank2_r ); @@ -97,35 +95,6 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(mstation_kb_timer); }; -READ8_MEMBER( mstation_state::flash_0x0000_read_handler ) -{ - return m_flashes[0]->read(offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x0000_write_handler ) -{ - m_flashes[0]->write(offset, data); -} - -READ8_MEMBER( mstation_state::flash_0x4000_read_handler ) -{ - return m_flashes[m_flash_at_0x4000]->read(((m_bank1[0] & 0x3f)<<14) | offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x4000_write_handler ) -{ - m_flashes[m_flash_at_0x4000]->write(((m_bank1[0] & 0x3f)<<14) | offset, data); -} - -READ8_MEMBER( mstation_state::flash_0x8000_read_handler ) -{ - return m_flashes[m_flash_at_0x8000]->read(((m_bank2[0] & 0x3f)<<14) | offset); -} - -WRITE8_MEMBER( mstation_state::flash_0x8000_write_handler ) -{ - m_flashes[m_flash_at_0x8000]->write(((m_bank2[0] & 0x3f)<<14) | offset, data); -} READ8_MEMBER( mstation_state::modem_r ) { @@ -185,53 +154,6 @@ UINT32 mstation_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap // Bankswitch //***************************************************************************/ -void mstation_state::refresh_memory(UINT8 bank, UINT8 chip_select) -{ - address_space& program = m_maincpu->space(AS_PROGRAM); - int &active_flash = (bank == 1 ? m_flash_at_0x4000 : m_flash_at_0x8000); - char bank_tag[6]; - - switch (chip_select) - { - case 0: // flash 0 - case 3: // flash 1 - if (active_flash < 0) - { - if (bank == 1) - program.install_readwrite_handler(0x4000, 0x7fff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x4000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x4000_write_handler), this)); - else - program.install_readwrite_handler(0x8000, 0xbfff, 0, 0, read8_delegate(FUNC(mstation_state::flash_0x8000_read_handler), this), write8_delegate(FUNC(mstation_state::flash_0x8000_write_handler), this)); - } - - active_flash = chip_select ? 1 : 0; - break; - case 1: // banked RAM - sprintf(bank_tag,"bank%d", bank); - membank(bank_tag)->set_base(m_ram_base + (((bank == 1 ? m_bank1[0] : m_bank2[0]) & 0x07)<<14)); - program.install_readwrite_bank (bank * 0x4000, bank * 0x4000 + 0x3fff, bank_tag); - active_flash = -1; - break; - case 2: // left LCD panel - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_left_r), this), write8_delegate(FUNC(mstation_state::lcd_left_w), this)); - active_flash = -1; - break; - case 4: // right LCD panel - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0, 0, read8_delegate(FUNC(mstation_state::lcd_right_r), this), write8_delegate(FUNC(mstation_state::lcd_right_w), this)); - active_flash = -1; - break; - case 5: // modem - program.install_readwrite_handler(bank * 0x4000, bank * 0x4000 + 0x3fff, 0x07, 0, read8_delegate(FUNC(mstation_state::modem_r), this), write8_delegate(FUNC(mstation_state::modem_w), this)); - active_flash = -1; - break; - - default: - logerror("Unknown chip %02x mapped at %04x - %04x\n", chip_select, bank * 0x4000, bank * 0x4000 + 0x3fff); - program.unmap_readwrite(bank * 0x4000, bank * 0x4000 + 0x3fff); - active_flash = -1; - break; - } -} - READ8_MEMBER( mstation_state::bank1_r ) { return m_bank1[offset]; @@ -246,14 +168,14 @@ WRITE8_MEMBER( mstation_state::bank1_w ) { m_bank1[offset] = data; - refresh_memory(1, m_bank1[1] & 0x07); + m_bankdev1->set_bank(((m_bank1[1] & 0x07) << 8) | m_bank1[0]); } WRITE8_MEMBER( mstation_state::bank2_w ) { m_bank2[offset] = data; - refresh_memory(2, m_bank2[1] & 0x07); + m_bankdev2->set_bank(((m_bank2[1] & 0x07) << 8) | m_bank2[0]); } @@ -314,25 +236,32 @@ WRITE8_MEMBER( mstation_state::kb_w ) READ8_MEMBER( mstation_state::kb_r ) { - static const char *const bitnames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", - "LINE5", "LINE6", "LINE7", "LINE8", "LINE9" }; UINT8 data = 0xff; for (int i=0; i<10; i++) { if (!(m_kb_matrix & (1<<i))) - data &= ioport(bitnames[i])->read(); + data &= m_keyboard[i]->read(); } return data; } +static ADDRESS_MAP_START(mstation_banked_map, AS_PROGRAM, 8, mstation_state) + AM_RANGE(0x0000000, 0x00fffff) AM_MIRROR(0x0300000) AM_DEVREADWRITE("flash0", intelfsh8_device, read, write) + AM_RANGE(0x0400000, 0x041ffff) AM_MIRROR(0x03e0000) AM_RAM AM_SHARE("nvram") + AM_RANGE(0x0c00000, 0x0c7ffff) AM_MIRROR(0x0380000) AM_DEVREADWRITE("flash1", intelfsh8_device, read, write) + AM_RANGE(0x0800000, 0x0803fff) AM_MIRROR(0x03fc000) AM_READWRITE(lcd_left_r, lcd_left_w) + AM_RANGE(0x1000000, 0x1003fff) AM_MIRROR(0x03fc000) AM_READWRITE(lcd_right_r, lcd_right_w) + AM_RANGE(0x1400000, 0x1403fff) AM_MIRROR(0x03fc000) AM_READWRITE(modem_r, modem_w) +ADDRESS_MAP_END + static ADDRESS_MAP_START(mstation_mem, AS_PROGRAM, 8, mstation_state) - AM_RANGE(0x0000, 0x3fff) AM_READWRITE(flash_0x0000_read_handler, flash_0x0000_write_handler) - AM_RANGE(0x4000, 0x7fff) AM_READWRITE_BANK("bank1") // bank 1 - AM_RANGE(0x8000, 0xbfff) AM_READWRITE_BANK("bank2") // bank 2 - AM_RANGE(0xc000, 0xffff) AM_READWRITE_BANK("sysram") // system ram always first RAM bank + AM_RANGE(0x0000, 0x3fff) AM_DEVREADWRITE("flash0", intelfsh8_device, read, write) + AM_RANGE(0x4000, 0x7fff) AM_DEVREADWRITE("bank0", address_map_bank_device, read8, write8) + AM_RANGE(0x8000, 0xbfff) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) + AM_RANGE(0xc000, 0xffff) AM_RAMBANK("sysram") // system ram always first RAM bank ADDRESS_MAP_END static ADDRESS_MAP_START(mstation_io , AS_IO, 8, mstation_state) @@ -350,7 +279,7 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START( mstation ) - PORT_START( "LINE0" ) + PORT_START( "LINE.0" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Main Menu") PORT_CODE( KEYCODE_HOME ) PORT_CHAR(UCHAR_MAMEKEY(HOME)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Back") PORT_CODE( KEYCODE_DEL ) PORT_CHAR(UCHAR_MAMEKEY(END)) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Print") PORT_CODE( KEYCODE_F6 ) @@ -360,7 +289,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F4") PORT_CODE( KEYCODE_F4 ) PORT_CHAR(UCHAR_MAMEKEY(F4)) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("F5") PORT_CODE( KEYCODE_F5 ) PORT_CHAR(UCHAR_MAMEKEY(F5)) - PORT_START( "LINE1" ) + PORT_START( "LINE.1" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -370,7 +299,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Get E-Mail") PORT_CODE( KEYCODE_F9 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Up") PORT_CODE( KEYCODE_PGUP ) PORT_CHAR(UCHAR_MAMEKEY(PGUP)) - PORT_START( "LINE2" ) + PORT_START( "LINE.2" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("\xc2\xb4") PORT_CODE( KEYCODE_0_PAD ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_1 ) PORT_CHAR('1') PORT_CHAR('!') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_2 ) PORT_CHAR('2') PORT_CHAR('@') @@ -380,7 +309,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_6 ) PORT_CHAR('6') PORT_CHAR('^') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_7 ) PORT_CHAR('7') PORT_CHAR('&') - PORT_START( "LINE3" ) + PORT_START( "LINE.3" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_8 ) PORT_CHAR('8') PORT_CHAR('*') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_9 ) PORT_CHAR('9') PORT_CHAR('(') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_0 ) PORT_CHAR('0') PORT_CHAR(')') @@ -390,7 +319,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_BACKSLASH ) PORT_CHAR('\\') PORT_CHAR('|') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("PG Down") PORT_CODE( KEYCODE_PGDN ) PORT_CHAR(UCHAR_MAMEKEY(PGDN)) - PORT_START( "LINE4" ) + PORT_START( "LINE.4" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Tab") PORT_CODE( KEYCODE_TAB ) PORT_CHAR(9) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Q ) PORT_CHAR('q') PORT_CHAR('Q') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_W ) PORT_CHAR('w') PORT_CHAR('W') @@ -400,7 +329,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Y ) PORT_CHAR('y') PORT_CHAR('Y') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_U ) PORT_CHAR('u') PORT_CHAR('U') - PORT_START( "LINE5" ) + PORT_START( "LINE.5" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_I ) PORT_CHAR('i') PORT_CHAR('I') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_O ) PORT_CHAR('o') PORT_CHAR('O') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_P ) PORT_CHAR('p') PORT_CHAR('P') @@ -410,7 +339,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_QUOTE ) PORT_CHAR('\'') PORT_CHAR('\"') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Enter") PORT_CODE( KEYCODE_ENTER ) PORT_CHAR(UCHAR_MAMEKEY(ENTER)) - PORT_START( "LINE6" ) + PORT_START( "LINE.6" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("CapsLock") PORT_CODE( KEYCODE_CAPSLOCK ) PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_A ) PORT_CHAR('a') PORT_CHAR('A') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_S ) PORT_CHAR('s') PORT_CHAR('S') @@ -420,7 +349,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_H ) PORT_CHAR('h') PORT_CHAR('H') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_J ) PORT_CHAR('j') PORT_CHAR('J') - PORT_START( "LINE7" ) + PORT_START( "LINE.7" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_K ) PORT_CHAR('K') PORT_CHAR('K') PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_L ) PORT_CHAR('l') PORT_CHAR('L') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_COMMA ) PORT_CHAR(',') PORT_CHAR('<') @@ -430,7 +359,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Down") PORT_CODE( KEYCODE_DOWN ) PORT_CHAR(UCHAR_MAMEKEY(DOWN)) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Right") PORT_CODE( KEYCODE_RIGHT ) PORT_CHAR(UCHAR_MAMEKEY(RIGHT)) - PORT_START( "LINE8" ) + PORT_START( "LINE.8" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Left Shift") PORT_CODE( KEYCODE_LSHIFT ) PORT_CHAR(UCHAR_MAMEKEY(LSHIFT)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_Z ) PORT_CHAR('z') PORT_CHAR('Z') PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_X ) PORT_CHAR('x') PORT_CHAR('X') @@ -440,7 +369,7 @@ static INPUT_PORTS_START( mstation ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_N ) PORT_CHAR('n') PORT_CHAR('N') PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE( KEYCODE_M ) PORT_CHAR('m') PORT_CHAR('M') - PORT_START( "LINE9" ) + PORT_START( "LINE.9" ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("Function") PORT_CODE( KEYCODE_LCONTROL ) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -453,29 +382,23 @@ INPUT_PORTS_END void mstation_state::machine_start() { - m_flashes[0] = machine().device<intelfsh8_device>("flash0"); - m_flashes[1] = machine().device<intelfsh8_device>("flash1"); - // allocate the videoram m_vram = (UINT8*)machine().memory().region_alloc( "vram", 9600, 1, ENDIANNESS_LITTLE )->base(); - m_ram_base = (UINT8*)m_ram->pointer(); // map firsh RAM bank at 0xc000-0xffff - membank("sysram")->set_base(m_ram_base); + membank("sysram")->set_base(m_nvram); } void mstation_state::machine_reset() { - m_flash_at_0x4000 = 0; - m_flash_at_0x8000 = 0; m_bank1[0] = m_bank1[1] = 0; m_bank2[0] = m_bank2[1] = 0; memset(m_vram, 0, 9600); // reset banks - refresh_memory(1, m_bank1[1]); - refresh_memory(2, m_bank2[1]); + m_bankdev1->set_bank(0); + m_bankdev2->set_bank(0); } WRITE_LINE_MEMBER( mstation_state::rtc_irq ) @@ -540,6 +463,18 @@ static MACHINE_CONFIG_START( mstation, mstation_state ) MCFG_DEVICE_ADD("rtc", RP5C01, XTAL_32_768kHz) MCFG_RP5C01_OUT_ALARM_CB(WRITELINE(mstation_state, rtc_irq)) + MCFG_DEVICE_ADD("bank0", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(mstation_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(mstation_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x4000) + /* internal ram */ MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("128K") diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index f2f305ec97c..81e799f64f6 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -536,7 +536,6 @@ public: /* PC9801RS specific */ UINT8 m_gate_a20; //A20 line - UINT8 m_nmi_enable; UINT8 m_access_ctrl; // DMA related UINT8 m_rom_bank; UINT8 m_fdc_ctrl; @@ -584,10 +583,10 @@ public: DECLARE_WRITE16_MEMBER(egc_w); DECLARE_READ8_MEMBER(pc9801_a0_r); DECLARE_WRITE8_MEMBER(pc9801_a0_w); - DECLARE_READ8_MEMBER(pc9801_fdc_2hd_r); - DECLARE_WRITE8_MEMBER(pc9801_fdc_2hd_w); - DECLARE_READ8_MEMBER(pc9801_fdc_2dd_r); - DECLARE_WRITE8_MEMBER(pc9801_fdc_2dd_w); + DECLARE_READ8_MEMBER(fdc_2hd_ctrl_r); + DECLARE_WRITE8_MEMBER(fdc_2hd_ctrl_w); + DECLARE_READ8_MEMBER(fdc_2dd_ctrl_r); + DECLARE_WRITE8_MEMBER(fdc_2dd_ctrl_w); DECLARE_READ16_MEMBER(tvram_r); DECLARE_WRITE16_MEMBER(tvram_w); DECLARE_READ8_MEMBER(gvram_r); @@ -602,7 +601,7 @@ public: DECLARE_WRITE16_MEMBER(upd7220_grcg_w); void egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask); UINT16 egc_blit_r(UINT32 offset, UINT16 mem_mask); - UINT32 pc9801_286_a20(bool state); + UINT32 a20_286(bool state); DECLARE_READ8_MEMBER(ide_ctrl_r); DECLARE_WRITE8_MEMBER(ide_ctrl_w); @@ -633,10 +632,8 @@ public: DECLARE_WRITE8_MEMBER(pc9801rs_bank_w); DECLARE_READ8_MEMBER(a20_ctrl_r); DECLARE_WRITE8_MEMBER(a20_ctrl_w); - DECLARE_READ8_MEMBER(pc9810rs_fdc_ctrl_r); - DECLARE_WRITE8_MEMBER(pc9810rs_fdc_ctrl_w); - DECLARE_READ8_MEMBER(pc9801rs_2hd_r); - DECLARE_WRITE8_MEMBER(pc9801rs_2hd_w); + DECLARE_READ8_MEMBER(fdc_mode_ctrl_r); + DECLARE_WRITE8_MEMBER(fdc_mode_ctrl_w); // DECLARE_READ8_MEMBER(pc9801rs_2dd_r); // DECLARE_WRITE8_MEMBER(pc9801rs_2dd_w); DECLARE_WRITE8_MEMBER(pc9801rs_video_ff_w); @@ -644,10 +641,9 @@ public: DECLARE_WRITE8_MEMBER(pc9821_video_ff_w); DECLARE_READ8_MEMBER(pc9821_a0_r); DECLARE_WRITE8_MEMBER(pc9821_a0_w); - DECLARE_READ8_MEMBER(pc9801rs_access_ctrl_r); - DECLARE_WRITE8_MEMBER(pc9801rs_access_ctrl_w); - DECLARE_WRITE8_MEMBER(pc9801rs_nmi_w); - DECLARE_READ8_MEMBER(pc9801rs_midi_r); + DECLARE_READ8_MEMBER(access_ctrl_r); + DECLARE_WRITE8_MEMBER(access_ctrl_w); + DECLARE_READ8_MEMBER(midi_r); // DECLARE_READ8_MEMBER(winram_r); // DECLARE_WRITE8_MEMBER(winram_w); // DECLARE_READ8_MEMBER(pc9801_ext_opna_r); @@ -681,11 +677,11 @@ public: DECLARE_WRITE8_MEMBER(sdip_a_w); DECLARE_WRITE8_MEMBER(sdip_b_w); - DECLARE_READ8_MEMBER(pc9821_window_bank_r); - DECLARE_WRITE8_MEMBER(pc9821_window_bank_w); - DECLARE_READ16_MEMBER(pc9821_timestamp_r); - DECLARE_READ8_MEMBER(pc9821_ext2_video_ff_r); - DECLARE_WRITE8_MEMBER(pc9821_ext2_video_ff_w); + DECLARE_READ8_MEMBER(window_bank_r); + DECLARE_WRITE8_MEMBER(window_bank_w); + DECLARE_READ16_MEMBER(timestamp_r); + DECLARE_READ8_MEMBER(ext2_video_ff_r); + DECLARE_WRITE8_MEMBER(ext2_video_ff_w); DECLARE_FLOPPY_FORMATS( floppy_formats ); UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels ); @@ -709,7 +705,7 @@ public: DECLARE_MACHINE_RESET(pc9821); DECLARE_PALETTE_INIT(pc9801); - INTERRUPT_GEN_MEMBER(pc9801_vrtc_irq); + INTERRUPT_GEN_MEMBER(vrtc_irq); DECLARE_READ8_MEMBER(get_slave_ack); DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); DECLARE_WRITE_LINE_MEMBER(tc_w); @@ -1200,120 +1196,56 @@ DECLARE_WRITE_LINE_MEMBER(pc9801_state::write_uart_clock) m_sio->write_rxc(state); } -READ8_MEMBER(pc9801_state::pc9801_fdc_2hd_r) +READ8_MEMBER(pc9801_state::fdc_2hd_ctrl_r) { - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); - case 4: return 0x5f; //unknown port meaning - } - } - else - { - switch((offset & 6) + 1) - { - case 1: return m_sio->data_r(space, 0); - case 3: return m_sio->status_r(space, 0); - } - logerror("Read to undefined port [%02x]\n",offset+0x90); - return 0xff; - } - - return 0xff; + return 0x44; //unknown port meaning 2hd flag? } -WRITE8_MEMBER(pc9801_state::pc9801_fdc_2hd_w) +WRITE8_MEMBER(pc9801_state::fdc_2hd_ctrl_w) { - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); return; - case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; - case 4: - //logerror("%02x ctrl\n",data); - if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2hd->soft_reset(); + //logerror("%02x ctrl\n",data); + if(((m_fdc_2hd_ctrl & 0x80) == 0) && (data & 0x80)) + m_fdc_2hd->soft_reset(); - m_fdc_2hd_ctrl = data; - - if(data & 0x40) - { - m_fdc_2hd->set_ready_line_connected(0); - m_fdc_2hd->ready_w(0); - } - else - m_fdc_2hd->set_ready_line_connected(1); + m_fdc_2hd_ctrl = data; - // TODO: is the motor control bit really inverted relative to the other fdcs? - m_fdc_2hd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); - m_fdc_2hd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); - break; - } - } - else + if(data & 0x40) { - switch((offset & 6) + 1) - { - case 1: m_sio->data_w(space, 0, data); return; - case 3: m_sio->control_w(space, 0, data); return; - } - logerror("Write to undefined port [%02x] <- %02x\n",offset+0x90,data); + m_fdc_2hd->set_ready_line_connected(0); + m_fdc_2hd->ready_w(0); } -} - + else + m_fdc_2hd->set_ready_line_connected(1); -READ8_MEMBER(pc9801_state::pc9801_fdc_2dd_r) -{ - if((offset & 1) == 0) + if(!m_sys_type) // required for 9801f 2hd adapter bios { - switch(offset & 6) - { - case 0: return m_fdc_2dd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2dd->fifo_r(space, 0, 0xff); - case 4: - { - int ret = (!m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->ready_r()) ? 0x10 : 0; - ret |= (m_fdc_2dd->subdevice<floppy_connector>("1")->get_device()->ready_r()) ? 0x10 : 0; - return ret | 0x40; //unknown port meaning, might be 0x70 - } - } + m_fdc_2hd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); + m_fdc_2hd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? ASSERT_LINE : CLEAR_LINE); } - else + else if(!(m_fdc_ctrl & 4)) // required for 9821 { - logerror("Read to undefined port [%02x]\n",offset+0xc8); - return 0xff; + m_fdc_2hd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + m_fdc_2hd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); } +} - return 0xff; + +READ8_MEMBER(pc9801_state::fdc_2dd_ctrl_r) +{ + int ret = (!m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->ready_r()) ? 0x10 : 0; + ret |= (m_fdc_2dd->subdevice<floppy_connector>("1")->get_device()->ready_r()) ? 0x10 : 0; + return ret | 0x40; //unknown port meaning, might be 0x70 } -WRITE8_MEMBER(pc9801_state::pc9801_fdc_2dd_w) +WRITE8_MEMBER(pc9801_state::fdc_2dd_ctrl_w) { - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); return; - case 2: m_fdc_2dd->fifo_w(space, 0, data, 0xff); return; - case 4: - logerror("%02x ctrl\n",data); - if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) - m_fdc_2dd->soft_reset(); - - m_fdc_2dd_ctrl = data; - m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - m_fdc_2dd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - break; - } - } - else - { - logerror("Write to undefined port [%02x] <- %02x\n",offset+0xc8,data); - } + logerror("%02x ctrl\n",data); + if(((m_fdc_2dd_ctrl & 0x80) == 0) && (data & 0x80)) + m_fdc_2dd->soft_reset(); + + m_fdc_2dd_ctrl = data; + m_fdc_2dd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); + m_fdc_2dd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); } @@ -1430,23 +1362,10 @@ void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) } // mask off the bits past the end of the blit - if((m_egc.count < 8) && (mem_mask != 0xffff)) - { - UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (8 - m_egc.count)) - 1); - // if the blit is less than 8 bits, adjust the masks - if(m_egc.first) - { - if(dir) - end_mask <<= dst_off & 7; - else - end_mask >>= dst_off & 7; - } - mask &= end_mask; - } - else if((m_egc.count < 16) && (mem_mask == 0xffff)) + if(((m_egc.count < 8) && (mem_mask != 0xffff)) || ((m_egc.count < 16) && (mem_mask == 0xffff))) { UINT16 end_mask = dir ? ((1 << m_egc.count) - 1) : ~((1 << (16 - m_egc.count)) - 1); - // if the blit is less than 16 bits, adjust the masks + // if the blit is less than the write size, adjust the masks if(m_egc.first) { if(dir) @@ -1461,7 +1380,7 @@ void pc9801_state::egc_blit_w(UINT32 offset, UINT16 data, UINT16 mem_mask) { if(!BIT(m_egc.regs[0], i)) { - UINT16 src = m_egc.src[i] & mem_mask, pat = m_egc.pat[i]; + UINT16 src = m_egc.src[i], pat = m_egc.pat[i]; if(BIT(m_egc.regs[2], 10)) src = egc_shift(i, data); @@ -1782,12 +1701,11 @@ static ADDRESS_MAP_START( pc9801_map, AS_PROGRAM, 16, pc9801_state ) ADDRESS_MAP_END /* first device is even offsets, second one is odd offsets */ -static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) +static ADDRESS_MAP_START( pc9801_common_io, AS_IO, 16, pc9801_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("i8237", am9517a_device, read, write, 0xff00) AM_RANGE(0x0000, 0x000f) AM_READWRITE8(pic_r, pic_w, 0x00ff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA AM_RANGE(0x0020, 0x0021) AM_WRITE8(rtc_w,0x00ff) - AM_RANGE(0x0020, 0x0027) AM_WRITE8(dmapg4_w,0xff00) AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00) //i8251 RS232c / i8255 system port AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff) AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00) //i8255 printer port / i8251 keyboard @@ -1795,19 +1713,29 @@ static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) AM_RANGE(0x0050, 0x0053) AM_WRITE8(nmi_ctrl_w,0x00ff) // NMI FF / i8255 floppy port (2d?) AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff) //upd7220 character ports / <undefined> AM_RANGE(0x0064, 0x0065) AM_WRITE8(vrtc_clear_w,0x00ff) - AM_RANGE(0x0068, 0x0069) AM_WRITE8(pc9801_video_ff_w,0x00ff) //mode FF / <undefined> // AM_RANGE(0x006c, 0x006f) border color / <undefined> AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) AM_RANGE(0x0070, 0x007b) AM_READWRITE8(txt_scrl_r,txt_scrl_w,0x00ff) //display registers / i8253 pit AM_RANGE(0x0080, 0x0081) AM_READWRITE8(sasi_data_r, sasi_data_w, 0x00ff) AM_RANGE(0x0082, 0x0083) AM_READWRITE8(sasi_status_r, sasi_ctrl_w,0x00ff) - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt - AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers - AM_RANGE(0x00c8, 0x00cd) AM_READWRITE8(pc9801_fdc_2dd_r,pc9801_fdc_2dd_w,0xffff) //upd765a 2dd / <undefined> -// AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / <undefined> + AM_RANGE(0x0090, 0x0091) AM_DEVREAD8("upd765_2hd", upd765a_device, msr_r, 0x00ff) + AM_RANGE(0x0092, 0x0093) AM_DEVREADWRITE8("upd765_2hd", upd765a_device, fifo_r, fifo_w, 0x00ff) + AM_RANGE(0x0094, 0x0095) AM_READWRITE8(fdc_2hd_ctrl_r, fdc_2hd_ctrl_w, 0x00ff) + AM_RANGE(0x0090, 0x0091) AM_DEVREADWRITE8(UPD8251_TAG, i8251_device, data_r, data_w, 0xff00) + AM_RANGE(0x0092, 0x0093) AM_DEVREADWRITE8(UPD8251_TAG, i8251_device, status_r, control_w, 0xff00) AM_RANGE(0x7fd8, 0x7fdf) AM_DEVREADWRITE8("ppi8255_mouse", i8255_device, read, write, 0xff00) ADDRESS_MAP_END +static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state ) + AM_RANGE(0x0020, 0x0027) AM_WRITE8(dmapg4_w,0xff00) + AM_RANGE(0x0068, 0x0069) AM_WRITE8(pc9801_video_ff_w,0x00ff) //mode FF / <undefined> + AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers + AM_RANGE(0x00c8, 0x00cb) AM_DEVICE8("upd765_2dd", upd765a_device, map, 0x00ff) + AM_RANGE(0x00cc, 0x00cd) AM_READWRITE8(fdc_2dd_ctrl_r, fdc_2dd_ctrl_w, 0x00ff) //upd765a 2dd / <undefined> + AM_IMPORT_FROM(pc9801_common_io) +ADDRESS_MAP_END + + /************************************* * * PC-9801RS specific handlers (IA-32) @@ -1890,7 +1818,7 @@ READ8_MEMBER(pc9801_state::a20_ctrl_r) if(offset == 0x01) return (m_gate_a20 ^ 1) | 0xfe; else if(offset == 0x03) - return (m_gate_a20 ^ 1) | (m_nmi_enable << 1); + return (m_gate_a20 ^ 1) | (m_nmi_ff << 1); return 0x00; } @@ -1999,12 +1927,12 @@ WRITE16_MEMBER(pc9801_state::egc_w) } } -READ8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_r) +READ8_MEMBER(pc9801_state::fdc_mode_ctrl_r) { return (m_fdc_ctrl & 3) | 0xf0 | 8 | 4; } -WRITE8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_w) +WRITE8_MEMBER(pc9801_state::fdc_mode_ctrl_w) { /* ---- x--- ready line? @@ -2022,55 +1950,6 @@ WRITE8_MEMBER(pc9801_state::pc9810rs_fdc_ctrl_w) // logerror("FDC ctrl called with %02x\n",data); } -READ8_MEMBER(pc9801_state::pc9801rs_2hd_r) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 0: return m_fdc_2hd->msr_r(space, 0, 0xff); - case 2: return m_fdc_2hd->fifo_r(space, 0, 0xff); - case 4: return 0x44; //2hd flag - } - } - - logerror("Read to undefined port [%02x]\n",offset+0x90); - - return 0xff; -} - -WRITE8_MEMBER(pc9801_state::pc9801rs_2hd_w) -{ - if((offset & 1) == 0) - { - switch(offset & 6) - { - case 2: m_fdc_2hd->fifo_w(space, 0, data, 0xff); return; - case 4: - if(data & 0x80) - m_fdc_2hd->soft_reset(); - - if(data & 0x40) - { - m_fdc_2hd->set_ready_line_connected(0); - m_fdc_2hd->ready_w(0); - } - else - m_fdc_2hd->set_ready_line_connected(1); - - //TODO: verify - if(!(m_fdc_ctrl & 4)) - { - m_fdc_2hd->subdevice<floppy_connector>("0")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - m_fdc_2hd->subdevice<floppy_connector>("1")->get_device()->mon_w(data & 8 ? CLEAR_LINE : ASSERT_LINE); - } - return; - } - } - - logerror("Write to undefined port [%02x] %02x\n",offset+0x90,data); -} - #if 0 READ8_MEMBER(pc9801_state::pc9801rs_2dd_r) { @@ -2160,7 +2039,7 @@ WRITE8_MEMBER(pc9801_state::pc9801rs_a0_w) pc9801_a0_w(space,offset,data); } -READ8_MEMBER( pc9801_state::pc9801rs_access_ctrl_r ) +READ8_MEMBER( pc9801_state::access_ctrl_r ) { if(offset == 1) return m_access_ctrl; @@ -2168,7 +2047,7 @@ READ8_MEMBER( pc9801_state::pc9801rs_access_ctrl_r ) return 0xff; } -WRITE8_MEMBER( pc9801_state::pc9801rs_access_ctrl_w ) +WRITE8_MEMBER( pc9801_state::access_ctrl_w ) { if(offset == 1) m_access_ctrl = data; @@ -2184,17 +2063,7 @@ WRITE8_MEMBER( pc9801_state::pc9801rs_mouse_freq_w ) } } - -WRITE8_MEMBER( pc9801_state::pc9801rs_nmi_w ) -{ - if(offset == 0) - m_nmi_enable = 0; - - if(offset == 2) - m_nmi_enable = 1; -} - -READ8_MEMBER( pc9801_state::pc9801rs_midi_r ) +READ8_MEMBER( pc9801_state::midi_r ) { /* unconnect, needed by Amaranth KH to boot */ return 0xff; @@ -2247,20 +2116,19 @@ static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0020, 0x002f) AM_WRITE8(dmapg8_w,0xff00) AM_RANGE(0x0050, 0x0057) AM_NOP // 2dd ppi? - AM_RANGE(0x005c, 0x005f) AM_READ(pc9821_timestamp_r) AM_WRITENOP // artic + AM_RANGE(0x005c, 0x005f) AM_READ(timestamp_r) AM_WRITENOP // artic AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9801rs_video_ff_w,0x00ff) //mode FF / <undefined> AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff) //display registers "GRCG" / i8253 pit - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r, pc9801rs_a0_w, 0xffff) //upd7220 bitmap ports / display registers - AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff) - AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffff) + AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(fdc_mode_ctrl_r,fdc_mode_ctrl_w,0xffff) + AM_RANGE(0x00c8, 0x00cb) AM_DEVICE8("upd765_2hd", upd765a_device, map, 0x00ff) + AM_RANGE(0x00cc, 0x00cd) AM_READWRITE8(fdc_2hd_ctrl_r, fdc_2hd_ctrl_w, 0x00ff) AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff) - AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff) - AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffff) //ROM/RAM bank + AM_RANGE(0x0438, 0x043b) AM_READWRITE8(access_ctrl_r,access_ctrl_w,0xffff) + AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffff) //ROM/RAM bank AM_RANGE(0x04a0, 0x04af) AM_WRITE(egc_w) AM_RANGE(0x3fd8, 0x3fdf) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00) -// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffff) - AM_IMPORT_FROM(pc9801_io) + AM_IMPORT_FROM(pc9801_common_io) ADDRESS_MAP_END static ADDRESS_MAP_START( pc9801rs_map, AS_PROGRAM, 16, pc9801_state ) @@ -2273,13 +2141,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 16, pc9801_state ) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffff) AM_RANGE(0x0430, 0x0433) AM_READWRITE8(ide_ctrl_r, ide_ctrl_w, 0x00ff) AM_RANGE(0x0640, 0x064f) AM_READWRITE(ide_cs0_r, ide_cs0_w) AM_RANGE(0x0740, 0x074f) AM_READWRITE(ide_cs1_r, ide_cs1_w) AM_RANGE(0x1e8c, 0x1e8f) AM_NOP // temp AM_RANGE(0xbfd8, 0xbfdf) AM_WRITE8(pc9801rs_mouse_freq_w, 0xffff) - AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffff) + AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(midi_r, 0xffff) AM_IMPORT_FROM(pc9801ux_io) ADDRESS_MAP_END @@ -2355,7 +2222,7 @@ WRITE8_MEMBER(pc9801_state::pc9821_a0_w) pc9801rs_a0_w(space,offset,data); } -READ8_MEMBER(pc9801_state::pc9821_window_bank_r) +READ8_MEMBER(pc9801_state::window_bank_r) { if(offset == 1) return m_pc9821_window_bank & 0xfe; @@ -2363,7 +2230,7 @@ READ8_MEMBER(pc9801_state::pc9821_window_bank_r) return 0xff; } -WRITE8_MEMBER(pc9801_state::pc9821_window_bank_w) +WRITE8_MEMBER(pc9801_state::window_bank_w) { if(offset == 1) m_pc9821_window_bank = data & 0xfe; @@ -2427,13 +2294,13 @@ WRITE8_MEMBER(pc9801_state::sdip_b_w) logerror("SDIP area B write %02x %02x\n",offset,data); } -READ16_MEMBER(pc9801_state::pc9821_timestamp_r) +READ16_MEMBER(pc9801_state::timestamp_r) { return (m_maincpu->total_cycles() >> (16 * offset)); } /* basically a read-back of various registers */ -READ8_MEMBER(pc9801_state::pc9821_ext2_video_ff_r) +READ8_MEMBER(pc9801_state::ext2_video_ff_r) { UINT8 res; @@ -2449,7 +2316,7 @@ READ8_MEMBER(pc9801_state::pc9821_ext2_video_ff_r) return res; } -WRITE8_MEMBER(pc9801_state::pc9821_ext2_video_ff_w) +WRITE8_MEMBER(pc9801_state::ext2_video_ff_w) { m_ext2_ff = data; } @@ -2491,36 +2358,38 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) AM_RANGE(0x0030, 0x0037) AM_DEVREADWRITE8("ppi8255_sys", i8255_device, read, write, 0xff00ff00) //i8251 RS232c / i8255 system port AM_RANGE(0x0040, 0x0047) AM_DEVREADWRITE8("ppi8255_prn", i8255_device, read, write, 0x00ff00ff) AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE8("keyb", pc9801_kbd_device, rx_r, tx_w, 0xff00ff00) //i8255 printer port / i8251 keyboard - AM_RANGE(0x0050, 0x0053) AM_WRITE8(pc9801rs_nmi_w, 0xffffffff) - AM_RANGE(0x005c, 0x005f) AM_READ16(pc9821_timestamp_r,0xffffffff) AM_WRITENOP // artic + AM_RANGE(0x0050, 0x0053) AM_WRITE8(nmi_ctrl_w, 0x00ff00ff) + AM_RANGE(0x005c, 0x005f) AM_READ16(timestamp_r,0xffffffff) AM_WRITENOP // artic AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE8("upd7220_chr", upd7220_device, read, write, 0x00ff00ff) //upd7220 character ports / <undefined> AM_RANGE(0x0060, 0x0063) AM_READ8(unk_r, 0xff00ff00) // mouse related (unmapped checking for AT keyb controller\PS/2 mouse?) AM_RANGE(0x0064, 0x0067) AM_WRITE8(vrtc_clear_w, 0x000000ff) AM_RANGE(0x0068, 0x006b) AM_WRITE8(pc9821_video_ff_w, 0x00ff00ff) //mode FF / <undefined> AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8("pit8253", pit8253_device, read, write, 0xff00ff00) AM_RANGE(0x0070, 0x007f) AM_READWRITE8(grcg_r, grcg_w, 0x00ff00ff) //display registers "GRCG" / i8253 pit - AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) + AM_RANGE(0x0090, 0x0093) AM_DEVICE8("upd765_2hd", upd765a_device, map, 0x00ff00ff) + AM_RANGE(0x0094, 0x0097) AM_READWRITE8(fdc_2hd_ctrl_r, fdc_2hd_ctrl_w, 0x000000ff) AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9821_a0_r, pc9821_a0_w, 0xffffffff) //upd7220 bitmap ports / display registers // AM_RANGE(0x00b0, 0x00b3) PC9861k (serial port?) // AM_RANGE(0x00b9, 0x00b9) PC9861k // AM_RANGE(0x00bb, 0x00bb) PC9861k - AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffffffff) - AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r, pc9801rs_2hd_w, 0xffffffff) -// AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board + AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(fdc_mode_ctrl_r,fdc_mode_ctrl_w,0xffffffff) + AM_RANGE(0x00c8, 0x00cb) AM_DEVICE8("upd765_2hd", upd765a_device, map, 0x00ff00ff) + AM_RANGE(0x00cc, 0x00cf) AM_READWRITE8(fdc_2hd_ctrl_r, fdc_2hd_ctrl_w, 0x000000ff) + // AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(a20_ctrl_r, a20_ctrl_w, 0x00ff00ff) // AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r, pc9801_opn_w, 0xffffffff) //ym2203 opn / <undefined> // AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / <undefined> AM_RANGE(0x0430, 0x0433) AM_READWRITE8(ide_ctrl_r, ide_ctrl_w, 0x00ff00ff) - AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff) + AM_RANGE(0x0438, 0x043b) AM_READWRITE8(access_ctrl_r,access_ctrl_w,0xffffffff) // AM_RANGE(0x043d, 0x043d) ROM/RAM bank (NEC) AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w, 0xffffffff) //ROM/RAM bank (EPSON) - AM_RANGE(0x0460, 0x0463) AM_READWRITE8(pc9821_window_bank_r,pc9821_window_bank_w, 0xffffffff) + AM_RANGE(0x0460, 0x0463) AM_READWRITE8(window_bank_r,window_bank_w, 0xffffffff) AM_RANGE(0x04a0, 0x04af) AM_WRITE16(egc_w, 0xffffffff) // AM_RANGE(0x04be, 0x04be) FDC "RPM" register AM_RANGE(0x0640, 0x064f) AM_READWRITE16(ide_cs0_r, ide_cs0_w, 0xffffffff) AM_RANGE(0x0740, 0x074f) AM_READWRITE16(ide_cs1_r, ide_cs1_w, 0xffffffff) // AM_RANGE(0x08e0, 0x08ea) <undefined> / EMM SIO registers - AM_RANGE(0x09a0, 0x09a3) AM_READWRITE8(pc9821_ext2_video_ff_r, pc9821_ext2_video_ff_w, 0x000000ff) // GDC extended register r/w + AM_RANGE(0x09a0, 0x09a3) AM_READWRITE8(ext2_video_ff_r, ext2_video_ff_w, 0x000000ff) // GDC extended register r/w // AM_RANGE(0x09a8, 0x09a8) GDC 31KHz register r/w // AM_RANGE(0x0c07, 0x0c07) EPSON register w // AM_RANGE(0x0c03, 0x0c03) EPSON register 0 r @@ -2545,7 +2414,6 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) AM_RANGE(0x8d1c, 0x8d1f) AM_READWRITE8(sdip_9_r,sdip_9_w,0xffffffff) AM_RANGE(0x8e1c, 0x8e1f) AM_READWRITE8(sdip_a_r,sdip_a_w,0xffffffff) AM_RANGE(0x8f1c, 0x8f1f) AM_READWRITE8(sdip_b_r,sdip_b_w,0xffffffff) -// AM_RANGE(0xa460, 0xa463) AM_READWRITE8(pc9801_ext_opna_r, pc9801_ext_opna_w, 0xffffffff) // AM_RANGE(0xa460, 0xa46f) cs4231 PCM extended port / <undefined> // AM_RANGE(0xbfdb, 0xbfdb) mouse timing port // AM_RANGE(0xc0d0, 0xc0d3) MIDI port, option 0 / <undefined> @@ -2556,7 +2424,7 @@ static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state ) // AM_RANGE(0xd4d0, 0xd4d3) MIDI port, option 5 / <undefined> // AM_RANGE(0xd8d0, 0xd8d3) MIDI port, option 6 / <undefined> // AM_RANGE(0xdcd0, 0xdcd3) MIDI port, option 7 / <undefined> - AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(pc9801rs_midi_r, 0xffffffff) // MIDI port, option 8 / <undefined> + AM_RANGE(0xe0d0, 0xe0d3) AM_READ8(midi_r, 0xffffffff) // MIDI port, option 8 / <undefined> // AM_RANGE(0xe4d0, 0xe4d3) MIDI port, option 9 / <undefined> // AM_RANGE(0xe8d0, 0xe8d3) MIDI port, option A / <undefined> // AM_RANGE(0xecd0, 0xecd3) MIDI port, option B / <undefined> @@ -3070,7 +2938,7 @@ WRITE_LINE_MEMBER( pc9801_state::pc9801rs_fdc_drq ) m_dmac->dreq3_w(state ^ 1); } -UINT32 pc9801_state::pc9801_286_a20(bool state) +UINT32 pc9801_state::a20_286(bool state) { return (state ? 0xffffff : 0x0fffff); } @@ -3240,7 +3108,7 @@ void pc9801_state::device_reset_after_children() ide0->identify_device_buffer()[47] = 0; } -INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq) +INTERRUPT_GEN_MEMBER(pc9801_state::vrtc_irq) { m_pic1->ir2_w(1); m_vbirq->adjust(m_screen->time_until_vblank_end()); @@ -3408,7 +3276,7 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_CPU_ADD("maincpu", I8086, 5000000) //unknown clock MCFG_CPU_PROGRAM_MAP(pc9801_map) MCFG_CPU_IO_MAP(pc9801_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MCFG_FRAGMENT_ADD(pc9801_common) @@ -3442,7 +3310,7 @@ static MACHINE_CONFIG_DERIVED( pc9801vm, pc9801 ) MCFG_CPU_REPLACE("maincpu",V30,10000000) MCFG_CPU_PROGRAM_MAP(pc9801ux_map) MCFG_CPU_IO_MAP(pc9801ux_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801_common) MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801_common) @@ -3452,7 +3320,7 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) MCFG_CPU_ADD("maincpu", I386SX, MAIN_CLOCK_X1*8) // unknown clock. MCFG_CPU_PROGRAM_MAP(pc9801rs_map) MCFG_CPU_IO_MAP(pc9801rs_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MCFG_FRAGMENT_ADD(pc9801_common) @@ -3481,8 +3349,8 @@ static MACHINE_CONFIG_DERIVED( pc9801ux, pc9801rs ) MCFG_CPU_REPLACE("maincpu",I80286,10000000) MCFG_CPU_PROGRAM_MAP(pc9801ux_map) MCFG_CPU_IO_MAP(pc9801ux_io) - MCFG_80286_A20(pc9801_state, pc9801_286_a20) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_80286_A20(pc9801_state, a20_286) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) // MCFG_DEVICE_MODIFY("i8237", AM9157A, 10000000) // unknown clock MACHINE_CONFIG_END @@ -3491,7 +3359,7 @@ static MACHINE_CONFIG_DERIVED( pc9801bx2, pc9801rs ) MCFG_CPU_REPLACE("maincpu",I486,25000000) MCFG_CPU_PROGRAM_MAP(pc9821_map) MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9801bx2) @@ -3501,7 +3369,7 @@ static MACHINE_CONFIG_DERIVED( pc9821, pc9801rs ) MCFG_CPU_REPLACE("maincpu", I486, 16000000) // unknown clock MCFG_CPU_PROGRAM_MAP(pc9821_map) MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MCFG_DEVICE_MODIFY("pit8253") @@ -3524,7 +3392,7 @@ static MACHINE_CONFIG_DERIVED( pc9821ap2, pc9821) MCFG_CPU_REPLACE("maincpu", I486, 66666667) // unknown clock MCFG_CPU_PROGRAM_MAP(pc9821_map) MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821ap2) @@ -3534,7 +3402,7 @@ static MACHINE_CONFIG_DERIVED( pc9821v20, pc9821 ) MCFG_CPU_REPLACE("maincpu",PENTIUM,32000000) /* TODO: clock */ MCFG_CPU_PROGRAM_MAP(pc9821_map) MCFG_CPU_IO_MAP(pc9821_io) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, vrtc_irq) MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) MACHINE_CONFIG_END diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp index 8709a578991..711571ea3c8 100644 --- a/src/mame/drivers/rex6000.cpp +++ b/src/mame/drivers/rex6000.cpp @@ -29,6 +29,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "machine/rp5c01.h" +#include "machine/bankdev.h" #include "machine/ram.h" #include "machine/intelfsh.h" #include "imagedev/snapquik.h" @@ -46,14 +47,6 @@ #define IRQ_FLAG_IRQ1 0x40 #define IRQ_FLAG_EVENT 0x80 -//memory bank types -#define BANK_FLASH0_B0 0x00 -#define BANK_FLASH0_B1 0x01 -#define BANK_FLASH1_B0 0x02 -#define BANK_FLASH1_B1 0x03 -#define BANK_RAM 0x10 -#define BANK_UNKNOWN 0xff - #define TC8521_TAG "rtc" class rex6000_state : public driver_device @@ -63,13 +56,20 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ram(*this, RAM_TAG), - m_beep(*this, "beeper") + m_beep(*this, "beeper"), + m_bankdev0(*this, "bank0"), + m_bankdev1(*this, "bank1"), + m_flash0b(*this, "flash0b"), + m_nvram(*this, "nvram") { } required_device<cpu_device> m_maincpu; required_device<ram_device> m_ram; required_device<beep_device> m_beep; - fujitsu_29dl16x_device *m_flash[4]; + required_device<address_map_bank_device> m_bankdev0; + required_device<address_map_bank_device> m_bankdev1; + optional_device<intelfsh8_device> m_flash0b; + required_shared_ptr<UINT8> m_nvram; UINT8 m_bank[4]; UINT8 m_beep_io[5]; @@ -77,19 +77,12 @@ public: UINT8 m_touchscreen[0x10]; UINT8 m_lcd_enabled; UINT8 m_lcd_cmd; - UINT8 *m_ram_base; UINT8 m_irq_mask; UINT8 m_irq_flag; UINT8 m_port6; UINT8 m_beep_mode; - struct - { - UINT8 type; - UINT16 page; - } m_banks[2]; - virtual void machine_start() override; virtual void machine_reset() override; UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -108,14 +101,6 @@ public: DECLARE_WRITE8_MEMBER( touchscreen_w ); DECLARE_WRITE_LINE_MEMBER( alarm_irq ); - DECLARE_READ8_MEMBER( flash_0x0000_r ); - DECLARE_WRITE8_MEMBER( flash_0x0000_w ); - DECLARE_READ8_MEMBER( flash_0x8000_r ); - DECLARE_WRITE8_MEMBER( flash_0x8000_w ); - DECLARE_READ8_MEMBER( flash_0xa000_r ); - DECLARE_WRITE8_MEMBER( flash_0xa000_w ); - - UINT8 identify_bank_type(UINT32 bank); DECLARE_PALETTE_INIT(rex6000); DECLARE_INPUT_CHANGED_MEMBER(trigger_irq); TIMER_DEVICE_CALLBACK_MEMBER(irq_timer1); @@ -125,34 +110,6 @@ public: }; -UINT8 rex6000_state::identify_bank_type(UINT32 bank) -{ - if (bank < 0x080) - { - return BANK_FLASH0_B0; - } - else if (bank >= 0x080 && bank < 0x100) - { - return BANK_FLASH0_B1; - } - else if ((bank >= 0xb00 && bank < 0xb80) || (bank >= 0x600 && bank < 0x680)) - { - return BANK_FLASH1_B0; - } - else if ((bank >= 0xb80 && bank < 0xc00) || (bank >= 0x680 && bank < 0x700)) - { - return BANK_FLASH1_B1; - } - else if (bank >= 0x1000 && bank < 0x1004) - { - return BANK_RAM; - } - else - { - //logerror("%04x: unkonwn memory bank %x\n", m_maincpu->pc(), bank); - return BANK_UNKNOWN; - } -} READ8_MEMBER( rex6000_state::bankswitch_r ) { @@ -161,8 +118,6 @@ READ8_MEMBER( rex6000_state::bankswitch_r ) WRITE8_MEMBER( rex6000_state::bankswitch_w ) { - address_space& program = m_maincpu->space(AS_PROGRAM); - m_bank[offset&3] = data; switch (offset) @@ -171,39 +126,13 @@ WRITE8_MEMBER( rex6000_state::bankswitch_w ) case 1: //bank 1 high { //bank 1 start at 0x8000 - m_banks[0].page = (MAKE_BANK(m_bank[0], m_bank[1]&0x0f) + 4); - m_banks[0].type = identify_bank_type(m_banks[0].page); - - if (m_banks[0].type != BANK_UNKNOWN) - { - program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); - } - else - { - program.unmap_readwrite(0x8000, 0x9fff); - } - + m_bankdev0->set_bank(MAKE_BANK(m_bank[0], m_bank[1]) + 4); break; } case 2: //bank 2 low case 3: //bank 2 high { - m_banks[1].page = MAKE_BANK(m_bank[2], m_bank[3]&0x1f); - m_banks[1].type = identify_bank_type(m_banks[1].page); - - if (m_banks[1].type == BANK_RAM) - { - program.install_ram(0xa000, 0xbfff, m_ram_base + ((m_banks[1].page & 0x03)<<13)); - } - else if (m_banks[1].type != BANK_UNKNOWN) - { - program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); - } - else - { - program.unmap_readwrite(0xa000, 0xbfff); - } - + m_bankdev1->set_bank(MAKE_BANK(m_bank[2], m_bank[3])); break; } } @@ -362,42 +291,24 @@ WRITE8_MEMBER( rex6000_state::touchscreen_w ) m_touchscreen[offset&0x0f] = data; } -READ8_MEMBER( rex6000_state::flash_0x0000_r ) -{ - return m_flash[0]->read(offset); -} - -WRITE8_MEMBER( rex6000_state::flash_0x0000_w ) -{ - m_flash[0]->write(offset, data); -} - -READ8_MEMBER( rex6000_state::flash_0x8000_r ) -{ - return m_flash[m_banks[0].type]->read(((m_banks[0].page & 0x7f)<<13) | offset); -} - -WRITE8_MEMBER( rex6000_state::flash_0x8000_w ) -{ - m_flash[m_banks[0].type]->write(((m_banks[0].page & 0x7f)<<13) | offset, data); -} -READ8_MEMBER( rex6000_state::flash_0xa000_r ) -{ - return m_flash[m_banks[1].type]->read(((m_banks[1].page & 0x7f)<<13) | offset); -} +static ADDRESS_MAP_START(rex6000_banked_map, AS_PROGRAM, 8, rex6000_state) + AM_RANGE( 0x0000000, 0x00fffff ) AM_DEVREADWRITE("flash0a", intelfsh8_device, read, write) + AM_RANGE( 0x0100000, 0x01fffff ) AM_DEVREADWRITE("flash0b", intelfsh8_device, read, write) + AM_RANGE( 0x0c00000, 0x0cfffff ) AM_DEVREADWRITE("flash1a", intelfsh8_device, read, write) + AM_RANGE( 0x0d00000, 0x0dfffff ) AM_DEVREADWRITE("flash1b", intelfsh8_device, read, write) + AM_RANGE( 0x1600000, 0x16fffff ) AM_DEVREADWRITE("flash1a", intelfsh8_device, read, write) + AM_RANGE( 0x1700000, 0x17fffff ) AM_DEVREADWRITE("flash1b", intelfsh8_device, read, write) + AM_RANGE( 0x2000000, 0x2007fff ) AM_RAM AM_SHARE("nvram") +ADDRESS_MAP_END -WRITE8_MEMBER( rex6000_state::flash_0xa000_w ) -{ - m_flash[m_banks[1].type]->write(((m_banks[1].page & 0x7f)<<13) | offset, data); -} static ADDRESS_MAP_START(rex6000_mem, AS_PROGRAM, 8, rex6000_state) ADDRESS_MAP_UNMAP_HIGH - AM_RANGE( 0x0000, 0x7fff ) AM_READWRITE(flash_0x0000_r, flash_0x0000_w) - AM_RANGE( 0x8000, 0x9fff ) AM_READWRITE(flash_0x8000_r, flash_0x8000_w) - AM_RANGE( 0xa000, 0xbfff ) AM_READWRITE(flash_0xa000_r, flash_0xa000_w) + AM_RANGE( 0x0000, 0x7fff ) AM_DEVREADWRITE("flash0a", intelfsh8_device, read, write) + AM_RANGE( 0x8000, 0x9fff ) AM_DEVREADWRITE("bank0", address_map_bank_device, read8, write8) + AM_RANGE( 0xa000, 0xbfff ) AM_DEVREADWRITE("bank1", address_map_bank_device, read8, write8) AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("ram") //system RAM ADDRESS_MAP_END @@ -450,27 +361,11 @@ INPUT_PORTS_END void rex6000_state::machine_start() { - m_flash[0] = machine().device<fujitsu_29dl16x_device>("flash0a"); - m_flash[1] = machine().device<fujitsu_29dl16x_device>("flash0b"); - m_flash[2] = machine().device<fujitsu_29dl16x_device>("flash1a"); - m_flash[3] = machine().device<fujitsu_29dl16x_device>("flash1b"); - - m_ram_base = m_ram->pointer(); - membank("ram")->set_base(m_ram_base + 0x4000); + membank("ram")->set_base((UINT8*)m_nvram + 0x4000); } + void rex6000_state::machine_reset() { - address_space& program = m_maincpu->space(AS_PROGRAM); - - program.install_readwrite_handler(0x8000, 0x9fff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0x8000_r), this), write8_delegate(FUNC(rex6000_state::flash_0x8000_w), this)); - program.install_readwrite_handler(0xa000, 0xbfff, 0, 0, read8_delegate(FUNC(rex6000_state::flash_0xa000_r), this), write8_delegate(FUNC(rex6000_state::flash_0xa000_w), this)); - - m_banks[0].type = 0x04; - m_banks[0].type = 0; - m_banks[1].type = 0x00; - m_banks[1].type = 0; - - memset(m_ram_base, 0, m_ram->size()); memset(m_bank, 0, sizeof(m_bank)); memset(m_beep_io, 0, sizeof(m_beep_io)); memset(m_lcd_base, 0, sizeof(m_lcd_base)); @@ -485,25 +380,14 @@ void rex6000_state::machine_reset() UINT32 rex6000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT16 lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]&0x1f); - UINT8 mem_type = identify_bank_type(lcd_bank); + UINT16 lcd_bank = MAKE_BANK(m_lcd_base[0], m_lcd_base[1]); - if (m_lcd_enabled && mem_type != BANK_UNKNOWN) + if (m_lcd_enabled) { for (int y=0; y<120; y++) for (int x=0; x<30; x++) { - UINT8 data = 0; - - if (mem_type == BANK_RAM) - { - data = (m_ram_base + ((lcd_bank & 0x03)<<13))[y*30 + x]; - } - else - { - data = m_flash[mem_type]->space(0).read_byte(((lcd_bank & 0x7f)<<13) | (y*30 + x)); - } - + UINT8 data = m_bankdev0->space(AS_PROGRAM).read_byte((lcd_bank << 13) + y*30 + x); for (int b=0; b<8; b++) { @@ -570,7 +454,7 @@ PALETTE_INIT_MEMBER(rex6000_state, rex6000) QUICKLOAD_LOAD_MEMBER( rex6000_state,rex6000) { static const char magic[] = "ApplicationName:Addin"; - address_space& flash = machine().device("flash0b")->memory().space(0); + address_space& flash = m_flash0b->space(0); UINT32 img_start = 0; dynamic_buffer data(image.length()); @@ -661,6 +545,18 @@ static MACHINE_CONFIG_START( rex6000, rex6000_state ) MCFG_PALETTE_INIT_OWNER(rex6000_state, rex6000) MCFG_GFXDECODE_ADD("gfxdecode", "palette", rex6000) + MCFG_DEVICE_ADD("bank0", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(rex6000_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) + + MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_PROGRAM_MAP(rex6000_banked_map) + MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) + MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8) + MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000) + /* quickload */ MCFG_QUICKLOAD_ADD("quickload", rex6000_state, rex6000, "rex,ds2", 0) diff --git a/src/mame/includes/avigo.h b/src/mame/includes/avigo.h index 6ef813906b6..b7556bb23d4 100644 --- a/src/mame/includes/avigo.h +++ b/src/mame/includes/avigo.h @@ -14,6 +14,7 @@ #include "machine/rp5c01.h" #include "machine/ins8250.h" #include "machine/intelfsh.h" +#include "machine/bankdev.h" #include "machine/nvram.h" #include "sound/speaker.h" #include "machine/ram.h" @@ -36,7 +37,11 @@ public: m_speaker(*this, "speaker"), m_uart(*this, "ns16550"), m_serport(*this, "serport"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_bankdev1(*this, "bank0"), + m_bankdev2(*this, "bank1"), + m_flash1(*this, "flash1"), + m_nvram(*this, "nvram") { } required_device<cpu_device> m_maincpu; @@ -45,25 +50,20 @@ public: required_device<ns16550_device> m_uart; required_device<rs232_port_device> m_serport; required_device<palette_device> m_palette; + required_device<address_map_bank_device> m_bankdev1; + required_device<address_map_bank_device> m_bankdev2; + required_device<intelfsh8_device> m_flash1; + required_shared_ptr<UINT8> m_nvram; // defined in drivers/avigo.c virtual void machine_start() override; virtual void machine_reset() override; - void postload(); - void refresh_memory(UINT8 bank, UINT8 chip_select); void refresh_ints(); void nvram_init(nvram_device &nvram, void *base, size_t size); DECLARE_WRITE_LINE_MEMBER( tc8521_alarm_int ); DECLARE_WRITE_LINE_MEMBER( com_interrupt ); - DECLARE_READ8_MEMBER(flash_0x0000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x0000_write_handler); - DECLARE_READ8_MEMBER(flash_0x4000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x4000_write_handler); - DECLARE_READ8_MEMBER(flash_0x8000_read_handler); - DECLARE_WRITE8_MEMBER(flash_0x8000_write_handler); - DECLARE_READ8_MEMBER(key_data_read_r); DECLARE_WRITE8_MEMBER(set_key_line_w); DECLARE_WRITE8_MEMBER(port2_w); @@ -99,14 +99,10 @@ public: UINT8 m_bank1_l; UINT8 m_bank1_h; UINT8 m_ad_control_status; - intelfsh8_device * m_flashes[3]; - int m_flash_at_0x4000; - int m_flash_at_0x8000; UINT16 m_ad_value; UINT8 * m_video_memory; UINT8 m_screen_column; UINT8 m_warm_start; - UINT8 * m_ram_base; DECLARE_PALETTE_INIT(avigo); TIMER_DEVICE_CALLBACK_MEMBER(avigo_scan_timer); TIMER_DEVICE_CALLBACK_MEMBER(avigo_1hz_timer); diff --git a/src/mame/includes/goldstar.h b/src/mame/includes/goldstar.h index 2eb7e47df05..55c51ab406e 100644 --- a/src/mame/includes/goldstar.h +++ b/src/mame/includes/goldstar.h @@ -122,6 +122,7 @@ public: DECLARE_DRIVER_INIT(rp35); DECLARE_DRIVER_INIT(rp36); DECLARE_DRIVER_INIT(rp36c3); + DECLARE_DRIVER_INIT(rp96sub); UINT32 screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); diff --git a/src/mame/layout/esq2by16.lay b/src/mame/layout/esq2by16.lay new file mode 100644 index 00000000000..1861b335476 --- /dev/null +++ b/src/mame/layout/esq2by16.lay @@ -0,0 +1,980 @@ +<?xml version="1.0"?> +<!-- esq2by16.lay --> +<!-- 2016-01-30: Initial version. [Parduz from R. Belmont / VFDGen 0.1] --> + +<mamelayout version="2"> + + <element name="rLeds"> + <rect state ="0"> + <bounds x="0" y="0" width="5" height="2" /> + <color red="0.2" green="0.2" blue="0.0" /> + </rect> + <rect state ="1"> + <bounds x="0" y="0" width="5" height="2" /> + <color red="1.0" green="1.0" blue="0.0" /> + </rect> + <rect state ="2"> + <bounds x="0" y="0" width="5" height="2" /> + <color red="0.5" green="0.5" blue="0.0" /> + </rect> + <rect state ="3"> + <bounds x="0" y="0" width="5" height="2" /> + <color red="0.0" green="1.0" blue="1.0" /> + </rect> + </element> + + <element name="background"> + <rect> + <bounds left="0" top="0" right="1" bottom="1" /> + <color red="0.3" green="0.3" blue="0.5" /> + </rect> + </element> + + + <element name="Page1"> + <dotmatrix5dot> + <color red="0.0" green="1.0" blue="1.0" /> + </dotmatrix5dot> + </element> + + <element name="Page2"> + <dotmatrix5dot> + <color red="0.0" green="1.0" blue="0.0" /> + </dotmatrix5dot> + </element> + + <element name="Page3"> + <dotmatrix5dot> + <color red="1.0" green="1.0" blue="0.0" /> + </dotmatrix5dot> + </element> + + <element name="Page4"> + <dotmatrix5dot> + <color red="0.0" green="0.0" blue="1.0" /> + </dotmatrix5dot> + </element> + + <view name="Default Layout"> + <!-- Background --> + <backdrop element="background"> + <bounds left="0" top="0" right="300" bottom="120" /> + </backdrop> + <bezel name="rLed_0" element="rLeds"> <bounds x="200" y="0" width="5" height="3" /> </bezel> + <bezel name="rLed_8" element="rLeds"> <bounds x="200" y="20" width="5" height="3" /> </bezel> + <bezel name="rLed_9" element="rLeds"> <bounds x="240" y="0" width="5" height="3" /> </bezel> + <bezel name="rLed_1" element="rLeds"> <bounds x="240" y="20" width="5" height="3" /> </bezel> + <bezel name="rLed_2" element="rLeds"> <bounds x="260" y="00" width="5" height="3" /> </bezel> + <bezel name="rLed_3" element="rLeds"> <bounds x="270" y="00" width="5" height="3" /> </bezel> + <bezel name="rLed_4" element="rLeds"> <bounds x="280" y="00" width="5" height="3" /> </bezel> + <bezel name="rLed_5" element="rLeds"> <bounds x="290" y="00" width="5" height="3" /> </bezel> + <bezel name="rLed_10" element="rLeds"> <bounds x="260" y="10" width="5" height="3" /> </bezel> + <bezel name="rLed_11" element="rLeds"> <bounds x="270" y="10" width="5" height="3" /> </bezel> + <bezel name="rLed_12" element="rLeds"> <bounds x="280" y="10" width="5" height="3" /> </bezel> + <bezel name="rLed_13" element="rLeds"> <bounds x="290" y="10" width="5" height="3" /> </bezel> + + <bezel name="rLed_6" element="rLeds"> <bounds x="260" y="20" width="5" height="3" /> </bezel> + <bezel name="rLed_7" element="rLeds"> <bounds x="270" y="20" width="5" height="3" /> </bezel> + <bezel name="rLed_14" element="rLeds"> <bounds x="280" y="20" width="5" height="3" /> </bezel> + <bezel name="rLed_15" element="rLeds"> <bounds x="290" y="20" width="5" height="3" /> </bezel> + <bezel name="pg_3000" element="Page3" state="0"> <bounds x=" 0" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3001" element="Page3" state="0"> <bounds x=" 0" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3002" element="Page3" state="0"> <bounds x=" 0" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3003" element="Page3" state="0"> <bounds x=" 0" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3004" element="Page3" state="0"> <bounds x=" 0" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3005" element="Page3" state="0"> <bounds x=" 0" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3006" element="Page3" state="0"> <bounds x=" 0" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3007" element="Page3" state="0"> <bounds x=" 6" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3008" element="Page3" state="0"> <bounds x=" 6" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3009" element="Page3" state="0"> <bounds x=" 6" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3010" element="Page3" state="0"> <bounds x=" 6" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3011" element="Page3" state="0"> <bounds x=" 6" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3012" element="Page3" state="0"> <bounds x=" 6" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3013" element="Page3" state="0"> <bounds x=" 6" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3014" element="Page3" state="0"> <bounds x=" 12" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3015" element="Page3" state="0"> <bounds x=" 12" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3016" element="Page3" state="0"> <bounds x=" 12" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3017" element="Page3" state="0"> <bounds x=" 12" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3018" element="Page3" state="0"> <bounds x=" 12" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3019" element="Page3" state="0"> <bounds x=" 12" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3020" element="Page3" state="0"> <bounds x=" 12" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3021" element="Page3" state="0"> <bounds x=" 18" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3022" element="Page3" state="0"> <bounds x=" 18" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3023" element="Page3" state="0"> <bounds x=" 18" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3024" element="Page3" state="0"> <bounds x=" 18" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3025" element="Page3" state="0"> <bounds x=" 18" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3026" element="Page3" state="0"> <bounds x=" 18" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3027" element="Page3" state="0"> <bounds x=" 18" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3028" element="Page3" state="0"> <bounds x=" 24" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3029" element="Page3" state="0"> <bounds x=" 24" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3030" element="Page3" state="0"> <bounds x=" 24" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3031" element="Page3" state="0"> <bounds x=" 24" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3032" element="Page3" state="0"> <bounds x=" 24" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3033" element="Page3" state="0"> <bounds x=" 24" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3034" element="Page3" state="0"> <bounds x=" 24" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3035" element="Page3" state="0"> <bounds x=" 30" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3036" element="Page3" state="0"> <bounds x=" 30" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3037" element="Page3" state="0"> <bounds x=" 30" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3038" element="Page3" state="0"> <bounds x=" 30" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3039" element="Page3" state="0"> <bounds x=" 30" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3040" element="Page3" state="0"> <bounds x=" 30" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3041" element="Page3" state="0"> <bounds x=" 30" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3042" element="Page3" state="0"> <bounds x=" 36" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3043" element="Page3" state="0"> <bounds x=" 36" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3044" element="Page3" state="0"> <bounds x=" 36" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3045" element="Page3" state="0"> <bounds x=" 36" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3046" element="Page3" state="0"> <bounds x=" 36" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3047" element="Page3" state="0"> <bounds x=" 36" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3048" element="Page3" state="0"> <bounds x=" 36" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3049" element="Page3" state="0"> <bounds x=" 42" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3050" element="Page3" state="0"> <bounds x=" 42" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3051" element="Page3" state="0"> <bounds x=" 42" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3052" element="Page3" state="0"> <bounds x=" 42" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3053" element="Page3" state="0"> <bounds x=" 42" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3054" element="Page3" state="0"> <bounds x=" 42" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3055" element="Page3" state="0"> <bounds x=" 42" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3056" element="Page3" state="0"> <bounds x=" 48" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3057" element="Page3" state="0"> <bounds x=" 48" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3058" element="Page3" state="0"> <bounds x=" 48" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3059" element="Page3" state="0"> <bounds x=" 48" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3060" element="Page3" state="0"> <bounds x=" 48" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3061" element="Page3" state="0"> <bounds x=" 48" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3062" element="Page3" state="0"> <bounds x=" 48" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3063" element="Page3" state="0"> <bounds x=" 54" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3064" element="Page3" state="0"> <bounds x=" 54" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3065" element="Page3" state="0"> <bounds x=" 54" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3066" element="Page3" state="0"> <bounds x=" 54" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3067" element="Page3" state="0"> <bounds x=" 54" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3068" element="Page3" state="0"> <bounds x=" 54" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3069" element="Page3" state="0"> <bounds x=" 54" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3070" element="Page3" state="0"> <bounds x=" 60" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3071" element="Page3" state="0"> <bounds x=" 60" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3072" element="Page3" state="0"> <bounds x=" 60" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3073" element="Page3" state="0"> <bounds x=" 60" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3074" element="Page3" state="0"> <bounds x=" 60" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3075" element="Page3" state="0"> <bounds x=" 60" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3076" element="Page3" state="0"> <bounds x=" 60" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3077" element="Page3" state="0"> <bounds x=" 66" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3078" element="Page3" state="0"> <bounds x=" 66" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3079" element="Page3" state="0"> <bounds x=" 66" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3080" element="Page3" state="0"> <bounds x=" 66" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3081" element="Page3" state="0"> <bounds x=" 66" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3082" element="Page3" state="0"> <bounds x=" 66" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3083" element="Page3" state="0"> <bounds x=" 66" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3084" element="Page3" state="0"> <bounds x=" 72" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3085" element="Page3" state="0"> <bounds x=" 72" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3086" element="Page3" state="0"> <bounds x=" 72" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3087" element="Page3" state="0"> <bounds x=" 72" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3088" element="Page3" state="0"> <bounds x=" 72" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3089" element="Page3" state="0"> <bounds x=" 72" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3090" element="Page3" state="0"> <bounds x=" 72" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3091" element="Page3" state="0"> <bounds x=" 78" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3092" element="Page3" state="0"> <bounds x=" 78" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3093" element="Page3" state="0"> <bounds x=" 78" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3094" element="Page3" state="0"> <bounds x=" 78" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3095" element="Page3" state="0"> <bounds x=" 78" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3096" element="Page3" state="0"> <bounds x=" 78" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3097" element="Page3" state="0"> <bounds x=" 78" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3098" element="Page3" state="0"> <bounds x=" 84" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3099" element="Page3" state="0"> <bounds x=" 84" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3100" element="Page3" state="0"> <bounds x=" 84" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3101" element="Page3" state="0"> <bounds x=" 84" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3102" element="Page3" state="0"> <bounds x=" 84" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3103" element="Page3" state="0"> <bounds x=" 84" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3104" element="Page3" state="0"> <bounds x=" 84" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3105" element="Page3" state="0"> <bounds x=" 90" y=" 0" width="5" height="1" /> </bezel> + <bezel name="pg_3106" element="Page3" state="0"> <bounds x=" 90" y=" 1" width="5" height="1" /> </bezel> + <bezel name="pg_3107" element="Page3" state="0"> <bounds x=" 90" y=" 2" width="5" height="1" /> </bezel> + <bezel name="pg_3108" element="Page3" state="0"> <bounds x=" 90" y=" 3" width="5" height="1" /> </bezel> + <bezel name="pg_3109" element="Page3" state="0"> <bounds x=" 90" y=" 4" width="5" height="1" /> </bezel> + <bezel name="pg_3110" element="Page3" state="0"> <bounds x=" 90" y=" 5" width="5" height="1" /> </bezel> + <bezel name="pg_3111" element="Page3" state="0"> <bounds x=" 90" y=" 6" width="5" height="1" /> </bezel> + <bezel name="pg_3112" element="Page3" state="0"> <bounds x=" 0" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3113" element="Page3" state="0"> <bounds x=" 0" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3114" element="Page3" state="0"> <bounds x=" 0" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3115" element="Page3" state="0"> <bounds x=" 0" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3116" element="Page3" state="0"> <bounds x=" 0" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3117" element="Page3" state="0"> <bounds x=" 0" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3118" element="Page3" state="0"> <bounds x=" 0" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3119" element="Page3" state="0"> <bounds x=" 6" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3120" element="Page3" state="0"> <bounds x=" 6" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3121" element="Page3" state="0"> <bounds x=" 6" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3122" element="Page3" state="0"> <bounds x=" 6" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3123" element="Page3" state="0"> <bounds x=" 6" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3124" element="Page3" state="0"> <bounds x=" 6" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3125" element="Page3" state="0"> <bounds x=" 6" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3126" element="Page3" state="0"> <bounds x=" 12" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3127" element="Page3" state="0"> <bounds x=" 12" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3128" element="Page3" state="0"> <bounds x=" 12" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3129" element="Page3" state="0"> <bounds x=" 12" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3130" element="Page3" state="0"> <bounds x=" 12" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3131" element="Page3" state="0"> <bounds x=" 12" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3132" element="Page3" state="0"> <bounds x=" 12" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3133" element="Page3" state="0"> <bounds x=" 18" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3134" element="Page3" state="0"> <bounds x=" 18" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3135" element="Page3" state="0"> <bounds x=" 18" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3136" element="Page3" state="0"> <bounds x=" 18" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3137" element="Page3" state="0"> <bounds x=" 18" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3138" element="Page3" state="0"> <bounds x=" 18" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3139" element="Page3" state="0"> <bounds x=" 18" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3140" element="Page3" state="0"> <bounds x=" 24" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3141" element="Page3" state="0"> <bounds x=" 24" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3142" element="Page3" state="0"> <bounds x=" 24" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3143" element="Page3" state="0"> <bounds x=" 24" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3144" element="Page3" state="0"> <bounds x=" 24" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3145" element="Page3" state="0"> <bounds x=" 24" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3146" element="Page3" state="0"> <bounds x=" 24" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3147" element="Page3" state="0"> <bounds x=" 30" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3148" element="Page3" state="0"> <bounds x=" 30" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3149" element="Page3" state="0"> <bounds x=" 30" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3150" element="Page3" state="0"> <bounds x=" 30" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3151" element="Page3" state="0"> <bounds x=" 30" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3152" element="Page3" state="0"> <bounds x=" 30" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3153" element="Page3" state="0"> <bounds x=" 30" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3154" element="Page3" state="0"> <bounds x=" 36" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3155" element="Page3" state="0"> <bounds x=" 36" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3156" element="Page3" state="0"> <bounds x=" 36" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3157" element="Page3" state="0"> <bounds x=" 36" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3158" element="Page3" state="0"> <bounds x=" 36" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3159" element="Page3" state="0"> <bounds x=" 36" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3160" element="Page3" state="0"> <bounds x=" 36" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3161" element="Page3" state="0"> <bounds x=" 42" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3162" element="Page3" state="0"> <bounds x=" 42" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3163" element="Page3" state="0"> <bounds x=" 42" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3164" element="Page3" state="0"> <bounds x=" 42" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3165" element="Page3" state="0"> <bounds x=" 42" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3166" element="Page3" state="0"> <bounds x=" 42" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3167" element="Page3" state="0"> <bounds x=" 42" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3168" element="Page3" state="0"> <bounds x=" 48" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3169" element="Page3" state="0"> <bounds x=" 48" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3170" element="Page3" state="0"> <bounds x=" 48" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3171" element="Page3" state="0"> <bounds x=" 48" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3172" element="Page3" state="0"> <bounds x=" 48" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3173" element="Page3" state="0"> <bounds x=" 48" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3174" element="Page3" state="0"> <bounds x=" 48" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3175" element="Page3" state="0"> <bounds x=" 54" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3176" element="Page3" state="0"> <bounds x=" 54" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3177" element="Page3" state="0"> <bounds x=" 54" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3178" element="Page3" state="0"> <bounds x=" 54" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3179" element="Page3" state="0"> <bounds x=" 54" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3180" element="Page3" state="0"> <bounds x=" 54" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3181" element="Page3" state="0"> <bounds x=" 54" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3182" element="Page3" state="0"> <bounds x=" 60" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3183" element="Page3" state="0"> <bounds x=" 60" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3184" element="Page3" state="0"> <bounds x=" 60" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3185" element="Page3" state="0"> <bounds x=" 60" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3186" element="Page3" state="0"> <bounds x=" 60" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3187" element="Page3" state="0"> <bounds x=" 60" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3188" element="Page3" state="0"> <bounds x=" 60" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3189" element="Page3" state="0"> <bounds x=" 66" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3190" element="Page3" state="0"> <bounds x=" 66" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3191" element="Page3" state="0"> <bounds x=" 66" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3192" element="Page3" state="0"> <bounds x=" 66" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3193" element="Page3" state="0"> <bounds x=" 66" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3194" element="Page3" state="0"> <bounds x=" 66" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3195" element="Page3" state="0"> <bounds x=" 66" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3196" element="Page3" state="0"> <bounds x=" 72" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3197" element="Page3" state="0"> <bounds x=" 72" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3198" element="Page3" state="0"> <bounds x=" 72" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3199" element="Page3" state="0"> <bounds x=" 72" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3200" element="Page3" state="0"> <bounds x=" 72" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3201" element="Page3" state="0"> <bounds x=" 72" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3202" element="Page3" state="0"> <bounds x=" 72" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3203" element="Page3" state="0"> <bounds x=" 78" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3204" element="Page3" state="0"> <bounds x=" 78" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3205" element="Page3" state="0"> <bounds x=" 78" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3206" element="Page3" state="0"> <bounds x=" 78" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3207" element="Page3" state="0"> <bounds x=" 78" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3208" element="Page3" state="0"> <bounds x=" 78" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3209" element="Page3" state="0"> <bounds x=" 78" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3210" element="Page3" state="0"> <bounds x=" 84" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3211" element="Page3" state="0"> <bounds x=" 84" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3212" element="Page3" state="0"> <bounds x=" 84" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3213" element="Page3" state="0"> <bounds x=" 84" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3214" element="Page3" state="0"> <bounds x=" 84" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3215" element="Page3" state="0"> <bounds x=" 84" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3216" element="Page3" state="0"> <bounds x=" 84" y=" 16" width="5" height="1" /> </bezel> + <bezel name="pg_3217" element="Page3" state="0"> <bounds x=" 90" y=" 10" width="5" height="1" /> </bezel> + <bezel name="pg_3218" element="Page3" state="0"> <bounds x=" 90" y=" 11" width="5" height="1" /> </bezel> + <bezel name="pg_3219" element="Page3" state="0"> <bounds x=" 90" y=" 12" width="5" height="1" /> </bezel> + <bezel name="pg_3220" element="Page3" state="0"> <bounds x=" 90" y=" 13" width="5" height="1" /> </bezel> + <bezel name="pg_3221" element="Page3" state="0"> <bounds x=" 90" y=" 14" width="5" height="1" /> </bezel> + <bezel name="pg_3222" element="Page3" state="0"> <bounds x=" 90" y=" 15" width="5" height="1" /> </bezel> + <bezel name="pg_3223" element="Page3" state="0"> <bounds x=" 90" y=" 16" width="5" height="1" /> </bezel> + + <bezel name="pg_2000" element="Page2" state="0"> <bounds x=" 0" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2001" element="Page2" state="0"> <bounds x=" 0" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2002" element="Page2" state="0"> <bounds x=" 0" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2003" element="Page2" state="0"> <bounds x=" 0" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2004" element="Page2" state="0"> <bounds x=" 0" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2005" element="Page2" state="0"> <bounds x=" 0" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2006" element="Page2" state="0"> <bounds x=" 0" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2007" element="Page2" state="0"> <bounds x=" 6" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2008" element="Page2" state="0"> <bounds x=" 6" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2009" element="Page2" state="0"> <bounds x=" 6" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2010" element="Page2" state="0"> <bounds x=" 6" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2011" element="Page2" state="0"> <bounds x=" 6" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2012" element="Page2" state="0"> <bounds x=" 6" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2013" element="Page2" state="0"> <bounds x=" 6" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2014" element="Page2" state="0"> <bounds x=" 12" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2015" element="Page2" state="0"> <bounds x=" 12" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2016" element="Page2" state="0"> <bounds x=" 12" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2017" element="Page2" state="0"> <bounds x=" 12" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2018" element="Page2" state="0"> <bounds x=" 12" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2019" element="Page2" state="0"> <bounds x=" 12" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2020" element="Page2" state="0"> <bounds x=" 12" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2021" element="Page2" state="0"> <bounds x=" 18" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2022" element="Page2" state="0"> <bounds x=" 18" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2023" element="Page2" state="0"> <bounds x=" 18" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2024" element="Page2" state="0"> <bounds x=" 18" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2025" element="Page2" state="0"> <bounds x=" 18" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2026" element="Page2" state="0"> <bounds x=" 18" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2027" element="Page2" state="0"> <bounds x=" 18" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2028" element="Page2" state="0"> <bounds x=" 24" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2029" element="Page2" state="0"> <bounds x=" 24" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2030" element="Page2" state="0"> <bounds x=" 24" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2031" element="Page2" state="0"> <bounds x=" 24" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2032" element="Page2" state="0"> <bounds x=" 24" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2033" element="Page2" state="0"> <bounds x=" 24" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2034" element="Page2" state="0"> <bounds x=" 24" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2035" element="Page2" state="0"> <bounds x=" 30" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2036" element="Page2" state="0"> <bounds x=" 30" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2037" element="Page2" state="0"> <bounds x=" 30" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2038" element="Page2" state="0"> <bounds x=" 30" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2039" element="Page2" state="0"> <bounds x=" 30" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2040" element="Page2" state="0"> <bounds x=" 30" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2041" element="Page2" state="0"> <bounds x=" 30" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2042" element="Page2" state="0"> <bounds x=" 36" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2043" element="Page2" state="0"> <bounds x=" 36" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2044" element="Page2" state="0"> <bounds x=" 36" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2045" element="Page2" state="0"> <bounds x=" 36" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2046" element="Page2" state="0"> <bounds x=" 36" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2047" element="Page2" state="0"> <bounds x=" 36" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2048" element="Page2" state="0"> <bounds x=" 36" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2049" element="Page2" state="0"> <bounds x=" 42" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2050" element="Page2" state="0"> <bounds x=" 42" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2051" element="Page2" state="0"> <bounds x=" 42" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2052" element="Page2" state="0"> <bounds x=" 42" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2053" element="Page2" state="0"> <bounds x=" 42" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2054" element="Page2" state="0"> <bounds x=" 42" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2055" element="Page2" state="0"> <bounds x=" 42" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2056" element="Page2" state="0"> <bounds x=" 48" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2057" element="Page2" state="0"> <bounds x=" 48" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2058" element="Page2" state="0"> <bounds x=" 48" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2059" element="Page2" state="0"> <bounds x=" 48" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2060" element="Page2" state="0"> <bounds x=" 48" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2061" element="Page2" state="0"> <bounds x=" 48" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2062" element="Page2" state="0"> <bounds x=" 48" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2063" element="Page2" state="0"> <bounds x=" 54" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2064" element="Page2" state="0"> <bounds x=" 54" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2065" element="Page2" state="0"> <bounds x=" 54" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2066" element="Page2" state="0"> <bounds x=" 54" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2067" element="Page2" state="0"> <bounds x=" 54" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2068" element="Page2" state="0"> <bounds x=" 54" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2069" element="Page2" state="0"> <bounds x=" 54" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2070" element="Page2" state="0"> <bounds x=" 60" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2071" element="Page2" state="0"> <bounds x=" 60" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2072" element="Page2" state="0"> <bounds x=" 60" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2073" element="Page2" state="0"> <bounds x=" 60" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2074" element="Page2" state="0"> <bounds x=" 60" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2075" element="Page2" state="0"> <bounds x=" 60" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2076" element="Page2" state="0"> <bounds x=" 60" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2077" element="Page2" state="0"> <bounds x=" 66" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2078" element="Page2" state="0"> <bounds x=" 66" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2079" element="Page2" state="0"> <bounds x=" 66" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2080" element="Page2" state="0"> <bounds x=" 66" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2081" element="Page2" state="0"> <bounds x=" 66" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2082" element="Page2" state="0"> <bounds x=" 66" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2083" element="Page2" state="0"> <bounds x=" 66" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2084" element="Page2" state="0"> <bounds x=" 72" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2085" element="Page2" state="0"> <bounds x=" 72" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2086" element="Page2" state="0"> <bounds x=" 72" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2087" element="Page2" state="0"> <bounds x=" 72" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2088" element="Page2" state="0"> <bounds x=" 72" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2089" element="Page2" state="0"> <bounds x=" 72" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2090" element="Page2" state="0"> <bounds x=" 72" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2091" element="Page2" state="0"> <bounds x=" 78" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2092" element="Page2" state="0"> <bounds x=" 78" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2093" element="Page2" state="0"> <bounds x=" 78" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2094" element="Page2" state="0"> <bounds x=" 78" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2095" element="Page2" state="0"> <bounds x=" 78" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2096" element="Page2" state="0"> <bounds x=" 78" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2097" element="Page2" state="0"> <bounds x=" 78" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2098" element="Page2" state="0"> <bounds x=" 84" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2099" element="Page2" state="0"> <bounds x=" 84" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2100" element="Page2" state="0"> <bounds x=" 84" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2101" element="Page2" state="0"> <bounds x=" 84" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2102" element="Page2" state="0"> <bounds x=" 84" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2103" element="Page2" state="0"> <bounds x=" 84" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2104" element="Page2" state="0"> <bounds x=" 84" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2105" element="Page2" state="0"> <bounds x=" 90" y=" 20" width="5" height="1" /> </bezel> + <bezel name="pg_2106" element="Page2" state="0"> <bounds x=" 90" y=" 21" width="5" height="1" /> </bezel> + <bezel name="pg_2107" element="Page2" state="0"> <bounds x=" 90" y=" 22" width="5" height="1" /> </bezel> + <bezel name="pg_2108" element="Page2" state="0"> <bounds x=" 90" y=" 23" width="5" height="1" /> </bezel> + <bezel name="pg_2109" element="Page2" state="0"> <bounds x=" 90" y=" 24" width="5" height="1" /> </bezel> + <bezel name="pg_2110" element="Page2" state="0"> <bounds x=" 90" y=" 25" width="5" height="1" /> </bezel> + <bezel name="pg_2111" element="Page2" state="0"> <bounds x=" 90" y=" 26" width="5" height="1" /> </bezel> + <bezel name="pg_2112" element="Page2" state="0"> <bounds x=" 0" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2113" element="Page2" state="0"> <bounds x=" 0" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2114" element="Page2" state="0"> <bounds x=" 0" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2115" element="Page2" state="0"> <bounds x=" 0" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2116" element="Page2" state="0"> <bounds x=" 0" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2117" element="Page2" state="0"> <bounds x=" 0" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2118" element="Page2" state="0"> <bounds x=" 0" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2119" element="Page2" state="0"> <bounds x=" 6" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2120" element="Page2" state="0"> <bounds x=" 6" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2121" element="Page2" state="0"> <bounds x=" 6" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2122" element="Page2" state="0"> <bounds x=" 6" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2123" element="Page2" state="0"> <bounds x=" 6" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2124" element="Page2" state="0"> <bounds x=" 6" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2125" element="Page2" state="0"> <bounds x=" 6" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2126" element="Page2" state="0"> <bounds x=" 12" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2127" element="Page2" state="0"> <bounds x=" 12" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2128" element="Page2" state="0"> <bounds x=" 12" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2129" element="Page2" state="0"> <bounds x=" 12" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2130" element="Page2" state="0"> <bounds x=" 12" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2131" element="Page2" state="0"> <bounds x=" 12" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2132" element="Page2" state="0"> <bounds x=" 12" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2133" element="Page2" state="0"> <bounds x=" 18" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2134" element="Page2" state="0"> <bounds x=" 18" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2135" element="Page2" state="0"> <bounds x=" 18" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2136" element="Page2" state="0"> <bounds x=" 18" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2137" element="Page2" state="0"> <bounds x=" 18" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2138" element="Page2" state="0"> <bounds x=" 18" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2139" element="Page2" state="0"> <bounds x=" 18" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2140" element="Page2" state="0"> <bounds x=" 24" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2141" element="Page2" state="0"> <bounds x=" 24" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2142" element="Page2" state="0"> <bounds x=" 24" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2143" element="Page2" state="0"> <bounds x=" 24" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2144" element="Page2" state="0"> <bounds x=" 24" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2145" element="Page2" state="0"> <bounds x=" 24" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2146" element="Page2" state="0"> <bounds x=" 24" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2147" element="Page2" state="0"> <bounds x=" 30" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2148" element="Page2" state="0"> <bounds x=" 30" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2149" element="Page2" state="0"> <bounds x=" 30" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2150" element="Page2" state="0"> <bounds x=" 30" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2151" element="Page2" state="0"> <bounds x=" 30" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2152" element="Page2" state="0"> <bounds x=" 30" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2153" element="Page2" state="0"> <bounds x=" 30" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2154" element="Page2" state="0"> <bounds x=" 36" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2155" element="Page2" state="0"> <bounds x=" 36" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2156" element="Page2" state="0"> <bounds x=" 36" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2157" element="Page2" state="0"> <bounds x=" 36" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2158" element="Page2" state="0"> <bounds x=" 36" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2159" element="Page2" state="0"> <bounds x=" 36" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2160" element="Page2" state="0"> <bounds x=" 36" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2161" element="Page2" state="0"> <bounds x=" 42" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2162" element="Page2" state="0"> <bounds x=" 42" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2163" element="Page2" state="0"> <bounds x=" 42" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2164" element="Page2" state="0"> <bounds x=" 42" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2165" element="Page2" state="0"> <bounds x=" 42" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2166" element="Page2" state="0"> <bounds x=" 42" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2167" element="Page2" state="0"> <bounds x=" 42" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2168" element="Page2" state="0"> <bounds x=" 48" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2169" element="Page2" state="0"> <bounds x=" 48" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2170" element="Page2" state="0"> <bounds x=" 48" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2171" element="Page2" state="0"> <bounds x=" 48" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2172" element="Page2" state="0"> <bounds x=" 48" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2173" element="Page2" state="0"> <bounds x=" 48" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2174" element="Page2" state="0"> <bounds x=" 48" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2175" element="Page2" state="0"> <bounds x=" 54" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2176" element="Page2" state="0"> <bounds x=" 54" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2177" element="Page2" state="0"> <bounds x=" 54" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2178" element="Page2" state="0"> <bounds x=" 54" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2179" element="Page2" state="0"> <bounds x=" 54" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2180" element="Page2" state="0"> <bounds x=" 54" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2181" element="Page2" state="0"> <bounds x=" 54" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2182" element="Page2" state="0"> <bounds x=" 60" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2183" element="Page2" state="0"> <bounds x=" 60" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2184" element="Page2" state="0"> <bounds x=" 60" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2185" element="Page2" state="0"> <bounds x=" 60" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2186" element="Page2" state="0"> <bounds x=" 60" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2187" element="Page2" state="0"> <bounds x=" 60" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2188" element="Page2" state="0"> <bounds x=" 60" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2189" element="Page2" state="0"> <bounds x=" 66" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2190" element="Page2" state="0"> <bounds x=" 66" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2191" element="Page2" state="0"> <bounds x=" 66" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2192" element="Page2" state="0"> <bounds x=" 66" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2193" element="Page2" state="0"> <bounds x=" 66" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2194" element="Page2" state="0"> <bounds x=" 66" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2195" element="Page2" state="0"> <bounds x=" 66" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2196" element="Page2" state="0"> <bounds x=" 72" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2197" element="Page2" state="0"> <bounds x=" 72" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2198" element="Page2" state="0"> <bounds x=" 72" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2199" element="Page2" state="0"> <bounds x=" 72" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2200" element="Page2" state="0"> <bounds x=" 72" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2201" element="Page2" state="0"> <bounds x=" 72" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2202" element="Page2" state="0"> <bounds x=" 72" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2203" element="Page2" state="0"> <bounds x=" 78" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2204" element="Page2" state="0"> <bounds x=" 78" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2205" element="Page2" state="0"> <bounds x=" 78" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2206" element="Page2" state="0"> <bounds x=" 78" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2207" element="Page2" state="0"> <bounds x=" 78" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2208" element="Page2" state="0"> <bounds x=" 78" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2209" element="Page2" state="0"> <bounds x=" 78" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2210" element="Page2" state="0"> <bounds x=" 84" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2211" element="Page2" state="0"> <bounds x=" 84" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2212" element="Page2" state="0"> <bounds x=" 84" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2213" element="Page2" state="0"> <bounds x=" 84" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2214" element="Page2" state="0"> <bounds x=" 84" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2215" element="Page2" state="0"> <bounds x=" 84" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2216" element="Page2" state="0"> <bounds x=" 84" y=" 36" width="5" height="1" /> </bezel> + <bezel name="pg_2217" element="Page2" state="0"> <bounds x=" 90" y=" 30" width="5" height="1" /> </bezel> + <bezel name="pg_2218" element="Page2" state="0"> <bounds x=" 90" y=" 31" width="5" height="1" /> </bezel> + <bezel name="pg_2219" element="Page2" state="0"> <bounds x=" 90" y=" 32" width="5" height="1" /> </bezel> + <bezel name="pg_2220" element="Page2" state="0"> <bounds x=" 90" y=" 33" width="5" height="1" /> </bezel> + <bezel name="pg_2221" element="Page2" state="0"> <bounds x=" 90" y=" 34" width="5" height="1" /> </bezel> + <bezel name="pg_2222" element="Page2" state="0"> <bounds x=" 90" y=" 35" width="5" height="1" /> </bezel> + <bezel name="pg_2223" element="Page2" state="0"> <bounds x=" 90" y=" 36" width="5" height="1" /> </bezel> + + <bezel name="pg_1000" element="Page1" state="0"> <bounds x=" 0" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1001" element="Page1" state="0"> <bounds x=" 0" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1002" element="Page1" state="0"> <bounds x=" 0" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1003" element="Page1" state="0"> <bounds x=" 0" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1004" element="Page1" state="0"> <bounds x=" 0" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1005" element="Page1" state="0"> <bounds x=" 0" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1006" element="Page1" state="0"> <bounds x=" 0" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1007" element="Page1" state="0"> <bounds x=" 6" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1008" element="Page1" state="0"> <bounds x=" 6" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1009" element="Page1" state="0"> <bounds x=" 6" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1010" element="Page1" state="0"> <bounds x=" 6" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1011" element="Page1" state="0"> <bounds x=" 6" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1012" element="Page1" state="0"> <bounds x=" 6" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1013" element="Page1" state="0"> <bounds x=" 6" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1014" element="Page1" state="0"> <bounds x=" 12" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1015" element="Page1" state="0"> <bounds x=" 12" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1016" element="Page1" state="0"> <bounds x=" 12" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1017" element="Page1" state="0"> <bounds x=" 12" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1018" element="Page1" state="0"> <bounds x=" 12" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1019" element="Page1" state="0"> <bounds x=" 12" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1020" element="Page1" state="0"> <bounds x=" 12" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1021" element="Page1" state="0"> <bounds x=" 18" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1022" element="Page1" state="0"> <bounds x=" 18" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1023" element="Page1" state="0"> <bounds x=" 18" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1024" element="Page1" state="0"> <bounds x=" 18" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1025" element="Page1" state="0"> <bounds x=" 18" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1026" element="Page1" state="0"> <bounds x=" 18" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1027" element="Page1" state="0"> <bounds x=" 18" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1028" element="Page1" state="0"> <bounds x=" 24" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1029" element="Page1" state="0"> <bounds x=" 24" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1030" element="Page1" state="0"> <bounds x=" 24" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1031" element="Page1" state="0"> <bounds x=" 24" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1032" element="Page1" state="0"> <bounds x=" 24" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1033" element="Page1" state="0"> <bounds x=" 24" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1034" element="Page1" state="0"> <bounds x=" 24" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1035" element="Page1" state="0"> <bounds x=" 30" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1036" element="Page1" state="0"> <bounds x=" 30" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1037" element="Page1" state="0"> <bounds x=" 30" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1038" element="Page1" state="0"> <bounds x=" 30" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1039" element="Page1" state="0"> <bounds x=" 30" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1040" element="Page1" state="0"> <bounds x=" 30" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1041" element="Page1" state="0"> <bounds x=" 30" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1042" element="Page1" state="0"> <bounds x=" 36" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1043" element="Page1" state="0"> <bounds x=" 36" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1044" element="Page1" state="0"> <bounds x=" 36" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1045" element="Page1" state="0"> <bounds x=" 36" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1046" element="Page1" state="0"> <bounds x=" 36" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1047" element="Page1" state="0"> <bounds x=" 36" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1048" element="Page1" state="0"> <bounds x=" 36" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1049" element="Page1" state="0"> <bounds x=" 42" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1050" element="Page1" state="0"> <bounds x=" 42" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1051" element="Page1" state="0"> <bounds x=" 42" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1052" element="Page1" state="0"> <bounds x=" 42" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1053" element="Page1" state="0"> <bounds x=" 42" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1054" element="Page1" state="0"> <bounds x=" 42" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1055" element="Page1" state="0"> <bounds x=" 42" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1056" element="Page1" state="0"> <bounds x=" 48" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1057" element="Page1" state="0"> <bounds x=" 48" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1058" element="Page1" state="0"> <bounds x=" 48" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1059" element="Page1" state="0"> <bounds x=" 48" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1060" element="Page1" state="0"> <bounds x=" 48" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1061" element="Page1" state="0"> <bounds x=" 48" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1062" element="Page1" state="0"> <bounds x=" 48" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1063" element="Page1" state="0"> <bounds x=" 54" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1064" element="Page1" state="0"> <bounds x=" 54" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1065" element="Page1" state="0"> <bounds x=" 54" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1066" element="Page1" state="0"> <bounds x=" 54" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1067" element="Page1" state="0"> <bounds x=" 54" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1068" element="Page1" state="0"> <bounds x=" 54" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1069" element="Page1" state="0"> <bounds x=" 54" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1070" element="Page1" state="0"> <bounds x=" 60" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1071" element="Page1" state="0"> <bounds x=" 60" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1072" element="Page1" state="0"> <bounds x=" 60" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1073" element="Page1" state="0"> <bounds x=" 60" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1074" element="Page1" state="0"> <bounds x=" 60" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1075" element="Page1" state="0"> <bounds x=" 60" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1076" element="Page1" state="0"> <bounds x=" 60" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1077" element="Page1" state="0"> <bounds x=" 66" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1078" element="Page1" state="0"> <bounds x=" 66" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1079" element="Page1" state="0"> <bounds x=" 66" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1080" element="Page1" state="0"> <bounds x=" 66" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1081" element="Page1" state="0"> <bounds x=" 66" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1082" element="Page1" state="0"> <bounds x=" 66" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1083" element="Page1" state="0"> <bounds x=" 66" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1084" element="Page1" state="0"> <bounds x=" 72" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1085" element="Page1" state="0"> <bounds x=" 72" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1086" element="Page1" state="0"> <bounds x=" 72" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1087" element="Page1" state="0"> <bounds x=" 72" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1088" element="Page1" state="0"> <bounds x=" 72" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1089" element="Page1" state="0"> <bounds x=" 72" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1090" element="Page1" state="0"> <bounds x=" 72" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1091" element="Page1" state="0"> <bounds x=" 78" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1092" element="Page1" state="0"> <bounds x=" 78" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1093" element="Page1" state="0"> <bounds x=" 78" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1094" element="Page1" state="0"> <bounds x=" 78" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1095" element="Page1" state="0"> <bounds x=" 78" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1096" element="Page1" state="0"> <bounds x=" 78" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1097" element="Page1" state="0"> <bounds x=" 78" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1098" element="Page1" state="0"> <bounds x=" 84" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1099" element="Page1" state="0"> <bounds x=" 84" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1100" element="Page1" state="0"> <bounds x=" 84" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1101" element="Page1" state="0"> <bounds x=" 84" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1102" element="Page1" state="0"> <bounds x=" 84" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1103" element="Page1" state="0"> <bounds x=" 84" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1104" element="Page1" state="0"> <bounds x=" 84" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1105" element="Page1" state="0"> <bounds x=" 90" y=" 40" width="5" height="1" /> </bezel> + <bezel name="pg_1106" element="Page1" state="0"> <bounds x=" 90" y=" 41" width="5" height="1" /> </bezel> + <bezel name="pg_1107" element="Page1" state="0"> <bounds x=" 90" y=" 42" width="5" height="1" /> </bezel> + <bezel name="pg_1108" element="Page1" state="0"> <bounds x=" 90" y=" 43" width="5" height="1" /> </bezel> + <bezel name="pg_1109" element="Page1" state="0"> <bounds x=" 90" y=" 44" width="5" height="1" /> </bezel> + <bezel name="pg_1110" element="Page1" state="0"> <bounds x=" 90" y=" 45" width="5" height="1" /> </bezel> + <bezel name="pg_1111" element="Page1" state="0"> <bounds x=" 90" y=" 46" width="5" height="1" /> </bezel> + <bezel name="pg_1112" element="Page1" state="0"> <bounds x=" 0" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1113" element="Page1" state="0"> <bounds x=" 0" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1114" element="Page1" state="0"> <bounds x=" 0" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1115" element="Page1" state="0"> <bounds x=" 0" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1116" element="Page1" state="0"> <bounds x=" 0" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1117" element="Page1" state="0"> <bounds x=" 0" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1118" element="Page1" state="0"> <bounds x=" 0" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1119" element="Page1" state="0"> <bounds x=" 6" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1120" element="Page1" state="0"> <bounds x=" 6" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1121" element="Page1" state="0"> <bounds x=" 6" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1122" element="Page1" state="0"> <bounds x=" 6" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1123" element="Page1" state="0"> <bounds x=" 6" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1124" element="Page1" state="0"> <bounds x=" 6" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1125" element="Page1" state="0"> <bounds x=" 6" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1126" element="Page1" state="0"> <bounds x=" 12" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1127" element="Page1" state="0"> <bounds x=" 12" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1128" element="Page1" state="0"> <bounds x=" 12" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1129" element="Page1" state="0"> <bounds x=" 12" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1130" element="Page1" state="0"> <bounds x=" 12" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1131" element="Page1" state="0"> <bounds x=" 12" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1132" element="Page1" state="0"> <bounds x=" 12" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1133" element="Page1" state="0"> <bounds x=" 18" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1134" element="Page1" state="0"> <bounds x=" 18" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1135" element="Page1" state="0"> <bounds x=" 18" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1136" element="Page1" state="0"> <bounds x=" 18" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1137" element="Page1" state="0"> <bounds x=" 18" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1138" element="Page1" state="0"> <bounds x=" 18" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1139" element="Page1" state="0"> <bounds x=" 18" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1140" element="Page1" state="0"> <bounds x=" 24" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1141" element="Page1" state="0"> <bounds x=" 24" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1142" element="Page1" state="0"> <bounds x=" 24" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1143" element="Page1" state="0"> <bounds x=" 24" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1144" element="Page1" state="0"> <bounds x=" 24" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1145" element="Page1" state="0"> <bounds x=" 24" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1146" element="Page1" state="0"> <bounds x=" 24" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1147" element="Page1" state="0"> <bounds x=" 30" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1148" element="Page1" state="0"> <bounds x=" 30" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1149" element="Page1" state="0"> <bounds x=" 30" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1150" element="Page1" state="0"> <bounds x=" 30" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1151" element="Page1" state="0"> <bounds x=" 30" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1152" element="Page1" state="0"> <bounds x=" 30" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1153" element="Page1" state="0"> <bounds x=" 30" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1154" element="Page1" state="0"> <bounds x=" 36" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1155" element="Page1" state="0"> <bounds x=" 36" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1156" element="Page1" state="0"> <bounds x=" 36" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1157" element="Page1" state="0"> <bounds x=" 36" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1158" element="Page1" state="0"> <bounds x=" 36" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1159" element="Page1" state="0"> <bounds x=" 36" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1160" element="Page1" state="0"> <bounds x=" 36" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1161" element="Page1" state="0"> <bounds x=" 42" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1162" element="Page1" state="0"> <bounds x=" 42" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1163" element="Page1" state="0"> <bounds x=" 42" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1164" element="Page1" state="0"> <bounds x=" 42" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1165" element="Page1" state="0"> <bounds x=" 42" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1166" element="Page1" state="0"> <bounds x=" 42" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1167" element="Page1" state="0"> <bounds x=" 42" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1168" element="Page1" state="0"> <bounds x=" 48" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1169" element="Page1" state="0"> <bounds x=" 48" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1170" element="Page1" state="0"> <bounds x=" 48" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1171" element="Page1" state="0"> <bounds x=" 48" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1172" element="Page1" state="0"> <bounds x=" 48" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1173" element="Page1" state="0"> <bounds x=" 48" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1174" element="Page1" state="0"> <bounds x=" 48" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1175" element="Page1" state="0"> <bounds x=" 54" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1176" element="Page1" state="0"> <bounds x=" 54" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1177" element="Page1" state="0"> <bounds x=" 54" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1178" element="Page1" state="0"> <bounds x=" 54" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1179" element="Page1" state="0"> <bounds x=" 54" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1180" element="Page1" state="0"> <bounds x=" 54" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1181" element="Page1" state="0"> <bounds x=" 54" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1182" element="Page1" state="0"> <bounds x=" 60" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1183" element="Page1" state="0"> <bounds x=" 60" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1184" element="Page1" state="0"> <bounds x=" 60" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1185" element="Page1" state="0"> <bounds x=" 60" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1186" element="Page1" state="0"> <bounds x=" 60" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1187" element="Page1" state="0"> <bounds x=" 60" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1188" element="Page1" state="0"> <bounds x=" 60" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1189" element="Page1" state="0"> <bounds x=" 66" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1190" element="Page1" state="0"> <bounds x=" 66" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1191" element="Page1" state="0"> <bounds x=" 66" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1192" element="Page1" state="0"> <bounds x=" 66" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1193" element="Page1" state="0"> <bounds x=" 66" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1194" element="Page1" state="0"> <bounds x=" 66" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1195" element="Page1" state="0"> <bounds x=" 66" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1196" element="Page1" state="0"> <bounds x=" 72" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1197" element="Page1" state="0"> <bounds x=" 72" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1198" element="Page1" state="0"> <bounds x=" 72" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1199" element="Page1" state="0"> <bounds x=" 72" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1200" element="Page1" state="0"> <bounds x=" 72" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1201" element="Page1" state="0"> <bounds x=" 72" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1202" element="Page1" state="0"> <bounds x=" 72" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1203" element="Page1" state="0"> <bounds x=" 78" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1204" element="Page1" state="0"> <bounds x=" 78" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1205" element="Page1" state="0"> <bounds x=" 78" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1206" element="Page1" state="0"> <bounds x=" 78" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1207" element="Page1" state="0"> <bounds x=" 78" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1208" element="Page1" state="0"> <bounds x=" 78" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1209" element="Page1" state="0"> <bounds x=" 78" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1210" element="Page1" state="0"> <bounds x=" 84" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1211" element="Page1" state="0"> <bounds x=" 84" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1212" element="Page1" state="0"> <bounds x=" 84" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1213" element="Page1" state="0"> <bounds x=" 84" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1214" element="Page1" state="0"> <bounds x=" 84" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1215" element="Page1" state="0"> <bounds x=" 84" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1216" element="Page1" state="0"> <bounds x=" 84" y=" 56" width="5" height="1" /> </bezel> + <bezel name="pg_1217" element="Page1" state="0"> <bounds x=" 90" y=" 50" width="5" height="1" /> </bezel> + <bezel name="pg_1218" element="Page1" state="0"> <bounds x=" 90" y=" 51" width="5" height="1" /> </bezel> + <bezel name="pg_1219" element="Page1" state="0"> <bounds x=" 90" y=" 52" width="5" height="1" /> </bezel> + <bezel name="pg_1220" element="Page1" state="0"> <bounds x=" 90" y=" 53" width="5" height="1" /> </bezel> + <bezel name="pg_1221" element="Page1" state="0"> <bounds x=" 90" y=" 54" width="5" height="1" /> </bezel> + <bezel name="pg_1222" element="Page1" state="0"> <bounds x=" 90" y=" 55" width="5" height="1" /> </bezel> + <bezel name="pg_1223" element="Page1" state="0"> <bounds x=" 90" y=" 56" width="5" height="1" /> </bezel> + + <bezel name="pg_4000" element="Page4" state="0"> <bounds x=" 0" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4001" element="Page4" state="0"> <bounds x=" 0" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4002" element="Page4" state="0"> <bounds x=" 0" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4003" element="Page4" state="0"> <bounds x=" 0" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4004" element="Page4" state="0"> <bounds x=" 0" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4005" element="Page4" state="0"> <bounds x=" 0" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4006" element="Page4" state="0"> <bounds x=" 0" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4007" element="Page4" state="0"> <bounds x=" 6" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4008" element="Page4" state="0"> <bounds x=" 6" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4009" element="Page4" state="0"> <bounds x=" 6" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4010" element="Page4" state="0"> <bounds x=" 6" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4011" element="Page4" state="0"> <bounds x=" 6" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4012" element="Page4" state="0"> <bounds x=" 6" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4013" element="Page4" state="0"> <bounds x=" 6" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4014" element="Page4" state="0"> <bounds x=" 12" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4015" element="Page4" state="0"> <bounds x=" 12" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4016" element="Page4" state="0"> <bounds x=" 12" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4017" element="Page4" state="0"> <bounds x=" 12" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4018" element="Page4" state="0"> <bounds x=" 12" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4019" element="Page4" state="0"> <bounds x=" 12" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4020" element="Page4" state="0"> <bounds x=" 12" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4021" element="Page4" state="0"> <bounds x=" 18" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4022" element="Page4" state="0"> <bounds x=" 18" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4023" element="Page4" state="0"> <bounds x=" 18" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4024" element="Page4" state="0"> <bounds x=" 18" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4025" element="Page4" state="0"> <bounds x=" 18" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4026" element="Page4" state="0"> <bounds x=" 18" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4027" element="Page4" state="0"> <bounds x=" 18" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4028" element="Page4" state="0"> <bounds x=" 24" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4029" element="Page4" state="0"> <bounds x=" 24" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4030" element="Page4" state="0"> <bounds x=" 24" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4031" element="Page4" state="0"> <bounds x=" 24" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4032" element="Page4" state="0"> <bounds x=" 24" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4033" element="Page4" state="0"> <bounds x=" 24" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4034" element="Page4" state="0"> <bounds x=" 24" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4035" element="Page4" state="0"> <bounds x=" 30" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4036" element="Page4" state="0"> <bounds x=" 30" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4037" element="Page4" state="0"> <bounds x=" 30" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4038" element="Page4" state="0"> <bounds x=" 30" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4039" element="Page4" state="0"> <bounds x=" 30" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4040" element="Page4" state="0"> <bounds x=" 30" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4041" element="Page4" state="0"> <bounds x=" 30" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4042" element="Page4" state="0"> <bounds x=" 36" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4043" element="Page4" state="0"> <bounds x=" 36" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4044" element="Page4" state="0"> <bounds x=" 36" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4045" element="Page4" state="0"> <bounds x=" 36" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4046" element="Page4" state="0"> <bounds x=" 36" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4047" element="Page4" state="0"> <bounds x=" 36" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4048" element="Page4" state="0"> <bounds x=" 36" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4049" element="Page4" state="0"> <bounds x=" 42" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4050" element="Page4" state="0"> <bounds x=" 42" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4051" element="Page4" state="0"> <bounds x=" 42" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4052" element="Page4" state="0"> <bounds x=" 42" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4053" element="Page4" state="0"> <bounds x=" 42" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4054" element="Page4" state="0"> <bounds x=" 42" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4055" element="Page4" state="0"> <bounds x=" 42" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4056" element="Page4" state="0"> <bounds x=" 48" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4057" element="Page4" state="0"> <bounds x=" 48" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4058" element="Page4" state="0"> <bounds x=" 48" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4059" element="Page4" state="0"> <bounds x=" 48" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4060" element="Page4" state="0"> <bounds x=" 48" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4061" element="Page4" state="0"> <bounds x=" 48" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4062" element="Page4" state="0"> <bounds x=" 48" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4063" element="Page4" state="0"> <bounds x=" 54" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4064" element="Page4" state="0"> <bounds x=" 54" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4065" element="Page4" state="0"> <bounds x=" 54" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4066" element="Page4" state="0"> <bounds x=" 54" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4067" element="Page4" state="0"> <bounds x=" 54" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4068" element="Page4" state="0"> <bounds x=" 54" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4069" element="Page4" state="0"> <bounds x=" 54" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4070" element="Page4" state="0"> <bounds x=" 60" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4071" element="Page4" state="0"> <bounds x=" 60" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4072" element="Page4" state="0"> <bounds x=" 60" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4073" element="Page4" state="0"> <bounds x=" 60" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4074" element="Page4" state="0"> <bounds x=" 60" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4075" element="Page4" state="0"> <bounds x=" 60" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4076" element="Page4" state="0"> <bounds x=" 60" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4077" element="Page4" state="0"> <bounds x=" 66" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4078" element="Page4" state="0"> <bounds x=" 66" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4079" element="Page4" state="0"> <bounds x=" 66" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4080" element="Page4" state="0"> <bounds x=" 66" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4081" element="Page4" state="0"> <bounds x=" 66" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4082" element="Page4" state="0"> <bounds x=" 66" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4083" element="Page4" state="0"> <bounds x=" 66" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4084" element="Page4" state="0"> <bounds x=" 72" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4085" element="Page4" state="0"> <bounds x=" 72" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4086" element="Page4" state="0"> <bounds x=" 72" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4087" element="Page4" state="0"> <bounds x=" 72" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4088" element="Page4" state="0"> <bounds x=" 72" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4089" element="Page4" state="0"> <bounds x=" 72" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4090" element="Page4" state="0"> <bounds x=" 72" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4091" element="Page4" state="0"> <bounds x=" 78" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4092" element="Page4" state="0"> <bounds x=" 78" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4093" element="Page4" state="0"> <bounds x=" 78" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4094" element="Page4" state="0"> <bounds x=" 78" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4095" element="Page4" state="0"> <bounds x=" 78" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4096" element="Page4" state="0"> <bounds x=" 78" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4097" element="Page4" state="0"> <bounds x=" 78" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4098" element="Page4" state="0"> <bounds x=" 84" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4099" element="Page4" state="0"> <bounds x=" 84" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4100" element="Page4" state="0"> <bounds x=" 84" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4101" element="Page4" state="0"> <bounds x=" 84" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4102" element="Page4" state="0"> <bounds x=" 84" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4103" element="Page4" state="0"> <bounds x=" 84" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4104" element="Page4" state="0"> <bounds x=" 84" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4105" element="Page4" state="0"> <bounds x=" 90" y=" 80" width="5" height="1" /> </bezel> + <bezel name="pg_4106" element="Page4" state="0"> <bounds x=" 90" y=" 81" width="5" height="1" /> </bezel> + <bezel name="pg_4107" element="Page4" state="0"> <bounds x=" 90" y=" 82" width="5" height="1" /> </bezel> + <bezel name="pg_4108" element="Page4" state="0"> <bounds x=" 90" y=" 83" width="5" height="1" /> </bezel> + <bezel name="pg_4109" element="Page4" state="0"> <bounds x=" 90" y=" 84" width="5" height="1" /> </bezel> + <bezel name="pg_4110" element="Page4" state="0"> <bounds x=" 90" y=" 85" width="5" height="1" /> </bezel> + <bezel name="pg_4111" element="Page4" state="0"> <bounds x=" 90" y=" 86" width="5" height="1" /> </bezel> + <bezel name="pg_4112" element="Page4" state="0"> <bounds x=" 0" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4113" element="Page4" state="0"> <bounds x=" 0" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4114" element="Page4" state="0"> <bounds x=" 0" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4115" element="Page4" state="0"> <bounds x=" 0" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4116" element="Page4" state="0"> <bounds x=" 0" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4117" element="Page4" state="0"> <bounds x=" 0" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4118" element="Page4" state="0"> <bounds x=" 0" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4119" element="Page4" state="0"> <bounds x=" 6" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4120" element="Page4" state="0"> <bounds x=" 6" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4121" element="Page4" state="0"> <bounds x=" 6" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4122" element="Page4" state="0"> <bounds x=" 6" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4123" element="Page4" state="0"> <bounds x=" 6" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4124" element="Page4" state="0"> <bounds x=" 6" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4125" element="Page4" state="0"> <bounds x=" 6" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4126" element="Page4" state="0"> <bounds x=" 12" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4127" element="Page4" state="0"> <bounds x=" 12" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4128" element="Page4" state="0"> <bounds x=" 12" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4129" element="Page4" state="0"> <bounds x=" 12" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4130" element="Page4" state="0"> <bounds x=" 12" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4131" element="Page4" state="0"> <bounds x=" 12" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4132" element="Page4" state="0"> <bounds x=" 12" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4133" element="Page4" state="0"> <bounds x=" 18" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4134" element="Page4" state="0"> <bounds x=" 18" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4135" element="Page4" state="0"> <bounds x=" 18" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4136" element="Page4" state="0"> <bounds x=" 18" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4137" element="Page4" state="0"> <bounds x=" 18" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4138" element="Page4" state="0"> <bounds x=" 18" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4139" element="Page4" state="0"> <bounds x=" 18" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4140" element="Page4" state="0"> <bounds x=" 24" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4141" element="Page4" state="0"> <bounds x=" 24" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4142" element="Page4" state="0"> <bounds x=" 24" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4143" element="Page4" state="0"> <bounds x=" 24" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4144" element="Page4" state="0"> <bounds x=" 24" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4145" element="Page4" state="0"> <bounds x=" 24" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4146" element="Page4" state="0"> <bounds x=" 24" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4147" element="Page4" state="0"> <bounds x=" 30" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4148" element="Page4" state="0"> <bounds x=" 30" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4149" element="Page4" state="0"> <bounds x=" 30" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4150" element="Page4" state="0"> <bounds x=" 30" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4151" element="Page4" state="0"> <bounds x=" 30" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4152" element="Page4" state="0"> <bounds x=" 30" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4153" element="Page4" state="0"> <bounds x=" 30" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4154" element="Page4" state="0"> <bounds x=" 36" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4155" element="Page4" state="0"> <bounds x=" 36" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4156" element="Page4" state="0"> <bounds x=" 36" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4157" element="Page4" state="0"> <bounds x=" 36" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4158" element="Page4" state="0"> <bounds x=" 36" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4159" element="Page4" state="0"> <bounds x=" 36" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4160" element="Page4" state="0"> <bounds x=" 36" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4161" element="Page4" state="0"> <bounds x=" 42" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4162" element="Page4" state="0"> <bounds x=" 42" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4163" element="Page4" state="0"> <bounds x=" 42" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4164" element="Page4" state="0"> <bounds x=" 42" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4165" element="Page4" state="0"> <bounds x=" 42" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4166" element="Page4" state="0"> <bounds x=" 42" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4167" element="Page4" state="0"> <bounds x=" 42" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4168" element="Page4" state="0"> <bounds x=" 48" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4169" element="Page4" state="0"> <bounds x=" 48" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4170" element="Page4" state="0"> <bounds x=" 48" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4171" element="Page4" state="0"> <bounds x=" 48" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4172" element="Page4" state="0"> <bounds x=" 48" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4173" element="Page4" state="0"> <bounds x=" 48" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4174" element="Page4" state="0"> <bounds x=" 48" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4175" element="Page4" state="0"> <bounds x=" 54" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4176" element="Page4" state="0"> <bounds x=" 54" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4177" element="Page4" state="0"> <bounds x=" 54" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4178" element="Page4" state="0"> <bounds x=" 54" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4179" element="Page4" state="0"> <bounds x=" 54" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4180" element="Page4" state="0"> <bounds x=" 54" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4181" element="Page4" state="0"> <bounds x=" 54" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4182" element="Page4" state="0"> <bounds x=" 60" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4183" element="Page4" state="0"> <bounds x=" 60" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4184" element="Page4" state="0"> <bounds x=" 60" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4185" element="Page4" state="0"> <bounds x=" 60" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4186" element="Page4" state="0"> <bounds x=" 60" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4187" element="Page4" state="0"> <bounds x=" 60" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4188" element="Page4" state="0"> <bounds x=" 60" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4189" element="Page4" state="0"> <bounds x=" 66" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4190" element="Page4" state="0"> <bounds x=" 66" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4191" element="Page4" state="0"> <bounds x=" 66" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4192" element="Page4" state="0"> <bounds x=" 66" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4193" element="Page4" state="0"> <bounds x=" 66" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4194" element="Page4" state="0"> <bounds x=" 66" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4195" element="Page4" state="0"> <bounds x=" 66" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4196" element="Page4" state="0"> <bounds x=" 72" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4197" element="Page4" state="0"> <bounds x=" 72" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4198" element="Page4" state="0"> <bounds x=" 72" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4199" element="Page4" state="0"> <bounds x=" 72" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4200" element="Page4" state="0"> <bounds x=" 72" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4201" element="Page4" state="0"> <bounds x=" 72" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4202" element="Page4" state="0"> <bounds x=" 72" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4203" element="Page4" state="0"> <bounds x=" 78" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4204" element="Page4" state="0"> <bounds x=" 78" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4205" element="Page4" state="0"> <bounds x=" 78" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4206" element="Page4" state="0"> <bounds x=" 78" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4207" element="Page4" state="0"> <bounds x=" 78" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4208" element="Page4" state="0"> <bounds x=" 78" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4209" element="Page4" state="0"> <bounds x=" 78" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4210" element="Page4" state="0"> <bounds x=" 84" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4211" element="Page4" state="0"> <bounds x=" 84" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4212" element="Page4" state="0"> <bounds x=" 84" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4213" element="Page4" state="0"> <bounds x=" 84" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4214" element="Page4" state="0"> <bounds x=" 84" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4215" element="Page4" state="0"> <bounds x=" 84" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4216" element="Page4" state="0"> <bounds x=" 84" y=" 96" width="5" height="1" /> </bezel> + <bezel name="pg_4217" element="Page4" state="0"> <bounds x=" 90" y=" 90" width="5" height="1" /> </bezel> + <bezel name="pg_4218" element="Page4" state="0"> <bounds x=" 90" y=" 91" width="5" height="1" /> </bezel> + <bezel name="pg_4219" element="Page4" state="0"> <bounds x=" 90" y=" 92" width="5" height="1" /> </bezel> + <bezel name="pg_4220" element="Page4" state="0"> <bounds x=" 90" y=" 93" width="5" height="1" /> </bezel> + <bezel name="pg_4221" element="Page4" state="0"> <bounds x=" 90" y=" 94" width="5" height="1" /> </bezel> + <bezel name="pg_4222" element="Page4" state="0"> <bounds x=" 90" y=" 95" width="5" height="1" /> </bezel> + <bezel name="pg_4223" element="Page4" state="0"> <bounds x=" 90" y=" 96" width="5" height="1" /> </bezel> + </view> +</mamelayout> diff --git a/src/mame/machine/esqlcd.cpp b/src/mame/machine/esqlcd.cpp new file mode 100644 index 00000000000..e9b23fa2685 --- /dev/null +++ b/src/mame/machine/esqlcd.cpp @@ -0,0 +1,403 @@ +// license:BSD-3-Clause +// copyright-holders:Parduz +/* + Ensoniq LCD dotmatrix Displays + derived by Parduz from the VFD Emulation by R. Belmont +*/ +#include "esqlcd.h" +#include "esq2by16.lh" + +//#define VERBOSE + +const device_type ESQ2x16_SQ1 = &device_creator<esq2x16_sq1_t>; + +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- +static MACHINE_CONFIG_FRAGMENT(esq2x16) + MCFG_DEFAULT_LAYOUT(layout_esq2by16) +MACHINE_CONFIG_END + +/*! \file font5x7.h \brief Graphic LCD Font (Ascii Characters). */ +//***************************************************************************** +// +// File Name : 'font5x7.h' +// Title : Graphic LCD Font (Ascii Charaters) +// Author : Pascal Stang +// Date : 10/19/2001 +// Revised : 10/19/2001 +// Version : 0.1 +// Target MCU : Atmel AVR +// Editor Tabs : 4 +// +//***************************************************************************** +// standard ascii 5x7 font +// defines ascii characters 0x20-0x7F (32-127) +static unsigned char Font5x7[][5] = { + {0x00, 0x00, 0x08, 0x00, 0x00}, // _Undef_ 0x00 - dots for debug purposes + {0x01, 0x00, 0x00, 0x00, 0x40}, // _Undef_ 0x01 - dots for debug purposes + {0x02, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x02 + {0x03, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x03 + {0x04, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x04 + {0x05, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x05 + {0x06, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x06 + {0x07, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x07 + {0x20, 0x70, 0x3F, 0x00, 0x00}, // Croma 0x08 + {0x20, 0x70, 0x3F, 0x02, 0x0C}, // Croma 0x09 + {0x20, 0x70, 0x3F, 0x05, 0x0A}, // Croma 0x0A + {0x20, 0x70, 0x3F, 0x15, 0x2A}, // Croma 0x0B + {0x20, 0x50, 0x50, 0x3F, 0x00}, // Croma 0x0C + {0x0D, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x0D + {0x0E, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x0E + {0x0F, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x0F + {0x10, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x10 + {0x11, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x11 + {0x12, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x12 + {0x13, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x13 + {0x14, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x14 + {0x15, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x15 + {0x16, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x16 + {0x17, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x17 + {0x18, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x18 + {0x19, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x19 + {0x1A, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1A + {0x1B, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1B + {0x1C, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1C + {0x1D, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1D + {0x1E, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1E + {0x1F, 0x00, 0x00, 0x00, 0x00}, // _Undef_ 0x1F + {0x00, 0x00, 0x00, 0x00, 0x00}, // (space) 0x20 + {0x00, 0x00, 0x5F, 0x00, 0x00}, // ! 0x21 + {0x00, 0x07, 0x00, 0x07, 0x00}, // " 0x22 + {0x14, 0x7F, 0x14, 0x7F, 0x14}, // # 0x23 + {0x24, 0x2A, 0x7F, 0x2A, 0x12}, // $ 0x24 + {0x23, 0x13, 0x08, 0x64, 0x62}, // % 0x25 + {0x36, 0x49, 0x55, 0x22, 0x50}, // & 0x26 + {0x00, 0x05, 0x03, 0x00, 0x00}, // ' 0x27 + {0x00, 0x1C, 0x22, 0x41, 0x00}, // ( 0x28 + {0x00, 0x41, 0x22, 0x1C, 0x00}, // ) 0x29 + {0x08, 0x2A, 0x1C, 0x2A, 0x08}, // * 0x2A + {0x08, 0x08, 0x3E, 0x08, 0x08}, // + 0x2B + {0x00, 0x50, 0x30, 0x00, 0x00}, // , 0x2C + {0x08, 0x08, 0x08, 0x08, 0x08}, // - 0x2D + {0x00, 0x60, 0x60, 0x00, 0x00}, // . 0x2E + {0x20, 0x10, 0x08, 0x04, 0x02}, // / 0x2F + {0x3E, 0x51, 0x49, 0x45, 0x3E}, // 0 0x30 + {0x00, 0x42, 0x7F, 0x40, 0x00}, // 1 0x31 + {0x42, 0x61, 0x51, 0x49, 0x46}, // 2 0x32 + {0x21, 0x41, 0x45, 0x4B, 0x31}, // 3 0x33 + {0x18, 0x14, 0x12, 0x7F, 0x10}, // 4 0x34 + {0x27, 0x45, 0x45, 0x45, 0x39}, // 5 0x35 + {0x3C, 0x4A, 0x49, 0x49, 0x30}, // 6 0x36 + {0x01, 0x71, 0x09, 0x05, 0x03}, // 7 0x37 + {0x36, 0x49, 0x49, 0x49, 0x36}, // 8 0x38 + {0x06, 0x49, 0x49, 0x29, 0x1E}, // 9 0x39 + {0x00, 0x36, 0x36, 0x00, 0x00}, // : 0x3A + {0x00, 0x56, 0x36, 0x00, 0x00}, // ; 0x3B + {0x00, 0x08, 0x14, 0x22, 0x41}, // < 0x3C + {0x14, 0x14, 0x14, 0x14, 0x14}, // = 0x3D + {0x41, 0x22, 0x14, 0x08, 0x00}, // > 0x3E + {0x02, 0x01, 0x51, 0x09, 0x06}, // ? 0x3F + {0x32, 0x49, 0x79, 0x41, 0x3E}, // @ 0x40 + {0x7E, 0x11, 0x11, 0x11, 0x7E}, // A 0x41 + {0x7F, 0x49, 0x49, 0x49, 0x36}, // B 0x42 + {0x3E, 0x41, 0x41, 0x41, 0x22}, // C 0x43 + {0x7F, 0x41, 0x41, 0x22, 0x1C}, // D 0x44 + {0x7F, 0x49, 0x49, 0x49, 0x41}, // E 0x45 + {0x7F, 0x09, 0x09, 0x01, 0x01}, // F 0x46 + {0x3E, 0x41, 0x41, 0x51, 0x32}, // G 0x47 + {0x7F, 0x08, 0x08, 0x08, 0x7F}, // H 0x48 + {0x00, 0x41, 0x7F, 0x41, 0x00}, // I 0x49 + {0x20, 0x40, 0x41, 0x3F, 0x01}, // J 0x4A + {0x7F, 0x08, 0x14, 0x22, 0x41}, // K 0x4B + {0x7F, 0x40, 0x40, 0x40, 0x40}, // L 0x4C + {0x7F, 0x02, 0x04, 0x02, 0x7F}, // M 0x4D + {0x7F, 0x04, 0x08, 0x10, 0x7F}, // N 0x4E + {0x3E, 0x41, 0x41, 0x41, 0x3E}, // O 0x4F + {0x7F, 0x09, 0x09, 0x09, 0x06}, // P 0x50 + {0x3E, 0x41, 0x51, 0x21, 0x5E}, // Q 0x51 + {0x7F, 0x09, 0x19, 0x29, 0x46}, // R 0x52 + {0x46, 0x49, 0x49, 0x49, 0x31}, // S 0x53 + {0x01, 0x01, 0x7F, 0x01, 0x01}, // T 0x54 + {0x3F, 0x40, 0x40, 0x40, 0x3F}, // U 0x55 + {0x1F, 0x20, 0x40, 0x20, 0x1F}, // V 0x56 + {0x7F, 0x20, 0x18, 0x20, 0x7F}, // W 0x57 + {0x63, 0x14, 0x08, 0x14, 0x63}, // X 0x58 + {0x03, 0x04, 0x78, 0x04, 0x03}, // Y 0x59 + {0x61, 0x51, 0x49, 0x45, 0x43}, // Z 0x5A + {0x00, 0x00, 0x7F, 0x41, 0x41}, // [ 0x5B + {0x02, 0x04, 0x08, 0x10, 0x20}, // \ 0x5C + {0x41, 0x41, 0x7F, 0x00, 0x00}, // ] 0x5D + {0x04, 0x02, 0x01, 0x02, 0x04}, // ^ 0x5E + {0x40, 0x40, 0x40, 0x40, 0x40}, // _ 0x5F + {0x00, 0x01, 0x02, 0x04, 0x00}, // ` 0x60 + {0x20, 0x54, 0x54, 0x54, 0x78}, // a 0x61 + {0x7F, 0x48, 0x44, 0x44, 0x38}, // b 0x62 + {0x38, 0x44, 0x44, 0x44, 0x20}, // c 0x63 + {0x38, 0x44, 0x44, 0x48, 0x7F}, // d 0x64 + {0x38, 0x54, 0x54, 0x54, 0x18}, // e 0x65 + {0x08, 0x7E, 0x09, 0x01, 0x02}, // f 0x66 + {0x08, 0x14, 0x54, 0x54, 0x3C}, // g 0x67 + {0x7F, 0x08, 0x04, 0x04, 0x78}, // h 0x68 + {0x00, 0x44, 0x7D, 0x40, 0x00}, // i 0x69 + {0x20, 0x40, 0x44, 0x3D, 0x00}, // j 0x6A + {0x00, 0x7F, 0x10, 0x28, 0x44}, // k 0x6B + {0x00, 0x41, 0x7F, 0x40, 0x00}, // l 0x6C + {0x7C, 0x04, 0x18, 0x04, 0x78}, // m 0x6D + {0x7C, 0x08, 0x04, 0x04, 0x78}, // n 0x6E + {0x38, 0x44, 0x44, 0x44, 0x38}, // o 0x6F + {0x7C, 0x14, 0x14, 0x14, 0x08}, // p 0x70 + {0x08, 0x14, 0x14, 0x18, 0x7C}, // q 0x71 + {0x7C, 0x08, 0x04, 0x04, 0x08}, // r 0x72 + {0x48, 0x54, 0x54, 0x54, 0x20}, // s 0x73 + {0x04, 0x3F, 0x44, 0x40, 0x20}, // t 0x74 + {0x3C, 0x40, 0x40, 0x20, 0x7C}, // u 0x75 + {0x1C, 0x20, 0x40, 0x20, 0x1C}, // v 0x76 + {0x3C, 0x40, 0x30, 0x40, 0x3C}, // w 0x77 + {0x44, 0x28, 0x10, 0x28, 0x44}, // x 0x78 + {0x0C, 0x50, 0x50, 0x50, 0x3C}, // y 0x79 + {0x44, 0x64, 0x54, 0x4C, 0x44}, // z 0x7A + {0x00, 0x08, 0x36, 0x41, 0x00}, // { 0x7B + {0x00, 0x00, 0x7F, 0x00, 0x00}, // | 0x7C + {0x00, 0x41, 0x36, 0x08, 0x00}, // } 0x7D + {0x08, 0x08, 0x2A, 0x1C, 0x08}, // -> 0x7E + {0x08, 0x1C, 0x2A, 0x08, 0x08} // <- 0x7F +}; +//-------------------------------------------------------------------------------------------------------------------------------------------- +machine_config_constructor esq2x16_sq1_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( esq2x16 ); +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +void esq2x16_sq1_t::write_char(int data) +{ + int DisplayCode = data; + int LedState; + + // Non-ASCII codes that needs to be treated as ASCII characters + if ( + data == 0x08 || + data == 0x09 || + data == 0x0A || + data == 0x0B || + data == 0x0C + ) data = '^'; // musical notes + + // Resolve here 2-Bytes commands: the command was saved previously + switch (m_LcdCommand) { + case 0: + // No current command. + break; + + case 0x87: + // Go To + #ifdef VERBOSE + printf("LCD %02X: Go To %02X - pos=%02X (%d)\n", m_LcdCommand, DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_lcdPos = DisplayCode; + m_LcdCommand = 0; + return; + break; + + case 0x88: + // Save Cursor position - What the second byte (00 or 01) means? + #ifdef VERBOSE + printf("LCD %02X: Save Pos. (%02X) - pos=%02X (%d)\n", m_LcdCommand, DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_lcdSavedPos = m_lcdPos; + m_LcdCommand = 0; + return; + break; + + case 0x89: + // Restore Cursor position - What the second byte (00 or 01) means? + #ifdef VERBOSE + printf("LCD %02X: Restore Pos. (%02X) - pos=%02X (%d)\n", m_LcdCommand, DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_lcdPos = m_lcdSavedPos; + m_LcdCommand = 0; + return; + break; + + case 0x8D: + case 0x8E: + case 0x8F: + // LED OFF, ON, BLINK + LedState = m_LcdCommand & 0x03; + if ( + DisplayCode >= 16 || // Out of bounds + DisplayCode == 6 || // non-existent + DisplayCode == 7 || // non-existent + DisplayCode == 14 || // non-existent + DisplayCode == 15 // non-existent + ) + { + #ifdef VERBOSE + printf("LCD %02X: Led %02d does'nt exist - pos=%02X (%d)\n", m_LcdCommand, DisplayCode, m_lcdPos, m_lcdPage); + #endif + } + else + { + if (m_leds[DisplayCode] != LedState) + { + m_leds[DisplayCode] = LedState; + m_ledsDirty[DisplayCode] = 1; + } + update_display(); + } + m_LcdCommand = 0; + return; + break; + + default: + #ifdef VERBOSE + printf("LCD: Unknown 2-Bytes Command:%02X-%02X - pos=%02X (%d)\n", m_LcdCommand, DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_LcdCommand = 0; + return; + break; + } + + if ((data >= 0x20) && (data <= 0x7f)) + { + #ifdef VERBOSE + printf("LCD %02X: \"%c\" - pos=%02X (%d)\n", DisplayCode, data, m_lcdPos, m_lcdPage); + #endif + m_lcdpg[m_lcdPage][m_lcdPos++] = DisplayCode; + if (m_lcdPos > 31) m_lcdPos = 31; + + update_display(); + return; + } + + if (DisplayCode >= 0x80) + { + switch (DisplayCode) { + // Known 2-bytes command + case 0x87: // Go To + case 0x88: // Save Cursor Position + case 0x89: // Restore Cursor Position + // Save the command for the next byte + m_LcdCommand = DisplayCode; + return; + break; + + // Unknown 2-bytes command + case 0x85: + case 0x86: + case 0x95: + // ??? - related to blinking chars? - 2 bytes command + m_LcdCommand = DisplayCode; + return; + break; + + case 0x8D: + case 0x8E: + case 0x8F: + // LEDs OFF,ON and BLINK - 2 bytes command + m_LcdCommand = DisplayCode; + return; + break; + + // "Page" selectors (?) + case 0x90: // Blink + case 0x91: // ?? + case 0x92: // Normal + m_lcdPage = DisplayCode & 0x03; + #ifdef VERBOSE + printf("LCD %02X: Page Change ? - pos=%02X (%d)\n", DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_LcdCommand = 0; + return; + break; + + case 0x8C: + #ifdef VERBOSE + printf("LCD %02X: Lcd Clear - pos=%02X (%d)\n", DisplayCode, m_lcdPos, m_lcdPage); + #endif + lcd_reset(); + return; + break; + case 0x98: + #ifdef VERBOSE + printf("LCD %02X: Page Clear ? - pos=%02X (%d)\n", DisplayCode, m_lcdPos, m_lcdPage); + #endif + page_reset(); + return; + break; + + default: + #ifdef VERBOSE + printf("LCD %02X: Unknown Command - pos=%02X (%d)\n", DisplayCode, m_lcdPos, m_lcdPage); + #endif + m_LcdCommand = 0; + return; + break; + } + } + #ifdef VERBOSE + else + { + printf("LCD: Unknown LCD Code: %04X - pos=%02X (%d)\n", data, m_lcdPos, m_lcdPage); + } + #endif +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +esq2x16_sq1_t::esq2x16_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : esqvfd_t(mconfig, ESQ2x16_SQ1, "Ensoniq 2x16 VFD (SQ-1 variant)", tag, owner, clock, "esq2x16_sq1", __FILE__) +{ + m_rows = 2; + m_cols = 16; +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +void esq2x16_sq1_t::update_display() +{ + char lcdCharRow; + + for (int led = 0; led < 16; led++) + { + if (m_ledsDirty[led]) { + machine().output().set_indexed_value("rLed_", led, m_leds[led]); + m_ledsDirty[led] = 0; + } + } + + for (int page = 0; page < 4; page++) + { + for (int pos = 0; pos < 32; pos++) + { + // stealed from tecnbras.cpp and modified + for (int rr=0; rr<7; rr++) { + lcdCharRow = RotateLcdChar(m_lcdpg[page][pos],rr); + machine().output().set_indexed_value("pg_", (page+1)*1000 + pos*7 + rr, 0x1F & lcdCharRow); + } + } + } +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +void esq2x16_sq1_t::device_reset() +{ + //lcd_reset(); + m_lcdPage = m_lcdSavedPos = m_lcdPos = m_LcdCommand = 0; + memset(m_leds, 0, sizeof(m_leds)); + memset(m_lcdpg, 1, sizeof(m_lcdpg)); // Set to 1 for debug: to see what "pages" are set to 0 from the firmware +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +void esq2x16_sq1_t::lcd_reset() +{ + m_lcdPage = m_lcdSavedPos = m_lcdPos = m_LcdCommand = 0; + memset(m_leds, 0, sizeof(m_leds)); + memset(m_lcdpg, 0, sizeof(m_lcdpg)); +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +void esq2x16_sq1_t::page_reset() +{ + memset(m_lcdpg[m_lcdPage], 0, 32); + m_lcdPos = m_LcdCommand = 0; +} +//-------------------------------------------------------------------------------------------------------------------------------------------- +char esq2x16_sq1_t::RotateLcdChar(UINT8 lcdChar, int charRow) +{ + char lcdCharRow = 0; + for (int cc=0; cc<5; cc++){ + lcdCharRow |= BIT(Font5x7[lcdChar][cc], charRow) ? (1 << (cc)) : 0; + } + return lcdCharRow; +} diff --git a/src/mame/machine/esqlcd.h b/src/mame/machine/esqlcd.h new file mode 100644 index 00000000000..0fa306f5161 --- /dev/null +++ b/src/mame/machine/esqlcd.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont, Parduz +#ifndef ESQLCD_H +#define ESQLCD_H + +#include "emu.h" +#include "esqvfd.h" + + +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- + +#define MCFG_ESQ2x16_SQ1_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQ2x16_SQ1, 60) + +#define MCFG_ESQ2x16_SQ1_REMOVE(_tag) \ + MCFG_DEVICE_REMOVE(_tag) + +class esq2x16_sq1_t : public esqvfd_t { +public: + esq2x16_sq1_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual void write_char(int data) override; + virtual void update_display() override; + virtual void device_reset() override; + + + void lcd_reset(); + void page_reset(); + char RotateLcdChar(UINT8 lcdChar, int charRow); +protected: + virtual machine_config_constructor device_mconfig_additions() const override; + UINT8 m_lcdpg[4][32]; + int m_lcdPage; + int m_lcdPos,m_lcdSavedPos; + + UINT8 m_leds[16]; + UINT8 m_ledsDirty[16]; + +private: + int m_LcdCommand; +}; + +extern const device_type ESQ2x16_SQ1; + +#endif diff --git a/src/mame/machine/esqpanel.cpp b/src/mame/machine/esqpanel.cpp index 1c4dee54248..4c084a6d5c5 100644 --- a/src/mame/machine/esqpanel.cpp +++ b/src/mame/machine/esqpanel.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:R. Belmont +// copyright-holders:R. Belmont, Parduz /* Ensoniq panel/display device */ @@ -16,7 +16,7 @@ const device_type ESQPANEL1x22 = &device_creator<esqpanel1x22_device>; const device_type ESQPANEL2x40 = &device_creator<esqpanel2x40_device>; -const device_type ESQPANEL2x40_SQ1 = &device_creator<esqpanel2x40_sq1_device>; +const device_type ESQPANEL2x16_SQ1 = &device_creator<esqpanel2x16_sq1_device>; //************************************************************************** // LIVE DEVICE @@ -234,19 +234,18 @@ esqpanel2x40_device::esqpanel2x40_device(const machine_config &mconfig, const ch m_eps_mode = false; } -/* panel with 2x16? LCD display used in the SQ and MR series, plus probably more */ - -static MACHINE_CONFIG_FRAGMENT(esqpanel2x40_sq1) - MCFG_ESQ2x40_SQ1_ADD("vfd") +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- +static MACHINE_CONFIG_FRAGMENT(esqpanel2x16_sq1) + MCFG_ESQ2x16_SQ1_ADD("vfd") MACHINE_CONFIG_END - -machine_config_constructor esqpanel2x40_sq1_device::device_mconfig_additions() const +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- +machine_config_constructor esqpanel2x16_sq1_device::device_mconfig_additions() const { - return MACHINE_CONFIG_NAME( esqpanel2x40_sq1 ); + return MACHINE_CONFIG_NAME( esqpanel2x16_sq1 ); } - -esqpanel2x40_sq1_device::esqpanel2x40_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - esqpanel_device(mconfig, ESQPANEL2x40, "Ensoniq front panel with 2x16 LCD", tag, owner, clock, "esqpanel240_sq1", __FILE__), +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- +esqpanel2x16_sq1_device::esqpanel2x16_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + esqpanel_device(mconfig, ESQPANEL2x16_SQ1, "Ensoniq front panel with 2x16 LCD", tag, owner, clock, "esqpanel216_sq1", __FILE__), m_vfd(*this, "vfd") { m_eps_mode = false; diff --git a/src/mame/machine/esqpanel.h b/src/mame/machine/esqpanel.h index 5de704f1375..46f9f07ec03 100644 --- a/src/mame/machine/esqpanel.h +++ b/src/mame/machine/esqpanel.h @@ -7,6 +7,7 @@ #include "emu.h" #include "machine/esqvfd.h" +#include "machine/esqlcd.h" //************************************************************************** // INTERFACE CONFIGURATION MACROS @@ -30,13 +31,13 @@ #define MCFG_ESQPANEL_2x40_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) -#define MCFG_ESQPANEL2x40_SQ1_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, ESQPANEL2x40_SQ1, 0) +#define MCFG_ESQPANEL2x16_SQ1_ADD(_tag) \ + MCFG_DEVICE_ADD(_tag, ESQPANEL2x16_SQ1, 0) -#define MCFG_ESQPANEL2x40_SQ1_REPLACE(_tag) \ - MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x40_SQ1, 0) +#define MCFG_ESQPANEL2x16_SQ1_REPLACE(_tag) \ + MCFG_DEVICE_REPLACE(_tag, ESQPANEL2x16_SQ1, 0) -#define MCFG_ESQPANEL2x40_SQ1_REMOVE(_tag) \ +#define MCFG_ESQPANEL2x16_SQ1_REMOVE(_tag) \ MCFG_DEVICE_REMOVE(_tag) #define MCFG_ESQPANEL_TX_CALLBACK(_write) \ @@ -133,8 +134,23 @@ protected: private: }; +// --- SQ1 - Parduz -------------------------------------------------------------------------------------------------------------------------- +class esqpanel2x16_sq1_device : public esqpanel_device { +public: + esqpanel2x16_sq1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + required_device<esq2x16_sq1_t> m_vfd; + + virtual void send_to_display(UINT8 data) override { m_vfd->write_char(data); } + +protected: + virtual machine_config_constructor device_mconfig_additions() const override; + +private: +}; + extern const device_type ESQPANEL1x22; extern const device_type ESQPANEL2x40; -extern const device_type ESQPANEL2x40_SQ1; +extern const device_type ESQPANEL2x16_SQ1; #endif diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index 69e07a8c374..b006c9d83b5 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -896,7 +896,7 @@ int ohci_function_device::execute_transfer(int address, int endpoint, int pid, U if (endpoint == 0) { if (pid == SetupPid) { - USBSetupPacket *p=(struct USBSetupPacket *)buffer; + USBSetupPacket *p=(USBSetupPacket *)buffer; // define direction 0:host->device 1:device->host controldirection = (p->bmRequestType & 128) >> 7; // case ==1, IN data stage and OUT status stage @@ -1012,14 +1012,17 @@ int ohci_function_device::execute_transfer(int address, int endpoint, int pid, U int ohci_function_device::handle_nonstandard_request(USBSetupPacket *setup) { + // >=8 ==42 !=0 !=0 1,3 2<20 <=20 + static UINT8 mytestdata[16] = { 0x10,0x42 ,0x32,0x43,1 ,0x65,0x18,0x20,0x98,0xa9,0xba,0xcb,0xdc,0xed,0xfe }; + if ((controltype == VendorType) && (controlrecipient == InterfaceRecipient)) { if (setup->bRequest == GET_DESCRIPTOR) { if (setup->wValue == 0x4200) { - position = nullptr; - remain = 0; + position = mytestdata; + remain = 16; } } } diff --git a/src/mame/mess.cpp b/src/mame/mess.cpp index 209ff7651d6..160f777c044 100644 --- a/src/mame/mess.cpp +++ b/src/mame/mess.cpp @@ -19,3 +19,5 @@ const char * emulator_info::get_appname() { return APPNAME;} const char * emulator_info::get_appname_lower() { return APPNAME_LOWER;} const char * emulator_info::get_configname() { return CONFIGNAME;} +const char * emulator_info::get_copyright() { return COPYRIGHT;} +const char * emulator_info::get_copyright_info() { return COPYRIGHT_INFO;} diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index b36bbf60df3..7317876eaca 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -15,32 +15,32 @@ const options_entry osd_options::s_option_entries[] = { - { NULL, NULL, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD KEYBOARD MAPPING OPTIONS" }, #ifdef SDLMAME_MACOSX { OSDOPTION_UIMODEKEY, "DEL", OPTION_STRING, "Key to toggle keyboard mode" }, #else { OSDOPTION_UIMODEKEY, "SCRLOCK", OPTION_STRING, "Key to toggle keyboard mode" }, #endif // SDLMAME_MACOSX - { NULL, NULL, OPTION_HEADER, "OSD FONT OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD FONT OPTIONS" }, { OSD_FONT_PROVIDER, OSDOPTVAL_AUTO, OPTION_STRING, "provider for ui font: " }, - { NULL, NULL, OPTION_HEADER, "OSD CLI OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD CLI OPTIONS" }, { OSDCOMMAND_LIST_MIDI_DEVICES ";mlist", "0", OPTION_COMMAND, "list available MIDI I/O devices" }, { OSDCOMMAND_LIST_NETWORK_ADAPTERS ";nlist", "0", OPTION_COMMAND, "list available network adapters" }, - { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used: " }, { OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, OPTION_STRING, "specifies the font to use for debugging" }, { OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", OPTION_FLOAT, "specifies the font size to use for debugging" }, { OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" }, - { NULL, NULL, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD PERFORMANCE OPTIONS" }, { OSDOPTION_MULTITHREADING ";mt", "0", OPTION_BOOLEAN, "enable multithreading; this enables rendering and blitting on a separate thread" }, { OSDOPTION_NUMPROCESSORS ";np", OSDOPTVAL_AUTO, OPTION_STRING, "number of processors; this overrides the number the system reports" }, { OSDOPTION_BENCH, "0", OPTION_INTEGER, "benchmark for the given number of emulated seconds; implies -video none -sound none -nothrottle" }, - { NULL, NULL, OPTION_HEADER, "OSD VIDEO OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD VIDEO OPTIONS" }, // OS X can be trusted to have working hardware OpenGL, so default to it on for the best user experience { OSDOPTION_VIDEO, OSDOPTVAL_AUTO, OPTION_STRING, "video output method: " }, { OSDOPTION_NUMSCREENS "(1-4)", "1", OPTION_INTEGER, "number of screens to create; usually, you want just one" }, @@ -52,7 +52,7 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SYNCREFRESH ";srf", "0", OPTION_BOOLEAN, "enable using the start of VBLANK for throttling instead of the game time" }, // per-window options - { NULL, NULL, OPTION_HEADER, "OSD PER-WINDOW VIDEO OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD PER-WINDOW VIDEO OPTIONS" }, { OSDOPTION_SCREEN, OSDOPTVAL_AUTO, OPTION_STRING, "explicit name of the first screen; 'auto' here will try to make a best guess" }, { OSDOPTION_ASPECT ";screen_aspect", OSDOPTVAL_AUTO, OPTION_STRING, "aspect ratio for all screens; 'auto' here will try to make a best guess" }, { OSDOPTION_RESOLUTION ";r", OSDOPTVAL_AUTO, OPTION_STRING, "preferred resolution for all screens; format is <width>x<height>[@<refreshrate>] or 'auto'" }, @@ -79,15 +79,15 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_VIEW "3", OSDOPTVAL_AUTO, OPTION_STRING, "preferred view for the fourth screen" }, // full screen options - { NULL, NULL, OPTION_HEADER, "OSD FULL SCREEN OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD FULL SCREEN OPTIONS" }, { OSDOPTION_SWITCHRES, "0", OPTION_BOOLEAN, "enable resolution switching" }, - { NULL, NULL, OPTION_HEADER, "OSD ACCELERATED VIDEO OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD ACCELERATED VIDEO OPTIONS" }, { OSDOPTION_FILTER ";glfilter;flt", "1", OPTION_BOOLEAN, "enable bilinear filtering on screen output" }, { OSDOPTION_PRESCALE, "1", OPTION_INTEGER, "scale screen rendering by this amount in software" }, #if USE_OPENGL - { NULL, NULL, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OpenGL-SPECIFIC OPTIONS" }, { OSDOPTION_GL_FORCEPOW2TEXTURE, "0", OPTION_BOOLEAN, "force power of two textures (default no)" }, { OSDOPTION_GL_NOTEXTURERECT, "0", OPTION_BOOLEAN, "don't use OpenGL GL_ARB_texture_rectangle (default on)" }, { OSDOPTION_GL_VBO, "1", OPTION_BOOLEAN, "enable OpenGL VBO, if available (default on)" }, @@ -116,12 +116,12 @@ const options_entry osd_options::s_option_entries[] = { OSDOPTION_SHADER_SCREEN "9", OSDOPTVAL_NONE, OPTION_STRING, "custom OpenGL GLSL shader screen bitmap 9" }, #endif - { NULL, NULL, OPTION_HEADER, "OSD SOUND OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "OSD SOUND OPTIONS" }, { OSDOPTION_SOUND, OSDOPTVAL_AUTO, OPTION_STRING, "sound output method: " }, { OSDOPTION_AUDIO_LATENCY "(1-5)", "2", OPTION_INTEGER, "set audio latency (increase to reduce glitches, decrease for responsiveness)" }, #ifdef SDLMAME_MACOSX - { NULL, NULL, OPTION_HEADER, "CoreAudio-SPECIFIC OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "CoreAudio-SPECIFIC OPTIONS" }, { OSDOPTION_AUDIO_OUTPUT, OSDOPTVAL_AUTO, OPTION_STRING, "Audio output device" }, { OSDOPTION_AUDIO_EFFECT "0", OSDOPTVAL_NONE, OPTION_STRING, "AudioUnit effect 0" }, { OSDOPTION_AUDIO_EFFECT "1", OSDOPTVAL_NONE, OPTION_STRING, "AudioUnit effect 1" }, @@ -136,7 +136,7 @@ const options_entry osd_options::s_option_entries[] = #endif // End of list - { NULL } + { nullptr } }; osd_options::osd_options() @@ -151,11 +151,11 @@ osd_options::osd_options() //------------------------------------------------- osd_common_t::osd_common_t(osd_options &options) - : osd_output(), m_machine(NULL), + : osd_output(), m_machine(nullptr), m_options(options), m_print_verbose(false), - m_sound(NULL), - m_debugger(NULL) + m_sound(nullptr), + m_debugger(nullptr) { osd_output::push(this); } @@ -240,7 +240,7 @@ void osd_common_t::register_options() update_option(OSD_DEBUG_PROVIDER, dnames); // Register video options and update options - video_options_add("none", NULL); + video_options_add("none", nullptr); video_register(); update_option(OSDOPTION_VIDEO, m_video_names); } @@ -426,7 +426,7 @@ void osd_common_t::set_mastervolume(int attenuation) // while (attenuation++ < 0) // volume /= 1.122018454; // = (10 ^ (1/20)) = 1dB // - if (m_sound != NULL) + if (m_sound != nullptr) m_sound->set_mastervolume(attenuation); } @@ -458,7 +458,7 @@ void osd_common_t::customize_input_type_list(simple_list<input_type_entry> &type osd_font *osd_common_t::font_open(const char *name, int &height) { - return NULL; + return nullptr; } @@ -490,9 +490,10 @@ bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_ar // list of OS-dependent slider values. //------------------------------------------------- -void *osd_common_t::get_slider_list() +slider_state* osd_common_t::get_slider_list() { - return NULL; + printf("Core get_slider_list\n"); + return nullptr; } //------------------------------------------------- diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index a73931f3fa1..d4fba565964 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -187,7 +187,7 @@ public: virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); // video overridables - virtual void *get_slider_list() override; + virtual slider_state *get_slider_list() override; // command option overrides virtual bool execute_command(const char *command) override; diff --git a/src/osd/modules/osdwindow.cpp b/src/osd/modules/osdwindow.cpp new file mode 100644 index 00000000000..29b77cd52e5 --- /dev/null +++ b/src/osd/modules/osdwindow.cpp @@ -0,0 +1,63 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont, Couriersud +//============================================================ +// +// osdwindow.cpp - SDL window handling +// +//============================================================ + +// standard windows headers +#ifdef OSD_WINDOWS +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> +#endif + +#include "osdwindow.h" + +#include "render/drawnone.h" +#include "render/drawbgfx.h" +#if (USE_OPENGL) +#include "render/drawogl.h" +#endif +#ifdef OSD_WINDOWS +#include "render/drawgdi.h" +#include "render/drawd3d.h" +#else +#include "render/draw13.h" +#include "render/drawsdl.h" +#endif + +osd_renderer* osd_renderer::make_for_type(int mode, osd_window* window, int extra_flags) +{ + switch(mode) + { +#ifdef OSD_WINDOWS + case VIDEO_MODE_NONE: + return new renderer_none(window); +#endif + case VIDEO_MODE_BGFX: + return new renderer_bgfx(window); +#if (USE_OPENGL) + case VIDEO_MODE_OPENGL: + return new renderer_ogl(window); +#endif +#ifdef OSD_WINDOWS + case VIDEO_MODE_GDI: + return new renderer_gdi(window); + case VIDEO_MODE_D3D: + { + osd_renderer *renderer = new renderer_d3d9(window); + return renderer; + } +#else + case VIDEO_MODE_SDL2ACCEL: + return new renderer_sdl2(window, extra_flags); + case VIDEO_MODE_SOFT: + return new renderer_sdl1(window, extra_flags); +#endif + default: + return nullptr; + } +}
\ No newline at end of file diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index d4c2a4101cc..5d9d7977968 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -9,13 +9,130 @@ #ifndef __OSDWINDOW__ #define __OSDWINDOW__ -#include "video.h" -#include "render.h" +#include "emu.h" +#include "ui/ui.h" + +#ifdef OSD_SDL +// standard SDL headers +#include "sdlinc.h" +#endif //============================================================ // TYPE DEFINITIONS //============================================================ +class osd_options; +class render_primitive_list; + +enum +{ + VIDEO_MODE_NONE = 0, + VIDEO_MODE_GDI, + VIDEO_MODE_BGFX, +#if (USE_OPENGL) + VIDEO_MODE_OPENGL, +#endif + VIDEO_MODE_SDL2ACCEL, + VIDEO_MODE_D3D, + VIDEO_MODE_SOFT, + + VIDEO_MODE_COUNT +}; + +class osd_dim +{ +public: + osd_dim(const int &w, const int &h) + : m_w(w), m_h(h) + { + } + int width() const { return m_w; } + int height() const { return m_h; } + + bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); } + bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); } +private: + int m_w; + int m_h; +}; + +class osd_rect +{ +public: + osd_rect() + : m_x(0), m_y(0), m_d(0,0) + { + } + osd_rect(const int x, const int y, const int &w, const int &h) + : m_x(x), m_y(y), m_d(w,h) + { + } + osd_rect(const int x, const int y, const osd_dim &d) + : m_x(x), m_y(y), m_d(d) + { + } + int top() const { return m_y; } + int left() const { return m_x; } + int width() const { return m_d.width(); } + int height() const { return m_d.height(); } + + osd_dim dim() const { return m_d; } + + int bottom() const { return m_y + m_d.height(); } + int right() const { return m_x + m_d.width(); } + + osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); } + osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); } + +private: + int m_x; + int m_y; + osd_dim m_d; +}; + +class osd_monitor_info +{ +public: + osd_monitor_info(void *handle, const char *monitor_device, float aspect) + : m_next(NULL), m_handle(handle), m_aspect(aspect) + { + strncpy(m_name, monitor_device, ARRAY_LENGTH(m_name) - 1); + } + + virtual ~osd_monitor_info() { } + + virtual void refresh() = 0; + + const void *oshandle() { return m_handle; } + + const osd_rect &position_size() { return m_pos_size; } + const osd_rect &usuable_position_size() { return m_usuable_pos_size; } + + const char *devicename() { return m_name[0] ? m_name : "UNKNOWN"; } + + float aspect(); + + void set_aspect(const float a) { m_aspect = a; } + bool is_primary() { return m_is_primary; } + + osd_monitor_info * next() { return m_next; } // pointer to next monitor in list + + static osd_monitor_info *pick_monitor(osd_options &options, int index); + static osd_monitor_info *list; + + // FIXME: should be private! + osd_monitor_info *m_next; // pointer to next monitor in list +protected: + osd_rect m_pos_size; + osd_rect m_usuable_pos_size; + bool m_is_primary; + char m_name[64]; +private: + + void * m_handle; // handle to the monitor + float m_aspect; // computed/configured aspect ratio of the physical device +}; + class osd_window_config { public: @@ -33,8 +150,7 @@ class osd_window public: osd_window() : -#ifdef OSD_SDL -#else +#ifndef OSD_SDL m_hwnd(0), m_dc(0), m_focus_hwnd(0), m_resize_state(0), #endif m_primlist(nullptr), @@ -96,7 +212,7 @@ public: static const int FLAG_NEEDS_ASYNCBLIT = 0x0200; osd_renderer(osd_window *window, const int flags) - : m_window(window), m_flags(flags) { } + : m_sliders_dirty(false), m_window(window), m_flags(flags) { } virtual ~osd_renderer() { } @@ -112,25 +228,24 @@ public: virtual int create() = 0; virtual render_primitive_list *get_primitives() = 0; + virtual slider_state* get_slider_list() { return nullptr; } virtual int draw(const int update) = 0; -#ifdef OSD_SDL - virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0; -#else - virtual void save() = 0; - virtual void record() = 0; - virtual void toggle_fsfx() = 0; -#endif + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) { return 0; }; + virtual void save() { }; + virtual void record() { }; + virtual void toggle_fsfx() { }; + virtual bool sliders_dirty() { return m_sliders_dirty; } - virtual void destroy() = 0; + static osd_renderer* make_for_type(int mode, osd_window *window, int extra_flags = FLAG_NONE); protected: /* Internal flags */ static const int FI_CHANGED = 0x010000; + bool m_sliders_dirty; private: - - osd_window *m_window; - int m_flags; + osd_window *m_window; + int m_flags; }; diff --git a/src/osd/modules/render/bgfx/blendreader.cpp b/src/osd/modules/render/bgfx/blendreader.cpp new file mode 100644 index 00000000000..45020a08027 --- /dev/null +++ b/src/osd/modules/render/bgfx/blendreader.cpp @@ -0,0 +1,51 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// blendreader.cpp - BGFX blend state JSON reader +// +//============================================================ + +#include <bgfx/bgfx.h> + +#include "blendreader.h" + +const blend_reader::string_to_enum blend_reader::EQUATION_NAMES[blend_reader::EQUATION_COUNT] = { + { "add", BGFX_STATE_BLEND_EQUATION_ADD }, + { "sub", BGFX_STATE_BLEND_EQUATION_SUB }, + { "subtract", BGFX_STATE_BLEND_EQUATION_SUB }, + { "revSub", BGFX_STATE_BLEND_EQUATION_REVSUB }, + { "revSubtract", BGFX_STATE_BLEND_EQUATION_REVSUB }, + { "min", BGFX_STATE_BLEND_EQUATION_MIN }, + { "max", BGFX_STATE_BLEND_EQUATION_MAX } +}; + +const blend_reader::string_to_enum blend_reader::FUNCTION_NAMES[blend_reader::FUNCTION_COUNT] = { + { "0", BGFX_STATE_BLEND_ZERO }, + { "zero", BGFX_STATE_BLEND_ZERO }, + { "1", BGFX_STATE_BLEND_ONE }, + { "one", BGFX_STATE_BLEND_ONE }, + { "srcColor", BGFX_STATE_BLEND_SRC_COLOR }, + { "1-srcColor", BGFX_STATE_BLEND_INV_SRC_COLOR }, + { "invSrcColor", BGFX_STATE_BLEND_INV_SRC_COLOR }, + { "dstColor", BGFX_STATE_BLEND_DST_COLOR }, + { "1-dstColor", BGFX_STATE_BLEND_INV_DST_COLOR }, + { "invDstColor", BGFX_STATE_BLEND_INV_DST_COLOR }, + { "srcAlpha", BGFX_STATE_BLEND_SRC_ALPHA }, + { "1-srcAlpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, + { "invSrcAlpha", BGFX_STATE_BLEND_INV_SRC_ALPHA }, + { "dstAlpha", BGFX_STATE_BLEND_DST_ALPHA }, + { "1-dstAlpha", BGFX_STATE_BLEND_INV_DST_ALPHA }, + { "invDstAlpha", BGFX_STATE_BLEND_INV_DST_ALPHA } +}; + +uint64_t blend_reader::read_from_value(const Value& value) +{ + uint64_t equation = get_enum_from_value(value, "equation", BGFX_STATE_BLEND_EQUATION_ADD, EQUATION_NAMES, EQUATION_COUNT); + uint64_t srccolor = get_enum_from_value(value, "srcColor", BGFX_STATE_BLEND_ONE, FUNCTION_NAMES, FUNCTION_COUNT); + uint64_t dstcolor = get_enum_from_value(value, "dstColor", BGFX_STATE_BLEND_ZERO, FUNCTION_NAMES, FUNCTION_COUNT); + uint64_t srcalpha = get_enum_from_value(value, "srcAlpha", BGFX_STATE_BLEND_ONE, FUNCTION_NAMES, FUNCTION_COUNT); + uint64_t dstalpha = get_enum_from_value(value, "dstAlpha", BGFX_STATE_BLEND_ZERO, FUNCTION_NAMES, FUNCTION_COUNT); + + return BGFX_STATE_BLEND_EQUATION(equation) | BGFX_STATE_BLEND_FUNC_SEPARATE(srccolor, dstcolor, srcalpha, dstalpha); +} diff --git a/src/osd/modules/render/bgfx/blendreader.h b/src/osd/modules/render/bgfx/blendreader.h new file mode 100644 index 00000000000..6dd16ae5d88 --- /dev/null +++ b/src/osd/modules/render/bgfx/blendreader.h @@ -0,0 +1,31 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// blendreader.h - BGFX blend state JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_BLEND_READER__ +#define __DRAWBGFX_BLEND_READER__ + +#include <bgfx/bgfx.h> + +#include "statereader.h" + +using namespace rapidjson; + +class blend_reader : public state_reader { +public: + static uint64_t read_from_value(const Value& value); + +private: + static const int EQUATION_COUNT = 7; + static const string_to_enum EQUATION_NAMES[EQUATION_COUNT]; + static const int FUNCTION_COUNT = 16; + static const string_to_enum FUNCTION_NAMES[FUNCTION_COUNT]; +}; + +#endif // __DRAWBGFX_BLEND_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chain.cpp b/src/osd/modules/render/bgfx/chain.cpp new file mode 100644 index 00000000000..271695b56a1 --- /dev/null +++ b/src/osd/modules/render/bgfx/chain.cpp @@ -0,0 +1,33 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chain.cpp - BGFX screen-space post-effect chain +// +//============================================================ + +#include "slider.h" +#include "parameter.h" +#include "chainentry.h" + +#include "chain.h" + +bgfx_chain::bgfx_chain(std::string name, std::string author, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries) + : m_name(name) + , m_author(author) + , m_sliders(sliders) + , m_params(params) + , m_entries(entries) +{ +} + +bgfx_chain::~bgfx_chain() +{ +} + +void bgfx_chain::submit(render_primitive* prim, int view) +{ + //for (bgfx_chain_entry* entry : m_entries) + //{ + //} +} diff --git a/src/osd/modules/render/bgfx/chain.h b/src/osd/modules/render/bgfx/chain.h new file mode 100644 index 00000000000..c34b1830681 --- /dev/null +++ b/src/osd/modules/render/bgfx/chain.h @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chain.h - BGFX screen-space post-effect chain +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_CHAIN__ +#define __DRAWBGFX_CHAIN__ + +#include <string> +#include <vector> + +class bgfx_slider; +class bgfx_parameter; +class bgfx_chain_entry; +class render_primitive; + +class bgfx_chain +{ +public: + bgfx_chain(std::string name, std::string author, std::vector<bgfx_slider*> sliders, std::vector<bgfx_parameter*> params, std::vector<bgfx_chain_entry*> entries); + ~bgfx_chain(); + + void submit(render_primitive* prim, int view); + +private: + std::string m_name; + std::string m_author; + std::vector<bgfx_slider*> m_sliders; + std::vector<bgfx_parameter*> m_params; + std::vector<bgfx_chain_entry*> m_entries; +}; + +#endif // __DRAWBGFX_CHAIN__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chainentry.cpp b/src/osd/modules/render/bgfx/chainentry.cpp new file mode 100644 index 00000000000..c0b8845cdd3 --- /dev/null +++ b/src/osd/modules/render/bgfx/chainentry.cpp @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainentry.cpp - BGFX shader post-processing node +// +// Represents a single entry in a list of post-processing +// passes to be applied to a screen quad or buffer. +// +//============================================================ + +#include "emu.h" + +#include <bgfx/bgfx.h> + +#include "effect.h" +#include "texture.h" +#include "target.h" +#include "chainentry.h" + +bgfx_chain_entry::bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_input_pair>& inputs, bgfx_target* output) + : m_name(name) + , m_effect(effect) + , m_output(output) +{ + for (bgfx_input_pair input : inputs) + { + m_inputs.push_back(input); + } +} + +bgfx_chain_entry::~bgfx_chain_entry() +{ +} + +void bgfx_chain_entry::submit(render_primitive* prim, int view) +{ + for (bgfx_input_pair input : m_inputs) + { + input.bind(m_effect); + } + bgfx::setViewFrameBuffer(view, m_output->target()); + m_effect->submit(view); +} diff --git a/src/osd/modules/render/bgfx/chainentry.h b/src/osd/modules/render/bgfx/chainentry.h new file mode 100644 index 00000000000..d607dd4ec7d --- /dev/null +++ b/src/osd/modules/render/bgfx/chainentry.h @@ -0,0 +1,45 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainentry.h - BGFX shader post-processing node +// +// Represents a single entry in a list of post-processing +// passes to be applied to a screen quad or buffer. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_CHAIN_ENTRY__ +#define __DRAWBGFX_CHAIN_ENTRY__ + +#include <string> +#include <vector> + +#include "inputpair.h" + +class render_primitive; +class bgfx_effect; +class bgfx_texture; +class bgfx_target; + +class bgfx_chain_entry +{ +public: + bgfx_chain_entry(std::string name, bgfx_effect* effect, std::vector<bgfx_input_pair>& inputs, bgfx_target* output); + ~bgfx_chain_entry(); + + void submit(render_primitive* prim, int view); + + // Getters + std::string name() const { return m_name; } + +private: + std::string m_name; + bgfx_effect* m_effect; + std::vector<bgfx_input_pair> m_inputs; + bgfx_target* m_output; +}; + +#endif // __DRAWBGFX_CHAIN_ENTRY__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chainentryreader.cpp b/src/osd/modules/render/bgfx/chainentryreader.cpp new file mode 100644 index 00000000000..39338359e81 --- /dev/null +++ b/src/osd/modules/render/bgfx/chainentryreader.cpp @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainentryreader.cpp - BGFX chain entry JSON reader +// +//============================================================ + +#include <string> + +#include "emu.h" + +#include "chainentryreader.h" + +#include "texturemanager.h" +#include "targetmanager.h" +#include "effectmanager.h" +#include "chainentry.h" +#include "inputpair.h" + +bgfx_chain_entry* chain_entry_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects) +{ + validate_parameters(value); + + bgfx_effect* effect = effects.effect(value["effect"].GetString()); + + std::vector<bgfx_input_pair> inputs; + if (value.HasMember("input")) + { + const Value& input_array = value["input"]; + for (UINT32 i = 0; i < input_array.Size(); i++) + { + std::string sampler = input_array[i]["sampler"].GetString(); + std::string texture = input_array[i]["texture"].GetString(); + inputs.push_back(bgfx_input_pair(i, sampler, textures.texture(texture))); + } + } + + bgfx_target* output = targets.target(value["output"].GetString()); + + return new bgfx_chain_entry(value["name"].GetString(), effect, inputs, output); +} + +void chain_entry_reader::validate_parameters(const Value& value) +{ + assert(value.HasMember("effect")); + assert(value["effect"].IsString()); + if (value.HasMember("name")) + { + assert(value["name"].IsString()); + } + assert(value.HasMember("shader")); + assert(value["shader"].IsString()); + assert(value.HasMember("output")); + assert(value["output"].IsString()); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chainentryreader.h b/src/osd/modules/render/bgfx/chainentryreader.h new file mode 100644 index 00000000000..8aeb1b402de --- /dev/null +++ b/src/osd/modules/render/bgfx/chainentryreader.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainentryreader.h - BGFX chain entry JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_CHAIN_ENTRY_READER__ +#define __DRAWBGFX_CHAIN_ENTRY_READER__ + +#include "statereader.h" + +class bgfx_chain_entry; +class texture_manager; +class target_manager; +class effect_manager; + +class chain_entry_reader : public state_reader +{ +public: + static bgfx_chain_entry* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects); + +private: + static void validate_parameters(const Value& value); +}; + +#endif // __DRAWBGFX_CHAIN_ENTRY_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chainreader.cpp b/src/osd/modules/render/bgfx/chainreader.cpp new file mode 100644 index 00000000000..8a69e007872 --- /dev/null +++ b/src/osd/modules/render/bgfx/chainreader.cpp @@ -0,0 +1,95 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainreader.cpp - BGFX chain JSON reader +// +//============================================================ + +#include <string> +#include <vector> + +#include "emu.h" + +#include "chain.h" +#include "sliderreader.h" +#include "paramreader.h" +#include "chainentryreader.h" +#include "targetmanager.h" +#include "chainreader.h" + +bgfx_chain* chain_reader::read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height) +{ + validate_parameters(value); + + std::string name = value["name"].GetString(); + std::string author = value["author"].GetString(); + + std::vector<bgfx_slider*> sliders; + if (value.HasMember("sliders")) + { + const Value& slider_array = value["sliders"]; + for (UINT32 i = 0; i < slider_array.Size(); i++) + { + sliders.push_back(slider_reader::read_from_value(slider_array[i])); + } + } + + std::vector<bgfx_parameter*> parameters; + if (value.HasMember("parameters")) + { + const Value& param_array = value["parameters"]; + for (UINT32 i = 0; i < param_array.Size(); i++) + { + parameters.push_back(parameter_reader::read_from_value(param_array[i])); + } + } + + std::vector<bgfx_chain_entry*> entries; + if (value.HasMember("passes")) + { + const Value& entry_array = value["passes"]; + for (UINT32 i = 0; i < entry_array.Size(); i++) + { + entries.push_back(chain_entry_reader::read_from_value(entry_array[i], textures, targets, effects)); + } + } + + if (value.HasMember("targets")) + { + const Value& target_array = value["targets"]; + for (UINT32 i = 0; i < target_array.Size(); i++) + { + assert(target_array[i].HasMember("name")); + assert(target_array[i]["name"].IsString()); + uint32_t width = 0; + uint32_t height = 0; + if (target_array[i].HasMember("screen") && target_array[i]["screen"].IsBool()) + { + width = screen_width; + height = screen_height; + } + else + { + assert(target_array[i].HasMember("width")); + assert(target_array[i]["width"].IsDouble()); + assert(target_array[i].HasMember("height")); + assert(target_array[i]["height"].IsDouble()); + width = uint32_t(target_array[i]["width"].GetDouble()); + height = uint32_t(target_array[i]["height"].GetDouble()); + } + targets.create_target(target_array[i]["name"].GetString(), bgfx::TextureFormat::RGBA8, width, height); + } + } + + return new bgfx_chain(name, author, sliders, parameters, entries); +} + +void chain_reader::validate_parameters(const Value& value) +{ + assert(value.HasMember("name")); + assert(value["name"].IsString()); + assert(value.HasMember("author")); + assert(value["author"].IsString()); + assert(value.HasMember("passes")); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/chainreader.h b/src/osd/modules/render/bgfx/chainreader.h new file mode 100644 index 00000000000..6e803516189 --- /dev/null +++ b/src/osd/modules/render/bgfx/chainreader.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// chainreader.h - BGFX chain JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_CHAIN_READER__ +#define __DRAWBGFX_CHAIN_READER__ + +#include "statereader.h" + +class bgfx_chain; +class texture_manager; +class target_manager; +class effect_manager; + +class chain_reader : public state_reader +{ +public: + static bgfx_chain* read_from_value(const Value& value, texture_manager& textures, target_manager& targets, effect_manager& effects, uint32_t screen_width, uint32_t screen_height); + +private: + static void validate_parameters(const Value& value); +}; + +#endif // __DRAWBGFX_CHAIN_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/cullreader.cpp b/src/osd/modules/render/bgfx/cullreader.cpp new file mode 100644 index 00000000000..0890d731583 --- /dev/null +++ b/src/osd/modules/render/bgfx/cullreader.cpp @@ -0,0 +1,22 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// cullreader.cpp - BGFX cull state JSON reader +// +//============================================================ + +#include <bgfx/bgfx.h> + +#include "cullreader.h" + +const cull_reader::string_to_enum cull_reader::MODE_NAMES[cull_reader::MODE_COUNT] = { + { "none", 0 }, + { "cw", BGFX_STATE_CULL_CW }, + { "ccw", BGFX_STATE_CULL_CCW } +}; + +uint64_t cull_reader::read_from_value(const Value& value) +{ + return get_enum_from_value(value, "mode", BGFX_STATE_CULL_CCW, MODE_NAMES, MODE_COUNT); +} diff --git a/src/osd/modules/render/bgfx/cullreader.h b/src/osd/modules/render/bgfx/cullreader.h new file mode 100644 index 00000000000..432ed494cf2 --- /dev/null +++ b/src/osd/modules/render/bgfx/cullreader.h @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// cullreader.h - BGFX cull state JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_CULL_READER__ +#define __DRAWBGFX_CULL_READER__ + +#include "statereader.h" + +class cull_reader : public state_reader { +public: + static uint64_t read_from_value(const Value& value); + +private: + static const int MODE_COUNT = 3; + static const string_to_enum MODE_NAMES[MODE_COUNT]; +}; + +#endif // __DRAWBGFX_CULL_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/depthreader.cpp b/src/osd/modules/render/bgfx/depthreader.cpp new file mode 100644 index 00000000000..077137159fe --- /dev/null +++ b/src/osd/modules/render/bgfx/depthreader.cpp @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// depthreader.cpp - BGFX depth state JSON reader +// +//============================================================ + +#include <bgfx/bgfx.h> + +#include "depthreader.h" + +const depth_reader::string_to_enum depth_reader::FUNCTION_NAMES[depth_reader::FUNCTION_COUNT] = { + { "never", BGFX_STATE_DEPTH_TEST_NEVER }, + { "less", BGFX_STATE_DEPTH_TEST_LESS }, + { "equal", BGFX_STATE_DEPTH_TEST_EQUAL }, + { "lequal", BGFX_STATE_DEPTH_TEST_LEQUAL }, + { "greater", BGFX_STATE_DEPTH_TEST_GREATER }, + { "notequal", BGFX_STATE_DEPTH_TEST_NOTEQUAL }, + { "gequal", BGFX_STATE_DEPTH_TEST_GEQUAL }, + { "always", BGFX_STATE_DEPTH_TEST_ALWAYS } +}; + +uint64_t depth_reader::read_from_value(const Value& value) +{ + uint64_t write_enable = 0; + if (value.HasMember("writeEnable")) + { + assert(value["writeEnable"].IsBool()); + write_enable = value["writeEnable"].GetBool() ? BGFX_STATE_DEPTH_WRITE: 0; + } + + uint64_t function = get_enum_from_value(value, "function", BGFX_STATE_DEPTH_TEST_ALWAYS, FUNCTION_NAMES, FUNCTION_COUNT); + + return write_enable | function; +} diff --git a/src/osd/modules/render/bgfx/depthreader.h b/src/osd/modules/render/bgfx/depthreader.h new file mode 100644 index 00000000000..5b2fc4e374c --- /dev/null +++ b/src/osd/modules/render/bgfx/depthreader.h @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// depthreader.h - BGFX depth state JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_DEPTH_READER__ +#define __DRAWBGFX_DEPTH_READER__ + +#include "statereader.h" + +class depth_reader : public state_reader { +public: + static uint64_t read_from_value(const Value& value); + +private: + static const int FUNCTION_COUNT = 8; + static const string_to_enum FUNCTION_NAMES[FUNCTION_COUNT]; +}; + +#endif // __DRAWBGFX_DEPTH_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/effect.cpp b/src/osd/modules/render/bgfx/effect.cpp new file mode 100644 index 00000000000..bf6ccb963c5 --- /dev/null +++ b/src/osd/modules/render/bgfx/effect.cpp @@ -0,0 +1,52 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effect.cpp - BGFX shader material to be applied to a mesh +// +//============================================================ + +#include "effect.h" + +bgfx_effect::bgfx_effect(uint64_t state, bgfx::ShaderHandle vertex_shader, bgfx::ShaderHandle fragment_shader, std::vector<bgfx_uniform*> uniforms) + : m_state(state) +{ + m_program_handle = bgfx::createProgram(vertex_shader, fragment_shader, false); + + for (int i = 0; i < uniforms.size(); i++) + { + m_uniforms[uniforms[i]->name()] = uniforms[i]; + } +} + +bgfx_effect::~bgfx_effect() +{ + for (std::pair<std::string, bgfx_uniform*> uniform : m_uniforms) + { + delete uniform.second; + } + m_uniforms.clear(); + bgfx::destroyProgram(m_program_handle); +} + +void bgfx_effect::submit(int view) +{ + for (std::pair<std::string, bgfx_uniform*> uniform_pair : m_uniforms) + { + (uniform_pair.second)->upload(); + } + bgfx::setState(m_state); + bgfx::submit(view, m_program_handle); +} + +bgfx_uniform* bgfx_effect::uniform(std::string name) +{ + std::map<std::string, bgfx_uniform*>::iterator iter = m_uniforms.find(name); + + if (iter != m_uniforms.end()) + { + return iter->second; + } + + return nullptr; +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/effect.h b/src/osd/modules/render/bgfx/effect.h new file mode 100644 index 00000000000..e87f418022e --- /dev/null +++ b/src/osd/modules/render/bgfx/effect.h @@ -0,0 +1,40 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effect.h - BGFX shader material to be applied to a mesh +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_EFFECT__ +#define __DRAWBGFX_EFFECT__ + +#include <bgfx/bgfx.h> + +#include <string> +#include <vector> +#include <map> + +#include "uniform.h" + +class bgfx_effect +{ +public: + bgfx_effect(uint64_t state, bgfx::ShaderHandle vertexShader, bgfx::ShaderHandle fragmentShader, std::vector<bgfx_uniform*> uniforms); + ~bgfx_effect(); + + void submit(int view); + + // Getters + bgfx_uniform* uniform(std::string name); + bgfx::ProgramHandle get_program() const { return m_program_handle; } + +private: + uint64_t m_state; + bgfx::ProgramHandle m_program_handle; + std::map<std::string, bgfx_uniform*> m_uniforms; +}; + +#endif // __DRAWBGFX_EFFECT__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/effectmanager.cpp b/src/osd/modules/render/bgfx/effectmanager.cpp new file mode 100644 index 00000000000..ea35020ad85 --- /dev/null +++ b/src/osd/modules/render/bgfx/effectmanager.cpp @@ -0,0 +1,66 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effectmanager.cpp - BGFX shader effect manager +// +// Maintains a string-to-entry lookup of BGFX shader +// effects, defined by effect.h and read by effectreader.h +// +//============================================================ + +#include "emu.h" + +#include <rapidjson/document.h> + +#include <bgfx/bgfxplatform.h> +#include <bgfx/bgfx.h> +#include <bx/readerwriter.h> + +#include "effectmanager.h" +#include "effectreader.h" +#include "effect.h" + +using namespace rapidjson; + +effect_manager::~effect_manager() +{ + for (std::pair<std::string, bgfx_effect*> effect : m_effects) + { + delete effect.second; + } + m_effects.clear(); +} + +bgfx_effect* effect_manager::effect(std::string name) +{ + std::map<std::string, bgfx_effect*>::iterator iter = m_effects.find(name); + if (iter != m_effects.end()) + { + return iter->second; + } + + return load_effect(name); +} + +bgfx_effect* effect_manager::load_effect(std::string name) { + std::string path = "bgfx/effects/" + name + ".json"; + + bx::CrtFileReader reader; + bx::open(&reader, path.c_str()); + + int32_t size = (uint32_t)bx::getSize(&reader); + + char* data = new char[size + 1]; + bx::read(&reader, reinterpret_cast<void*>(data), size); + bx::close(&reader); + data[size] = 0; + + Document document; + document.Parse<0>(data); + bgfx_effect* effect = effect_reader::read_from_value(m_shaders, document); + + m_effects[name] = effect; + + return effect; +} diff --git a/src/osd/modules/render/bgfx/effectmanager.h b/src/osd/modules/render/bgfx/effectmanager.h new file mode 100644 index 00000000000..e86b24669ad --- /dev/null +++ b/src/osd/modules/render/bgfx/effectmanager.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effectmanager.h - BGFX shader effect manager +// +// Maintains a string-to-entry lookup of BGFX shader +// effects, defined by effect.h and read by effectreader.h +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_EFFECT_MANAGER__ +#define __DRAWBGFX_EFFECT_MANAGER__ + +#include <map> +#include <string> + +#include <bgfx/bgfx.h> + +#include "shadermanager.h" + +class bgfx_effect; + +class effect_manager { +public: + effect_manager(shader_manager& shaders) : m_shaders(shaders) { } + ~effect_manager(); + + // Getters + bgfx_effect* effect(std::string name); + +private: + bgfx_effect* load_effect(std::string name); + + shader_manager& m_shaders; + std::map<std::string, bgfx_effect*> m_effects; +}; + +#endif // __DRAWBGFX_EFFECT_MANAGER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/effectreader.cpp b/src/osd/modules/render/bgfx/effectreader.cpp new file mode 100644 index 00000000000..978c004337f --- /dev/null +++ b/src/osd/modules/render/bgfx/effectreader.cpp @@ -0,0 +1,77 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effectreader.cpp - BGFX effect JSON reader +// +//============================================================ + +#include <string> + +#include <bgfx/bgfx.h> + +#include "emu.h" + +#include "effect.h" +#include "blendreader.h" +#include "depthreader.h" +#include "cullreader.h" +#include "writereader.h" +#include "shadermanager.h" +#include "uniformreader.h" + +#include "effectreader.h" + +bgfx_effect* effect_reader::read_from_value(shader_manager& shaders, const Value& value) +{ + validate_parameters(value); + + uint64_t blend = blend_reader::read_from_value(value["blend"]); + uint64_t depth = depth_reader::read_from_value(value["depth"]); + uint64_t cull = cull_reader::read_from_value(value["cull"]); + uint64_t write = write_reader::read_from_value(value["write"]); + + std::vector<bgfx_uniform*> uniforms; + const Value& uniform_array = value["uniforms"]; + for (UINT32 i = 0; i < uniform_array.Size(); i++) + { + uniforms.push_back(uniform_reader::read_from_value(uniform_array[i])); + } + + std::string vertex_name(value["vertex"].GetString()); + bgfx::ShaderHandle vertex_shader = shaders.shader(vertex_name); + + std::string fragment_name(""); + if (value.HasMember("fragment")) + { + fragment_name = value["fragment"].GetString(); + } + else if (value.HasMember("pixel")) + { + fragment_name = value["pixel"].GetString(); + } + bgfx::ShaderHandle fragment_shader = shaders.shader(fragment_name); + + return new bgfx_effect(blend | depth | cull | write, vertex_shader, fragment_shader, uniforms); +} + +void effect_reader::validate_parameters(const Value& value) +{ + assert(value.HasMember("blend")); + assert(value.HasMember("depth")); + assert(value.HasMember("cull")); + assert(value.HasMember("write")); + assert(value.HasMember("vertex")); + assert(value["vertex"].IsString()); + assert(value.HasMember("fragment") || value.HasMember("pixel")); + if (value.HasMember("fragment")) + { + assert(value["fragment"].IsString()); + } + if (value.HasMember("pixel")) + { + assert(value["pixel"].IsString()); + } + assert(value.HasMember("uniforms")); + assert(value["uniforms"].IsArray()); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/effectreader.h b/src/osd/modules/render/bgfx/effectreader.h new file mode 100644 index 00000000000..cc0c3ea69e5 --- /dev/null +++ b/src/osd/modules/render/bgfx/effectreader.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// effectreader.h - BGFX effect JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_EFFECT_READER__ +#define __DRAWBGFX_EFFECT_READER__ + +#include "statereader.h" + +class bgfx_effect; +class shader_manager; + +class effect_reader : public state_reader +{ +public: + static bgfx_effect* read_from_value(shader_manager& shaders, const Value& value); + +private: + static void validate_parameters(const Value& value); +}; + +#endif // __DRAWBGFX_EFFECT_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/fs_quad_texture.sc b/src/osd/modules/render/bgfx/fs_gui.sc index 5a45a056171..28a1438d189 100644 --- a/src/osd/modules/render/bgfx/fs_quad_texture.sc +++ b/src/osd/modules/render/bgfx/fs_gui.sc @@ -5,7 +5,7 @@ $input v_color0, v_texcoord0 #include "../../../../../3rdparty/bgfx/examples/common/common.sh" -SAMPLER2D(s_tex, 0); +SAMPLER2D(s_tex, 0); void main() { diff --git a/src/osd/modules/render/bgfx/fs_line.sc b/src/osd/modules/render/bgfx/fs_line.sc deleted file mode 100644 index 1fcd3b27284..00000000000 --- a/src/osd/modules/render/bgfx/fs_line.sc +++ /dev/null @@ -1,11 +0,0 @@ -$input v_color0 - -// license:BSD-3-Clause -// copyright-holders:Dario Manesku - -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" - -void main() -{ - gl_FragColor = v_color0; -} diff --git a/src/osd/modules/render/bgfx/fs_quad.sc b/src/osd/modules/render/bgfx/fs_quad.sc deleted file mode 100644 index 1fcd3b27284..00000000000 --- a/src/osd/modules/render/bgfx/fs_quad.sc +++ /dev/null @@ -1,11 +0,0 @@ -$input v_color0 - -// license:BSD-3-Clause -// copyright-holders:Dario Manesku - -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" - -void main() -{ - gl_FragColor = v_color0; -} diff --git a/src/osd/modules/render/bgfx/fs_screen.sc b/src/osd/modules/render/bgfx/fs_screen.sc new file mode 100644 index 00000000000..59c2916039e --- /dev/null +++ b/src/osd/modules/render/bgfx/fs_screen.sc @@ -0,0 +1,16 @@ +$input v_color0, v_texcoord0 + +// license:BSD-3-Clause +// copyright-holders:Dario Manesku + +#include "../../../../../3rdparty/bgfx/examples/common/common.sh" + +SAMPLER2D(s_tex, 0); + +uniform vec4 u_tint; + +void main() +{ + vec4 texel = texture2D(s_tex, v_texcoord0); + gl_FragColor = texel * v_color0 * u_tint; +} diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp new file mode 100644 index 00000000000..bcebb755ab6 --- /dev/null +++ b/src/osd/modules/render/bgfx/inputpair.cpp @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// inputpair.h - BGFX sampler-and-texture pair +// +// Keeps track of the texture which is bound to the sampler +// which is bound to the specified stage index. +// +//============================================================ + +#include "inputpair.h" +#include "texture.h" +#include "effect.h" + +bgfx_input_pair::bgfx_input_pair(int index, std::string sampler, bgfx_texture* texture) + : m_index(index) + , m_sampler(sampler) + , m_texture(texture) +{ +} + +void bgfx_input_pair::bind(bgfx_effect *effect) +{ + bgfx::setTexture(m_index, effect->uniform(m_sampler)->handle(), m_texture->handle()); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/inputpair.h b/src/osd/modules/render/bgfx/inputpair.h new file mode 100644 index 00000000000..2cab7ff2363 --- /dev/null +++ b/src/osd/modules/render/bgfx/inputpair.h @@ -0,0 +1,37 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// inputpair.h - BGFX sampler-and-texture pair +// +// Keeps track of the texture which is bound to the sampler +// which is bound to the specified stage index. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_INPUT_PAIR__ +#define __DRAWBGFX_INPUT_PAIR__ + +#include <bgfx/bgfx.h> + +#include <string> + +class bgfx_effect; +class bgfx_texture; + +class bgfx_input_pair +{ +public: + bgfx_input_pair(int index, std::string sampler, bgfx_texture* texture); + + void bind(bgfx_effect *effect); + +private: + int m_index; + std::string m_sampler; + bgfx_texture* m_texture; +}; + +#endif // __DRAWBGFX_INPUT_PAIR__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/parameter.cpp b/src/osd/modules/render/bgfx/parameter.cpp new file mode 100644 index 00000000000..004d5fd17f8 --- /dev/null +++ b/src/osd/modules/render/bgfx/parameter.cpp @@ -0,0 +1,56 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// parameter.cpp - BGFX shader parameter +// +// A value that represents some form of parametric +// operation, which can be fed to the input of a BGFX +// shader uniform. +// +//============================================================ + +#include "emu.h" + +// NB: NOT FINISHED! + +#include "parameter.h" + +bgfx_parameter::bgfx_parameter(std::string name, parameter_type type, int period) + : m_name(name) + , m_type(type) + , m_period(period) + , m_frame(0) +{ +} + +bgfx_parameter::~bgfx_parameter() +{ +} + +void bgfx_parameter::frame() +{ + switch(m_type) + { + case PARAM_FRAME_MASK: + m_frame++; + if (m_frame == m_period) + { + m_frame = 0; + } + break; + default: + break; + } +} + +bool bgfx_parameter::active() +{ + switch (m_type) + { + case PARAM_FRAME_MASK: + return (m_frame % m_period == 0); + default: + return false; + } +} diff --git a/src/osd/modules/render/bgfx/parameter.h b/src/osd/modules/render/bgfx/parameter.h new file mode 100644 index 00000000000..76defb439c4 --- /dev/null +++ b/src/osd/modules/render/bgfx/parameter.h @@ -0,0 +1,43 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// parameter.h - BGFX shader parameter +// +// A value that represents some form of parametric +// operation, which can be fed to the input of a BGFX +// shader uniform. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_PARAMETER__ +#define __DRAWBGFX_PARAMETER__ + +#include <string> + +#include "emu.h" + +class bgfx_parameter +{ +public: + enum parameter_type + { + PARAM_FRAME_MASK + }; + + bgfx_parameter(std::string name, parameter_type type, int period); + ~bgfx_parameter(); + + void frame(); + bool active(); + +private: + std::string m_name; + parameter_type m_type; + UINT32 m_period; + UINT32 m_frame; +}; + +#endif // __DRAWBGFX_PARAMETER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/paramreader.cpp b/src/osd/modules/render/bgfx/paramreader.cpp new file mode 100644 index 00000000000..f1391ec761e --- /dev/null +++ b/src/osd/modules/render/bgfx/paramreader.cpp @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// paramreader.cpp - BGFX shader parameter JSON reader +// +//============================================================ + +#include <string> + +#include "paramreader.h" + +#include "parameter.h" + +const parameter_reader::string_to_enum parameter_reader::TYPE_NAMES[parameter_reader::TYPE_COUNT] = { + { "frame_mask", uint64_t(bgfx_parameter::parameter_type::PARAM_FRAME_MASK) } +}; + +bgfx_parameter* parameter_reader::read_from_value(const Value& value) +{ + validate_parameters(value); + + std::string name = value["name"].GetString(); + bgfx_parameter::parameter_type type = bgfx_parameter::parameter_type(get_enum_from_value(value, "type", uint64_t(bgfx_parameter::parameter_type::PARAM_FRAME_MASK), TYPE_NAMES, TYPE_COUNT)); + int period = int(value["period"].GetDouble()); + + return new bgfx_parameter(name, type, period); +} + +void parameter_reader::validate_parameters(const Value& value) +{ + assert(value.HasMember("name")); + assert(value["name"].IsString()); + assert(value.HasMember("type")); + assert(value["type"].IsString()); + assert(value.HasMember("period")); + assert(value["period"].IsDouble()); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/paramreader.h b/src/osd/modules/render/bgfx/paramreader.h new file mode 100644 index 00000000000..12df9185dfc --- /dev/null +++ b/src/osd/modules/render/bgfx/paramreader.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// paramreader.h - BGFX shader parameter JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_PARAM_READER__ +#define __DRAWBGFX_PARAM_READER__ + +#include "statereader.h" + +class bgfx_parameter; + +class parameter_reader : public state_reader +{ +public: + static bgfx_parameter* read_from_value(const Value& value); + +private: + static void validate_parameters(const Value& value); + + static const int TYPE_COUNT = 1; + static const string_to_enum TYPE_NAMES[TYPE_COUNT]; +}; + +#endif // __DRAWBGFX_PARAM_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/shadermanager.cpp b/src/osd/modules/render/bgfx/shadermanager.cpp new file mode 100644 index 00000000000..20821721ea8 --- /dev/null +++ b/src/osd/modules/render/bgfx/shadermanager.cpp @@ -0,0 +1,84 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// shadermanager.cpp - BGFX shader manager +// +// Maintains a mapping between strings and BGFX shaders, +// either vertex or pixel/fragment. +// +//============================================================ + +#include "emu.h" + +#include <bgfx/bgfxplatform.h> +#include <bgfx/bgfx.h> +#include <bx/fpumath.h> +#include <bx/readerwriter.h> + +#include "shadermanager.h" + +shader_manager::~shader_manager() +{ + for (std::pair<std::string, bgfx::ShaderHandle> shader : m_shaders) + { + bgfx::destroyShader(shader.second); + } + m_shaders.clear(); +} + +bgfx::ShaderHandle shader_manager::shader(std::string name) +{ + std::map<std::string, bgfx::ShaderHandle>::iterator iter = m_shaders.find(name); + if (iter != m_shaders.end()) + { + return iter->second; + } + + return load_shader(name); +} + +bgfx::ShaderHandle shader_manager::load_shader(std::string name) { + std::string shader_path = "shaders/dx9/"; + switch (bgfx::getRendererType()) + { + case bgfx::RendererType::Direct3D11: + case bgfx::RendererType::Direct3D12: + shader_path = "shaders/dx11/"; + break; + + case bgfx::RendererType::OpenGL: + shader_path = "shaders/glsl/"; + break; + + case bgfx::RendererType::Metal: + shader_path = "shaders/metal/"; + break; + + case bgfx::RendererType::OpenGLES: + shader_path = "shaders/gles/"; + break; + + default: + break; + } + + bgfx::ShaderHandle handle = bgfx::createShader(load_mem(shader_path + name + ".bin")); + + m_shaders[name] = handle; + + return handle; +} + +const bgfx::Memory* shader_manager::load_mem(std::string name) { + bx::CrtFileReader reader; + bx::open(&reader, name.c_str()); + + uint32_t size = (uint32_t)bx::getSize(&reader); + const bgfx::Memory* mem = bgfx::alloc(size + 1); + bx::read(&reader, mem->data, size); + bx::close(&reader); + + mem->data[mem->size - 1] = '\0'; + return mem; +} diff --git a/src/osd/modules/render/bgfx/shadermanager.h b/src/osd/modules/render/bgfx/shadermanager.h new file mode 100644 index 00000000000..a3dbb425088 --- /dev/null +++ b/src/osd/modules/render/bgfx/shadermanager.h @@ -0,0 +1,37 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// shadermanager.h - BGFX shader manager +// +// Maintains a mapping between strings and BGFX shaders, +// either vertex or pixel/fragment. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_SHADER_MANAGER__ +#define __DRAWBGFX_SHADER_MANAGER__ + +#include <map> +#include <string> + +#include <bgfx/bgfx.h> + +class shader_manager { +public: + shader_manager() {} + ~shader_manager(); + + // Getters + bgfx::ShaderHandle shader(std::string name); + +private: + bgfx::ShaderHandle load_shader(std::string name); + static const bgfx::Memory* load_mem(std::string name); + + std::map<std::string, bgfx::ShaderHandle> m_shaders; +}; + +#endif // __DRAWBGFX_SHADER_MANAGER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp new file mode 100644 index 00000000000..76f093580bd --- /dev/null +++ b/src/osd/modules/render/bgfx/slider.cpp @@ -0,0 +1,65 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// slider.cpp - BGFX shader parameter slider +// +//============================================================ + +#include "emu.h" + +#include "slider.h" + +bgfx_slider::bgfx_slider(slider_type type, std::string name, std::string description, void *defaults, void *min, void *max) + : m_type(type) + , m_name(name) + , m_description(description) +{ + m_data = global_alloc_array_clear<char>(storage_size(type)); + m_min = global_alloc_array_clear<char>(storage_size(type)); + m_max = global_alloc_array_clear<char>(storage_size(type)); + memcpy(m_data, defaults, size(type)); + memcpy(m_min, min, size(type)); + memcpy(m_max, max, size(type)); +} + +bgfx_slider::~bgfx_slider() +{ + global_free(m_data); + global_free(m_min); + global_free(m_max); +} + +size_t bgfx_slider::storage_size(slider_type type) +{ + switch(type) + { + case SLIDER_INT: + return 1 * sizeof(int); + case SLIDER_BOOL: + case SLIDER_FLOAT: + case SLIDER_COLOR: + case SLIDER_VEC2: + return 4 * sizeof(float); + default: + return 0; + } +} + +size_t bgfx_slider::size(slider_type type) +{ + switch(type) + { + case SLIDER_INT: + return sizeof(int); + case SLIDER_BOOL: + case SLIDER_FLOAT: + return sizeof(float); + case SLIDER_COLOR: + return sizeof(float) * 3; + case SLIDER_VEC2: + return sizeof(float) * 2; + default: + return 0; + } +} diff --git a/src/osd/modules/render/bgfx/slider.h b/src/osd/modules/render/bgfx/slider.h new file mode 100644 index 00000000000..6c3054d7cc2 --- /dev/null +++ b/src/osd/modules/render/bgfx/slider.h @@ -0,0 +1,49 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// slider.h - BGFX shader parameter slider +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_SLIDER__ +#define __DRAWBGFX_SLIDER__ + +#include <bgfx/bgfx.h> + +#include <string> +#include <vector> +#include <map> + +#include "uniform.h" + +class bgfx_slider +{ +public: + enum slider_type + { + SLIDER_BOOL, + SLIDER_FLOAT, + SLIDER_INT, + SLIDER_COLOR, + SLIDER_VEC2 + }; + + bgfx_slider(slider_type type, std::string name, std::string description, void *defaults, void *min, void *max); + ~bgfx_slider(); + + static size_t size(slider_type type); + static size_t storage_size(slider_type type); +protected: + + slider_type m_type; + std::string m_name; + std::string m_description; + char* m_data; + char* m_min; + char* m_max; +}; + +#endif // __DRAWBGFX_SLIDER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/sliderreader.cpp b/src/osd/modules/render/bgfx/sliderreader.cpp new file mode 100644 index 00000000000..7bd2d8c59fa --- /dev/null +++ b/src/osd/modules/render/bgfx/sliderreader.cpp @@ -0,0 +1,74 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================== +// +// sliderreader.cpp - BGFX shader parameter slider JSON reader +// +//============================================================== + +#include "emu.h" + +#include "sliderreader.h" + +#include "slider.h" + +const slider_reader::string_to_enum slider_reader::TYPE_NAMES[slider_reader::TYPE_COUNT] = { + { "bool", uint64_t(bgfx_slider::slider_type::SLIDER_BOOL) }, + { "float", uint64_t(bgfx_slider::slider_type::SLIDER_FLOAT) }, + { "int", uint64_t(bgfx_slider::slider_type::SLIDER_INT) }, + { "color", uint64_t(bgfx_slider::slider_type::SLIDER_COLOR) }, + { "vec2", uint64_t(bgfx_slider::slider_type::SLIDER_VEC2) } +}; + +bgfx_slider* slider_reader::read_from_value(const Value& value) +{ + validate_parameters(value); + + bgfx_slider::slider_type type = bgfx_slider::slider_type(get_enum_from_value(value, "type", uint64_t(bgfx_slider::slider_type::SLIDER_FLOAT), TYPE_NAMES, TYPE_COUNT)); + std::string name = value["name"].GetString(); + std::string description = value["text"].GetString(); + + float defaults[4]; + float min[4]; + float max[4]; + get_values(value, "default", defaults); + get_values(value, "min", min); + get_values(value, "max", max); + + return new bgfx_slider(type, name, description, defaults, min, max); +} + +void slider_reader::get_values(const Value& value, std::string name, float* values) +{ + const char* name_str = name.c_str(); + if (value.HasMember(name_str)) + { + if (value[name_str].IsBool()) + { + values[0] = value[name_str].GetBool() ? 1.0f : 0.0f; + } + else if (value[name_str].IsDouble()) + { + values[0] = float(value[name_str].GetDouble()); + } + else + { + const Value& value_array = value[name_str]; + for (UINT32 i = 0; i < value_array.Size() && i < 4; i++) + { + values[i] = float(value_array[i].GetDouble()); + } + } + } +} + +void slider_reader::validate_parameters(const Value& value) +{ + assert(value.HasMember("type")); + assert(value["type"].IsString()); + assert(value.HasMember("name")); + assert(value["name"].IsString()); + assert(value.HasMember("text")); + assert(value["text"].IsString()); + assert(value.HasMember("default")); +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/sliderreader.h b/src/osd/modules/render/bgfx/sliderreader.h new file mode 100644 index 00000000000..9253b9b9130 --- /dev/null +++ b/src/osd/modules/render/bgfx/sliderreader.h @@ -0,0 +1,31 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// sliderreader.h - BGFX shader parameter slider JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_SLIDER_READER__ +#define __DRAWBGFX_SLIDER_READER__ + +#include "statereader.h" + +class bgfx_slider; + +class slider_reader : public state_reader +{ +public: + static bgfx_slider* read_from_value(const Value& value); + +private: + static void get_values(const Value& value, std::string name, float* values); + static void validate_parameters(const Value& value); + + static const int TYPE_COUNT = 5; + static const string_to_enum TYPE_NAMES[TYPE_COUNT]; +}; + +#endif // __DRAWBGFX_SLIDER_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/statereader.cpp b/src/osd/modules/render/bgfx/statereader.cpp new file mode 100644 index 00000000000..2f222b19bdf --- /dev/null +++ b/src/osd/modules/render/bgfx/statereader.cpp @@ -0,0 +1,107 @@ +#include "statereader.h" + +uint64_t state_reader::get_enum_from_value(const Value& value, std::string name, const uint64_t default_value, const string_to_enum* enums, const int count) +{ + if (value.HasMember(name.c_str())) + { + assert(value[name.c_str()].IsString()); + return get_param_from_string(value[name.c_str()].GetString(), enums, count); + } + else + { + return default_value; + } +} + +uint64_t state_reader::get_param_from_string(std::string value, const string_to_enum* enums, const int count) +{ + for (int i = 0; i < count; i++) + { + if (value == enums[i].m_string) + { + return enums[i].m_enum; + } + } + assert(false); + return 0; +} + +void state_reader::validate_array_parameter(const Value& value, std::string typeName, std::string paramName, const int count) +{ + const char* name = paramName.c_str(); + if (value.HasMember(name)) + { + assert(value[name].IsArray()); + assert(value[name].Size() == count); + } +} + +void state_reader::validate_double_parameter(const Value& value, std::string typeName, std::string name) +{ + if (value.HasMember(name.c_str())) + { + assert(value[name.c_str()].IsDouble()); + } +} + +void state_reader::validate_string_parameter(const Value& value, std::string typeName, std::string name) +{ + if (value.HasMember(name.c_str())) + { + assert(value[name.c_str()].IsString()); + } +} + +void state_reader::validate_boolean_parameter(const Value& value, std::string typeName, std::string name) +{ + if (value.HasMember(name.c_str())) + { + assert(value[name.c_str()].IsBool()); + } +} + +bool state_reader::get_bool(const Value& value, const std::string name, const bool default_value) +{ + if (value.HasMember(name.c_str())) + { + return value[name.c_str()].GetBool(); + } + return default_value; +} + +void state_reader::get_float(const Value& value, const std::string name, float* out, float* default_value, int count) +{ + if (value.HasMember(name.c_str())) + { + if (count == 1) + { + *out = (float) value[name.c_str()].GetDouble(); + return; + } + else + { + get_vec_values(value[name.c_str()], out, count); + } + } + for (int def = 0; def < count; def++) + { + out[def] = default_value[def]; + } +} + +void state_reader::get_vec_values(const Value& value_array, float* data, const unsigned int count) +{ + for (unsigned int i = 0; i < count && i < value_array.Size(); i++) + { + data[i] = (float) value_array[i].GetDouble(); + } +} + +std::string state_reader::get_string(const Value& value, const std::string name, const std::string default_value) +{ + if (value.HasMember(name.c_str())) + { + return std::string(value[name.c_str()].GetString()); + } + return default_value; +} diff --git a/src/osd/modules/render/bgfx/statereader.h b/src/osd/modules/render/bgfx/statereader.h new file mode 100644 index 00000000000..57edea1d28e --- /dev/null +++ b/src/osd/modules/render/bgfx/statereader.h @@ -0,0 +1,38 @@ +#pragma once + +#ifndef __DRAWBGFX_STATE_READER__ +#define __DRAWBGFX_STATE_READER__ + +#include "emu.h" + +#include <string> +#include "rapidjson/document.h" + +using namespace rapidjson; + +class state_reader +{ +protected: + struct string_to_enum + { + std::string m_string; + const UINT64 m_enum; + }; + + static void validate_array_parameter(const Value& value, std::string type_name, std::string name, const int count); + static void validate_double_parameter(const Value& value, std::string type_name, std::string name); + static void validate_string_parameter(const Value& value, std::string type_name, std::string name); + static void validate_boolean_parameter(const Value& value, std::string type_name, std::string name); + + static bool get_bool(const Value& value, const std::string name, const bool default_value); + static void get_float(const Value& value, const std::string name, float* out, float* default_value, const int count = 1); + static std::string get_string(const Value& value, const std::string name, const std::string default_value); + + static uint64_t get_enum_from_value(const Value& value, std::string name, const uint64_t default_value, const string_to_enum* enums, const int count); + static uint64_t get_param_from_string(std::string value, const string_to_enum* enums, const int count); + +private: + static void get_vec_values(const Value& value_array, float* data, const unsigned int count); +}; + +#endif // __DRAWBGFX_STATE_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/target.cpp b/src/osd/modules/render/bgfx/target.cpp new file mode 100644 index 00000000000..b8026060b04 --- /dev/null +++ b/src/osd/modules/render/bgfx/target.cpp @@ -0,0 +1,26 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// target.cpp - Render target abstraction for BGFX layer +// +//============================================================ + +#include "target.h" + +bgfx_target::bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter) + : bgfx_texture(name, format, width, height, nullptr, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | (filter ? 0 : (BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT))) +{ + m_target = bgfx::createFrameBuffer(1, &m_handle, false); +} + +bgfx_target::bgfx_target(std::string name, void *handle, uint32_t width, uint32_t height) + : bgfx_texture(name, bgfx::TextureFormat::RGBA8, width, height, nullptr, BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT) +{ + m_target = bgfx::createFrameBuffer(handle, width, height); +} + +bgfx_target::~bgfx_target() +{ + bgfx::destroyFrameBuffer(m_target); +} diff --git a/src/osd/modules/render/bgfx/target.h b/src/osd/modules/render/bgfx/target.h new file mode 100644 index 00000000000..099288cbec1 --- /dev/null +++ b/src/osd/modules/render/bgfx/target.h @@ -0,0 +1,30 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// target.h - Render target abstraction for BGFX layer +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_TARGET__ +#define __DRAWBGFX_TARGET__ + +#include "texture.h" + +class bgfx_target : public bgfx_texture +{ +public: + bgfx_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter = false); + bgfx_target(std::string name, void *handle, uint32_t width, uint32_t height); + virtual ~bgfx_target(); + + // Getters + bgfx::FrameBufferHandle target() const { return m_target; } + +private: + bgfx::FrameBufferHandle m_target; +}; + +#endif // __DRAWBGFX_TARGET__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp new file mode 100644 index 00000000000..88bf6a9d96f --- /dev/null +++ b/src/osd/modules/render/bgfx/targetmanager.cpp @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// targetmanager.cpp - BGFX render target manager +// +// Maintains a string-to-entry mapping for any registered +// render targets. +// +//============================================================ + +#include <bgfx/bgfx.h> + +#include "targetmanager.h" +#include "target.h" + +target_manager::~target_manager() +{ + for (std::pair<std::string, bgfx_target*> target : m_targets) + { + delete target.second; + } + m_targets.clear(); +} + +bgfx_target* target_manager::create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter) +{ + printf("Creating %s\n", name.c_str()); + bgfx_target* target = new bgfx_target(name, format, width, height, filter); + m_targets[name] = target; + + m_textures.add_texture(name, target); + return target; +} + +bgfx_target* target_manager::create_target(std::string name, void *handle, uint32_t width, uint32_t height) +{ + printf("Creating %s\n", name.c_str()); + bgfx_target* target = new bgfx_target(name, handle, width, height); + m_targets[name] = target; + + m_textures.add_texture(name, target); + return target; +} + +bgfx_target* target_manager::target(std::string name) +{ + std::map<std::string, bgfx_target*>::iterator iter = m_targets.find(name); + if (iter != m_targets.end()) + { + return iter->second; + } + + return nullptr; +} diff --git a/src/osd/modules/render/bgfx/targetmanager.h b/src/osd/modules/render/bgfx/targetmanager.h new file mode 100644 index 00000000000..9cc957d1c38 --- /dev/null +++ b/src/osd/modules/render/bgfx/targetmanager.h @@ -0,0 +1,44 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// targetmanager.h - BGFX render target manager +// +// Maintains a string-to-entry mapping for any registered +// render targets. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_TARGET_MANAGER__ +#define __DRAWBGFX_TARGET_MANAGER__ + +#include <map> +#include <string> + +#include <bgfx/bgfx.h> + +#include "texturemanager.h" + +class bgfx_target; + +class target_manager { +public: + target_manager(texture_manager& textures) : m_textures(textures) { } + ~target_manager(); + + bgfx_target* create_target(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, bool filter = false); + bgfx_target* create_target(std::string name, void *handle, uint32_t width, uint32_t height); + + // Getters + bgfx_target* target(std::string name); + +private: + bgfx_target* create_target(std::string name); + + std::map<std::string, bgfx_target*> m_targets; + texture_manager& m_textures; +}; + +#endif // __DRAWBGFX_TARGET_MANAGER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/texture.cpp b/src/osd/modules/render/bgfx/texture.cpp new file mode 100644 index 00000000000..c588fa63b20 --- /dev/null +++ b/src/osd/modules/render/bgfx/texture.cpp @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// texture.cpp - Texture abstraction for BGFX layer +// +//============================================================ + +#include "emu.h" + +#include "texture.h" + +bgfx_texture::bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data, uint32_t flags) + : m_name(name) + , m_format(format) + , m_width(width) + , m_height(height) +{ + bgfx::TextureInfo info; + bgfx::calcTextureSize(info, width, height, 1, false, 1, format); + if (data != nullptr) + { + m_handle = bgfx::createTexture2D(width, height, 1, format, flags, bgfx::copy(data, info.storageSize)); + } + else + { + m_handle = bgfx::createTexture2D(width, height, 1, format, flags); + + const bgfx::Memory* memory = bgfx::alloc(info.storageSize); + memset(memory->data, 0, info.storageSize); + bgfx::updateTexture2D(m_handle, 0, 0, 0, width, height, memory, info.storageSize / height); + } +} + +bgfx_texture::~bgfx_texture() +{ + bgfx::destroyTexture(m_handle); +} diff --git a/src/osd/modules/render/bgfx/texture.h b/src/osd/modules/render/bgfx/texture.h new file mode 100644 index 00000000000..833ab230917 --- /dev/null +++ b/src/osd/modules/render/bgfx/texture.h @@ -0,0 +1,39 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// texture.h - Texture abstraction for BGFX layer +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_TEXTURE__ +#define __DRAWBGFX_TEXTURE__ + +#include <bgfx/bgfx.h> + +#include <string> + +class bgfx_texture +{ +public: + bgfx_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP); + virtual ~bgfx_texture(); + + // Getters + std::string name() const { return m_name; } + bgfx::TextureFormat::Enum format() const { return m_format; } + uint32_t width() const { return m_width; } + uint32_t height() const { return m_height; } + bgfx::TextureHandle handle() const { return m_handle; } + +protected: + std::string m_name; + bgfx::TextureFormat::Enum m_format; + uint32_t m_width; + uint32_t m_height; + bgfx::TextureHandle m_handle; +}; + +#endif // __DRAWBGFX_TEXTURE__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/texturemanager.cpp b/src/osd/modules/render/bgfx/texturemanager.cpp new file mode 100644 index 00000000000..bb8f49494da --- /dev/null +++ b/src/osd/modules/render/bgfx/texturemanager.cpp @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// texturemanager.cpp - BGFX texture manager +// +// Maintains a string-to-entry mapping for any registered +// textures. +// +//============================================================ + +#include <bgfx/bgfx.h> + +#include "texturemanager.h" +#include "texture.h" + +texture_manager::~texture_manager() +{ + for (std::pair<std::string, bgfx_texture*> texture : m_textures) + { + delete texture.second; + } + m_textures.clear(); +} + +void texture_manager::add_texture(std::string name, bgfx_texture* texture) +{ + m_textures[name] = texture; +} + +bgfx_texture* texture_manager::create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data, uint32_t flags) +{ + bgfx_texture* texture = new bgfx_texture(name, format, width, height, data, flags); + m_textures[name] = texture; + return texture; +} + +bgfx_texture* texture_manager::texture(std::string name) +{ + std::map<std::string, bgfx_texture*>::iterator iter = m_textures.find(name); + if (iter != m_textures.end()) + { + return iter->second; + } + + return nullptr; +} diff --git a/src/osd/modules/render/bgfx/texturemanager.h b/src/osd/modules/render/bgfx/texturemanager.h new file mode 100644 index 00000000000..627e6689fa9 --- /dev/null +++ b/src/osd/modules/render/bgfx/texturemanager.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// texturemanager.h - BGFX texture manager +// +// Maintains a string-to-entry mapping for any registered +// textures. +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_TEXTURE_MANAGER__ +#define __DRAWBGFX_TEXTURE_MANAGER__ + +#include <map> +#include <string> + +#include <bgfx/bgfx.h> + +class bgfx_texture; + +class texture_manager { +public: + texture_manager() { } + ~texture_manager(); + + bgfx_texture* create_texture(std::string name, bgfx::TextureFormat::Enum format, uint32_t width, uint32_t height, void* data = nullptr, uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP); + void add_texture(std::string name, bgfx_texture* texture); + + // Getters + bgfx_texture* texture(std::string name); + +private: + bgfx_texture* create_texture(std::string name); + + std::map<std::string, bgfx_texture*> m_textures; +}; + +#endif // __DRAWBGFX_TEXTURE_MANAGER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/uniform.cpp b/src/osd/modules/render/bgfx/uniform.cpp new file mode 100644 index 00000000000..81fb95273f2 --- /dev/null +++ b/src/osd/modules/render/bgfx/uniform.cpp @@ -0,0 +1,80 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// uniform.cpp - Shader uniform abstraction for BGFX layer +// +//============================================================ + +#include "uniform.h" + +bgfx_uniform::bgfx_uniform(std::string name, bgfx::UniformType::Enum type) + : m_name(name) + , m_type(type) +{ + m_handle = bgfx::createUniform(m_name.c_str(), m_type); + m_data_size = get_size_for_type(type); + if (m_data_size > 0) + { + m_data = new uint8_t[m_data_size]; + } +} + +bgfx_uniform::~bgfx_uniform() +{ + bgfx::destroyUniform(m_handle); + delete [] m_data; +} + +void bgfx_uniform::upload() +{ + bgfx::setUniform(m_handle, m_data); +} + +bgfx_uniform* bgfx_uniform::set(float* value) +{ + return set(value, get_size_for_type(bgfx::UniformType::Vec4)); +} + +bgfx_uniform* bgfx_uniform::set_int(int value) +{ + return set(&value, get_size_for_type(bgfx::UniformType::Int1)); +} + +bgfx_uniform* bgfx_uniform::set_mat3(float* value) +{ + return set(value, get_size_for_type(bgfx::UniformType::Mat3)); +} + +bgfx_uniform* bgfx_uniform::set_mat4(float* value) +{ + return set(value, get_size_for_type(bgfx::UniformType::Mat4)); +} + +bgfx_uniform* bgfx_uniform::set(void* data, size_t size) +{ + int min_size = (size < m_data_size) ? size : m_data_size; + memcpy(m_data, data, min_size); + return this; +} + +size_t bgfx_uniform::get_size_for_type(bgfx::UniformType::Enum type) +{ + switch (type) + { + case bgfx::UniformType::Vec4: + return sizeof(float) * 4; + + case bgfx::UniformType::Int1: + return sizeof(int); + + case bgfx::UniformType::Mat3: + return sizeof(float) * 3 * 3; + + case bgfx::UniformType::Mat4: + return sizeof(float) * 4 * 4; + + default: + return 0; + } +}
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/uniform.h b/src/osd/modules/render/bgfx/uniform.h new file mode 100644 index 00000000000..6bb45f50d06 --- /dev/null +++ b/src/osd/modules/render/bgfx/uniform.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// uniform.h - Shader uniform abstraction for BGFX layer +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_UNIFORM__ +#define __DRAWBGFX_UNIFORM__ + +#include <bgfx/bgfx.h> + +#include <string> + +class bgfx_uniform +{ +public: + bgfx_uniform(std::string name, bgfx::UniformType::Enum type); + virtual ~bgfx_uniform(); + + virtual void upload(); + + // Getters + std::string name() { return m_name; } + bgfx::UniformType::Enum type() const { return m_type; } + bgfx::UniformHandle handle() const { return m_handle; } + + // Setters + bgfx_uniform* set(float* value); + bgfx_uniform* set_int(int value); + bgfx_uniform* set_mat3(float* value); + bgfx_uniform* set_mat4(float* value); + bgfx_uniform* set(void* data, size_t size); + + static size_t get_size_for_type(bgfx::UniformType::Enum type); + +protected: + bgfx::UniformHandle m_handle; + std::string m_name; + bgfx::UniformType::Enum m_type; + uint8_t* m_data; + size_t m_data_size; +}; + +#endif // __DRAWBGFX_UNIFORM__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/uniformreader.cpp b/src/osd/modules/render/bgfx/uniformreader.cpp new file mode 100644 index 00000000000..863c20e6e4f --- /dev/null +++ b/src/osd/modules/render/bgfx/uniformreader.cpp @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// uniformreader.cpp - BGFX shader uniform JSON reader +// +//============================================================ + +#include "uniformreader.h" +#include "uniform.h" + +const uniform_reader::string_to_enum uniform_reader::TYPE_NAMES[uniform_reader::TYPE_COUNT] = { + { "int", bgfx::UniformType::Int1 }, + { "vec4", bgfx::UniformType::Vec4 }, + { "mat3", bgfx::UniformType::Mat3 }, + { "mat4", bgfx::UniformType::Mat4 }, + { "camera", bgfx::UniformType::Mat4 } +}; + +bgfx_uniform* uniform_reader::read_from_value(const Value& value) +{ + assert(value.HasMember("name")); + assert(value["name"].IsString()); + const char* name = value["name"].GetString(); + + assert(value.HasMember("type")); + bgfx::UniformType::Enum type = bgfx::UniformType::Enum(get_enum_from_value(value, "type", bgfx::UniformType::Vec4, TYPE_NAMES, TYPE_COUNT)); + const size_t type_size = bgfx_uniform::get_size_for_type(type); + + assert(value.HasMember("values")); + assert(value["values"].IsArray()); + const Value& value_array = value["values"]; + const size_t array_size = value_array.Size() * sizeof(float); + + const size_t alloc_size = (type_size > array_size) ? type_size : array_size; + float* data = reinterpret_cast<float*>(new char[alloc_size]); + + unsigned int index = 0; + for (; index < type_size / 4 && index < value_array.Size(); index++) + { + data[index] = (float)value_array[index].GetDouble(); + } + + for (; index < type_size / 4; index++) { + data[index] = 0.0f; + } + + bgfx_uniform* uniform = new bgfx_uniform(name, type); + uniform->set((void*)data, type_size); + delete [] data; + + return uniform; +} diff --git a/src/osd/modules/render/bgfx/uniformreader.h b/src/osd/modules/render/bgfx/uniformreader.h new file mode 100644 index 00000000000..ead4bb0cefe --- /dev/null +++ b/src/osd/modules/render/bgfx/uniformreader.h @@ -0,0 +1,41 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// uniformreader.h - BGFX shader uniform JSON reader +// +//============================================================ + +#pragma once + +#ifndef __DRAWBGFX_UNIFORM_READER__ +#define __DRAWBGFX_UNIFORM_READER__ + +#include <bgfx/bgfx.h> + +#include "statereader.h" + +class bgfx_uniform; + +enum uniform_type +{ + TYPE_INT1 = bgfx::UniformType::Int1, + TYPE_VEC4 = bgfx::UniformType::Vec4, + TYPE_MAT3 = bgfx::UniformType::Mat3, + TYPE_MAT4 = bgfx::UniformType::Mat4, + TYPE_CAMERA, // Alias for the current ortho camera, used to auto-bind on material load + + TYPE_COUNT = 5 +}; + +class uniform_reader : public state_reader +{ +public: + static bgfx_uniform* read_from_value(const Value& value); + +private: + static const int TYPE_COUNT = uniform_type::TYPE_COUNT; + static const string_to_enum TYPE_NAMES[TYPE_COUNT]; +}; + +#endif // __DRAWBGFX_UNIFORM_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/bgfx/vs_quad_texture.sc b/src/osd/modules/render/bgfx/vs_gui.sc index c3699f6fbd9..c3699f6fbd9 100644 --- a/src/osd/modules/render/bgfx/vs_quad_texture.sc +++ b/src/osd/modules/render/bgfx/vs_gui.sc diff --git a/src/osd/modules/render/bgfx/vs_quad.sc b/src/osd/modules/render/bgfx/vs_quad.sc deleted file mode 100644 index 84e23c5a09b..00000000000 --- a/src/osd/modules/render/bgfx/vs_quad.sc +++ /dev/null @@ -1,13 +0,0 @@ -$input a_position, a_color0 -$output v_color0 - -// license:BSD-3-Clause -// copyright-holders:Dario Manesku - -#include "../../../../../3rdparty/bgfx/examples/common/common.sh" - -void main() -{ - gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); - v_color0 = a_color0; -} diff --git a/src/osd/modules/render/bgfx/vs_line.sc b/src/osd/modules/render/bgfx/vs_screen.sc index 874ffcf46ac..c3699f6fbd9 100644 --- a/src/osd/modules/render/bgfx/vs_line.sc +++ b/src/osd/modules/render/bgfx/vs_screen.sc @@ -1,5 +1,5 @@ -$input a_position, a_color0 -$output v_color0 +$input a_position, a_texcoord0, a_color0 +$output v_texcoord0, v_color0 // license:BSD-3-Clause // copyright-holders:Dario Manesku @@ -9,5 +9,6 @@ $output v_color0 void main() { gl_Position = mul(u_viewProj, vec4(a_position.xy, 0.0, 1.0)); + v_texcoord0 = a_texcoord0; v_color0 = a_color0; } diff --git a/src/osd/modules/render/bgfx/writereader.cpp b/src/osd/modules/render/bgfx/writereader.cpp new file mode 100644 index 00000000000..b10220908c8 --- /dev/null +++ b/src/osd/modules/render/bgfx/writereader.cpp @@ -0,0 +1,24 @@ +#include <bgfx/bgfx.h> + +#include "writereader.h" + +const write_reader::string_to_enum write_reader::RGB_NAMES[write_reader::RGB_COUNT] = { + { "true", BGFX_STATE_RGB_WRITE }, + { "false", 0 }, + { "1", BGFX_STATE_RGB_WRITE }, + { "0", 0 } +}; + +const write_reader::string_to_enum write_reader::ALPHA_NAMES[write_reader::ALPHA_COUNT] = { + { "true", BGFX_STATE_ALPHA_WRITE }, + { "false", 0 }, + { "1", BGFX_STATE_ALPHA_WRITE }, + { "0", 0 } +}; + +uint64_t write_reader::read_from_value(const Value& value) +{ + uint64_t rgb = get_enum_from_value(value, "rgb", 0, RGB_NAMES, RGB_COUNT); + uint64_t alpha = get_enum_from_value(value, "alpha", 0, ALPHA_NAMES, ALPHA_COUNT); + return rgb | alpha; +} diff --git a/src/osd/modules/render/bgfx/writereader.h b/src/osd/modules/render/bgfx/writereader.h new file mode 100644 index 00000000000..854505bc9cf --- /dev/null +++ b/src/osd/modules/render/bgfx/writereader.h @@ -0,0 +1,19 @@ +#pragma once + +#ifndef __DRAWBGFX_WRITE_READER__ +#define __DRAWBGFX_WRITE_READER__ + +#include "statereader.h" + +class write_reader : public state_reader { +public: + static uint64_t read_from_value(const Value& value); + +private: + static const int RGB_COUNT = 4; + static const int ALPHA_COUNT = 4; + static const string_to_enum RGB_NAMES[RGB_COUNT]; + static const string_to_enum ALPHA_NAMES[ALPHA_COUNT]; +}; + +#endif // __DRAWBGFX_WRITE_READER__
\ No newline at end of file diff --git a/src/osd/modules/render/d3d/d3d9intf.cpp b/src/osd/modules/render/d3d/d3d9intf.cpp index e4f5e08db3b..435ec7ef64c 100644 --- a/src/osd/modules/render/d3d/d3d9intf.cpp +++ b/src/osd/modules/render/d3d/d3d9intf.cpp @@ -27,13 +27,11 @@ typedef IDirect3D9 *(WINAPI *direct3dcreate9_ptr)(UINT SDKVersion); -namespace d3d -{ //============================================================ // PROTOTYPES //============================================================ -static void set_interfaces(base *d3dptr); +static void set_interfaces(d3d_base *d3dptr); //============================================================ // INLINES @@ -64,7 +62,7 @@ static inline void convert_present_params(const present_parameters *params, D3DP // drawd3d9_init //============================================================ -base *drawd3d9_init(void) +d3d_base *drawd3d9_init(void) { bool post_available = true; @@ -119,7 +117,7 @@ base *drawd3d9_init(void) } // allocate an object to hold our data - auto d3dptr = global_alloc(base); + auto d3dptr = global_alloc(d3d_base); d3dptr->version = 9; d3dptr->d3dobj = d3d9; d3dptr->dllhandle = dllhandle; @@ -137,20 +135,20 @@ base *drawd3d9_init(void) // Direct3D interfaces //============================================================ -static HRESULT check_device_format(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format) +static HRESULT check_device_format(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_CheckDeviceFormat(d3d9, adapter, devtype, adapterformat, usage, restype, format); } -static HRESULT check_device_type(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed) +static HRESULT check_device_type(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_CheckDeviceType(d3d9, adapter, devtype, format, backformat, windowed); } -static HRESULT create_device(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev) +static HRESULT create_device(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; D3DPRESENT_PARAMETERS d3d9params; @@ -158,28 +156,28 @@ static HRESULT create_device(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWN return IDirect3D9_CreateDevice(d3d9, adapter, devtype, focus, behavior, &d3d9params, (IDirect3DDevice9 **)dev); } -static HRESULT enum_adapter_modes(base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode) +static HRESULT enum_adapter_modes(d3d_base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_EnumAdapterModes(d3d9, adapter, format, index, mode); } -static UINT get_adapter_count(base *d3dptr) +static UINT get_adapter_count(d3d_base *d3dptr) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_GetAdapterCount(d3d9); } -static HRESULT get_adapter_display_mode(base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode) +static HRESULT get_adapter_display_mode(d3d_base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_GetAdapterDisplayMode(d3d9, adapter, mode); } -static HRESULT get_adapter_identifier(base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier) +static HRESULT get_adapter_identifier(d3d_base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; D3DADAPTER_IDENTIFIER9 id; @@ -197,21 +195,21 @@ static HRESULT get_adapter_identifier(base *d3dptr, UINT adapter, DWORD flags, a } -static UINT get_adapter_mode_count(base *d3dptr, UINT adapter, D3DFORMAT format) +static UINT get_adapter_mode_count(d3d_base *d3dptr, UINT adapter, D3DFORMAT format) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_GetAdapterModeCount(d3d9, adapter, format); } -static HMONITOR get_adapter_monitor(base *d3dptr, UINT adapter) +static HMONITOR get_adapter_monitor(d3d_base *d3dptr, UINT adapter) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; return IDirect3D9_GetAdapterMonitor(d3d9, adapter); } -static HRESULT get_caps_dword(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value) +static HRESULT get_caps_dword(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; D3DCAPS9 caps; @@ -237,7 +235,7 @@ static HRESULT get_caps_dword(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, ca } -static ULONG release(base *d3dptr) +static ULONG release(d3d_base *d3dptr) { IDirect3D9 *d3d9 = (IDirect3D9 *)d3dptr->d3dobj; ULONG result = IDirect3D9_Release(d3d9); @@ -469,7 +467,7 @@ static HRESULT device_test_cooperative_level(device *dev) } -static const device_interface d3d9_device_interface = +static const d3d_device_interface d3d9_device_interface = { device_begin_scene, device_clear, @@ -611,7 +609,7 @@ static const vertex_buffer_interface d3d9_vertex_buffer_interface = // set_interfaces //============================================================ -static void set_interfaces(base *d3dptr) +static void set_interfaces(d3d_base *d3dptr) { d3dptr->d3d = d3d9_interface; d3dptr->device = d3d9_device_interface; @@ -619,5 +617,3 @@ static void set_interfaces(base *d3dptr) d3dptr->texture = d3d9_texture_interface; d3dptr->vertexbuf = d3d9_vertex_buffer_interface; } - -} diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 5f5a3f6794c..947dbba2362 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -13,10 +13,9 @@ // FORWARD DECLARATIONS //============================================================ -namespace d3d -{ class texture_info; -class renderer; +class renderer_d3d9; +struct d3d_base; //============================================================ // TYPE DEFINITIONS @@ -51,12 +50,12 @@ public: } c; }; -class texture_manager +class d3d_texture_manager { public: - texture_manager() { } - texture_manager(renderer *d3d); - ~texture_manager(); + d3d_texture_manager() { } + d3d_texture_manager(renderer_d3d9 *d3d); + ~d3d_texture_manager(); void update_textures(); @@ -83,10 +82,10 @@ public: texture_info * get_default_texture() { return m_default_texture; } texture_info * get_vector_texture() { return m_vector_texture; } - renderer * get_d3d() { return m_renderer; } + renderer_d3d9 * get_d3d() { return m_renderer; } private: - renderer * m_renderer; + renderer_d3d9 * m_renderer; texture_info * m_texlist; // list of active textures int m_dynamic_supported; // are dynamic textures supported? @@ -110,7 +109,7 @@ private: class texture_info { public: - texture_info(texture_manager *manager, const render_texinfo *texsource, int prescale, UINT32 flags); + texture_info(d3d_texture_manager *manager, const render_texinfo *texsource, int prescale, UINT32 flags); ~texture_info(); render_texinfo & get_texinfo() { return m_texinfo; } @@ -152,9 +151,9 @@ private: void prescale(); void compute_size(int texwidth, int texheight); - texture_manager * m_texture_manager; // texture manager pointer + d3d_texture_manager * m_texture_manager; // texture manager pointer - renderer * m_renderer; // renderer pointer + renderer_d3d9 * m_renderer; // renderer pointer texture_info * m_next; // next texture in the list texture_info * m_prev; // prev texture in the list @@ -175,17 +174,17 @@ private: texture * m_d3dfinaltex; // Direct3D final (post-scaled) texture }; -/* d3d::poly_info holds information about a single polygon/d3d primitive */ +/* poly_info holds information about a single polygon/d3d primitive */ class poly_info { public: poly_info() { } void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts, - UINT32 flags, d3d::texture_info *texture, UINT32 modmode, + UINT32 flags, texture_info *texture, UINT32 modmode, float prim_width, float prim_height); void init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts, - UINT32 flags, d3d::texture_info *texture, UINT32 modmode, + UINT32 flags, texture_info *texture, UINT32 modmode, float line_time, float line_length, float prim_width, float prim_height); @@ -194,7 +193,7 @@ public: UINT32 get_vertcount() { return m_numverts; } UINT32 get_flags() { return m_flags; } - d3d::texture_info * get_texture() { return m_texture; } + texture_info * get_texture() { return m_texture; } DWORD get_modmode() { return m_modmode; } float get_line_time() { return m_line_time; } @@ -220,16 +219,14 @@ private: float m_prim_height; // used by quads }; -} // d3d - /* vertex describes a single vertex */ struct vertex { - float x, y, z; // X,Y,Z coordinates - float rhw; // RHW when no HLSL, padding when HLSL - D3DCOLOR color; // diffuse color - float u0, v0; // texture stage 0 coordinates - float u1, v1; // additional info for vector data + float x, y, z; // X,Y,Z coordinates + float rhw; // RHW when no HLSL, padding when HLSL + D3DCOLOR color; // diffuse color + float u0, v0; // texture stage 0 coordinates + float u1, v1; // additional info for vector data }; @@ -240,5 +237,63 @@ struct line_aa_step float weight; // weight contribution }; +/* cache_target is a simple linked list containing only a rednerable target and texture, used for phosphor effects */ +class cache_target +{ +public: + // construction/destruction + cache_target() { } + ~cache_target(); + + bool init(renderer_d3d9 *d3d, d3d_base *d3dintf, int width, int height); + + surface *last_target; + texture *last_texture; + + int target_width; + int target_height; + + int width; + int height; + + int screen_index; + + cache_target *next; + cache_target *prev; +}; + +/* render_target is the information about a Direct3D render target chain */ +class d3d_render_target +{ +public: + // construction/destruction + d3d_render_target() { } + ~d3d_render_target(); + + bool init(renderer_d3d9 *d3d, d3d_base *d3dintf, int width, int height, int target_width, int target_height); + int next_index(int index) { return ++index > 1 ? 0 : index; } + + // real target dimension + int target_width; + int target_height; + + // only used to identify/find the render target + int width; + int height; + + int screen_index; + int page_index; + + surface *target_surface[2]; + texture *target_texture[2]; + surface *source_surface[2]; + texture *source_texture[2]; + + d3d_render_target *next; + d3d_render_target *prev; + + surface *bloom_target[11]; + texture *bloom_texture[11]; +}; #endif diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 3ffcee44707..d862fdcb6a8 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -14,16 +14,6 @@ // Windows NT shipped with DirectX 3.0a // Windows 95 shipped with DirectX 2 -// standard windows headers -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <tchar.h> -#include <mmsystem.h> -#include <d3d9.h> -#include <d3dx9.h> -#include <math.h> -#undef interface - // MAME headers #include "emu.h" #include "render.h" @@ -35,12 +25,12 @@ #include "screen.h" // MAMEOS headers -#include "d3dintf.h" #include "winmain.h" #include "window.h" -#include "d3dcomm.h" #include "modules/render/drawd3d.h" +#include "d3dcomm.h" #include "strconv.h" +#include "d3dhlsl.h" //============================================================ @@ -48,10 +38,8 @@ //============================================================ static slider_state *g_slider_list; -static file_error open_next(d3d::renderer *d3d, emu_file &file, const char *templ, const char *extension, int idx); +static file_error open_next(renderer_d3d9 *d3d, emu_file &file, const char *templ, const char *extension, int idx); -namespace d3d -{ //============================================================ // PROTOTYPES //============================================================ @@ -105,7 +93,7 @@ shaders::~shaders() currcache = cachehead; } - render_target *currtarget = targethead; + d3d_render_target *currtarget = targethead; while(targethead != NULL) { targethead = currtarget->next; @@ -562,14 +550,14 @@ void shaders::remove_render_target(texture_info *texture) void shaders::remove_render_target(int width, int height, UINT32 screen_index, UINT32 page_index) { - render_target *target = find_render_target(width, height, screen_index, page_index); + d3d_render_target *target = find_render_target(width, height, screen_index, page_index); if (target != NULL) { remove_render_target(target); } } -void shaders::remove_render_target(render_target *rt) +void shaders::remove_render_target(d3d_render_target *rt) { if (rt != NULL) { @@ -642,7 +630,7 @@ void shaders::set_texture(texture_info *texture) // shaders::init //============================================================ -void shaders::init(base *d3dintf, running_machine *machine, d3d::renderer *renderer) +void shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *renderer) { if (!d3dintf->post_fx_available) { @@ -1161,13 +1149,13 @@ void shaders::init_effect_info(poly_info *poly) // shaders::find_render_target //============================================================ -render_target* shaders::find_render_target(texture_info *info) +d3d_render_target* shaders::find_render_target(texture_info *info) { UINT32 screen_index_data = (UINT32)info->get_texinfo().osddata; UINT32 screen_index = screen_index_data >> 1; UINT32 page_index = screen_index_data & 1; - render_target *curr = targethead; + d3d_render_target *curr = targethead; while (curr != NULL && ( curr->screen_index != screen_index || curr->page_index != page_index || @@ -1185,9 +1173,9 @@ render_target* shaders::find_render_target(texture_info *info) // shaders::find_render_target //============================================================ -render_target* shaders::find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index) +d3d_render_target* shaders::find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index) { - render_target *curr = targethead; + d3d_render_target *curr = targethead; while (curr != NULL && ( curr->width != width || curr->height != height || @@ -1219,7 +1207,7 @@ cache_target* shaders::find_cache_target(UINT32 screen_index, int width, int hei return curr; } -int shaders::ntsc_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::ntsc_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1286,7 +1274,7 @@ rgb_t shaders::apply_color_convolution(rgb_t color) MAX(0, MIN(255, static_cast<int>(b * 255.0f)))); } -int shaders::color_convolution_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::color_convolution_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1301,7 +1289,7 @@ int shaders::color_convolution_pass(render_target *rt, int source_index, poly_in return next_index; } -int shaders::prescale_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::prescale_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1316,7 +1304,7 @@ int shaders::prescale_pass(render_target *rt, int source_index, poly_info *poly, return next_index; } -int shaders::deconverge_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::deconverge_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1340,7 +1328,7 @@ int shaders::deconverge_pass(render_target *rt, int source_index, poly_info *pol return next_index; } -int shaders::defocus_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::defocus_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1361,7 +1349,7 @@ int shaders::defocus_pass(render_target *rt, int source_index, poly_info *poly, return next_index; } -int shaders::phosphor_pass(render_target *rt, cache_target *ct, int source_index, poly_info *poly, int vertnum) +int shaders::phosphor_pass(d3d_render_target *rt, cache_target *ct, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1394,7 +1382,7 @@ int shaders::phosphor_pass(render_target *rt, cache_target *ct, int source_index return next_index; } -int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int vertnum, bool prepare_bloom) +int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum, bool prepare_bloom) { int next_index = source_index; @@ -1443,7 +1431,7 @@ int shaders::post_pass(render_target *rt, int source_index, poly_info *poly, int return next_index; } -int shaders::downsample_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::downsample_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1485,7 +1473,7 @@ int shaders::downsample_pass(render_target *rt, int source_index, poly_info *pol return next_index; } -int shaders::bloom_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1558,7 +1546,7 @@ int shaders::bloom_pass(render_target *rt, int source_index, poly_info *poly, in return next_index; } -int shaders::distortion_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::distortion_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1606,7 +1594,7 @@ int shaders::distortion_pass(render_target *rt, int source_index, poly_info *pol return next_index; } -int shaders::vector_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::vector_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1624,7 +1612,7 @@ int shaders::vector_pass(render_target *rt, int source_index, poly_info *poly, i return next_index; } -int shaders::vector_buffer_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::vector_buffer_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1641,7 +1629,7 @@ int shaders::vector_buffer_pass(render_target *rt, int source_index, poly_info * return next_index; } -int shaders::screen_pass(render_target *rt, int source_index, poly_info *poly, int vertnum) +int shaders::screen_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum) { int next_index = source_index; @@ -1699,7 +1687,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) curr_render_target = find_render_target(curr_texture); - render_target *rt = curr_render_target; + d3d_render_target *rt = curr_render_target; if (rt == NULL) { osd_printf_verbose("Direct3D: No raster render target\n"); @@ -1746,7 +1734,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) { curr_render_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0); - render_target *rt = curr_render_target; + d3d_render_target *rt = curr_render_target; if (rt == NULL) { osd_printf_verbose("Direct3D: No vector render target\n"); @@ -1769,7 +1757,7 @@ void shaders::render_quad(poly_info *poly, int vertnum) { curr_render_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0); - render_target *rt = curr_render_target; + d3d_render_target *rt = curr_render_target; if (rt == NULL) { osd_printf_verbose("Direct3D: No vector buffer render target\n"); @@ -1838,7 +1826,7 @@ void shaders::end_draw() //============================================================ // shaders::add_cache_target - register a cache target //============================================================ -bool shaders::add_cache_target(renderer* d3d, texture_info* info, int width, int height, int screen_index) +bool shaders::add_cache_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int screen_index) { cache_target* target = (cache_target*)global_alloc_clear<cache_target>(); @@ -1873,7 +1861,7 @@ bool shaders::add_cache_target(renderer* d3d, texture_info* info, int width, int return true; } -render_target* shaders::get_vector_target() +d3d_render_target* shaders::get_vector_target() { if (!vector_enable) { @@ -1899,13 +1887,13 @@ void shaders::create_vector_target(render_primitive *prim) // shaders::add_render_target - register a render target //============================================================ -bool shaders::add_render_target(renderer* d3d, texture_info* info, int width, int height, int target_width, int target_height) +bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int target_width, int target_height) { UINT32 screen_index = 0; UINT32 page_index = 0; if (info != NULL) { - render_target *existing_target = find_render_target(info); + d3d_render_target *existing_target = find_render_target(info); if (existing_target != NULL) { remove_render_target(existing_target); @@ -1917,14 +1905,14 @@ bool shaders::add_render_target(renderer* d3d, texture_info* info, int width, in } else { - render_target *existing_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0); + d3d_render_target *existing_target = find_render_target(d3d->get_width(), d3d->get_height(), 0, 0); if (existing_target != NULL) { remove_render_target(existing_target); } } - render_target* target = (render_target*)global_alloc_clear<render_target>(); + d3d_render_target* target = (d3d_render_target*)global_alloc_clear<d3d_render_target>(); if (!target->init(d3d, d3dintf, width, height, target_width, target_height)) { @@ -2037,7 +2025,7 @@ void shaders::delete_resources(bool reset) currcache = cachehead; } - render_target *currtarget = targethead; + d3d_render_target *currtarget = targethead; while(targethead != NULL) { targethead = currtarget->next; @@ -2186,7 +2174,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, const char *title, INT32 minval, INT32 defval, INT32 maxval, INT32 incval, slider_update update, void *arg) +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) { int size = sizeof(slider_state) + strlen(title); slider_state *state = (slider_state *)auto_alloc_array_clear(machine, UINT8, size); @@ -2197,6 +2185,8 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I state->incval = incval; state->update = update; state->arg = arg; + state->hidden = false; + state->id = id; strcpy(state->description, title); return state; @@ -2824,99 +2814,191 @@ static INT32 slider_ntsc_scan_time(running_machine &machine, void *arg, std::str hlsl_options shaders::last_options = { false }; +enum slider_option +{ + SLIDER_VECTOR_ATTENUATION = 0, + SLIDER_VECTOR_LENGTH_MAX, + SLIDER_SHADOW_MASK_TILE_MODE, + SLIDER_SHADOW_MASK_ALPHA, + SLIDER_SHADOW_MASK_X_COUNT, + SLIDER_SHADOW_MASK_Y_COUNT, + SLIDER_SHADOW_MASK_U_SIZE, + SLIDER_SHADOW_MASK_V_SIZE, + SLIDER_SHADOW_MASK_U_OFFSET, + SLIDER_SHADOW_MASK_V_OFFSET, + SLIDER_CURVATURE, + SLIDER_ROUND_CORNER, + SLIDER_SMOOTH_BORDER, + SLIDER_REFLECTION, + SLIDER_VIGNETTING, + SLIDER_SCANLINE_ALPHA, + SLIDER_SCANLINE_SCALE, + SLIDER_SCANLINE_HEIGHT, + SLIDER_SCANLINE_BRIGHT_SCALE, + SLIDER_SCANLINE_BRIGHT_OFFSET, + SLIDER_SCANLINE_JITTER, + SLIDER_HUM_BAR_ALPHA, + SLIDER_DEFOCUS_X, + SLIDER_DEFOCUS_Y, + SLIDER_RED_CONVERGE_X, + SLIDER_RED_CONVERGE_Y, + SLIDER_GREEN_CONVERGE_X, + SLIDER_GREEN_CONVERGE_Y, + SLIDER_BLUE_CONVERGE_X, + SLIDER_BLUE_CONVERGE_Y, + SLIDER_RED_RADIAL_CONVERGE_X, + SLIDER_RED_RADIAL_CONVERGE_Y, + SLIDER_GREEN_RADIAL_CONVERGE_X, + SLIDER_GREEN_RADIAL_CONVERGE_Y, + SLIDER_BLUE_RADIAL_CONVERGE_X, + SLIDER_BLUE_RADIAL_CONVERGE_Y, + SLIDER_RED_FROM_R, + SLIDER_RED_FROM_G, + SLIDER_RED_FROM_B, + SLIDER_GREEN_FROM_R, + SLIDER_GREEN_FROM_G, + SLIDER_GREEN_FROM_B, + SLIDER_BLUE_FROM_R, + SLIDER_BLUE_FROM_G, + SLIDER_BLUE_FROM_B, + SLIDER_SATURATION, + SLIDER_RED_OFFSET, + SLIDER_GREEN_OFFSET, + SLIDER_BLUE_OFFSET, + SLIDER_RED_SCALE, + SLIDER_GREEN_SCALE, + SLIDER_BLUE_SCALE, + SLIDER_RED_POWER, + SLIDER_GREEN_POWER, + SLIDER_BLUE_POWER, + SLIDER_RED_FLOOR, + SLIDER_GREEN_FLOOR, + SLIDER_BLUE_FLOOR, + SLIDER_RED_PHOSPHOR, + SLIDER_GREEN_PHOSPHOR, + SLIDER_BLUE_PHOSPHOR, + SLIDER_BLOOM_BLEND_MODE, + SLIDER_BLOOM_SCALE, + SLIDER_BLOOM_RED_OVERDRIVE, + SLIDER_BLOOM_GREEN_OVERDRIVE, + SLIDER_BLOOM_BLUE_OVERDRIVE, + SLIDER_BLOOM_LVL0_SCALE, + SLIDER_BLOOM_LVL1_SCALE, + SLIDER_BLOOM_LVL2_SCALE, + SLIDER_BLOOM_LVL3_SCALE, + SLIDER_BLOOM_LVL4_SCALE, + SLIDER_BLOOM_LVL5_SCALE, + SLIDER_BLOOM_LVL6_SCALE, + SLIDER_BLOOM_LVL7_SCALE, + SLIDER_BLOOM_LVL8_SCALE, + SLIDER_BLOOM_LVL9_SCALE, + SLIDER_BLOOM_LVL10_SCALE, + SLIDER_NTSC_ENABLE, + SLIDER_NTSC_JITTER, + SLIDER_NTSC_A_VALUE, + SLIDER_NTSC_B_VALUE, + SLIDER_NTSC_P_VALUE, + SLIDER_NTSC_O_VALUE, + SLIDER_NTSC_CC_VALUE, + SLIDER_NTSC_N_VALUE, + SLIDER_NTSC_Y_VALUE, + SLIDER_NTSC_I_VALUE, + SLIDER_NTSC_Q_VALUE, + SLIDER_NTSC_SCAN_TIME +}; + shaders::slider_desc shaders::s_sliders[] = { - { "Vector Length Attenuation", 0, 50, 100, 1, 2, slider_vector_attenuation }, - { "Vector Attenuation Length Limit", 1, 500, 1000, 1, 2, slider_vector_length_max }, - { "Shadow Mask Tile Mode", 0, 0, 1, 1, 7, slider_shadow_mask_tile_mode }, - { "Shadow Mask Darkness", 0, 0, 100, 1, 7, slider_shadow_mask_alpha }, - { "Shadow Mask X Count", 1, 1, 1024, 1, 7, slider_shadow_mask_x_count }, - { "Shadow Mask Y Count", 1, 1, 1024, 1, 7, slider_shadow_mask_y_count }, - { "Shadow Mask Pixel Count X", 1, 1, 64, 1, 7, slider_shadow_mask_usize }, - { "Shadow Mask Pixel Count Y", 1, 1, 64, 1, 7, slider_shadow_mask_vsize }, - { "Shadow Mask Offset X", -100, 0, 100, 1, 7, slider_shadow_mask_uoffset }, - { "Shadow Mask Offset Y", -100, 0, 100, 1, 7, slider_shadow_mask_voffset }, - { "Screen Curvature", 0, 0, 100, 1, 7, slider_curvature }, - { "Screen Round Corner", 0, 0, 100, 1, 7, slider_round_corner }, - { "Screen Smooth Border", 0, 0, 100, 1, 7, slider_smooth_border }, - { "Screen Reflection", 0, 0, 100, 1, 7, slider_reflection }, - { "Image Vignetting", 0, 0, 100, 1, 7, slider_vignetting }, - { "Scanline Darkness", 0, 0, 100, 1, 5, slider_scanline_alpha }, - { "Scanline Screen Scale", 0, 100, 400, 5, 5, slider_scanline_scale }, - { "Scanline Heigth", 0, 100, 400, 5, 5, slider_scanline_height }, - { "Scanline Brightness", 0, 100, 200, 1, 5, slider_scanline_bright_scale }, - { "Scanline Brightness Overdrive", 0, 0, 100, 1, 5, slider_scanline_bright_offset }, - { "Scanline Jitter", 0, 0, 100, 1, 5, slider_scanline_jitter }, - { "Hum Bar Darkness", 0, 0, 100, 1, 5, slider_hum_bar_alpha }, - { "Defocus X", 0, 0, 100, 1, 7, slider_defocus_x }, - { "Defocus Y", 0, 0, 100, 1, 7, slider_defocus_y }, - { "Red Position Offset X", -100, 0, 100, 1, 7, slider_red_converge_x }, - { "Red Position Offset Y", -100, 0, 100, 1, 7, slider_red_converge_y }, - { "Green Position Offset X", -100, 0, 100, 1, 7, slider_green_converge_x }, - { "Green Position Offset Y", -100, 0, 100, 1, 7, slider_green_converge_y }, - { "Blue Position Offset X", -100, 0, 100, 1, 7, slider_blue_converge_x }, - { "Blue Position Offset Y", -100, 0, 100, 1, 7, slider_blue_converge_y }, - { "Red Convergence X", -100, 0, 100, 1, 7, slider_red_radial_converge_x }, - { "Red Convergence Y", -100, 0, 100, 1, 7, slider_red_radial_converge_y }, - { "Green Convergence X", -100, 0, 100, 1, 7, slider_green_radial_converge_x }, - { "Green Convergence Y", -100, 0, 100, 1, 7, slider_green_radial_converge_y }, - { "Blue Convergence X", -100, 0, 100, 1, 7, slider_blue_radial_converge_x }, - { "Blue Convergence Y", -100, 0, 100, 1, 7, slider_blue_radial_converge_y }, - { "Red Output from Red Input", -400, 0, 400, 5, 7, slider_red_from_r }, - { "Red Output from Green Input", -400, 0, 400, 5, 7, slider_red_from_g }, - { "Red Output from Blue Input", -400, 0, 400, 5, 7, slider_red_from_b }, - { "Green Output from Red Input", -400, 0, 400, 5, 7, slider_green_from_r }, - { "Green Output from Green Input", -400, 0, 400, 5, 7, slider_green_from_g }, - { "Green Output from Blue Input", -400, 0, 400, 5, 7, slider_green_from_b }, - { "Blue Output from Red Input", -400, 0, 400, 5, 7, slider_blue_from_r }, - { "Blue Output from Green Input", -400, 0, 400, 5, 7, slider_blue_from_g }, - { "Blue Output from Blue Input", -400, 0, 400, 5, 7, slider_blue_from_b }, - { "Saturation", 0, 100, 400, 1, 7, slider_saturation }, - { "Red DC Offset", -100, 0, 100, 1, 7, slider_red_offset }, - { "Green DC Offset", -100, 0, 100, 1, 7, slider_green_offset }, - { "Blue DC Offset", -100, 0, 100, 1, 7, slider_blue_offset }, - { "Red Scale", -200, 100, 200, 1, 7, slider_red_scale }, - { "Green Scale", -200, 100, 200, 1, 7, slider_green_scale }, - { "Blue Scale", -200, 100, 200, 1, 7, slider_blue_scale }, - { "Red Gamma", -80, 0, 80, 1, 7, slider_red_power }, - { "Green Gamma", -80, 0, 80, 1, 7, slider_green_power }, - { "Blue Gamma", -80, 0, 80, 1, 7, slider_blue_power }, - { "Red Floor", 0, 0, 100, 1, 7, slider_red_floor }, - { "Green Floor", 0, 0, 100, 1, 7, slider_green_floor }, - { "Blue Floor", 0, 0, 100, 1, 7, slider_blue_floor }, - { "Red Phosphor Life", 0, 0, 100, 1, 7, slider_red_phosphor_life }, - { "Green Phosphor Life", 0, 0, 100, 1, 7, slider_green_phosphor_life }, - { "Blue Phosphor Life", 0, 0, 100, 1, 7, slider_blue_phosphor_life }, - { "Bloom Blend Mode", 0, 0, 1, 1, 7, slider_bloom_blend_mode }, - { "Bloom Scale", 0, 0, 2000, 5, 7, slider_bloom_scale }, - { "Bloom Red Overdrive", 0, 0, 2000, 5, 7, slider_bloom_red_overdrive }, - { "Bloom Green Overdrive", 0, 0, 2000, 5, 7, slider_bloom_green_overdrive }, - { "Bloom Blue Overdrive", 0, 0, 2000, 5, 7, slider_bloom_blue_overdrive }, - { "Bloom Level 0 Scale", 0, 100, 100, 1, 7, slider_bloom_lvl0_scale }, - { "Bloom Level 1 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl1_scale }, - { "Bloom Level 2 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl2_scale }, - { "Bloom Level 3 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl3_scale }, - { "Bloom Level 4 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl4_scale }, - { "Bloom Level 5 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl5_scale }, - { "Bloom Level 6 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl6_scale }, - { "Bloom Level 7 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl7_scale }, - { "Bloom Level 8 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl8_scale }, - { "Bloom Level 9 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl9_scale }, - { "Bloom Level 10 Scale", 0, 0, 100, 1, 7, slider_bloom_lvl10_scale }, - { "NTSC processing", 0, 0, 1, 1, 5, slider_ntsc_enable }, - { "Signal Jitter", 0, 0, 100, 1, 5, slider_ntsc_jitter }, - { "A Value", -100, 50, 100, 1, 5, slider_ntsc_a_value }, - { "B Value", -100, 50, 100, 1, 5, slider_ntsc_b_value }, - { "Incoming Pixel Clock Scaling", -300, 100, 300, 1, 5, slider_ntsc_p_value }, - { "Outgoing Color Carrier Phase", -300, 0, 300, 1, 5, slider_ntsc_o_value }, - { "Color Carrier Frequency", 0, 35795, 60000, 5, 5, slider_ntsc_cc_value }, - { "Y Notch", 0, 100, 600, 5, 5, slider_ntsc_n_value }, - { "Y Frequency", 0, 600, 600, 5, 5, slider_ntsc_y_value }, - { "I Frequency", 0, 120, 600, 5, 5, slider_ntsc_i_value }, - { "Q Frequency", 0, 60, 600, 5, 5, slider_ntsc_q_value }, - { "Scanline Duration", 0, 5260, 10000, 1, 5, slider_ntsc_scan_time }, - // { "Phase Count", 1, 2, 3, 1, 5, slider_ntsc_phase_count }, - { NULL, 0, 0, 0, 0, 0, NULL }, + { "Vector Length Attenuation", 0, 50, 100, 1, SLIDER_SCREEN_TYPE_VECTOR, slider_vector_attenuation, SLIDER_VECTOR_ATTENUATION }, + { "Vector Attenuation Length Limit", 1, 500, 1000, 1, SLIDER_SCREEN_TYPE_VECTOR, slider_vector_length_max, SLIDER_VECTOR_LENGTH_MAX }, + { "Shadow Mask Tile Mode", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_tile_mode, SLIDER_SHADOW_MASK_TILE_MODE }, + { "Shadow Mask Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_alpha, SLIDER_SHADOW_MASK_ALPHA }, + { "Shadow Mask X Count", 1, 1, 1024, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_x_count, SLIDER_SHADOW_MASK_X_COUNT }, + { "Shadow Mask Y Count", 1, 1, 1024, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_y_count, SLIDER_SHADOW_MASK_Y_COUNT }, + { "Shadow Mask Pixel Count X", 1, 1, 64, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_usize, SLIDER_SHADOW_MASK_U_SIZE }, + { "Shadow Mask Pixel Count Y", 1, 1, 64, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_vsize, SLIDER_SHADOW_MASK_V_SIZE }, + { "Shadow Mask Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_uoffset, SLIDER_SHADOW_MASK_U_OFFSET }, + { "Shadow Mask Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_shadow_mask_voffset, SLIDER_SHADOW_MASK_V_OFFSET }, + { "Screen Curvature", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_curvature, SLIDER_CURVATURE }, + { "Screen Round Corner", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_round_corner, SLIDER_ROUND_CORNER }, + { "Screen Smooth Border", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_smooth_border, SLIDER_SMOOTH_BORDER }, + { "Screen Reflection", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_reflection, SLIDER_REFLECTION }, + { "Image Vignetting", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_vignetting, SLIDER_VIGNETTING }, + { "Scanline Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_alpha, SLIDER_SCANLINE_ALPHA }, + { "Scanline Screen Scale", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_scale, SLIDER_SCANLINE_SCALE }, + { "Scanline Height", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_height, SLIDER_SCANLINE_HEIGHT }, + { "Scanline Brightness", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_scale, SLIDER_SCANLINE_BRIGHT_SCALE }, + { "Scanline Brightness Overdrive", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_bright_offset, SLIDER_SCANLINE_BRIGHT_OFFSET }, + { "Scanline Jitter", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_scanline_jitter, SLIDER_SCANLINE_JITTER }, + { "Hum Bar Darkness", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_hum_bar_alpha, SLIDER_HUM_BAR_ALPHA }, + { "Defocus X", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_defocus_x, SLIDER_DEFOCUS_X }, + { "Defocus Y", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_defocus_y, SLIDER_DEFOCUS_Y }, + { "Red Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_converge_x, SLIDER_RED_CONVERGE_X }, + { "Red Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_converge_y, SLIDER_RED_CONVERGE_Y }, + { "Green Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_converge_x, SLIDER_GREEN_CONVERGE_X }, + { "Green Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_converge_y, SLIDER_GREEN_CONVERGE_Y }, + { "Blue Position Offset X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_converge_x, SLIDER_BLUE_CONVERGE_X }, + { "Blue Position Offset Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_converge_y, SLIDER_BLUE_CONVERGE_Y }, + { "Red Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_radial_converge_x, SLIDER_RED_RADIAL_CONVERGE_X }, + { "Red Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_radial_converge_y, SLIDER_RED_RADIAL_CONVERGE_Y }, + { "Green Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_radial_converge_x, SLIDER_GREEN_RADIAL_CONVERGE_X }, + { "Green Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_radial_converge_y, SLIDER_GREEN_RADIAL_CONVERGE_Y }, + { "Blue Convergence X", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_radial_converge_x, SLIDER_BLUE_RADIAL_CONVERGE_X }, + { "Blue Convergence Y", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_radial_converge_y, SLIDER_BLUE_RADIAL_CONVERGE_Y }, + { "Red Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_r, SLIDER_RED_FROM_R }, + { "Red Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_g, SLIDER_RED_FROM_G }, + { "Red Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_red_from_b, SLIDER_RED_FROM_B }, + { "Green Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_r, SLIDER_GREEN_FROM_R }, + { "Green Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_g, SLIDER_GREEN_FROM_G }, + { "Green Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_green_from_b, SLIDER_GREEN_FROM_B }, + { "Blue Output from Red Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_r, SLIDER_BLUE_FROM_R }, + { "Blue Output from Green Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_g, SLIDER_BLUE_FROM_G }, + { "Blue Output from Blue Input", -400, 0, 400, 5, SLIDER_SCREEN_TYPE_ANY, slider_blue_from_b, SLIDER_BLUE_FROM_B }, + { "Saturation", 0, 100, 400, 1, SLIDER_SCREEN_TYPE_ANY, slider_saturation, SLIDER_SATURATION }, + { "Red DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_offset, SLIDER_RED_OFFSET }, + { "Green DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_offset, SLIDER_GREEN_OFFSET }, + { "Blue DC Offset", -100, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_offset, SLIDER_BLUE_OFFSET }, + { "Red Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_scale, SLIDER_RED_SCALE }, + { "Green Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_scale, SLIDER_GREEN_SCALE }, + { "Blue Scale", -200, 100, 200, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_scale, SLIDER_BLUE_SCALE }, + { "Red Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_power, SLIDER_RED_POWER }, + { "Green Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_power, SLIDER_GREEN_POWER }, + { "Blue Gamma", -80, 0, 80, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_power, SLIDER_BLUE_POWER }, + { "Red Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_floor, SLIDER_RED_FLOOR }, + { "Green Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_floor, SLIDER_GREEN_FLOOR }, + { "Blue Floor", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_floor, SLIDER_BLUE_FLOOR }, + { "Red Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_red_phosphor_life, SLIDER_RED_PHOSPHOR }, + { "Green Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_green_phosphor_life, SLIDER_GREEN_PHOSPHOR }, + { "Blue Phosphor Life", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_blue_phosphor_life, SLIDER_BLUE_PHOSPHOR }, + { "Bloom Blend Mode", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_blend_mode, SLIDER_BLOOM_BLEND_MODE }, + { "Bloom Scale", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_scale, SLIDER_BLOOM_SCALE }, + { "Bloom Red Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_red_overdrive, SLIDER_BLOOM_RED_OVERDRIVE }, + { "Bloom Green Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_green_overdrive, SLIDER_BLOOM_GREEN_OVERDRIVE }, + { "Bloom Blue Overdrive", 0, 0, 2000, 5, SLIDER_SCREEN_TYPE_ANY, slider_bloom_blue_overdrive, SLIDER_BLOOM_BLUE_OVERDRIVE }, + { "Bloom Level 0 Scale", 0, 100, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl0_scale, SLIDER_BLOOM_LVL0_SCALE }, + { "Bloom Level 1 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl1_scale, SLIDER_BLOOM_LVL1_SCALE }, + { "Bloom Level 2 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl2_scale, SLIDER_BLOOM_LVL2_SCALE }, + { "Bloom Level 3 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl3_scale, SLIDER_BLOOM_LVL3_SCALE }, + { "Bloom Level 4 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl4_scale, SLIDER_BLOOM_LVL4_SCALE }, + { "Bloom Level 5 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl5_scale, SLIDER_BLOOM_LVL5_SCALE }, + { "Bloom Level 6 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl6_scale, SLIDER_BLOOM_LVL6_SCALE }, + { "Bloom Level 7 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl7_scale, SLIDER_BLOOM_LVL7_SCALE }, + { "Bloom Level 8 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl8_scale, SLIDER_BLOOM_LVL8_SCALE }, + { "Bloom Level 9 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl9_scale, SLIDER_BLOOM_LVL9_SCALE }, + { "Bloom Level 10 Scale", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_ANY, slider_bloom_lvl10_scale, SLIDER_BLOOM_LVL10_SCALE }, + { "NTSC processing", 0, 0, 1, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_enable, SLIDER_NTSC_ENABLE }, + { "Signal Jitter", 0, 0, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_jitter, SLIDER_NTSC_JITTER }, + { "A Value", -100, 50, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_a_value, SLIDER_NTSC_A_VALUE }, + { "B Value", -100, 50, 100, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_b_value, SLIDER_NTSC_B_VALUE }, + { "Incoming Pixel Clock Scaling", -300, 100, 300, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_p_value, SLIDER_NTSC_P_VALUE }, + { "Outgoing Color Carrier Phase", -300, 0, 300, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_o_value, SLIDER_NTSC_O_VALUE }, + { "Color Carrier Frequency", 0, 35795, 60000, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_cc_value, SLIDER_NTSC_CC_VALUE }, + { "Y Notch", 0, 100, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_n_value, SLIDER_NTSC_N_VALUE }, + { "Y Frequency", 0, 600, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_y_value, SLIDER_NTSC_Y_VALUE }, + { "I Frequency", 0, 120, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_i_value, SLIDER_NTSC_I_VALUE }, + { "Q Frequency", 0, 60, 600, 5, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_q_value, SLIDER_NTSC_Q_VALUE }, + { "Scanline Duration", 0, 5260, 10000, 1, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, slider_ntsc_scan_time, SLIDER_NTSC_SCAN_TIME }, + { NULL, 0, 0, 0, 0, 0, NULL, -1 }, }; @@ -2944,7 +3026,7 @@ slider_state *shaders::init_slider_list() (screen_type == SCREEN_TYPE_RASTER && (slider->screen_type & SLIDER_SCREEN_TYPE_RASTER) == SLIDER_SCREEN_TYPE_RASTER) || (screen_type == SCREEN_TYPE_LCD && (slider->screen_type & SLIDER_SCREEN_TYPE_LCD) == SLIDER_SCREEN_TYPE_LCD)) { - *tailptr = slider_alloc(*machine, slider->name, slider->minval, slider->defval, slider->maxval, slider->step, slider->adjustor, (void*)options); + *tailptr = slider_alloc(*machine, slider->id, slider->name, slider->minval, slider->defval, slider->maxval, slider->step, slider->adjustor, (void*)options); tailptr = &(*tailptr)->next; } } @@ -3008,7 +3090,7 @@ void uniform::update() shaders *shadersys = m_shader->m_shaders; hlsl_options *options = shadersys->options; - renderer *d3d = shadersys->d3d; + renderer_d3d9 *d3d = shadersys->d3d; switch (m_id) { @@ -3507,16 +3589,14 @@ ULONG effect::release() return m_effect->Release(); } -} - //============================================================ // get_slider_list //============================================================ -void *windows_osd_interface::get_slider_list() +slider_state *renderer_d3d9::get_slider_list() { - return (void*)g_slider_list; + return g_slider_list; } @@ -3527,7 +3607,7 @@ void *windows_osd_interface::get_slider_list() // scheme //------------------------------------------------- -static file_error open_next(d3d::renderer *d3d, emu_file &file, const char *templ, const char *extension, int idx) +static file_error open_next(renderer_d3d9 *d3d, emu_file &file, const char *templ, const char *extension, int idx) { UINT32 origflags = file.openflags(); diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index b0e502a761f..4f3a072cf41 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -22,8 +22,6 @@ struct slider_state; -namespace d3d -{ class effect; class shaders; @@ -182,9 +180,9 @@ private: bool m_valid; }; -class render_target; +class d3d_render_target; class cache_target; -class renderer; +class renderer_d3d9; /* hlsl_options is the information about runtime-mutable Direct3D HLSL options */ /* in the future this will be moved into an OSD/emu shared buffer */ @@ -274,13 +272,13 @@ public: shaders(); ~shaders(); - void init(base *d3dintf, running_machine *machine, d3d::renderer *renderer); + void init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *renderer); bool enabled() { return master_enable; } void toggle(); bool vector_enabled() { return master_enable && vector_enable; } - render_target* get_vector_target(); + d3d_render_target* get_vector_target(); void create_vector_target(render_primitive *prim); void begin_frame(); @@ -293,8 +291,8 @@ public: void render_quad(poly_info *poly, int vertnum); bool register_texture(texture_info *texture); - bool add_render_target(renderer* d3d, texture_info* info, int width, int height, int target_width, int target_height); - bool add_cache_target(renderer* d3d, texture_info* info, int width, int height, int screen_index); + bool add_render_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int target_width, int target_height); + bool add_cache_target(renderer_d3d9* d3d, texture_info* info, int width, int height, int screen_index); void window_save(); void window_record(); @@ -306,10 +304,10 @@ public: void init_fsfx_quad(void *vertbuf); void set_texture(texture_info *texture); - render_target * find_render_target(texture_info *info); + d3d_render_target * find_render_target(texture_info *info); void remove_render_target(texture_info *texture); void remove_render_target(int width, int height, UINT32 screen_index, UINT32 page_index); - void remove_render_target(render_target *rt); + void remove_render_target(d3d_render_target *rt); int create_resources(bool reset); void delete_resources(bool reset); @@ -322,7 +320,9 @@ public: SLIDER_SCREEN_TYPE_NONE = 0, SLIDER_SCREEN_TYPE_RASTER = 1, SLIDER_SCREEN_TYPE_VECTOR = 2, - SLIDER_SCREEN_TYPE_LCD = 4 + SLIDER_SCREEN_TYPE_LCD = 4, + SLIDER_SCREEN_TYPE_LCD_OR_RASTER = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_LCD, + SLIDER_SCREEN_TYPE_ANY = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_VECTOR | SLIDER_SCREEN_TYPE_LCD }; struct slider_desc @@ -334,6 +334,7 @@ public: int step; int screen_type; INT32(*adjustor)(running_machine &, void *, std::string *, INT32); + int id; }; private: @@ -345,32 +346,32 @@ private: bool register_texture(texture_info *texture, int width, int height, int xscale, int yscale); - render_target* find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index); + d3d_render_target* find_render_target(int width, int height, UINT32 screen_index, UINT32 page_index); cache_target * find_cache_target(UINT32 screen_index, int width, int height); void remove_cache_target(cache_target *cache); rgb_t apply_color_convolution(rgb_t color); // Shader passes - int ntsc_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int color_convolution_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int prescale_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int deconverge_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int defocus_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int phosphor_pass(render_target *rt, cache_target *ct, int source_index, poly_info *poly, int vertnum); - int post_pass(render_target *rt, int source_index, poly_info *poly, int vertnum, bool prepare_bloom); - int downsample_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int bloom_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int distortion_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int vector_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int vector_buffer_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); - int screen_pass(render_target *rt, int source_index, poly_info *poly, int vertnum); + int ntsc_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int color_convolution_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int prescale_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int deconverge_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int defocus_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int phosphor_pass(d3d_render_target *rt, cache_target *ct, int source_index, poly_info *poly, int vertnum); + int post_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum, bool prepare_bloom); + int downsample_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int bloom_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int distortion_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int vector_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int vector_buffer_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); + int screen_pass(d3d_render_target *rt, int source_index, poly_info *poly, int vertnum); void menu_pass(poly_info *poly, int vertnum); - base * d3dintf; // D3D interface + d3d_base * d3dintf; // D3D interface running_machine * machine; - d3d::renderer * d3d; // D3D renderer + renderer_d3d9 * d3d; // D3D renderer bool master_enable; // overall enable flag bool vector_enable; // vector post-processing enable flag @@ -431,15 +432,13 @@ private: vertex * fsfx_vertices; // pointer to our full-screen-quad object texture_info * curr_texture; - render_target * curr_render_target; + d3d_render_target * curr_render_target; poly_info * curr_poly; - render_target * targethead; + d3d_render_target * targethead; cache_target * cachehead; static slider_desc s_sliders[]; static hlsl_options last_options; // last used options }; -} - #endif diff --git a/src/osd/modules/render/d3d/d3dintf.h b/src/osd/modules/render/d3d/d3dintf.h index 9155f620545..3e0a90a46f5 100644 --- a/src/osd/modules/render/d3d/d3dintf.h +++ b/src/osd/modules/render/d3d/d3dintf.h @@ -9,6 +9,15 @@ #ifndef __WIN_D3DINTF__ #define __WIN_D3DINTF__ +// standard windows headers +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <tchar.h> +#include <mmsystem.h> +#include <d3d9.h> +#include <d3dx9.h> +#include <math.h> +#undef interface //============================================================ // CONSTANTS @@ -33,13 +42,11 @@ #define D3DTSS_MAXMIPLEVEL 20 #define D3DTSS_MAXANISOTROPY 21 -namespace d3d -{ //============================================================ // TYPE DEFINITIONS //============================================================ -struct base; +struct d3d_base; struct device; struct surface; struct texture; @@ -118,17 +125,17 @@ enum caps_index struct interface { - HRESULT (*check_device_format)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format); - HRESULT (*check_device_type)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed); - HRESULT (*create_device)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev); - HRESULT (*enum_adapter_modes)(base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode); - UINT (*get_adapter_count)(base *d3dptr); - HRESULT (*get_adapter_display_mode)(base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode); - HRESULT (*get_adapter_identifier)(base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier); - UINT (*get_adapter_mode_count)(base *d3dptr, UINT adapter, D3DFORMAT format); - HMONITOR (*get_adapter_monitor)(base *d3dptr, UINT adapter); - HRESULT (*get_caps_dword)(base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value); - ULONG (*release)(base *d3dptr); + HRESULT (*check_device_format)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT adapterformat, DWORD usage, D3DRESOURCETYPE restype, D3DFORMAT format); + HRESULT (*check_device_type)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, D3DFORMAT format, D3DFORMAT backformat, BOOL windowed); + HRESULT (*create_device)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, HWND focus, DWORD behavior, present_parameters *params, device **dev); + HRESULT (*enum_adapter_modes)(d3d_base *d3dptr, UINT adapter, D3DFORMAT format, UINT index, D3DDISPLAYMODE *mode); + UINT (*get_adapter_count)(d3d_base *d3dptr); + HRESULT (*get_adapter_display_mode)(d3d_base *d3dptr, UINT adapter, D3DDISPLAYMODE *mode); + HRESULT (*get_adapter_identifier)(d3d_base *d3dptr, UINT adapter, DWORD flags, adapter_identifier *identifier); + UINT (*get_adapter_mode_count)(d3d_base *d3dptr, UINT adapter, D3DFORMAT format); + HMONITOR (*get_adapter_monitor)(d3d_base *d3dptr, UINT adapter); + HRESULT (*get_caps_dword)(d3d_base *d3dptr, UINT adapter, D3DDEVTYPE devtype, caps_index which, DWORD *value); + ULONG (*release)(d3d_base *d3dptr); }; @@ -136,7 +143,7 @@ struct interface // Direct3DDevice interfaces //============================================================ -struct device_interface +struct d3d_device_interface { HRESULT (*begin_scene)(device *dev); HRESULT (*clear)(device *dev, DWORD count, const D3DRECT *rects, DWORD flags, D3DCOLOR color, float z, DWORD stencil); @@ -205,7 +212,7 @@ struct vertex_buffer_interface // Core D3D object //============================================================ -struct base +struct d3d_base { // internal objects int version; @@ -216,7 +223,7 @@ struct base // interface pointers interface d3d; - device_interface device; + d3d_device_interface device; surface_interface surface; texture_interface texture; vertex_buffer_interface vertexbuf; @@ -227,8 +234,6 @@ struct base // PROTOTYPES //============================================================ -base *drawd3d9_init(void); - -} +d3d_base *drawd3d9_init(void); #endif diff --git a/src/osd/modules/render/d3dtarget.h b/src/osd/modules/render/d3dtarget.h new file mode 100644 index 00000000000..9179b2d43ba --- /dev/null +++ b/src/osd/modules/render/d3dtarget.h @@ -0,0 +1,14 @@ +// license:BSD-3-Clause +// copyright-holders:Ryan Holtz +//============================================================ +// +// d3dtarget.h - Direct3D HLSL targets +// +//============================================================ + +#pragma once + +#ifndef __D3DTARGET__ +#define __D3DTARGET__ + +#endif // __D3DTARGET__
\ No newline at end of file diff --git a/src/osd/modules/render/draw13.cpp b/src/osd/modules/render/draw13.cpp index 320cc9f3a62..7874cd16ea1 100644 --- a/src/osd/modules/render/draw13.cpp +++ b/src/osd/modules/render/draw13.cpp @@ -18,13 +18,11 @@ #include "emu.h" #include "options.h" -// standard SDL headers -#include "sdlinc.h" - // OSD headers #include "osdsdl.h" #include "window.h" +#include "draw13.h" //============================================================ // DEBUGGING @@ -59,196 +57,38 @@ static inline bool is_transparent(const float &a) } //============================================================ -// TYPES -//============================================================ - - -struct quad_setup_data -{ - quad_setup_data() - : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0), - rotwidth(0), rotheight(0) - {} - void compute(const render_primitive &prim, const int prescale); - - INT32 dudx, dvdx, dudy, dvdy; - INT32 startu, startv; - INT32 rotwidth, rotheight; -}; - -//============================================================ -// Textures -//============================================================ - -class sdl_info13; -struct copy_info_t; - -/* texture_info holds information about a texture */ -class texture_info -{ - friend class simple_list<texture_info>; -public: - texture_info(sdl_info13 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); - ~texture_info(); - - void set_data(const render_texinfo &texsource, const UINT32 flags); - void render_quad(const render_primitive *prim, const int x, const int y); - bool matches(const render_primitive &prim, const quad_setup_data &setup); - - copy_info_t *compute_size_type(); - - void *m_pixels; // pixels for the texture - int m_pitch; - - copy_info_t *m_copyinfo; - quad_setup_data m_setup; - - osd_ticks_t m_last_access; - - int raw_width() const { return m_texinfo.width; } - int raw_height() const { return m_texinfo.height; } - - texture_info *next() { return m_next; } - const render_texinfo &texinfo() const { return m_texinfo; } - render_texinfo &texinfo() { return m_texinfo; } - - HashT hash() const { return m_hash; } - UINT32 flags() const { return m_flags; } - // FIXME: - bool is_pixels_owned() const; - -private: - Uint32 m_sdl_access; - sdl_info13 * m_renderer; - render_texinfo m_texinfo; // copy of the texture info - HashT m_hash; // hash value for the texture (must be >= pointer size) - UINT32 m_flags; // rendering flags - - SDL_Texture * m_texture_id; - bool m_is_rotated; - - int m_format; // texture format - SDL_BlendMode m_sdl_blendmode; - - texture_info * m_next; // next texture in the list -}; - -//============================================================ -// TEXCOPY FUNCS +// CONSTRUCTOR & DESTRUCTOR //============================================================ -enum SDL_TEXFORMAT_E +renderer_sdl1::renderer_sdl1(osd_window *window, int extra_flags) + : osd_renderer(window, extra_flags) + , m_sdl_renderer(nullptr) + , m_blittimer(0) + , m_last_hofs(0) + , m_last_vofs(0) + , m_width(0) + , m_height(0) + , m_blit_dim(0, 0) + , m_last_blit_time(0) + , m_last_blit_pixels(0) { - SDL_TEXFORMAT_ARGB32 = 0, - SDL_TEXFORMAT_RGB32, - SDL_TEXFORMAT_RGB32_PALETTED, - SDL_TEXFORMAT_YUY16, - SDL_TEXFORMAT_YUY16_PALETTED, - SDL_TEXFORMAT_PALETTE16, - SDL_TEXFORMAT_RGB15, - SDL_TEXFORMAT_RGB15_PALETTED, - SDL_TEXFORMAT_PALETTE16A, - SDL_TEXFORMAT_PALETTE16_ARGB1555, - SDL_TEXFORMAT_RGB15_ARGB1555, - SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555, - SDL_TEXFORMAT_LAST = SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555 -}; - -#include "blit13.h" - -/* sdl_info is the information about SDL for the current screen */ -class sdl_info13 : public osd_renderer -{ -public: - sdl_info13(osd_window *w, int extra_flags) - : osd_renderer(w, extra_flags), m_sdl_renderer(NULL), m_blittimer(0), - m_last_hofs(0), m_last_vofs(0), - m_width(0), m_height(0), - m_blit_dim(0,0), - m_last_blit_time(0), m_last_blit_pixels(0) + for (int i = 0; i < 30; i++) { - for (int i=0; i < 30; i++) - { - fmt_support[i].format = 0; - fmt_support[i].status = 0; - } + fmt_support[i].format = 0; + fmt_support[i].status = 0; } - /* virtual */ int create() override; - /* virtual */ int draw(const int update) override; - /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; - /* virtual */ void destroy() override; - /* virtual */ render_primitive_list *get_primitives() override + if (!s_blit_info_initialized) { - osd_dim nd = window().blit_surface_size(); - if (nd != m_blit_dim) - { - m_blit_dim = nd; - notify_changed(); - } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); - return &window().target()->get_primitives(); + /* On OSX, calling this from drawsdl2_init will + * prohibit fullscreen toggling. It is than not possible + * to toggle from fullscreen to window mode. + */ + expand_copy_info(s_blit_info_default); + s_blit_info_initialized = true; } - int RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat); - - SDL_Renderer * m_sdl_renderer; - -private: - void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); - - texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); - texture_info *texture_update(const render_primitive &prim); - - void destroy_all_textures(); - - INT32 m_blittimer; - - - simple_list<texture_info> m_texlist; // list of active textures - - float m_last_hofs; - float m_last_vofs; - - int m_width; - int m_height; - - osd_dim m_blit_dim; - - struct - { - Uint32 format; - int status; - } fmt_support[30]; - - // Stats - INT64 m_last_blit_time; - INT64 m_last_blit_pixels; -}; - -struct copy_info_t { - int src_fmt; - Uint32 dst_fmt; - const blit_base *blitter; - Uint32 bm_mask; - const char *srcname; - const char *dstname; - /* Statistics */ - UINT64 pixel_count; - INT64 time; - int samples; - int perf; - /* list */ - copy_info_t *next; -}; - - -//============================================================ -// PROTOTYPES -//============================================================ - -// core functions +} -static void drawsdl2_exit(void); //============================================================ // STATIC VARIABLES @@ -261,7 +101,7 @@ static void drawsdl2_exit(void); #define ENTRY_BM(a,b,f,bm) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, &texcopy_ ## f, bm, #a, #b, 0, 0, 0, 0} #define ENTRY_LR(a,b,f) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, &texcopy_ ## f, BM_ALL, #a, #b, 0, 0, 0, -1} -static copy_info_t blit_info_default[] = +const copy_info_t renderer_sdl1::s_blit_info_default[] = { /* no rotation */ ENTRY(ARGB32, ARGB8888, argb32_argb32), @@ -340,8 +180,8 @@ static copy_info_t blit_info_default[] = { -1 }, }; -static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1] = { NULL }; -static bool blit_info_initialized = false; +copy_info_t* renderer_sdl1::s_blit_info[SDL_TEXFORMAT_LAST+1] = { nullptr }; +bool renderer_sdl1::s_blit_info_initialized = false; //============================================================ // INLINES @@ -376,7 +216,7 @@ static inline SDL_BlendMode map_blendmode(const int blendmode) return SDL_BLENDMODE_NONE; } -static inline void set_coloralphamode(SDL_Texture *texture_id, const render_color *color) +void texture_info::set_coloralphamode(SDL_Texture *texture_id, const render_color *color) { UINT32 sr = (UINT32)(255.0f * color->r); UINT32 sg = (UINT32)(255.0f * color->g); @@ -421,12 +261,12 @@ void texture_info::render_quad(const render_primitive *prim, const int x, const set_coloralphamode(m_texture_id, &prim->color); //printf("%d %d %d %d\n", target_rect.x, target_rect.y, target_rect.w, target_rect.h); // Arghhh .. Just another bug. SDL_RenderCopy has severe issues with scaling ... - SDL_RenderCopy(m_renderer->m_sdl_renderer, m_texture_id, NULL, &target_rect); - //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, NULL, &target_rect, 0, NULL, SDL_FLIP_NONE); - //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, NULL, NULL, 0, NULL, SDL_FLIP_NONE); + SDL_RenderCopy(m_renderer->m_sdl_renderer, m_texture_id, nullptr, &target_rect); + //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, nullptr, &target_rect, 0, nullptr, SDL_FLIP_NONE); + //SDL_RenderCopyEx(m_renderer->m_sdl_renderer, m_texture_id, nullptr, nullptr, 0, nullptr, SDL_FLIP_NONE); } -void sdl_info13::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) +void renderer_sdl1::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) { SDL_Rect target_rect; @@ -463,11 +303,10 @@ void sdl_info13::render_quad(texture_info *texture, const render_primitive *prim } } -int sdl_info13::RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat) +int renderer_sdl1::RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat) { int i; - SDL_Texture *texid; - for (i=0; fmt_support[i].format != 0; i++) + for (i = 0; fmt_support[i].format != 0; i++) { if (format == fmt_support[i].format) { @@ -477,7 +316,7 @@ int sdl_info13::RendererSupportsFormat(Uint32 format, Uint32 access, const char /* not tested yet */ fmt_support[i].format = format; fmt_support[i + 1].format = 0; - texid = SDL_CreateTexture(m_sdl_renderer, format, access, 16, 16); + SDL_Texture *texid = SDL_CreateTexture(m_sdl_renderer, format, access, 16, 16); if (texid) { fmt_support[i].status = 1; @@ -494,7 +333,7 @@ int sdl_info13::RendererSupportsFormat(Uint32 format, Uint32 access, const char // drawsdl_init //============================================================ -static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm) +void renderer_sdl1::add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm) { copy_info_t *newci = global_alloc(copy_info_t); *newci = *element; @@ -504,96 +343,49 @@ static void add_list(copy_info_t **head, copy_info_t *element, Uint32 bm) *head = newci; } -static void expand_copy_info(copy_info_t *list) +void renderer_sdl1::expand_copy_info(const copy_info_t *list) { - copy_info_t *bi; - - for (bi = list; bi->src_fmt != -1; bi++) + for (const copy_info_t *bi = list; bi->src_fmt != -1; bi++) { if (bi->bm_mask == BM_ALL) { - add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_NONE); - add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_ADD); - add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_MOD); - add_list(&blit_info[bi->src_fmt], bi, SDL_BLENDMODE_BLEND); + add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_NONE); + add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_ADD); + add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_MOD); + add_list(&s_blit_info[bi->src_fmt], bi, SDL_BLENDMODE_BLEND); } else - add_list(&blit_info[bi->src_fmt], bi, bi->bm_mask); - } -} - -static osd_renderer *drawsdl2_create(osd_window *window) -{ - if (!blit_info_initialized) - { - /* On OSX, calling this from drawsdl2_init will - * prohibit fullscreen toggling. It is than not possible - * to toggle from fullscreen to window mode. - */ - expand_copy_info(blit_info_default); - blit_info_initialized = true; - + { + add_list(&s_blit_info[bi->src_fmt], bi, bi->bm_mask); + } } - return global_alloc(sdl_info13(window, osd_renderer::FLAG_NONE)); } // FIXME: machine only used to access options. -int drawsdl2_init(running_machine &machine, osd_draw_callbacks *callbacks) +bool renderer_sdl1::init(running_machine &machine) { - // fill in the callbacks - callbacks->exit = drawsdl2_exit; - callbacks->create = drawsdl2_create; - osd_printf_verbose("Using SDL native texturing driver (SDL 2.0+)\n"); #if USE_OPENGL // Load the GL library now - else MT will fail const char *stemp = downcast<sdl_options &>(machine.options()).gl_lib(); #else - const char *stemp = NULL; + const char *stemp = nullptr; #endif - if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0) - stemp = NULL; + if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) == 0) + stemp = nullptr; // No fatalerror here since not all video drivers support GL ! - if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==NULL + if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==nullptr osd_printf_warning("Warning: Unable to load opengl library: %s\n", stemp ? stemp : "<default>"); else osd_printf_verbose("Loaded opengl shared library: %s\n", stemp ? stemp : "<default>"); - return 0; + return false; } //============================================================ -// drawsdl_exit -//============================================================ - -static void drawsdl2_exit(void) -{ - int i; - copy_info_t *bi, *freeme; - if (blit_info_initialized) - { - for (i = 0; i <= SDL_TEXFORMAT_LAST; i++) - { - for (bi = blit_info[i]; bi != NULL; ) - { - if (bi->pixel_count) - osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname, - bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples, - (int) bi->perf); - freeme = bi; - bi = bi->next; - global_free(freeme); - } - blit_info[i] = NULL; - } - blit_info_initialized = false; - } -} - -//============================================================ // sdl_info::create //============================================================ @@ -616,18 +408,18 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info) RF_ENTRY(SDL_RENDERER_PRESENTVSYNC), RF_ENTRY(SDL_RENDERER_ACCELERATED), RF_ENTRY(SDL_RENDERER_TARGETTEXTURE), - {-1, NULL} + {-1, nullptr} }; int i; osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>"); - for (i = 0; rflist[i].name != NULL; i++) + for (i = 0; rflist[i].name != nullptr; i++) if (render_info->flags & rflist[i].flag) osd_printf_verbose("renderer: flag %s\n", rflist[i].name); } -int sdl_info13::create() +int renderer_sdl1::create() { // create renderer @@ -659,7 +451,7 @@ int sdl_info13::create() m_blittimer = 3; //SDL_RenderPresent(m_sdl_renderer); - osd_printf_verbose("Leave sdl_info13::create\n"); + osd_printf_verbose("Leave renderer_sdl1::create\n"); struct SDL_RendererInfo render_info; @@ -671,22 +463,10 @@ int sdl_info13::create() //============================================================ -// sdl_info::destroy -//============================================================ - -void sdl_info13::destroy() -{ - destroy_all_textures(); - SDL_DestroyRenderer(m_sdl_renderer); - m_sdl_renderer = NULL; -} - - -//============================================================ // drawsdl_xy_to_render_target //============================================================ -int sdl_info13::xy_to_render_target(int x, int y, int *xt, int *yt) +int renderer_sdl1::xy_to_render_target(int x, int y, int *xt, int *yt) { *xt = x - m_last_hofs; *yt = y - m_last_vofs; @@ -701,7 +481,7 @@ int sdl_info13::xy_to_render_target(int x, int y, int *xt, int *yt) // drawsdl_destroy_all_textures //============================================================ -void sdl_info13::destroy_all_textures() +void renderer_sdl1::destroy_all_textures() { if(window().m_primlist) { @@ -717,10 +497,10 @@ void sdl_info13::destroy_all_textures() // sdl_info::draw //============================================================ -int sdl_info13::draw(int update) +int renderer_sdl1::draw(int update) { render_primitive *prim; - texture_info *texture=NULL; + texture_info *texture=nullptr; float vofs, hofs; int blit_pixels = 0; @@ -736,7 +516,7 @@ int sdl_info13::draw(int update) destroy_all_textures(); m_width = wdim.width(); m_height = wdim.height(); - SDL_RenderSetViewport(m_sdl_renderer, NULL); + SDL_RenderSetViewport(m_sdl_renderer, nullptr); m_blittimer = 3; clear_flags(FI_CHANGED); } @@ -749,7 +529,7 @@ int sdl_info13::draw(int update) SDL_SetRenderDrawBlendMode(m_sdl_renderer, SDL_BLENDMODE_NONE); //SDL_SetRenderDrawColor(0,0,0,255); SDL_SetRenderDrawColor(m_sdl_renderer, 0,0,0,0); - SDL_RenderFillRect(m_sdl_renderer, NULL); + SDL_RenderFillRect(m_sdl_renderer, nullptr); m_blittimer--; } @@ -779,7 +559,7 @@ int sdl_info13::draw(int update) window().m_primlist->acquire_lock(); // now draw - for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { Uint8 sr, sg, sb, sa; @@ -830,11 +610,10 @@ int sdl_info13::draw(int update) copy_info_t *texture_info::compute_size_type() { - copy_info_t *bi; - copy_info_t *result = NULL; + copy_info_t *result = nullptr; int maxperf = 0; - for (bi = blit_info[m_format]; bi != NULL; bi = bi->next) + for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != nullptr; bi = bi->next) { if ((m_is_rotated == bi->blitter->m_is_rot) && (m_sdl_blendmode == bi->bm_mask)) @@ -852,10 +631,12 @@ copy_info_t *texture_info::compute_size_type() } } } + if (result) return result; + /* try last resort handlers */ - for (bi = blit_info[m_format]; bi != NULL; bi = bi->next) + for (copy_info_t *bi = renderer_sdl1::s_blit_info[m_format]; bi != nullptr; bi = bi->next) { if ((m_is_rotated == bi->blitter->m_is_rot) && (m_sdl_blendmode == bi->bm_mask)) @@ -863,7 +644,7 @@ copy_info_t *texture_info::compute_size_type() return bi; } //FIXME: crash implement a -do nothing handler */ - return NULL; + return nullptr; } // FIXME: @@ -896,7 +677,7 @@ bool texture_info::matches(const render_primitive &prim, const quad_setup_data & // texture_create //============================================================ -texture_info::texture_info(sdl_info13 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) +texture_info::texture_info(renderer_sdl1 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) { // fill in the core data m_renderer = renderer; @@ -958,7 +739,7 @@ texture_info::texture_info(sdl_info13 *renderer, const render_texinfo &texsource if (m_sdl_access == SDL_TEXTUREACCESS_STATIC) { if (m_copyinfo->blitter->m_is_passthrough) - m_pixels = NULL; + m_pixels = nullptr; else m_pixels = malloc(m_setup.rotwidth * m_setup.rotheight * m_copyinfo->blitter->m_dest_bpp); } @@ -968,7 +749,7 @@ texture_info::texture_info(sdl_info13 *renderer, const render_texinfo &texsource texture_info::~texture_info() { - if ( is_pixels_owned() && (m_pixels != NULL) ) + if ( is_pixels_owned() && (m_pixels != nullptr) ) free(m_pixels); SDL_DestroyTexture(m_texture_id); } @@ -992,11 +773,11 @@ void texture_info::set_data(const render_texinfo &texsource, const UINT32 flags) m_pitch = m_setup.rotwidth * m_copyinfo->blitter->m_dest_bpp; m_copyinfo->blitter->texop(this, &texsource); } - SDL_UpdateTexture(m_texture_id, NULL, m_pixels, m_pitch); + SDL_UpdateTexture(m_texture_id, nullptr, m_pixels, m_pitch); } else { - SDL_LockTexture(m_texture_id, NULL, (void **) &m_pixels, &m_pitch); + SDL_LockTexture(m_texture_id, nullptr, (void **) &m_pixels, &m_pitch); if ( m_copyinfo->blitter->m_is_passthrough ) { UINT8 *src = (UINT8 *) texsource.base; @@ -1084,14 +865,14 @@ void quad_setup_data::compute(const render_primitive &prim, const int prescale) // texture_find //============================================================ -texture_info *sdl_info13::texture_find(const render_primitive &prim, const quad_setup_data &setup) +texture_info *renderer_sdl1::texture_find(const render_primitive &prim, const quad_setup_data &setup) { HashT texhash = texture_compute_hash(prim.texture, prim.flags); texture_info *texture; osd_ticks_t now = osd_ticks(); // find a match - for (texture = m_texlist.first(); texture != NULL; ) + for (texture = m_texlist.first(); texture != nullptr; ) if (texture->hash() == texhash && texture->matches(prim, setup)) { @@ -1099,7 +880,7 @@ texture_info *sdl_info13::texture_find(const render_primitive &prim, const quad_ if ((texture->m_copyinfo->samples & 0x7f) == 0x7f) { if (texture->m_copyinfo != texture->compute_size_type()) - return NULL; + return nullptr; } texture->m_last_access = now; return texture; @@ -1114,14 +895,14 @@ texture_info *sdl_info13::texture_find(const render_primitive &prim, const quad_ } // nothing found - return NULL; + return nullptr; } //============================================================ // texture_update //============================================================ -texture_info * sdl_info13::texture_update(const render_primitive &prim) +texture_info * renderer_sdl1::texture_update(const render_primitive &prim) { quad_setup_data setup; texture_info *texture; @@ -1131,16 +912,16 @@ texture_info * sdl_info13::texture_update(const render_primitive &prim) texture = texture_find(prim, setup); // if we didn't find one, create a new texture - if (texture == NULL && prim.texture.base != NULL) + if (texture == nullptr && prim.texture.base != nullptr) { texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); /* add us to the texture list */ m_texlist.prepend(*texture); } - if (texture != NULL) + if (texture != nullptr) { - if (prim.texture.base != NULL && texture->texinfo().seqid != prim.texture.seqid) + if (prim.texture.base != nullptr && texture->texinfo().seqid != prim.texture.seqid) { texture->texinfo().seqid = prim.texture.seqid; // if we found it, but with a different seqid, copy the data @@ -1150,3 +931,15 @@ texture_info * sdl_info13::texture_update(const render_primitive &prim) } return texture; } + +render_primitive_list *renderer_sdl1::get_primitives() +{ + osd_dim nd = window().blit_surface_size(); + if (nd != m_blit_dim) + { + m_blit_dim = nd; + notify_changed(); + } + window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); + return &window().target()->get_primitives(); +} diff --git a/src/osd/modules/render/draw13.h b/src/osd/modules/render/draw13.h new file mode 100644 index 00000000000..7335bd5be81 --- /dev/null +++ b/src/osd/modules/render/draw13.h @@ -0,0 +1,229 @@ +// license:BSD-3-Clause +// copyright-holders:Couriersud, Olivier Galibert, R. Belmont +//============================================================ +// +// draw13.h - SDL 2.0 drawing implementation +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#pragma once + +#ifndef __DRAW13__ +#define __DRAW13__ + +// OSD headers +#ifndef OSD_WINDOWS +#include "osdsdl.h" +#include "window.h" +#else +#include "../windows/window.h" +typedef UINT64 HashT; +#endif + +// standard SDL headers +#include "sdl/sdlinc.h" + +struct quad_setup_data +{ + quad_setup_data() + : dudx(0) + , dvdx(0) + , dudy(0) + , dvdy(0) + , startu(0) + , startv(0) + , rotwidth(0) + , rotheight(0) + { + } + + void compute(const render_primitive &prim, const int prescale); + + INT32 dudx, dvdx, dudy, dvdy; + INT32 startu, startv; + INT32 rotwidth, rotheight; +}; + +//============================================================ +// Textures +//============================================================ + +class renderer_sdl1; +struct copy_info_t; + +/* texture_info holds information about a texture */ +class texture_info +{ + friend class simple_list<texture_info>; +public: + texture_info(renderer_sdl1 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); + ~texture_info(); + + void set_data(const render_texinfo &texsource, const UINT32 flags); + void render_quad(const render_primitive *prim, const int x, const int y); + bool matches(const render_primitive &prim, const quad_setup_data &setup); + + copy_info_t *compute_size_type(); + + void *m_pixels; // pixels for the texture + int m_pitch; + + copy_info_t *m_copyinfo; + quad_setup_data m_setup; + + osd_ticks_t m_last_access; + + int raw_width() const { return m_texinfo.width; } + int raw_height() const { return m_texinfo.height; } + + texture_info *next() { return m_next; } + const render_texinfo &texinfo() const { return m_texinfo; } + render_texinfo &texinfo() { return m_texinfo; } + + HashT hash() const { return m_hash; } + UINT32 flags() const { return m_flags; } + // FIXME: + bool is_pixels_owned() const; + +private: + void set_coloralphamode(SDL_Texture *texture_id, const render_color *color); + + Uint32 m_sdl_access; + renderer_sdl1 * m_renderer; + render_texinfo m_texinfo; // copy of the texture info + HashT m_hash; // hash value for the texture (must be >= pointer size) + UINT32 m_flags; // rendering flags + + SDL_Texture * m_texture_id; + bool m_is_rotated; + + int m_format; // texture format + SDL_BlendMode m_sdl_blendmode; + + texture_info * m_next; // next texture in the list +}; + +//============================================================ +// TEXCOPY FUNCS +//============================================================ + +enum SDL_TEXFORMAT_E +{ + SDL_TEXFORMAT_ARGB32 = 0, + SDL_TEXFORMAT_RGB32, + SDL_TEXFORMAT_RGB32_PALETTED, + SDL_TEXFORMAT_YUY16, + SDL_TEXFORMAT_YUY16_PALETTED, + SDL_TEXFORMAT_PALETTE16, + SDL_TEXFORMAT_RGB15, + SDL_TEXFORMAT_RGB15_PALETTED, + SDL_TEXFORMAT_PALETTE16A, + SDL_TEXFORMAT_PALETTE16_ARGB1555, + SDL_TEXFORMAT_RGB15_ARGB1555, + SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555, + SDL_TEXFORMAT_LAST = SDL_TEXFORMAT_RGB15_PALETTED_ARGB1555 +}; + +#include "blit13.h" + +struct copy_info_t +{ + int src_fmt; + Uint32 dst_fmt; + const blit_base *blitter; + Uint32 bm_mask; + const char *srcname; + const char *dstname; + /* Statistics */ + UINT64 pixel_count; + INT64 time; + int samples; + int perf; + /* list */ + copy_info_t *next; +}; + +/* sdl_info is the information about SDL for the current screen */ +class renderer_sdl1 : public osd_renderer +{ +public: + renderer_sdl1(osd_window *window, int extra_flags); + + virtual ~renderer_sdl1() + { + destroy_all_textures(); + SDL_DestroyRenderer(m_sdl_renderer); + m_sdl_renderer = nullptr; + + if (s_blit_info_initialized) + { + for (int i = 0; i <= SDL_TEXFORMAT_LAST; i++) + { + for (copy_info_t *bi = s_blit_info[i]; bi != nullptr; ) + { + if (bi->pixel_count) + osd_printf_verbose("%s -> %s %s blendmode 0x%02x, %d samples: %d KPixel/sec\n", bi->srcname, bi->dstname, + bi->blitter->m_is_rot ? "rot" : "norot", bi->bm_mask, bi->samples, + (int) bi->perf); + copy_info_t *freeme = bi; + bi = bi->next; + global_free(freeme); + } + s_blit_info[i] = nullptr; + } + s_blit_info_initialized = false; + } + } + + virtual int create() override; + static bool init(running_machine &machine); + virtual int draw(const int update) override; + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; + virtual render_primitive_list *get_primitives() override; + int RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat); + + SDL_Renderer * m_sdl_renderer; + + static copy_info_t* s_blit_info[SDL_TEXFORMAT_LAST+1]; + +private: + void expand_copy_info(const copy_info_t *list); + void add_list(copy_info_t **head, const copy_info_t *element, Uint32 bm); + + void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); + + texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); + texture_info *texture_update(const render_primitive &prim); + + void destroy_all_textures(); + + INT32 m_blittimer; + + + simple_list<texture_info> m_texlist; // list of active textures + + float m_last_hofs; + float m_last_vofs; + + int m_width; + int m_height; + + osd_dim m_blit_dim; + + struct + { + Uint32 format; + int status; + } fmt_support[30]; + + // Stats + INT64 m_last_blit_time; + INT64 m_last_blit_pixels; + + static bool s_blit_info_initialized; + static const copy_info_t s_blit_info_default[]; +}; + +#endif // __DRAW13__
\ No newline at end of file diff --git a/src/osd/modules/render/drawbgfx.cpp b/src/osd/modules/render/drawbgfx.cpp index 9d751c9f816..f2d58f4e4d5 100644 --- a/src/osd/modules/render/drawbgfx.cpp +++ b/src/osd/modules/render/drawbgfx.cpp @@ -31,6 +31,13 @@ #include <algorithm> #include "drawbgfx.h" +#include "bgfx/texturemanager.h" +#include "bgfx/targetmanager.h" +#include "bgfx/shadermanager.h" +#include "bgfx/effectmanager.h" +#include "bgfx/effect.h" +#include "bgfx/texture.h" +#include "bgfx/target.h" //============================================================ // DEBUGGING @@ -57,50 +64,8 @@ //============================================================ -// PROTOTYPES -//============================================================ - -// core functions -static void drawbgfx_exit(void); - -//============================================================ -// drawnone_create -//============================================================ - -static osd_renderer *drawbgfx_create(osd_window *window) -{ - return global_alloc(renderer_bgfx(window)); -} - -//============================================================ -// drawbgfx_init -//============================================================ - -int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks) -{ - // fill in the callbacks - //memset(callbacks, 0, sizeof(*callbacks)); - callbacks->exit = drawbgfx_exit; - callbacks->create = drawbgfx_create; - - return 0; -} - -//============================================================ -// drawbgfx_exit -//============================================================ - -static void drawbgfx_exit(void) -{ - // Shutdown bgfx. - bgfx::shutdown(); -} - -//============================================================ // renderer_bgfx::create //============================================================ -bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); - #ifdef OSD_SDL static void* sdlNativeWindowHandle(SDL_Window* _window) @@ -131,6 +96,8 @@ int renderer_bgfx::create() // create renderer osd_dim wdim = window().get_size(); + m_width[window().m_index] = wdim.width(); + m_height[window().m_index] = wdim.height(); if (window().m_index == 0) { #ifdef OSD_WINDOWS @@ -139,34 +106,42 @@ int renderer_bgfx::create() bgfx::sdlSetWindow(window().sdl_window()); #endif bgfx::init(); - bgfx::reset(wdim.width(), wdim.height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + bgfx::reset(m_width[window().m_index], m_height[window().m_index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); // Enable debug text. bgfx::setDebug(BGFX_DEBUG_TEXT); //BGFX_DEBUG_STATS - m_dimensions = osd_dim(wdim.width(), wdim.height()); + m_dimensions = osd_dim(m_width[0], m_height[0]); + + ScreenVertex::init(); } - else - { + + m_textures = new texture_manager(); + m_targets = new target_manager(*m_textures); + m_shaders = new shader_manager(); + m_effects = new effect_manager(*m_shaders); + + if (window().m_index != 0) + { #ifdef OSD_WINDOWS - fbh = bgfx::createFrameBuffer(window().m_hwnd, wdim.width(), wdim.height()); + m_framebuffer = m_targets->create_target("backbuffer", window().m_hwnd, m_width[window().m_index], m_height[window().m_index]); #else - fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), wdim.width(), wdim.height()); + m_framebuffer = m_targets->create_target("backbuffer", sdlNativeWindowHandle(window().sdl_window()), m_width[window().m_index], m_height[window().m_index]); #endif - bgfx::touch(window().m_index); - } - - ScreenVertex::init(); + bgfx::touch(window().m_index); + } // Create program from shaders. - m_progQuad = loadProgram("vs_quad", "fs_quad"); - m_progQuadTexture = loadProgram("vs_quad_texture", "fs_quad_texture"); - m_s_texColor = bgfx::createUniform("s_texColor", bgfx::UniformType::Int1); + m_gui_effect[0] = m_effects->effect("gui_opaque"); + m_gui_effect[1] = m_effects->effect("gui_blend"); + m_gui_effect[2] = m_effects->effect("gui_multiply"); + m_gui_effect[3] = m_effects->effect("gui_add"); - uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; - m_texture_cache = bgfx::createTexture2D(CACHE_SIZE, CACHE_SIZE, 1, bgfx::TextureFormat::RGBA8, flags); + m_screen_effect[0] = m_effects->effect("screen_opaque"); + m_screen_effect[1] = m_effects->effect("screen_blend"); + m_screen_effect[2] = m_effects->effect("screen_multiply"); + m_screen_effect[3] = m_effects->effect("screen_add"); - const bgfx::Memory* memory = bgfx::alloc(sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE); - memset(memory->data, 0, sizeof(uint32_t) * CACHE_SIZE * CACHE_SIZE); - bgfx::updateTexture2D(m_texture_cache, 0, 0, 0, CACHE_SIZE, CACHE_SIZE, memory, CACHE_SIZE * sizeof(uint32_t)); + uint32_t flags = BGFX_TEXTURE_U_CLAMP | BGFX_TEXTURE_V_CLAMP | BGFX_TEXTURE_MIN_POINT | BGFX_TEXTURE_MAG_POINT | BGFX_TEXTURE_MIP_POINT; + m_texture_cache = m_textures->create_texture("#cache", bgfx::TextureFormat::RGBA8, CACHE_SIZE, CACHE_SIZE, nullptr, flags); memset(m_white, 0xff, sizeof(uint32_t) * 16 * 16); m_texinfo.push_back(rectangle_packer::packable_rectangle(WHITE_HASH, PRIMFLAG_TEXFORMAT(TEXFORMAT_ARGB32), 16, 16, 16, nullptr, m_white)); @@ -175,19 +150,18 @@ int renderer_bgfx::create() } //============================================================ -// drawbgfx_window_destroy +// destructor //============================================================ -void renderer_bgfx::destroy() +renderer_bgfx::~renderer_bgfx() { - if (window().m_index > 0) - { - bgfx::destroyFrameBuffer(fbh); - } - bgfx::destroyUniform(m_s_texColor); // Cleanup. - bgfx::destroyProgram(m_progQuad); - bgfx::destroyProgram(m_progQuadTexture); + delete m_targets; + delete m_textures; + delete m_effects; + delete m_shaders; + + bgfx::shutdown(); } @@ -208,74 +182,6 @@ int renderer_bgfx::xy_to_render_target(int x, int y, int *xt, int *yt) } #endif -static const bgfx::Memory* loadMem(bx::FileReaderI* _reader, const char* _filePath) -{ - if (bx::open(_reader, _filePath)) - { - uint32_t size = (uint32_t)bx::getSize(_reader); - const bgfx::Memory* mem = bgfx::alloc(size + 1); - bx::read(_reader, mem->data, size); - bx::close(_reader); - mem->data[mem->size - 1] = '\0'; - return mem; - } - - return nullptr; -} -static bgfx::ShaderHandle loadShader(bx::FileReaderI* _reader, const char* _name) -{ - char filePath[512]; - - const char* shaderPath = "shaders/dx9/"; - - switch (bgfx::getRendererType()) - { - case bgfx::RendererType::Direct3D11: - case bgfx::RendererType::Direct3D12: - shaderPath = "shaders/dx11/"; - break; - - case bgfx::RendererType::OpenGL: - shaderPath = "shaders/glsl/"; - break; - - case bgfx::RendererType::Metal: - shaderPath = "shaders/metal/"; - break; - - case bgfx::RendererType::OpenGLES: - shaderPath = "shaders/gles/"; - break; - - default: - break; - } - - strcpy(filePath, shaderPath); - strcat(filePath, _name); - strcat(filePath, ".bin"); - - return bgfx::createShader(loadMem(_reader, filePath)); -} - -bgfx::ProgramHandle renderer_bgfx::loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName) -{ - bgfx::ShaderHandle vsh = loadShader(_reader, _vsName); - bgfx::ShaderHandle fsh = BGFX_INVALID_HANDLE; - if (nullptr != _fsName) - { - fsh = loadShader(_reader, _fsName); - } - - return bgfx::createProgram(vsh, fsh, true /* destroy shaders when program is destroyed */); -} -static auto s_fileReader = new bx::CrtFileReader; - -bgfx::ProgramHandle renderer_bgfx::loadProgram(const char* _vsName, const char* _fsName) -{ - return loadProgram(s_fileReader, _vsName, _fsName); -} - //============================================================ // drawbgfx_window_draw //============================================================ @@ -425,10 +331,10 @@ void renderer_bgfx::render_textured_quad(int view, render_primitive* prim, bgfx: bgfx::TextureHandle texture = bgfx::createTexture2D((uint16_t)prim->texture.width, (uint16_t)prim->texture.height, 1, bgfx::TextureFormat::RGBA8, texture_flags, mem); - bgfx::setTexture(0, m_s_texColor, texture); - - set_bgfx_state(PRIMFLAG_GET_BLENDMODE(prim->flags)); - bgfx::submit(view, m_progQuadTexture); + bgfx_effect** effects = PRIMFLAG_GET_SCREENTEX(prim->flags) ? m_screen_effect : m_gui_effect; + UINT32 blend = PRIMFLAG_GET_BLENDMODE(prim->flags); + bgfx::setTexture(0, effects[blend]->uniform("s_tex")->handle(), texture); + effects[blend]->submit(view); bgfx::destroyTexture(texture); } @@ -826,29 +732,29 @@ int renderer_bgfx::draw(int update) int index = window().m_index; // Set view 0 default viewport. osd_dim wdim = window().get_size(); - int width = wdim.width(); - int height = wdim.height(); + m_width[index] = wdim.width(); + m_height[index] = wdim.height(); if (index == 0) { - if ((m_dimensions != osd_dim(width, height))) { - bgfx::reset(width, height, video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); - m_dimensions = osd_dim(width, height); + if ((m_dimensions != osd_dim(m_width[index], m_height[index]))) + { + bgfx::reset(m_width[index], m_height[index], video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); + m_dimensions = osd_dim(m_width[index], m_height[index]); } } - else { - if ((m_dimensions != osd_dim(width, height))) { + else + { + if ((m_dimensions != osd_dim(m_width[index], m_height[index]))) + { bgfx::reset(window().m_main->get_size().width(), window().m_main->get_size().height(), video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE); - if (bgfx::isValid(fbh)) - { - bgfx::destroyFrameBuffer(fbh); - } + delete m_framebuffer; #ifdef OSD_WINDOWS - fbh = bgfx::createFrameBuffer(window().m_hwnd, width, height); + m_framebuffer = m_targets->create_target("backbuffer", window().m_hwnd, m_width[index], m_height[index]); #else - fbh = bgfx::createFrameBuffer(sdlNativeWindowHandle(window().sdl_window()), width, height); + m_framebuffer = m_targets->create_target("backbuffer", sdlNativeWindowHandle(window().sdl_window()), m_width[index], m_height[index]); #endif - bgfx::setViewFrameBuffer(index, fbh); - m_dimensions = osd_dim(width, height); + bgfx::setViewFrameBuffer(index, m_framebuffer->target()); + m_dimensions = osd_dim(m_width[index], m_height[index]); bgfx::setViewClear(index , BGFX_CLEAR_COLOR | BGFX_CLEAR_DEPTH , 0x000000ff @@ -860,9 +766,13 @@ int renderer_bgfx::draw(int update) return 0; } } - if (index != 0) bgfx::setViewFrameBuffer(index, fbh); - bgfx::setViewSeq(index, true); - bgfx::setViewRect(index, 0, 0, width, height); + + if (index != 0) + { + bgfx::setViewFrameBuffer(index, m_framebuffer->target()); + } + bgfx::setViewSeq(index, true); + bgfx::setViewRect(index, 0, 0, m_width[index], m_height[index]); // Setup view transform. { @@ -871,8 +781,8 @@ int renderer_bgfx::draw(int update) float left = 0.0f; float top = 0.0f; - float right = width; - float bottom = height; + float right = m_width[index]; + float bottom = m_height[index]; float proj[16]; bx::mtxOrtho(proj, left, right, bottom, top, 0.0f, 100.0f); bgfx::setViewTransform(index, view, proj); @@ -884,10 +794,6 @@ int renderer_bgfx::draw(int update) , 0 ); - // This dummy draw call is here to make sure that view 0 is cleared - // if no other draw calls are submitted to view 0. - bgfx::touch(index); - window().m_primlist->acquire_lock(); // Mark our texture atlas as dirty if we need to do so @@ -905,10 +811,9 @@ int renderer_bgfx::draw(int update) if (status != BUFFER_EMPTY) { - set_bgfx_state(blend); bgfx::setVertexBuffer(&buffer); - bgfx::setTexture(0, m_s_texColor, m_texture_cache); - bgfx::submit(index, m_progQuadTexture); + bgfx::setTexture(0, m_gui_effect[blend]->uniform("s_tex")->handle(), m_texture_cache->handle()); + m_gui_effect[blend]->submit(index); } if (status != BUFFER_DONE && status != BUFFER_PRE_FLUSH) @@ -918,6 +823,11 @@ int renderer_bgfx::draw(int update) } window().m_primlist->release_lock(); + + // This dummy draw call is here to make sure that view 0 is cleared + // if no other draw calls are submitted to view 0. + bgfx::touch(index); + // Advance to next frame. Rendering thread will be kicked to // process submitted rendering primitives. if (index==0) bgfx::frame(); @@ -1051,7 +961,7 @@ void renderer_bgfx::process_atlas_packs(std::vector<std::vector<rectangle_packer } m_hash_to_entry[rect.hash()] = rect; const bgfx::Memory* mem = mame_texture_data_to_bgfx_texture_data(rect.format(), rect.width(), rect.height(), rect.rowpixels(), rect.palette(), rect.base()); - bgfx::updateTexture2D(m_texture_cache, 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); + bgfx::updateTexture2D(m_texture_cache->handle(), 0, rect.x(), rect.y(), rect.width(), rect.height(), mem); } } } @@ -1168,3 +1078,8 @@ void renderer_bgfx::allocate_buffer(render_primitive *prim, UINT32 blend, bgfx:: bgfx::allocTransientVertexBuffer(buffer, vertices, ScreenVertex::ms_decl); } } + +slider_state* renderer_bgfx::get_slider_list() +{ + return nullptr; +}
\ No newline at end of file diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index 86619eab718..7ce7c75a1de 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -3,11 +3,21 @@ #ifndef __RENDER_BGFX__ #define __RENDER_BGFX__ +#include <bgfx/bgfx.h> + #include <map> #include <vector> #include "binpacker.h" +class texture_manager; +class target_manager; +class shader_manager; +class effect_manager; +class bgfx_texture; +class bgfx_effect; +class bgfx_target; + /* sdl_info is the information about SDL for the current screen */ class renderer_bgfx : public osd_renderer { @@ -17,8 +27,11 @@ public: , m_dimensions(0, 0) { } + virtual ~renderer_bgfx(); virtual int create() override; + virtual slider_state* get_slider_list() override; + static bool init(running_machine &machine) { return false; } virtual int draw(const int update) override; #ifdef OSD_SDL virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; @@ -27,7 +40,6 @@ public: virtual void record() override { } virtual void toggle_fsfx() override { } #endif - virtual void destroy() override; virtual render_primitive_list *get_primitives() override { osd_dim wdim = window().get_size(); @@ -83,22 +95,25 @@ private: const bgfx::Memory* mame_texture_data_to_bgfx_texture_data(UINT32 format, int width, int height, int rowpixels, const rgb_t *palette, void *base); UINT32 get_texture_hash(render_primitive *prim); - bgfx::ProgramHandle loadProgram(bx::FileReaderI* _reader, const char* _vsName, const char* _fsName); - bgfx::ProgramHandle loadProgram(const char* _vsName, const char* _fsName); - - bgfx::ProgramHandle m_progQuad; - bgfx::ProgramHandle m_progQuadTexture; - bgfx::UniformHandle m_s_texColor; - bgfx::FrameBufferHandle fbh; - bgfx::TextureHandle m_texture_cache; + bgfx_target* m_framebuffer; + bgfx_texture* m_texture_cache; // Original display_mode osd_dim m_dimensions; + texture_manager* m_textures; + target_manager* m_targets; + shader_manager* m_shaders; + effect_manager* m_effects; + bgfx_effect* m_gui_effect[4]; + bgfx_effect* m_screen_effect[4]; + std::map<UINT32, rectangle_packer::packed_rectangle> m_hash_to_entry; std::vector<rectangle_packer::packable_rectangle> m_texinfo; rectangle_packer m_packer; + uint32_t m_width[16]; + uint32_t m_height[16]; uint32_t m_white[16*16]; enum : uint16_t { CACHE_SIZE = 1024 }; enum : uint32_t { PACKABLE_SIZE = 128 }; diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index c4ceb30fef4..301e3de3df6 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -14,16 +14,6 @@ // Windows NT shipped with DirectX 3.0a // Windows 95 shipped with DirectX 2 -// standard windows headers -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <tchar.h> -#include <mmsystem.h> -#include <d3d9.h> -#include <d3dx9.h> -#include <math.h> -#undef interface - // MAME headers #include "emu.h" #include "render.h" @@ -33,11 +23,11 @@ #include "aviio.h" // MAMEOS headers -#include "modules/render/d3d/d3dintf.h" #include "winmain.h" #include "window.h" -#include "modules/render/d3d/d3dcomm.h" #include "drawd3d.h" +#include "modules/render/d3d/d3dhlsl.h" +#include "d3dtarget.h" //============================================================ @@ -109,7 +99,7 @@ static inline BOOL GetClientRectExceptMenu(HWND hWnd, PRECT pRect, BOOL fullscre last_menu = menu; last_rect = *pRect; - SetMenu(hWnd, NULL); + SetMenu(hWnd, nullptr); result = GetClientRect(hWnd, &cached_rect); SetMenu(hWnd, menu); } @@ -165,26 +155,21 @@ static inline UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) // drawd3d_init //============================================================ -static d3d::base * d3dintf; // FIX ME +static d3d_base * d3dintf; // FIX ME //============================================================ // PROTOTYPES //============================================================ -// core functions -static void drawd3d_exit(void); - - //============================================================ // drawd3d_window_init //============================================================ -int d3d::renderer::create() +int renderer_d3d9::create() { if (!initialize()) { - destroy(); osd_printf_error("Unable to initialize Direct3D.\n"); return 1; } @@ -192,50 +177,27 @@ int d3d::renderer::create() return 0; } - -//============================================================ -// drawd3d_exit -//============================================================ - -static void drawd3d_exit(void) -{ - if (d3dintf != NULL) - (*d3dintf->d3d.release)(d3dintf); -} - -void d3d::renderer::toggle_fsfx() +void renderer_d3d9::toggle_fsfx() { set_restarting(true); } -void d3d::renderer::record() +void renderer_d3d9::record() { get_shaders()->window_record(); } -void d3d::renderer::save() +void renderer_d3d9::save() { get_shaders()->window_save(); } //============================================================ -// drawd3d_window_destroy -//============================================================ - -void d3d::renderer::destroy() -{ - if (get_shaders() != NULL && get_shaders()->recording()) - get_shaders()->window_record(); - -} - - -//============================================================ // drawd3d_window_get_primitives //============================================================ -render_primitive_list *d3d::renderer::get_primitives() +render_primitive_list *renderer_d3d9::get_primitives() { RECT client; @@ -245,7 +207,7 @@ render_primitive_list *d3d::renderer::get_primitives() window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect()); window().target()->set_max_update_rate((get_refresh() == 0) ? get_origmode().RefreshRate : get_refresh()); } - if (m_shaders != NULL) + if (m_shaders != nullptr) { // do not transform primitives (scale, offset) if shaders are enabled, the shaders will handle the transformation window().target()->set_transform_primitives(!m_shaders->enabled()); @@ -258,30 +220,19 @@ render_primitive_list *d3d::renderer::get_primitives() // drawnone_create //============================================================ -static osd_renderer *drawd3d_create(osd_window *window) +bool renderer_d3d9::init(running_machine &machine) { - return global_alloc(d3d::renderer(window)); -} - -int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks) -{ - d3dintf = NULL; - // Use Direct3D9 - d3dintf = d3d::drawd3d9_init(); + d3dintf = drawd3d9_init(); // if we failed, note the error - if (d3dintf == NULL) + if (d3dintf == nullptr) { osd_printf_error("Unable to initialize Direct3D.\n"); - return 1; + return true; } - // fill in the callbacks - memset(callbacks, 0, sizeof(*callbacks)); - callbacks->exit = drawd3d_exit; - callbacks->create = drawd3d_create; - return 0; + return false; } @@ -289,7 +240,7 @@ int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks) // drawd3d_window_draw //============================================================ -int d3d::renderer::draw(const int update) +int renderer_d3d9::draw(const int update) { int check = pre_window_draw_check(); if (check >= 0) @@ -302,21 +253,19 @@ int d3d::renderer::draw(const int update) return 0; } -namespace d3d -{ -void renderer::set_texture(texture_info *texture) +void renderer_d3d9::set_texture(texture_info *texture) { if (texture != m_last_texture) { m_last_texture = texture; - m_last_texture_flags = (texture == NULL ? 0 : texture->get_flags()); - HRESULT result = (*d3dintf->device.set_texture)(m_device, 0, (texture == NULL) ? get_default_texture()->get_finaltex() : texture->get_finaltex()); + m_last_texture_flags = (texture == nullptr ? 0 : texture->get_flags()); + HRESULT result = (*d3dintf->device.set_texture)(m_device, 0, (texture == nullptr) ? get_default_texture()->get_finaltex() : texture->get_finaltex()); m_shaders->set_texture(texture); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_texture call\n", (int)result); } } -void renderer::set_filter(int filter) +void renderer_d3d9::set_filter(int filter) { if (filter != m_last_filter) { @@ -332,7 +281,7 @@ void renderer::set_filter(int filter) } } -void renderer::set_wrap(D3DTEXTUREADDRESS wrap) +void renderer_d3d9::set_wrap(unsigned int wrap) { if (wrap != m_last_wrap) { @@ -348,7 +297,7 @@ void renderer::set_wrap(D3DTEXTUREADDRESS wrap) } } -void renderer::set_modmode(DWORD modmode) +void renderer_d3d9::set_modmode(int modmode) { if (modmode != m_last_modmode) { @@ -360,7 +309,7 @@ void renderer::set_modmode(DWORD modmode) } } -void renderer::set_blendmode(int blendmode) +void renderer_d3d9::set_blendmode(int blendmode) { int blendenable; int blendop; @@ -407,7 +356,7 @@ void renderer::set_blendmode(int blendmode) } } -void renderer::reset_render_states() +void renderer_d3d9::reset_render_states() { // this ensures subsequent calls to the above setters will force-update the data m_last_texture = (texture_info *)~0; @@ -419,13 +368,13 @@ void renderer::reset_render_states() m_last_wrap = (D3DTEXTUREADDRESS)-1; } -texture_manager::texture_manager(renderer *d3d) +d3d_texture_manager::d3d_texture_manager(renderer_d3d9 *d3d) { m_renderer = d3d; - m_texlist = NULL; - m_vector_texture = NULL; - m_default_texture = NULL; + m_texlist = nullptr; + m_vector_texture = nullptr; + m_default_texture = nullptr; // check for dynamic texture support DWORD tempcaps; @@ -467,16 +416,16 @@ texture_manager::texture_manager(renderer *d3d) osd_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)m_texture_max_width, (int)m_texture_max_height); } -texture_manager::~texture_manager() +d3d_texture_manager::~d3d_texture_manager() { } //============================================================ -// texture_manager::compute_texture_size +// d3d_texture_manager::compute_texture_size //============================================================ -void texture_manager::compute_texture_size(int texwidth, int texheight, int* p_width, int* p_height) +void d3d_texture_manager::compute_texture_size(int texwidth, int texheight, int* p_width, int* p_height) { int finalheight = texheight; int finalwidth = texwidth; @@ -528,16 +477,16 @@ void texture_manager::compute_texture_size(int texwidth, int texheight, int* p_w *p_height = finalheight; } -void texture_manager::create_resources() +void d3d_texture_manager::create_resources() { // experimental: load a PNG to use for vector rendering; it is treated // as a brightness map emu_file file(m_renderer->window().machine().options().art_path(), OPEN_FLAG_READ); - render_load_png(m_vector_bitmap, file, NULL, "vector.png"); + render_load_png(m_vector_bitmap, file, nullptr, "vector.png"); if (m_vector_bitmap.valid()) { m_vector_bitmap.fill(rgb_t(0xff,0xff,0xff,0xff)); - render_load_png(m_vector_bitmap, file, NULL, "vector.png", true); + render_load_png(m_vector_bitmap, file, nullptr, "vector.png", true); } m_default_bitmap.allocate(8, 8); @@ -552,7 +501,7 @@ void texture_manager::create_resources() texture.rowpixels = m_default_bitmap.rowpixels(); texture.width = m_default_bitmap.width(); texture.height = m_default_bitmap.height(); - texture.palette = NULL; + texture.palette = nullptr; texture.seqid = 0; // now create it @@ -569,7 +518,7 @@ void texture_manager::create_resources() texture.rowpixels = m_vector_bitmap.rowpixels(); texture.width = m_vector_bitmap.width(); texture.height = m_vector_bitmap.height(); - texture.palette = NULL; + texture.palette = nullptr; texture.seqid = 0; // now create it @@ -577,17 +526,17 @@ void texture_manager::create_resources() } } -void texture_manager::delete_resources() +void d3d_texture_manager::delete_resources() { // is part of m_texlist and will be free'd there //global_free(m_default_texture); - m_default_texture = NULL; + m_default_texture = nullptr; //global_free(m_vector_texture); - m_vector_texture = NULL; + m_vector_texture = nullptr; // free all textures - while (m_texlist != NULL) + while (m_texlist != nullptr) { texture_info *tex = m_texlist; m_texlist = tex->get_next(); @@ -595,18 +544,18 @@ void texture_manager::delete_resources() } } -UINT32 texture_manager::texture_compute_hash(const render_texinfo *texture, UINT32 flags) +UINT32 d3d_texture_manager::texture_compute_hash(const render_texinfo *texture, UINT32 flags) { return (FPTR)texture->base ^ (flags & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)); } -texture_info *texture_manager::find_texinfo(const render_texinfo *texinfo, UINT32 flags) +texture_info *d3d_texture_manager::find_texinfo(const render_texinfo *texinfo, UINT32 flags) { UINT32 hash = texture_compute_hash(texinfo, flags); texture_info *texture; // find a match - for (texture = m_renderer->get_texture_manager()->get_texlist(); texture != NULL; texture = texture->get_next()) + for (texture = m_renderer->get_texture_manager()->get_texlist(); texture != nullptr; texture = texture->get_next()) { UINT32 test_screen = (UINT32)texture->get_texinfo().osddata >> 1; UINT32 test_page = (UINT32)texture->get_texinfo().osddata & 1; @@ -626,7 +575,7 @@ texture_info *texture_manager::find_texinfo(const render_texinfo *texinfo, UINT3 // Reject a texture if it belongs to an out-of-date render target, so as to cause the HLSL system to re-cache if (m_renderer->get_shaders()->enabled() && texinfo->width != 0 && texinfo->height != 0 && (flags & PRIMFLAG_SCREENTEX_MASK) != 0) { - if (m_renderer->get_shaders()->find_render_target(texture) != NULL) + if (m_renderer->get_shaders()->find_render_target(texture) != nullptr) { return texture; } @@ -643,13 +592,13 @@ texture_info *texture_manager::find_texinfo(const render_texinfo *texinfo, UINT3 { if (texinfo->width == 0 || texinfo->height == 0) { - return NULL; + return nullptr; } UINT32 prim_screen = texinfo->osddata >> 1; UINT32 prim_page = texinfo->osddata & 1; - for (texture = m_renderer->get_texture_manager()->get_texlist(); texture != NULL; texture = texture->get_next()) + for (texture = m_renderer->get_texture_manager()->get_texlist(); texture != nullptr; texture = texture->get_next()) { UINT32 test_screen = texture->get_texinfo().osddata >> 1; UINT32 test_page = texture->get_texinfo().osddata & 1; @@ -670,31 +619,35 @@ texture_info *texture_manager::find_texinfo(const render_texinfo *texinfo, UINT3 } } - return NULL; + return nullptr; } -renderer::renderer(osd_window *window) - : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(NULL), m_gamma_supported(0), m_pixformat(), - m_vertexbuf(NULL), m_lockedbuf(NULL), m_numverts(0), m_vectorbatch(NULL), m_batchindex(0), m_numpolys(0), m_restarting(false), m_mod2x_supported(0), m_mod4x_supported(0), - m_screen_format(), m_last_texture(NULL), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), - m_last_wrap(), m_last_modmode(0), m_hlsl_buf(NULL), m_shaders(NULL), m_shaders_options(NULL), m_texture_manager(NULL), m_line_count(0) +renderer_d3d9::renderer_d3d9(osd_window *window) + : osd_renderer(window, FLAG_NONE), m_adapter(0), m_width(0), m_height(0), m_refresh(0), m_create_error_count(0), m_device(nullptr), m_gamma_supported(0), m_pixformat(), + m_vertexbuf(nullptr), m_lockedbuf(nullptr), m_numverts(0), m_vectorbatch(nullptr), m_batchindex(0), m_numpolys(0), m_restarting(false), m_mod2x_supported(0), m_mod4x_supported(0), + m_screen_format(), m_last_texture(nullptr), m_last_texture_flags(0), m_last_blendenable(0), m_last_blendop(0), m_last_blendsrc(0), m_last_blenddst(0), m_last_filter(0), + m_last_wrap(), m_last_modmode(0), m_hlsl_buf(nullptr), m_shaders(nullptr), m_shaders_options(nullptr), m_texture_manager(nullptr), m_line_count(0) { } -int renderer::initialize() +int renderer_d3d9::initialize() { // configure the adapter for the mode we want if (config_adapter_mode()) + { return false; + } // create the device immediately for the full screen case (defer for window mode) if (window().fullscreen() && device_create(window().m_focus_hwnd)) + { return false; + } return true; } -int renderer::pre_window_draw_check() +int renderer_d3d9::pre_window_draw_check() { // if we're in the middle of resizing, leave things alone if (window().m_resize_state == RESIZE_STATE_RESIZING) @@ -709,7 +662,7 @@ int renderer::pre_window_draw_check() } // if we have a device, check the cooperative level - if (m_device != NULL) + if (m_device != nullptr) { if (device_test_cooperative()) { @@ -718,28 +671,28 @@ int renderer::pre_window_draw_check() } // in window mode, we need to track the window size - if (!window().fullscreen() || m_device == NULL) + if (!window().fullscreen() || m_device == nullptr) { // if the size changes, skip this update since the render target will be out of date if (update_window_size()) return 0; // if we have no device, after updating the size, return an error so GDI can try - if (m_device == NULL) + if (m_device == nullptr) return 1; } return -1; } -void texture_manager::update_textures() +void d3d_texture_manager::update_textures() { - for (render_primitive *prim = m_renderer->window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (render_primitive *prim = m_renderer->window().m_primlist->first(); prim != nullptr; prim = prim->next()) { - if (prim->texture.base != NULL) + if (prim->texture.base != nullptr) { texture_info *texture = find_texinfo(&prim->texture, prim->flags); - if (texture == NULL) + if (texture == nullptr) { // if there isn't one, create a new texture global_alloc(texture_info(this, &prim->texture, m_renderer->window().prescale(), prim->flags)); @@ -764,9 +717,9 @@ void texture_manager::update_textures() } } -void renderer::begin_frame() +void renderer_d3d9::begin_frame() { - HRESULT result = (*d3dintf->device.clear)(m_device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); + HRESULT result = (*d3dintf->device.clear)(m_device, 0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); m_shaders->begin_frame(); @@ -781,7 +734,7 @@ void renderer::begin_frame() result = (*d3dintf->device.begin_scene)(m_device); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device begin_scene call\n", (int)result); - m_lockedbuf = NULL; + m_lockedbuf = nullptr; if(m_shaders->enabled()) { @@ -792,15 +745,15 @@ void renderer::begin_frame() m_line_count = 0; // loop over primitives - for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) if (prim->type == render_primitive::LINE && PRIMFLAG_GET_VECTOR(prim->flags)) m_line_count++; } -void renderer::process_primitives() +void renderer_d3d9::process_primitives() { // Rotating index for vector time offsets - for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { switch (prim->type) { @@ -828,7 +781,7 @@ void renderer::process_primitives() } } -void renderer::end_frame() +void renderer_d3d9::end_frame() { window().m_primlist->release_lock(); @@ -842,7 +795,7 @@ void renderer::end_frame() if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device end_scene call\n", (int)result); // present the current buffers - result = (*d3dintf->device.present)(m_device, NULL, NULL, NULL, NULL, 0); + result = (*d3dintf->device.present)(m_device, nullptr, nullptr, nullptr, nullptr, 0); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device present call\n", (int)result); } @@ -850,10 +803,10 @@ void renderer::end_frame() // device_create //============================================================ -int renderer::device_create(HWND device_hwnd) +int renderer_d3d9::device_create(HWND device_hwnd) { // if a device exists, free it - if (m_device != NULL) + if (m_device != nullptr) { device_delete(); } @@ -878,7 +831,7 @@ int renderer::device_create(HWND device_hwnd) return 1; } - m_texture_manager = global_alloc(texture_manager(this)); + m_texture_manager = global_alloc(d3d_texture_manager(this)); try_again: // try for XRGB first @@ -971,7 +924,7 @@ try_again: } // create shader options only once - if (m_shaders_options == NULL) + if (m_shaders_options == nullptr) { m_shaders_options = (hlsl_options*)global_alloc_clear<hlsl_options>(); m_shaders_options->params_init = false; @@ -979,6 +932,7 @@ try_again: m_shaders = (shaders*)global_alloc_clear<shaders>(); m_shaders->init(d3dintf, &window().machine(), this); + m_sliders_dirty = true; int failed = m_shaders->create_resources(false); if (failed) @@ -994,7 +948,7 @@ try_again: // device_create_resources //============================================================ -int renderer::device_create_resources() +int renderer_d3d9::device_create_resources() { // allocate a vertex buffer to use HRESULT result = (*d3dintf->device.create_vertex_buffer)(m_device, @@ -1046,8 +1000,8 @@ int renderer::device_create_resources() reset_render_states(); // clear the buffer - result = (*d3dintf->device.clear)(m_device, 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); - result = (*d3dintf->device.present)(m_device, NULL, NULL, NULL, NULL, 0); + result = (*d3dintf->device.clear)(m_device, 0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); + result = (*d3dintf->device.present)(m_device, nullptr, nullptr, nullptr, nullptr, 0); m_texture_manager->create_resources(); @@ -1059,20 +1013,26 @@ int renderer::device_create_resources() // device_delete //============================================================ -renderer::~renderer() +renderer_d3d9::~renderer_d3d9() { + if (get_shaders() != nullptr && get_shaders()->recording()) + get_shaders()->window_record(); + + if (d3dintf != nullptr) + (*d3dintf->d3d.release)(d3dintf); + device_delete(); - if (m_shaders_options != NULL) + if (m_shaders_options != nullptr) { global_free(m_shaders_options); - m_shaders_options = NULL; + m_shaders_options = nullptr; } } -void renderer::device_delete() +void renderer_d3d9::device_delete() { - if (m_shaders != NULL) + if (m_shaders != nullptr) { // free our effects m_shaders->delete_resources(false); @@ -1084,18 +1044,18 @@ void renderer::device_delete() // free our base resources device_delete_resources(); - if (m_texture_manager != NULL) + if (m_texture_manager != nullptr) { global_free(m_texture_manager); - m_texture_manager = NULL; + m_texture_manager = nullptr; } // free the device itself - if (m_device != NULL) + if (m_device != nullptr) { (*d3dintf->device.reset)(m_device, &m_presentation); (*d3dintf->device.release)(m_device); - m_device = NULL; + m_device = nullptr; } } @@ -1104,18 +1064,18 @@ void renderer::device_delete() // device_delete_resources //============================================================ -void renderer::device_delete_resources() +void renderer_d3d9::device_delete_resources() { - if (m_texture_manager != NULL) + if (m_texture_manager != nullptr) { m_texture_manager->delete_resources(); } // free the vertex buffer - if (m_vertexbuf != NULL) + if (m_vertexbuf != nullptr) { (*d3dintf->vertexbuf.release)(m_vertexbuf); - m_vertexbuf = NULL; + m_vertexbuf = nullptr; } } @@ -1124,7 +1084,7 @@ void renderer::device_delete_resources() // device_verify_caps //============================================================ -int renderer::device_verify_caps() +int renderer_d3d9::device_verify_caps() { int retval = 0; @@ -1190,7 +1150,7 @@ int renderer::device_verify_caps() // device_test_cooperative //============================================================ -int renderer::device_test_cooperative() +int renderer_d3d9::device_test_cooperative() { // check our current status; if we lost the device, punt to GDI HRESULT result = (*d3dintf->device.test_cooperative_level)(m_device); @@ -1237,7 +1197,7 @@ int renderer::device_test_cooperative() // config_adapter_mode //============================================================ -int renderer::config_adapter_mode() +int renderer_d3d9::config_adapter_mode() { adapter_identifier identifier; @@ -1312,7 +1272,7 @@ int renderer::config_adapter_mode() // get_adapter_for_monitor //============================================================ -int renderer::get_adapter_for_monitor() +int renderer_d3d9::get_adapter_for_monitor() { int maxadapter = (*d3dintf->d3d.get_adapter_count)(d3dintf); @@ -1338,7 +1298,7 @@ int renderer::get_adapter_for_monitor() // pick_best_mode //============================================================ -void renderer::pick_best_mode() +void renderer_d3d9::pick_best_mode() { double target_refresh = 60.0; INT32 minwidth, minheight; @@ -1346,7 +1306,7 @@ void renderer::pick_best_mode() // determine the refresh rate of the primary screen const screen_device *primary_screen = window().machine().config().first_screen(); - if (primary_screen != NULL) + if (primary_screen != nullptr) { target_refresh = ATTOSECONDS_TO_HZ(primary_screen->refresh_attoseconds()); } @@ -1426,14 +1386,14 @@ void renderer::pick_best_mode() // update_window_size //============================================================ -int renderer::update_window_size() +int renderer_d3d9::update_window_size() { // get the current window bounds RECT client; GetClientRectExceptMenu(window().m_hwnd, &client, window().fullscreen()); // if we have a device and matching width/height, nothing to do - if (m_device != NULL && rect_width(&client) == m_width && rect_height(&client) == m_height) + if (m_device != nullptr && rect_width(&client) == m_width && rect_height(&client) == m_height) { // clear out any pending resizing if the area didn't change if (window().m_resize_state == RESIZE_STATE_PENDING) @@ -1461,7 +1421,7 @@ int renderer::update_window_size() // batch_vectors //============================================================ -void renderer::batch_vectors() +void renderer_d3d9::batch_vectors() { windows_options &options = downcast<windows_options &>(window().machine().options()); @@ -1473,7 +1433,7 @@ void renderer::batch_vectors() int line_index = 0; float period = options.screen_vector_time_period(); UINT32 cached_flags = 0; - for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { switch (prim->type) { @@ -1513,7 +1473,7 @@ void renderer::batch_vectors() m_line_count = 0; } -void renderer::batch_vector(const render_primitive *prim, float line_time) +void renderer_d3d9::batch_vector(const render_primitive *prim, float line_time) { // compute the effective width based on the direction of the line float effwidth = prim->width; @@ -1531,7 +1491,7 @@ void renderer::batch_vector(const render_primitive *prim, float line_time) step->weight != 0; step++) { // get a pointer to the vertex buffer - if (m_vectorbatch == NULL) + if (m_vectorbatch == nullptr) return; m_vectorbatch[m_batchindex + 0].x = b0.x0 + step->xoffs; @@ -1615,7 +1575,7 @@ void renderer::batch_vector(const render_primitive *prim, float line_time) // draw_line //============================================================ -void renderer::draw_line(const render_primitive *prim) +void renderer_d3d9::draw_line(const render_primitive *prim) { // compute the effective width based on the direction of the line float effwidth = prim->width; @@ -1634,7 +1594,7 @@ void renderer::draw_line(const render_primitive *prim) { // get a pointer to the vertex buffer vertex *vertex = mesh_alloc(4); - if (vertex == NULL) + if (vertex == nullptr) return; // rotate the unit vector by 135 degrees and add to point 0 @@ -1699,18 +1659,18 @@ void renderer::draw_line(const render_primitive *prim) // draw_quad //============================================================ -void renderer::draw_quad(const render_primitive *prim) +void renderer_d3d9::draw_quad(const render_primitive *prim) { texture_info *texture = m_texture_manager->find_texinfo(&prim->texture, prim->flags); - if (texture == NULL) + if (texture == nullptr) { texture = get_default_texture(); } // get a pointer to the vertex buffer vertex *vertex = mesh_alloc(4); - if (vertex == NULL) + if (vertex == nullptr) return; // fill in the vertexes clockwise @@ -1726,7 +1686,7 @@ void renderer::draw_quad(const render_primitive *prim) float height = prim->bounds.y1 - prim->bounds.y0; // set the texture coordinates - if(texture != NULL) + if(texture != nullptr) { vec2f& start = texture->get_uvstart(); vec2f& stop = texture->get_uvstop(); @@ -1747,7 +1707,7 @@ void renderer::draw_quad(const render_primitive *prim) INT32 b = (INT32)(prim->color.b * 255.0f); INT32 a = (INT32)(prim->color.a * 255.0f); DWORD modmode = D3DTOP_MODULATE; - if (texture != NULL) + if (texture != nullptr) { if (m_mod2x_supported && (r > 255 || g > 255 || b > 255)) { @@ -1813,12 +1773,12 @@ void poly_info::init(D3DPRIMITIVETYPE type, UINT32 count, UINT32 numverts, // primitive_alloc //============================================================ -vertex *renderer::mesh_alloc(int numverts) +vertex *renderer_d3d9::mesh_alloc(int numverts) { HRESULT result; // if we're going to overflow, flush - if (m_lockedbuf != NULL && m_numverts + numverts >= VERTEX_BUFFER_SIZE) + if (m_lockedbuf != nullptr && m_numverts + numverts >= VERTEX_BUFFER_SIZE) { primitive_flush_pending(); @@ -1830,21 +1790,21 @@ vertex *renderer::mesh_alloc(int numverts) } // if we don't have a lock, grab it now - if (m_lockedbuf == NULL) + if (m_lockedbuf == nullptr) { result = (*d3dintf->vertexbuf.lock)(m_vertexbuf, 0, 0, (VOID **)&m_lockedbuf, D3DLOCK_DISCARD); if (result != D3D_OK) - return NULL; + return nullptr; } // if we already have the lock and enough room, just return a pointer - if (m_lockedbuf != NULL && m_numverts + numverts < VERTEX_BUFFER_SIZE) + if (m_lockedbuf != nullptr && m_numverts + numverts < VERTEX_BUFFER_SIZE) { int oldverts = m_numverts; m_numverts += numverts; return &m_lockedbuf[oldverts]; } - return NULL; + return nullptr; } @@ -1852,10 +1812,10 @@ vertex *renderer::mesh_alloc(int numverts) // primitive_flush_pending //============================================================ -void renderer::primitive_flush_pending() +void renderer_d3d9::primitive_flush_pending() { // ignore if we're not locked - if (m_lockedbuf == NULL) + if (m_lockedbuf == nullptr) { return; } @@ -1863,7 +1823,7 @@ void renderer::primitive_flush_pending() // unlock the buffer HRESULT result = (*d3dintf->vertexbuf.unlock)(m_vertexbuf); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during vertex buffer unlock call\n", (int)result); - m_lockedbuf = NULL; + m_lockedbuf = nullptr; // set the stream result = (*d3dintf->device.set_stream_source)(m_device, 0, m_vertexbuf, sizeof(vertex)); @@ -1888,7 +1848,7 @@ void renderer::primitive_flush_pending() set_texture(texture); // set filtering if different - if (texture != NULL) + if (texture != nullptr) { newfilter = FALSE; if (PRIMFLAG_GET_SCREENTEX(flags)) @@ -1940,24 +1900,24 @@ void renderer::primitive_flush_pending() texture_info::~texture_info() { - if (m_d3dfinaltex != NULL) + if (m_d3dfinaltex != nullptr) { if (m_d3dtex == m_d3dfinaltex) { - m_d3dtex = NULL; + m_d3dtex = nullptr; } (*d3dintf->texture.release)(m_d3dfinaltex); - m_d3dfinaltex = NULL; + m_d3dfinaltex = nullptr; } - if (m_d3dtex != NULL) + if (m_d3dtex != nullptr) { (*d3dintf->texture.release)(m_d3dtex); - m_d3dtex = NULL; + m_d3dtex = nullptr; } - if (m_d3dsurface != NULL) + if (m_d3dsurface != nullptr) { (*d3dintf->surface.release)(m_d3dsurface); - m_d3dsurface = NULL; + m_d3dsurface = nullptr; } } @@ -1966,7 +1926,7 @@ texture_info::~texture_info() // texture_info constructor //============================================================ -texture_info::texture_info(texture_manager *manager, const render_texinfo* texsource, int prescale, UINT32 flags) +texture_info::texture_info(d3d_texture_manager *manager, const render_texinfo* texsource, int prescale, UINT32 flags) { HRESULT result; @@ -1979,9 +1939,9 @@ texture_info::texture_info(texture_manager *manager, const render_texinfo* texso m_xprescale = prescale; m_yprescale = prescale; - m_d3dtex = NULL; - m_d3dsurface = NULL; - m_d3dfinaltex = NULL; + m_d3dtex = nullptr; + m_d3dsurface = nullptr; + m_d3dfinaltex = nullptr; // non-screen textures are easy if (!PRIMFLAG_GET_SCREENTEX(flags)) @@ -2124,7 +2084,7 @@ texture_info::texture_info(texture_manager *manager, const render_texinfo* texso } (*d3dintf->texture.release)(m_d3dtex); - m_d3dtex = NULL; + m_d3dtex = nullptr; } } } @@ -2133,9 +2093,9 @@ texture_info::texture_info(texture_manager *manager, const render_texinfo* texso set_data(texsource, flags); // add us to the texture list - if(m_texture_manager->get_texlist() != NULL) + if(m_texture_manager->get_texlist() != nullptr) m_texture_manager->get_texlist()->m_prev = this; - m_prev = NULL; + m_prev = nullptr; m_next = m_texture_manager->get_texlist(); m_texture_manager->set_texlist(this); return; @@ -2143,9 +2103,9 @@ texture_info::texture_info(texture_manager *manager, const render_texinfo* texso error: d3dintf->post_fx_available = false; osd_printf_error("Direct3D: Critical warning: A texture failed to allocate. Expect things to get bad quickly.\n"); - if (m_d3dsurface != NULL) + if (m_d3dsurface != nullptr) (*d3dintf->surface.release)(m_d3dsurface); - if (m_d3dtex != NULL) + if (m_d3dtex != nullptr) (*d3dintf->texture.release)(m_d3dtex); } @@ -2267,7 +2227,7 @@ static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, con assert(xborderpix == 0 || xborderpix == 1); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2310,7 +2270,7 @@ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, co assert(xborderpix == 0 || xborderpix == 1); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2354,7 +2314,7 @@ static inline void copyline_yuy16_to_yuy2(UINT16 *dst, const UINT16 *src, int wi assert(width % 2 == 0); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2419,7 +2379,7 @@ static inline void copyline_yuy16_to_uyvy(UINT16 *dst, const UINT16 *src, int wi assert(width % 2 == 0); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2482,7 +2442,7 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi assert(width % 2 == 0); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2560,9 +2520,9 @@ void texture_info::set_data(const render_texinfo *texsource, UINT32 flags) switch (m_type) { default: - case TEXTURE_TYPE_PLAIN: result = (*d3dintf->texture.lock_rect)(m_d3dtex, 0, &rect, NULL, 0); break; - case TEXTURE_TYPE_DYNAMIC: result = (*d3dintf->texture.lock_rect)(m_d3dtex, 0, &rect, NULL, D3DLOCK_DISCARD); break; - case TEXTURE_TYPE_SURFACE: result = (*d3dintf->surface.lock_rect)(m_d3dsurface, &rect, NULL, D3DLOCK_DISCARD); break; + case TEXTURE_TYPE_PLAIN: result = (*d3dintf->texture.lock_rect)(m_d3dtex, 0, &rect, nullptr, 0); break; + case TEXTURE_TYPE_DYNAMIC: result = (*d3dintf->texture.lock_rect)(m_d3dtex, 0, &rect, nullptr, D3DLOCK_DISCARD); break; + case TEXTURE_TYPE_SURFACE: result = (*d3dintf->surface.lock_rect)(m_d3dsurface, &rect, nullptr, D3DLOCK_DISCARD); break; } if (result != D3D_OK) { @@ -2650,7 +2610,7 @@ void texture_info::prescale() // if we have an offscreen plain surface, we can just StretchRect to it if (m_type == TEXTURE_TYPE_SURFACE) { - assert(m_d3dsurface != NULL); + assert(m_d3dsurface != nullptr); // set the source bounds RECT source; @@ -2674,7 +2634,7 @@ void texture_info::prescale() { surface *backbuffer; - assert(m_d3dtex != NULL); + assert(m_d3dtex != nullptr); // first remember the original render target and set the new one result = (*d3dintf->device.get_render_target)(m_renderer->get_device(), 0, &backbuffer); @@ -2729,7 +2689,7 @@ void texture_info::prescale() // unlock the vertex buffer result = (*d3dintf->vertexbuf.unlock)(m_renderer->get_vertex_buffer()); if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during vertex buffer unlock call\n", (int)result); - m_renderer->set_locked_buffer(NULL); + m_renderer->set_locked_buffer(nullptr); // set the stream and draw the triangle strip result = (*d3dintf->device.set_stream_source)(m_renderer->get_device(), 0, m_renderer->get_vertex_buffer(), sizeof(vertex)); @@ -2759,15 +2719,15 @@ void texture_info::prescale() cache_target::~cache_target() { - if (last_texture != NULL) + if (last_texture != nullptr) { (*d3dintf->texture.release)(last_texture); - last_texture = NULL; + last_texture = nullptr; } - if (last_target != NULL) + if (last_target != nullptr) { (*d3dintf->surface.release)(last_target); - last_target = NULL; + last_target = nullptr; } } @@ -2776,7 +2736,7 @@ cache_target::~cache_target() // cache_target::init - initializes a target cache //============================================================ -bool cache_target::init(renderer *d3d, base *d3dintf, int target_width, int target_height) +bool cache_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int target_width, int target_height) { // d3d->get_texture_manager()->compute_texture_size(target_width, target_height, &target_width, &target_height); @@ -2795,56 +2755,56 @@ bool cache_target::init(renderer *d3d, base *d3dintf, int target_width, int targ //============================================================ -// render_target::~render_target +// d3d_render_target::~d3d_render_target //============================================================ -render_target::~render_target() +d3d_render_target::~d3d_render_target() { for (int index = 0; index < 11; index++) { - if (bloom_texture[index] != NULL) + if (bloom_texture[index] != nullptr) { (*d3dintf->texture.release)(bloom_texture[index]); - bloom_texture[index] = NULL; + bloom_texture[index] = nullptr; } - if (bloom_target[index] != NULL) + if (bloom_target[index] != nullptr) { (*d3dintf->surface.release)(bloom_target[index]); - bloom_target[index] = NULL; + bloom_target[index] = nullptr; } } for (int index = 0; index < 2; index++) { - if (source_texture[index] != NULL) + if (source_texture[index] != nullptr) { (*d3dintf->texture.release)(source_texture[index]); - source_texture[index] = NULL; + source_texture[index] = nullptr; } - if (source_surface[index] != NULL) + if (source_surface[index] != nullptr) { (*d3dintf->surface.release)(source_surface[index]); - source_surface[index] = NULL; + source_surface[index] = nullptr; } - if (target_texture[index] != NULL) + if (target_texture[index] != nullptr) { (*d3dintf->texture.release)(target_texture[index]); - target_texture[index] = NULL; + target_texture[index] = nullptr; } - if (target_surface[index] != NULL) + if (target_surface[index] != nullptr) { (*d3dintf->surface.release)(target_surface[index]); - target_surface[index] = NULL; + target_surface[index] = nullptr; } } } //============================================================ -// render_target::init - initializes a render target +// d3d_render_target::init - initializes a render target //============================================================ -bool render_target::init(renderer *d3d, base *d3dintf, int width, int height, int target_width, int target_height) +bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int width, int height, int target_width, int target_height) { HRESULT result; @@ -2895,4 +2855,12 @@ bool render_target::init(renderer *d3d, base *d3dintf, int width, int height, in return true; } +texture_info *renderer_d3d9::get_default_texture() +{ + return m_texture_manager->get_default_texture(); +} + +texture_info *renderer_d3d9::get_vector_texture() +{ + return m_texture_manager->get_vector_texture(); } diff --git a/src/osd/modules/render/drawd3d.h b/src/osd/modules/render/drawd3d.h index 9c2014ead39..31246f5baf8 100644 --- a/src/osd/modules/render/drawd3d.h +++ b/src/osd/modules/render/drawd3d.h @@ -9,9 +9,10 @@ #ifndef __WIN_DRAWD3D__ #define __WIN_DRAWD3D__ +#ifdef OSD_WINDOWS -#include "modules/render/d3d/d3dhlsl.h" - +#include "d3d/d3dintf.h" +#include "d3d/d3dcomm.h" //============================================================ // CONSTANTS @@ -24,88 +25,30 @@ // TYPE DEFINITIONS //============================================================ -namespace d3d -{ -class cache_target; -class render_target; -class renderer; - -/* cache_target is a simple linked list containing only a rednerable target and texture, used for phosphor effects */ -class cache_target -{ -public: - // construction/destruction - cache_target() { } - ~cache_target(); - - bool init(renderer *d3d, base *d3dintf, int target_width, int target_height); - - surface *last_target; - texture *last_texture; - - // real target dimension - int target_width; - int target_height; - - // only used to identify/find the render target - int width; - int height; - - int screen_index; - - cache_target *next; - cache_target *prev; -}; - -/* render_target is the information about a Direct3D render target chain */ -class render_target -{ -public: - // construction/destruction - render_target() { } - ~render_target(); - - bool init(renderer *d3d, base *d3dintf, int width, int height, int target_width, int target_height); - int next_index(int index) { return ++index > 1 ? 0 : index; } - - // real target dimension - int target_width; - int target_height; - - // only used to identify/find the render target - int width; - int height; - - int screen_index; - int page_index; - - surface *target_surface[2]; - texture *target_texture[2]; - surface *source_surface[2]; - texture *source_texture[2]; - - render_target *next; - render_target *prev; - - surface *bloom_target[11]; - texture *bloom_texture[11]; -}; +struct vertex; +class texture_info; +class texture_manager; +struct device; +struct vertex_buffer; +class shaders; +struct hlsl_options; +class poly_info; /* renderer is the information about Direct3D for the current screen */ -class renderer : public osd_renderer +class renderer_d3d9 : public osd_renderer { public: - //renderer() { } - renderer(osd_window *window); - virtual ~renderer(); + renderer_d3d9(osd_window *window); + virtual ~renderer_d3d9(); virtual int create() override; + virtual slider_state* get_slider_list() override; + static bool init(running_machine &machine); virtual render_primitive_list *get_primitives() override; virtual int draw(const int update) override; virtual void save() override; virtual void record() override; virtual void toggle_fsfx() override; - virtual void destroy() override; int initialize(); @@ -141,8 +84,8 @@ public: void set_texture(texture_info *texture); void set_filter(int filter); - void set_wrap(D3DTEXTUREADDRESS wrap); - void set_modmode(DWORD modmode); + void set_wrap(unsigned int wrap); + void set_modmode(int modmode); void set_blendmode(int blendmode); void reset_render_states(); @@ -165,15 +108,15 @@ public: bool is_mod2x_supported() { return (bool)m_mod2x_supported; } bool is_mod4x_supported() { return (bool)m_mod4x_supported; } - D3DFORMAT get_screen_format() { return m_screen_format; } - D3DFORMAT get_pixel_format() { return m_pixformat; } - D3DDISPLAYMODE get_origmode() { return m_origmode; } + D3DFORMAT get_screen_format() { return m_screen_format; } + D3DFORMAT get_pixel_format() { return m_pixformat; } + D3DDISPLAYMODE get_origmode() { return m_origmode; } UINT32 get_last_texture_flags() { return m_last_texture_flags; } - texture_manager * get_texture_manager() { return m_texture_manager; } - texture_info * get_default_texture() { return m_texture_manager->get_default_texture(); } - texture_info * get_vector_texture() { return m_texture_manager->get_vector_texture(); } + d3d_texture_manager * get_texture_manager() { return m_texture_manager; } + texture_info * get_default_texture(); + texture_info * get_vector_texture(); shaders * get_shaders() { return m_shaders; } hlsl_options * get_shaders_options() { return m_shaders_options; } @@ -187,9 +130,9 @@ private: device * m_device; // pointer to the Direct3DDevice object int m_gamma_supported; // is full screen gamma supported? - present_parameters m_presentation; // set of presentation parameters - D3DDISPLAYMODE m_origmode; // original display mode for the adapter - D3DFORMAT m_pixformat; // pixel format we are using + present_parameters m_presentation; // set of presentation parameters + D3DDISPLAYMODE m_origmode; // original display mode for the adapter + D3DFORMAT m_pixformat; // pixel format we are using vertex_buffer * m_vertexbuf; // pointer to the vertex buffer object vertex * m_lockedbuf; // pointer to the locked vertex buffer @@ -198,14 +141,14 @@ private: vertex * m_vectorbatch; // pointer to the vector batch buffer int m_batchindex; // current index into the vector batch - poly_info m_poly[VERTEX_BUFFER_SIZE/3];// array to hold polygons as they are created + poly_info m_poly[VERTEX_BUFFER_SIZE/3];// array to hold polygons as they are created int m_numpolys; // number of accumulated polygons bool m_restarting; // if we're restarting int m_mod2x_supported; // is D3DTOP_MODULATE2X supported? int m_mod4x_supported; // is D3DTOP_MODULATE4X supported? - D3DFORMAT m_screen_format; // format to use for screen textures + D3DFORMAT m_screen_format; // format to use for screen textures texture_info * m_last_texture; // previous texture UINT32 m_last_texture_flags; // previous texture flags @@ -214,18 +157,18 @@ private: int m_last_blendsrc; // previous blendmode int m_last_blenddst; // previous blendmode int m_last_filter; // previous texture filter - D3DTEXTUREADDRESS m_last_wrap; // previous wrap state - DWORD m_last_modmode; // previous texture modulation + UINT32 m_last_wrap; // previous wrap state + int m_last_modmode; // previous texture modulation void * m_hlsl_buf; // HLSL vertex data shaders * m_shaders; // HLSL interface hlsl_options * m_shaders_options; // HLSL options - texture_manager * m_texture_manager; // texture manager + d3d_texture_manager * m_texture_manager; // texture manager int m_line_count; }; -} +#endif // OSD_WINDOWS -#endif +#endif // __WIN_DRAWD3D__
\ No newline at end of file diff --git a/src/osd/modules/render/drawgdi.cpp b/src/osd/modules/render/drawgdi.cpp index 11e61a28407..354d6950e30 100644 --- a/src/osd/modules/render/drawgdi.cpp +++ b/src/osd/modules/render/drawgdi.cpp @@ -6,125 +6,41 @@ // //============================================================ -// standard windows headers -#define WIN32_LEAN_AND_MEAN -#include <windows.h> - -// MAME headers -#include "emu.h" +#include "drawgdi.h" #include "rendersw.inc" -// MAMEOS headers -#include "window.h" - - -//============================================================ -// TYPE DEFINITIONS -//============================================================ - -class renderer_gdi : public osd_renderer -{ -public: - renderer_gdi(osd_window *window) - : osd_renderer(window, FLAG_NONE), bmdata(NULL), bmsize(0) { } - - virtual ~renderer_gdi() { } - - virtual int create() override; - virtual render_primitive_list *get_primitives() override; - virtual int draw(const int update) override; - virtual void save() override {}; - virtual void record() override {}; - virtual void toggle_fsfx() override {}; - virtual void destroy() override; - -private: - /* gdi_info is the information for the current screen */ - BITMAPINFO bminfo; - UINT8 * bmdata; - size_t bmsize; -}; - - -//============================================================ -// PROTOTYPES -//============================================================ - -// core functions -static void drawgdi_exit(void); - -//============================================================ -// drawnone_create -//============================================================ - -static osd_renderer *drawgdi_create(osd_window *window) -{ - return global_alloc(renderer_gdi(window)); -} - - -//============================================================ -// drawgdi_init -//============================================================ - -int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks) -{ - // fill in the callbacks - memset(callbacks, 0, sizeof(*callbacks)); - callbacks->exit = drawgdi_exit; - callbacks->create = drawgdi_create; - return 0; -} - - - //============================================================ -// drawgdi_exit +// destructor //============================================================ -static void drawgdi_exit(void) +renderer_gdi::~renderer_gdi() { + // free the bitmap memory + if (m_bmdata != nullptr) + global_free_array(m_bmdata); } - - //============================================================ -// drawgdi_window_init +// renderer_gdi::create //============================================================ int renderer_gdi::create() { // fill in the bitmap info header - bminfo.bmiHeader.biSize = sizeof(bminfo.bmiHeader); - bminfo.bmiHeader.biPlanes = 1; - bminfo.bmiHeader.biBitCount = 32; - bminfo.bmiHeader.biCompression = BI_RGB; - bminfo.bmiHeader.biSizeImage = 0; - bminfo.bmiHeader.biXPelsPerMeter = 0; - bminfo.bmiHeader.biYPelsPerMeter = 0; - bminfo.bmiHeader.biClrUsed = 0; - bminfo.bmiHeader.biClrImportant = 0; - + m_bminfo.bmiHeader.biSize = sizeof(m_bminfo.bmiHeader); + m_bminfo.bmiHeader.biPlanes = 1; + m_bminfo.bmiHeader.biBitCount = 32; + m_bminfo.bmiHeader.biCompression = BI_RGB; + m_bminfo.bmiHeader.biSizeImage = 0; + m_bminfo.bmiHeader.biXPelsPerMeter = 0; + m_bminfo.bmiHeader.biYPelsPerMeter = 0; + m_bminfo.bmiHeader.biClrUsed = 0; + m_bminfo.bmiHeader.biClrImportant = 0; return 0; } - - -//============================================================ -// drawgdi_window_destroy -//============================================================ - -void renderer_gdi::destroy() -{ - // free the bitmap memory - if (bmdata != NULL) - global_free_array(bmdata); -} - - - //============================================================ -// drawgdi_window_get_primitives +// renderer_gdi::get_primitives //============================================================ render_primitive_list *renderer_gdi::get_primitives() @@ -135,49 +51,45 @@ render_primitive_list *renderer_gdi::get_primitives() return &window().target()->get_primitives(); } - - //============================================================ -// drawgdi_window_draw +// renderer_gdi::draw //============================================================ int renderer_gdi::draw(const int update) { - int width, height, pitch; - RECT bounds; - // we don't have any special resize behaviors if (window().m_resize_state == RESIZE_STATE_PENDING) window().m_resize_state = RESIZE_STATE_NORMAL; // get the target bounds + RECT bounds; GetClientRect(window().m_hwnd, &bounds); // compute width/height/pitch of target - width = rect_width(&bounds); - height = rect_height(&bounds); - pitch = (width + 3) & ~3; + int width = rect_width(&bounds); + int height = rect_height(&bounds); + int pitch = (width + 3) & ~3; // make sure our temporary bitmap is big enough - if (pitch * height * 4 > bmsize) + if (pitch * height * 4 > m_bmsize) { - bmsize = pitch * height * 4 * 2; - global_free_array(bmdata); - bmdata = global_alloc_array(UINT8, bmsize); + m_bmsize = pitch * height * 4 * 2; + global_free_array(m_bmdata); + m_bmdata = global_alloc_array(UINT8, m_bmsize); } // draw the primitives to the bitmap window().m_primlist->acquire_lock(); - software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, bmdata, width, height, pitch); + software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, m_bmdata, width, height, pitch); window().m_primlist->release_lock(); // fill in bitmap-specific info - bminfo.bmiHeader.biWidth = pitch; - bminfo.bmiHeader.biHeight = -height; + m_bminfo.bmiHeader.biWidth = pitch; + m_bminfo.bmiHeader.biHeight = -height; // blit to the screen StretchDIBits(window().m_dc, 0, 0, width, height, 0, 0, width, height, - bmdata, &bminfo, DIB_RGB_COLORS, SRCCOPY); + m_bmdata, &m_bminfo, DIB_RGB_COLORS, SRCCOPY); return 0; } diff --git a/src/osd/modules/render/drawgdi.h b/src/osd/modules/render/drawgdi.h new file mode 100644 index 00000000000..af52eac1e77 --- /dev/null +++ b/src/osd/modules/render/drawgdi.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +//============================================================ +// +// drawgdi.h - Win32 GDI drawing +// +//============================================================ + +#pragma once + +#ifndef __DRAWGDI__ +#define __DRAWGDI__ + +// standard windows headers +#define WIN32_LEAN_AND_MEAN +#include <windows.h> + +// MAME headers +#include "emu.h" + +// MAMEOS headers +#include "window.h" + + +//============================================================ +// TYPE DEFINITIONS +//============================================================ + +class renderer_gdi : public osd_renderer +{ +public: + renderer_gdi(osd_window *window) + : osd_renderer(window, FLAG_NONE) + , m_bmdata(nullptr) + , m_bmsize(0) + { + } + virtual ~renderer_gdi(); + + virtual int create() override; + static bool init(running_machine &machine) { return false; } + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override; + virtual void save() override {}; + virtual void record() override {}; + virtual void toggle_fsfx() override {}; + +private: + /* gdi_info is the information for the current screen */ + BITMAPINFO m_bminfo; + UINT8 * m_bmdata; + size_t m_bmsize; +}; + +#endif // __DRAWGDI__
\ No newline at end of file diff --git a/src/osd/modules/render/drawnone.cpp b/src/osd/modules/render/drawnone.cpp index 9f45683e6da..5e1b4aa05dd 100644 --- a/src/osd/modules/render/drawnone.cpp +++ b/src/osd/modules/render/drawnone.cpp @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles //============================================================ // -// drawnone.c - stub "nothing" drawer +// drawnone.cpp - stub "nothing" drawer // //============================================================ @@ -13,88 +13,7 @@ // MAME headers #include "emu.h" -// MAMEOS headers -#include "window.h" - - -class renderer_none : public osd_renderer -{ -public: - renderer_none(osd_window *window) - : osd_renderer(window, FLAG_NONE) { } - - virtual ~renderer_none() { } - - virtual int create() override; - virtual render_primitive_list *get_primitives() override; - virtual int draw(const int update) override; - virtual void save() override { }; - virtual void record() override { }; - virtual void toggle_fsfx() override { }; - virtual void destroy() override; -}; - -//============================================================ -// PROTOTYPES -//============================================================ - -// core functions -static void drawnone_exit(void); - -//============================================================ -// drawnone_create -//============================================================ - -osd_renderer *drawnone_create(osd_window *window) -{ - return global_alloc(renderer_none(window)); -} - -//============================================================ -// drawnone_init -//============================================================ - -int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks) -{ - // fill in the callbacks - memset(callbacks, 0, sizeof(*callbacks)); - callbacks->exit = drawnone_exit; - callbacks->create = drawnone_create; - return 0; -} - - - -//============================================================ -// drawnone_exit -//============================================================ - -static void drawnone_exit(void) -{ -} - - - -//============================================================ -// drawnone_window_init -//============================================================ - -int renderer_none::create() -{ - return 0; -} - - - -//============================================================ -// drawnone_window_destroy -//============================================================ - -void renderer_none::destroy() -{ -} - - +#include "drawnone.h" //============================================================ // drawnone_window_get_primitives @@ -107,14 +26,3 @@ render_primitive_list *renderer_none::get_primitives() window().target()->set_bounds(rect_width(&client), rect_height(&client), window().aspect()); return &window().target()->get_primitives(); } - - - -//============================================================ -// drawnone_window_draw -//============================================================ - -int renderer_none::draw(const int update) -{ - return 0; -} diff --git a/src/osd/modules/render/drawnone.h b/src/osd/modules/render/drawnone.h new file mode 100644 index 00000000000..e6f49aa1727 --- /dev/null +++ b/src/osd/modules/render/drawnone.h @@ -0,0 +1,34 @@ +// license:BSD-3-Clause +// copyright-holders:Aaron Giles +//============================================================ +// +// drawnone.h - stub "nothing" drawer +// +//============================================================ + +// MAMEOS headers +#include "window.h" + +#pragma once + +#ifndef __DRAWNONE__ +#define __DRAWNONE__ + +class renderer_none : public osd_renderer +{ +public: + renderer_none(osd_window *window) + : osd_renderer(window, FLAG_NONE) { } + + virtual ~renderer_none() { } + + virtual int create() override { return 0; } + static bool init(running_machine &machine) { return false; } + virtual render_primitive_list *get_primitives() override; + virtual int draw(const int update) override { return 0; } + virtual void save() override { } + virtual void record() override { } + virtual void toggle_fsfx() override { } +}; + +#endif // __DRAWNONE__
\ No newline at end of file diff --git a/src/osd/modules/render/drawogl.cpp b/src/osd/modules/render/drawogl.cpp index 728b0810290..e90d74a40e6 100644 --- a/src/osd/modules/render/drawogl.cpp +++ b/src/osd/modules/render/drawogl.cpp @@ -119,17 +119,7 @@ typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuin #define GL_DEPTH_COMPONENT32 0x81A7 #endif -#define HASH_SIZE ((1<<10)+1) -#define OVERFLOW_SIZE (1<<10) - -// OSD headers -#ifndef OSD_WINDOWS -#include "osdsdl.h" -#include "window.h" -#else -#include "../windows/window.h" -typedef UINT64 HashT; -#endif +#include "drawogl.h" //============================================================ // DEBUGGING @@ -179,405 +169,6 @@ enum #define FSWAP(var1, var2) do { float temp = var1; var1 = var2; var2 = temp; } while (0) #define GL_NO_PRIMITIVE -1 -//============================================================ -// TYPES -//============================================================ - -#if defined(OSD_WINDOWS) - -class win_gl_context : public osd_gl_context -{ -public: - win_gl_context(HWND window) : osd_gl_context(), m_context(0), m_window(NULL), m_hdc(0) - { - m_error[0] = 0; - - this->pfn_wglGetProcAddress = (PROC (WINAPI *)(LPCSTR lpszProc)) GetProcAddress(m_module, "wglGetProcAddress"); - this->pfn_wglCreateContext = (HGLRC (WINAPI *)(HDC hdc)) GetProcAddress(m_module, "wglCreateContext"); - this->pfn_wglDeleteContext = (BOOL (WINAPI *)(HGLRC hglrc)) GetProcAddress(m_module, "wglDeleteContext"); - this->pfn_wglMakeCurrent = (BOOL (WINAPI *)(HDC hdc, HGLRC hglrc)) GetProcAddress(m_module, "wglMakeCurrent"); - - this->pfn_wglGetExtensionsStringEXT = (const char *(WINAPI *) (void)) pfn_wglGetProcAddress("wglGetExtensionsStringEXT"); - - if (WGLExtensionSupported("WGL_EXT_swap_control")) - { - this->pfn_wglSwapIntervalEXT = (BOOL (WINAPI *) (int)) getProcAddress("wglSwapIntervalEXT"); - this->pfn_wglGetSwapIntervalEXT = (int (WINAPI *) (void)) getProcAddress("wglGetSwapIntervalEXT"); - } - else - { - pfn_wglSwapIntervalEXT = NULL; - pfn_wglGetSwapIntervalEXT = NULL; - } - - m_hdc = GetDC(window); - if (!setupPixelFormat(m_hdc)) - { - m_context = this->pfn_wglCreateContext(m_hdc); - if (!m_context) - { - FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, m_error, 255, NULL); - return; - } - this->pfn_wglMakeCurrent(m_hdc, m_context); - } - } - - virtual ~win_gl_context() - { - this->pfn_wglDeleteContext(m_context); - ReleaseDC(m_window, m_hdc); - } - - virtual void MakeCurrent() override - { - this->pfn_wglMakeCurrent(m_hdc, m_context); - } - - virtual const char *LastErrorMsg() override - { - if (m_error[0] == 0) - return NULL; - else - return m_error; - } - - virtual void *getProcAddress(const char *proc) override - { - void *ret = (void *) GetProcAddress(m_module, proc); - if (ret == NULL) - ret = (void *) this->pfn_wglGetProcAddress(proc); - return ret; - } - - virtual int SetSwapInterval(const int swap) override - { - if (this->pfn_wglSwapIntervalEXT != NULL) - { - this->pfn_wglSwapIntervalEXT(swap ? 1 : 0); - } - return 0; - } - - virtual void SwapBuffer() override - { - SwapBuffers(m_hdc); - //wglSwapLayerBuffers(GetDC(window().m_hwnd), WGL_SWAP_MAIN_PLANE); - } - - static void load_library() - { - m_module = LoadLibraryA("opengl32.dll"); - } - -private: - - int setupPixelFormat(HDC hDC) - { - PIXELFORMATDESCRIPTOR pfd = { - sizeof(PIXELFORMATDESCRIPTOR), /* size */ - 1, /* version */ - PFD_SUPPORT_OPENGL | - PFD_DRAW_TO_WINDOW | - PFD_DOUBLEBUFFER, /* support double-buffering */ - PFD_TYPE_RGBA, /* color type */ - 32, /* prefered color depth */ - 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ - 0, /* no alpha buffer */ - 0, /* alpha bits (ignored) */ - 0, /* no accumulation buffer */ - 0, 0, 0, 0, /* accum bits (ignored) */ - 16, /* depth buffer */ - 0, /* no stencil buffer */ - 0, /* no auxiliary buffers */ - PFD_MAIN_PLANE, /* main layer */ - 0, /* reserved */ - 0, 0, 0, /* no layer, visible, damage masks */ - }; - int pixelFormat; - - pixelFormat = ChoosePixelFormat(hDC, &pfd); - if (pixelFormat == 0) { - strcpy(m_error, "ChoosePixelFormat failed"); - return 1; - } - - if (SetPixelFormat(hDC, pixelFormat, &pfd) != TRUE) { - strcpy(m_error, "SetPixelFormat failed."); - return 1; - } - return 0; - } - - bool WGLExtensionSupported(const char *extension_name) - { - //if (pfn_wglGetExtensionsStringEXT != NULL) - // printf("%s\n", this->pfn_wglGetExtensionsStringEXT()); - - if (pfn_wglGetExtensionsStringEXT != NULL && strstr(pfn_wglGetExtensionsStringEXT(), extension_name) != NULL) - return true; - else - return false; - } - - HGLRC m_context; - HWND m_window; - HDC m_hdc; - char m_error[256]; - - PROC (WINAPI *pfn_wglGetProcAddress)(LPCSTR lpszProc); - HGLRC (WINAPI *pfn_wglCreateContext)(HDC hdc); - BOOL (WINAPI *pfn_wglDeleteContext)(HGLRC hglrc); - BOOL (WINAPI *pfn_wglMakeCurrent)(HDC hdc, HGLRC hglrc); - - const char *(WINAPI *pfn_wglGetExtensionsStringEXT) (void); - BOOL (WINAPI *pfn_wglSwapIntervalEXT) (int interval); - int (WINAPI * pfn_wglGetSwapIntervalEXT) (void); - - static HMODULE m_module; -}; - -HMODULE win_gl_context::m_module; - - -#else - -class sdl_gl_context : public osd_gl_context -{ -public: - sdl_gl_context(SDL_Window *window) : osd_gl_context(), m_context(0), m_window(window) - { - m_error[0] = 0; - m_context = SDL_GL_CreateContext(window); - if (!m_context) - { - snprintf(m_error,255, "OpenGL not supported on this driver: %s", SDL_GetError()); - } - } - virtual ~sdl_gl_context() - { - SDL_GL_DeleteContext(m_context); - } - virtual void MakeCurrent() override - { - SDL_GL_MakeCurrent(m_window, m_context); - } - - virtual int SetSwapInterval(const int swap) override - { - return SDL_GL_SetSwapInterval(swap); - } - - virtual const char *LastErrorMsg() override - { - if (m_error[0] == 0) - return NULL; - else - return m_error; - } - virtual void *getProcAddress(const char *proc) override - { - return SDL_GL_GetProcAddress(proc); - } - - virtual void SwapBuffer() override - { - SDL_GL_SwapWindow(m_window); - } - -private: - SDL_GLContext m_context; - SDL_Window *m_window; - char m_error[256]; -}; - -#endif - -//============================================================ -// Textures -//============================================================ - -/* ogl_texture_info holds information about a texture */ -class ogl_texture_info -{ -public: - ogl_texture_info() - : hash(0), flags(0), rawwidth(0), rawheight(0), - rawwidth_create(0), rawheight_create(0), - type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0), - texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL), - data_own(0), texCoordBufferName(0) - { - for (int i=0; i<2; i++) - { - mpass_textureunit[i] = 0; - mpass_texture_mamebm[i] = 0; - mpass_fbo_mamebm[i] = 0; - mpass_texture_scrn[i] = 0; - mpass_fbo_scrn[i] = 0; - } - for (int i=0; i<8; i++) - texCoord[i] = 0.0f; - } - - HashT hash; // hash value for the texture (must be >= pointer size) - UINT32 flags; // rendering flags - render_texinfo texinfo; // copy of the texture info - int rawwidth, rawheight; // raw width/height of the texture - int rawwidth_create; // raw width/height, pow2 compatible, if needed - int rawheight_create; // (create and initial set the texture, not for copy!) - int type; // what type of texture are we? - int format; // texture format - int borderpix; // do we have a 1 pixel border? - int xprescale; // what is our X prescale factor? - int yprescale; // what is our Y prescale factor? - int nocopy; // must the texture date be copied? - - UINT32 texture; // OpenGL texture "name"/ID - - GLenum texTarget; // OpenGL texture target - int texpow2; // Is this texture pow2 - - UINT32 mpass_dest_idx; // Multipass dest idx [0..1] - UINT32 mpass_textureunit[2]; // texture unit names for GLSL - - UINT32 mpass_texture_mamebm[2];// Multipass OpenGL texture "name"/ID for the shader - UINT32 mpass_fbo_mamebm[2]; // framebuffer object for this texture, multipass - UINT32 mpass_texture_scrn[2]; // Multipass OpenGL texture "name"/ID for the shader - UINT32 mpass_fbo_scrn[2]; // framebuffer object for this texture, multipass - - UINT32 pbo; // pixel buffer object for this texture (DYNAMIC only!) - UINT32 *data; // pixels for the texture - int data_own; // do we own / allocated it ? - GLfloat texCoord[8]; - GLuint texCoordBufferName; - -}; - -/* sdl_info is the information about SDL for the current screen */ -class sdl_info_ogl : public osd_renderer -{ -public: - sdl_info_ogl(osd_window *window) - : osd_renderer(window, FLAG_NEEDS_OPENGL), m_blittimer(0), - m_width(0), m_height(0), - m_blit_dim(0, 0), - m_gl_context(NULL), - m_initialized(0), - m_last_blendmode(0), - m_texture_max_width(0), - m_texture_max_height(0), - m_texpoweroftwo(0), - m_usevbo(0), m_usepbo(0), m_usefbo(0), m_useglsl(0), m_glsl(NULL), - m_glsl_program_num(0), - m_glsl_program_mb2sc(0), - m_usetexturerect(0), - m_init_context(0), - m_last_hofs(0.0f), - m_last_vofs(0.0f), - m_surf_w(0), - m_surf_h(0) - { - for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++) - m_texhash[i] = NULL; - for (int i=0; i < 2*GLSL_SHADER_MAX; i++) - m_glsl_program[i] = 0; - for (int i=0; i < 8; i++) - m_texVerticex[i] = 0.0f; - } - - virtual int create() override; - virtual int draw(const int update) override; - -#ifndef OSD_WINDOWS - virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; -#endif - virtual void destroy() override; - virtual render_primitive_list *get_primitives() override - { -#ifdef OSD_WINDOWS - osd_dim nd = window().get_size(); -#else - osd_dim nd = window().blit_surface_size(); -#endif - if (nd != m_blit_dim) - { - m_blit_dim = nd; - notify_changed(); - } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); - return &window().target()->get_primitives(); - } - -#ifdef OSD_WINDOWS - virtual void save() override { } - virtual void record() override { } - virtual void toggle_fsfx() override { } -#endif - -private: - void destroy_all_textures(); - - void loadGLExtensions(); - void initialize_gl(); - void set_blendmode(int blendmode); - void texture_compute_type_subroutine(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); - void texture_compute_size_subroutine(ogl_texture_info *texture, UINT32 flags, - UINT32 width, UINT32 height, - int* p_width, int* p_height, int* p_width_create, int* p_height_create); - void texture_compute_size_type(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); - ogl_texture_info *texture_create(const render_texinfo *texsource, UINT32 flags); - int texture_shader_create(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); - ogl_texture_info *texture_find(const render_primitive *prim); - void texture_coord_update(ogl_texture_info *texture, const render_primitive *prim, int shaderIdx); - void texture_mpass_flip(ogl_texture_info *texture, int shaderIdx); - void texture_shader_update(ogl_texture_info *texture, render_container *container, int shaderIdx); - ogl_texture_info * texture_update(const render_primitive *prim, int shaderIdx); - void texture_disable(ogl_texture_info * texture); - void texture_all_disable(); - - INT32 m_blittimer; - int m_width; - int m_height; - osd_dim m_blit_dim; - - osd_gl_context *m_gl_context; - - int m_initialized; // is everything well initialized, i.e. all GL stuff etc. - // 3D info (GL mode only) - ogl_texture_info * m_texhash[HASH_SIZE + OVERFLOW_SIZE]; - int m_last_blendmode; // previous blendmode - INT32 m_texture_max_width; // texture maximum width - INT32 m_texture_max_height; // texture maximum height - int m_texpoweroftwo; // must textures be power-of-2 sized? - int m_usevbo; // runtime check if VBO is available - int m_usepbo; // runtime check if PBO is available - int m_usefbo; // runtime check if FBO is available - int m_useglsl; // runtime check if GLSL is available - - glsl_shader_info *m_glsl; // glsl_shader_info - - GLhandleARB m_glsl_program[2*GLSL_SHADER_MAX]; // GLSL programs, or 0 - int m_glsl_program_num; // number of GLSL programs - int m_glsl_program_mb2sc; // GLSL program idx, which transforms - // the mame-bitmap. screen-bitmap (size/rotation/..) - // All progs <= glsl_program_mb2sc using the mame bitmap - // as input, otherwise the screen bitmap. - // All progs >= glsl_program_mb2sc using the screen bitmap - // as output, otherwise the mame bitmap. - int m_usetexturerect; // use ARB_texture_rectangle for non-power-of-2, general use - - int m_init_context; // initialize context before next draw - - float m_last_hofs; - float m_last_vofs; - - // Static vars from draogl_window_dra - INT32 m_surf_w; - INT32 m_surf_h; - GLfloat m_texVerticex[8]; -}; - /* line_aa_step is used for drawing antialiased lines */ struct line_aa_step { @@ -606,14 +197,14 @@ static const line_aa_step line_aa_4step[] = // INLINES //============================================================ -static inline HashT texture_compute_hash(const render_texinfo *texture, UINT32 flags) +HashT renderer_ogl::texture_compute_hash(const render_texinfo *texture, UINT32 flags) { HashT h = (HashT)texture->base ^ (flags & (PRIMFLAG_BLENDMODE_MASK | PRIMFLAG_TEXFORMAT_MASK)); //printf("hash %d\n", (int) h % HASH_SIZE); return (h >> 8) % HASH_SIZE; } -void sdl_info_ogl::set_blendmode(int blendmode) +void renderer_ogl::set_blendmode(int blendmode) { // try to minimize texture state changes if (blendmode != m_last_blendmode) @@ -642,45 +233,34 @@ void sdl_info_ogl::set_blendmode(int blendmode) } //============================================================ -// PROTOTYPES -//============================================================ - -// core functions - -//============================================================ // STATIC VARIABLES //============================================================ -static void drawogl_exit(void); -static void load_gl_lib(running_machine &machine); - - - // OGL 1.3 #ifdef GL_ARB_multitexture -static PFNGLACTIVETEXTUREARBPROC pfn_glActiveTexture = NULL; +static PFNGLACTIVETEXTUREARBPROC pfn_glActiveTexture = nullptr; #else -static PFNGLACTIVETEXTUREPROC pfn_glActiveTexture = NULL; +static PFNGLACTIVETEXTUREPROC pfn_glActiveTexture = nullptr; #endif // VBO -static PFNGLGENBUFFERSPROC pfn_glGenBuffers = NULL; -static PFNGLDELETEBUFFERSPROC pfn_glDeleteBuffers = NULL; -static PFNGLBINDBUFFERPROC pfn_glBindBuffer = NULL; -static PFNGLBUFFERDATAPROC pfn_glBufferData = NULL; -static PFNGLBUFFERSUBDATAPROC pfn_glBufferSubData = NULL; +static PFNGLGENBUFFERSPROC pfn_glGenBuffers = nullptr; +static PFNGLDELETEBUFFERSPROC pfn_glDeleteBuffers = nullptr; +static PFNGLBINDBUFFERPROC pfn_glBindBuffer = nullptr; +static PFNGLBUFFERDATAPROC pfn_glBufferData = nullptr; +static PFNGLBUFFERSUBDATAPROC pfn_glBufferSubData = nullptr; // PBO -static PFNGLMAPBUFFERPROC pfn_glMapBuffer = NULL; -static PFNGLUNMAPBUFFERPROC pfn_glUnmapBuffer = NULL; +static PFNGLMAPBUFFERPROC pfn_glMapBuffer = nullptr; +static PFNGLUNMAPBUFFERPROC pfn_glUnmapBuffer = nullptr; // FBO -static PFNGLISFRAMEBUFFEREXTPROC pfn_glIsFramebuffer = NULL; -static PFNGLBINDFRAMEBUFFEREXTPROC pfn_glBindFramebuffer = NULL; -static PFNGLDELETEFRAMEBUFFERSEXTPROC pfn_glDeleteFramebuffers = NULL; -static PFNGLGENFRAMEBUFFERSEXTPROC pfn_glGenFramebuffers = NULL; -static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pfn_glCheckFramebufferStatus = NULL; -static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pfn_glFramebufferTexture2D = NULL; +static PFNGLISFRAMEBUFFEREXTPROC pfn_glIsFramebuffer = nullptr; +static PFNGLBINDFRAMEBUFFEREXTPROC pfn_glBindFramebuffer = nullptr; +static PFNGLDELETEFRAMEBUFFERSEXTPROC pfn_glDeleteFramebuffers = nullptr; +static PFNGLGENFRAMEBUFFERSEXTPROC pfn_glGenFramebuffers = nullptr; +static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC pfn_glCheckFramebufferStatus = nullptr; +static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC pfn_glFramebufferTexture2D = nullptr; static int glsl_shader_feature = GLSL_SHADER_FEAT_PLAIN; @@ -694,25 +274,12 @@ static void texture_set_data(ogl_texture_info *texture, const render_texinfo *te // Static Variables //============================================================ -static int shown_video_info = 0; -static int dll_loaded = 0; - -//============================================================ -// drawsdl_init -//============================================================ - -static osd_renderer *drawogl_create(osd_window *window) -{ - return global_alloc(sdl_info_ogl(window)); -} +bool renderer_ogl::s_shown_video_info = false; +bool renderer_ogl::s_dll_loaded = false; -int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks) +bool renderer_ogl::init(running_machine &machine) { - // fill in the callbacks - callbacks->exit = drawogl_exit; - callbacks->create = drawogl_create; - - dll_loaded = 0; + s_dll_loaded = false; load_gl_lib(machine); #if defined(OSD_WINDOWS) @@ -721,7 +288,37 @@ int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks) osd_printf_verbose("Using SDL multi-window OpenGL driver (SDL 2.0+)\n"); #endif - return 0; + return false; +} + +//============================================================ +// CONSTRUCTOR & DESTRUCTOR +//============================================================ + +renderer_ogl::~renderer_ogl() +{ + // free the memory in the window + destroy_all_textures(); + + global_free(m_gl_context); + m_gl_context = nullptr; + + for (int i = 0; i < video_config.glsl_shader_mamebm_num; i++) + { + if (nullptr != video_config.glsl_shader_mamebm[i]) + { + free(video_config.glsl_shader_mamebm[i]); + video_config.glsl_shader_mamebm[i] = nullptr; + } + } + for (int i =0; i < video_config.glsl_shader_scrn_num; i++) + { + if (nullptr != video_config.glsl_shader_scrn[i]) + { + free(video_config.glsl_shader_scrn[i]); + video_config.glsl_shader_scrn[i] = nullptr; + } + } } //============================================================ @@ -762,9 +359,13 @@ static void loadgl_functions(osd_gl_context *context) osd_gl_dispatch *gl_dispatch; #endif -static void load_gl_lib(running_machine &machine) +#ifdef OSD_WINDOWS +HMODULE win_gl_context::m_module; +#endif + +void renderer_ogl::load_gl_lib(running_machine &machine) { - if (!dll_loaded) + if (!s_dll_loaded) { #ifdef OSD_WINDOWS win_gl_context::load_library(); @@ -777,10 +378,10 @@ static void load_gl_lib(running_machine &machine) const char *stemp; stemp = downcast<sdl_options &>(machine.options()).gl_lib(); - if (stemp != NULL && strcmp(stemp, OSDOPTVAL_AUTO) == 0) - stemp = NULL; + if (stemp != nullptr && strcmp(stemp, OSDOPTVAL_AUTO) == 0) + stemp = nullptrnullptr; - if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==NULL + if (SDL_GL_LoadLibrary(stemp) != 0) // Load library (default for e==nullptr { fatalerror("Unable to load opengl library: %s\n", stemp ? stemp : "<default>"); } @@ -791,11 +392,11 @@ static void load_gl_lib(running_machine &machine) #ifdef USE_DISPATCH_GL gl_dispatch = (osd_gl_dispatch *) osd_malloc(sizeof(osd_gl_dispatch)); #endif - dll_loaded=1; + s_dll_loaded = true; } } -void sdl_info_ogl::initialize_gl() +void renderer_ogl::initialize_gl() { int has_and_allow_texturerect = 0; @@ -808,7 +409,7 @@ void sdl_info_ogl::initialize_gl() extstr = (char *)""; #endif // print out the driver info for debugging - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: %s\nOpenGL: %s\nOpenGL: %s\n", vendor, (char *)glGetString(GL_RENDERER), (char *)glGetString(GL_VERSION)); } @@ -820,21 +421,19 @@ void sdl_info_ogl::initialize_gl() m_usefbo = 0; m_useglsl = 0; - if ( video_config.allowtexturerect && - ( strstr(extstr, "GL_ARB_texture_rectangle") || strstr(extstr, "GL_EXT_texture_rectangle") ) - ) + if (video_config.allowtexturerect && (strstr(extstr, "GL_ARB_texture_rectangle") || strstr(extstr, "GL_EXT_texture_rectangle"))) { has_and_allow_texturerect = 1; - if (!shown_video_info) - { - osd_printf_verbose("OpenGL: texture rectangle supported\n"); - } + if (!s_shown_video_info) + { + osd_printf_verbose("OpenGL: texture rectangle supported\n"); + } } // does this card support non-power-of-two sized textures? (they're faster, so use them if possible) if ( !video_config.forcepow2texture && strstr(extstr, "GL_ARB_texture_non_power_of_two")) { - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: non-power-of-2 textures supported (new method)\n"); } @@ -845,7 +444,7 @@ void sdl_info_ogl::initialize_gl() // second chance: GL_ARB_texture_rectangle or GL_EXT_texture_rectangle (old version) if (has_and_allow_texturerect) { - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: non-power-of-2 textures supported (old method)\n"); } @@ -853,7 +452,7 @@ void sdl_info_ogl::initialize_gl() } else { - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: forcing power-of-2 textures (creation, not copy)\n"); } @@ -862,8 +461,8 @@ void sdl_info_ogl::initialize_gl() if (strstr(extstr, "GL_ARB_vertex_buffer_object")) { - m_usevbo = video_config.vbo; - if (!shown_video_info) + m_usevbo = video_config.vbo; + if (!s_shown_video_info) { if(m_usevbo) osd_printf_verbose("OpenGL: vertex buffer supported\n"); @@ -877,15 +476,17 @@ void sdl_info_ogl::initialize_gl() if( m_usevbo ) { m_usepbo = video_config.pbo; - if (!shown_video_info) + if (!s_shown_video_info) { if(m_usepbo) osd_printf_verbose("OpenGL: pixel buffers supported\n"); else osd_printf_verbose("OpenGL: pixel buffers supported, but disabled\n"); } - } else { - if (!shown_video_info) + } + else + { + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: pixel buffers supported, but disabled due to disabled vbo\n"); } @@ -893,7 +494,7 @@ void sdl_info_ogl::initialize_gl() } else { - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: pixel buffers not supported\n"); } @@ -902,7 +503,7 @@ void sdl_info_ogl::initialize_gl() if (strstr(extstr, "GL_EXT_framebuffer_object")) { m_usefbo = 1; - if (!shown_video_info) + if (!s_shown_video_info) { if(m_usefbo) osd_printf_verbose("OpenGL: framebuffer object supported\n"); @@ -918,22 +519,24 @@ void sdl_info_ogl::initialize_gl() ) { m_useglsl = video_config.glsl; - if (!shown_video_info) + if (!s_shown_video_info) { if(m_useglsl) osd_printf_verbose("OpenGL: GLSL supported\n"); else osd_printf_verbose("OpenGL: GLSL supported, but disabled\n"); } - } else { - if (!shown_video_info) + } + else + { + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: GLSL not supported\n"); } } #ifdef TOBEMIGRATED - if (osd_getenv(SDLENV_VMWARE) != NULL) + if (osd_getenv(SDLENV_VMWARE) != nullptr) { m_usetexturerect = 1; m_texpoweroftwo = 1; @@ -941,45 +544,19 @@ void sdl_info_ogl::initialize_gl() #endif glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&m_texture_max_width); glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&m_texture_max_height); - if (!shown_video_info) + if (!s_shown_video_info) { osd_printf_verbose("OpenGL: max texture size %d x %d\n", m_texture_max_width, m_texture_max_height); } - shown_video_info = 1; + s_shown_video_info = true; } //============================================================ // sdl_info::create -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a -// a //============================================================ -int sdl_info_ogl::create() +int renderer_ogl::create() { // create renderer #if defined(OSD_WINDOWS) @@ -987,7 +564,7 @@ int sdl_info_ogl::create() #else m_gl_context = global_alloc(sdl_gl_context(window().sdl_window())); #endif - if (m_gl_context->LastErrorMsg() != NULL) + if (m_gl_context->LastErrorMsg() != nullptr) { osd_printf_error("%s\n", m_gl_context->LastErrorMsg()); return 1; @@ -1015,31 +592,16 @@ int sdl_info_ogl::create() m_init_context = 0; - osd_printf_verbose("Leave sdl_info_ogl::create\n"); + osd_printf_verbose("Leave renderer_ogl::create\n"); return 0; } //============================================================ -// sdl_info::destroy -//============================================================ - -void sdl_info_ogl::destroy() -{ - // free the memory in the window - - destroy_all_textures(); - - global_free(m_gl_context); - m_gl_context = NULL; -} - - -//============================================================ // drawsdl_xy_to_render_target //============================================================ #ifndef OSD_WINDOWS -int sdl_info_ogl::xy_to_render_target(int x, int y, int *xt, int *yt) +int renderer_ogl::xy_to_render_target(int x, int y, int *xt, int *yt) { *xt = x - m_last_hofs; *yt = y - m_last_vofs; @@ -1050,13 +612,14 @@ int sdl_info_ogl::xy_to_render_target(int x, int y, int *xt, int *yt) return 1; } #endif + //============================================================ -// drawsdl_destroy_all_textures +// renderer_ogl::destroy_all_textures //============================================================ -void sdl_info_ogl::destroy_all_textures() +void renderer_ogl::destroy_all_textures() { - ogl_texture_info *texture = NULL; + ogl_texture_info *texture = nullptr; int lock=FALSE; int i; @@ -1081,8 +644,8 @@ void sdl_info_ogl::destroy_all_textures() while (i<HASH_SIZE+OVERFLOW_SIZE) { texture = m_texhash[i]; - m_texhash[i] = NULL; - if (texture != NULL) + m_texhash[i] = nullptr; + if (texture != nullptr) { if(m_usevbo) { @@ -1114,7 +677,7 @@ void sdl_info_ogl::destroy_all_textures() if ( texture->data_own ) { free(texture->data); - texture->data=NULL; + texture->data=nullptr; texture->data_own=FALSE; } global_free(texture); @@ -1124,7 +687,7 @@ void sdl_info_ogl::destroy_all_textures() if ( m_useglsl ) { glsl_shader_free(m_glsl); - m_glsl = NULL; + m_glsl = nullptr; } m_initialized = 0; @@ -1136,7 +699,7 @@ void sdl_info_ogl::destroy_all_textures() // loadGLExtensions //============================================================ -void sdl_info_ogl::loadGLExtensions() +void renderer_ogl::loadGLExtensions() { static int _once = 1; @@ -1337,7 +900,7 @@ void sdl_info_ogl::loadGLExtensions() if ( m_useglsl ) { m_glsl = glsl_shader_init(m_gl_context); - m_useglsl = (m_glsl != NULL ? 1 : 0); + m_useglsl = (m_glsl != nullptr ? 1 : 0); if ( ! m_useglsl ) { @@ -1446,10 +1009,10 @@ void sdl_info_ogl::loadGLExtensions() // sdl_info::draw //============================================================ -int sdl_info_ogl::draw(const int update) +int renderer_ogl::draw(const int update) { render_primitive *prim; - ogl_texture_info *texture=NULL; + ogl_texture_info *texture=nullptr; float vofs, hofs; int pendingPrimitive=GL_NO_PRIMITIVE, curPrimitive=GL_NO_PRIMITIVE; @@ -1594,7 +1157,7 @@ int sdl_info_ogl::draw(const int update) window().m_primlist->acquire_lock(); // now draw - for (prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { int i; @@ -1710,7 +1273,7 @@ int sdl_info_ogl::draw(const int update) // if we have a texture to use for the vectors, use it here #if 0 - if (d3d->vector_texture != NULL) + if (d3d->vector_texture != nullptr) { printf("SDL: textured lines unsupported\n"); vertex[0].u0 = d3d->vector_texture->ustart; @@ -1795,7 +1358,7 @@ int sdl_info_ogl::draw(const int update) if ( texture ) { texture_disable(texture); - texture=NULL; + texture=nullptr; } break; @@ -1853,32 +1416,6 @@ static const GLint texture_copy_properties[9][2] = { }; //============================================================ -// drawogl_exit -//============================================================ - -static void drawogl_exit(void) -{ - int i; - - for(i=0; i<video_config.glsl_shader_mamebm_num; i++) - { - if ( NULL!=video_config.glsl_shader_mamebm[i]) - { - free(video_config.glsl_shader_mamebm[i]); - video_config.glsl_shader_mamebm[i] = NULL; - } - } - for(i=0; i<video_config.glsl_shader_scrn_num; i++) - { - if ( NULL!=video_config.glsl_shader_scrn[i]) - { - free(video_config.glsl_shader_scrn[i]); - video_config.glsl_shader_scrn[i] = NULL; - } - } -} - -//============================================================ // texture_compute_size and type //============================================================ @@ -1889,7 +1426,7 @@ static void drawogl_exit(void) // we also don't want to use PBO's in the case of nocopy==TRUE, // since we now might have GLSL shaders - this decision simplifies out life ;-) // -void sdl_info_ogl::texture_compute_type_subroutine(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) +void renderer_ogl::texture_compute_type_subroutine(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) { texture->type = TEXTURE_TYPE_NONE; texture->nocopy = FALSE; @@ -1943,7 +1480,7 @@ static inline int get_valid_pow2_value(int v, int needPow2) return (needPow2)?gl_round_to_pow2(v):v; } -void sdl_info_ogl::texture_compute_size_subroutine(ogl_texture_info *texture, UINT32 flags, +void renderer_ogl::texture_compute_size_subroutine(ogl_texture_info *texture, UINT32 flags, UINT32 width, UINT32 height, int* p_width, int* p_height, int* p_width_create, int* p_height_create) { @@ -1994,7 +1531,7 @@ void sdl_info_ogl::texture_compute_size_subroutine(ogl_texture_info *texture, UI *p_height_create=height_create; } -void sdl_info_ogl::texture_compute_size_type(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) +void renderer_ogl::texture_compute_size_type(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) { int finalheight, finalwidth; int finalheight_create, finalwidth_create; @@ -2126,7 +1663,7 @@ static int texture_fbo_create(UINT32 text_unit, UINT32 text_name, UINT32 fbo_nam } glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, - 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL ); + 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr ); } // non-screen textures will never be filtered glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); @@ -2147,7 +1684,7 @@ static int texture_fbo_create(UINT32 text_unit, UINT32 text_name, UINT32 fbo_nam return 0; } -int sdl_info_ogl::texture_shader_create(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) +int renderer_ogl::texture_shader_create(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags) { int uniform_location; int i; @@ -2266,7 +1803,7 @@ int sdl_info_ogl::texture_shader_create(const render_texinfo *texsource, ogl_tex glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->rawwidth_create); - UINT32 * dummy = NULL; + UINT32 * dummy = nullptr; GLint _width, _height; if ( gl_texture_check_size(GL_TEXTURE_2D, 0, GL_RGBA8, texture->rawwidth_create, texture->rawheight_create, @@ -2320,7 +1857,7 @@ int sdl_info_ogl::texture_shader_create(const render_texinfo *texsource, ogl_tex return 0; } -ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, UINT32 flags) +ogl_texture_info *renderer_ogl::texture_create(const render_texinfo *texsource, UINT32 flags) { ogl_texture_info *texture; @@ -2363,7 +1900,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, texture->format = SDL_TEXFORMAT_ARGB32; break; case TEXFORMAT_RGB32: - if (texsource->palette != NULL) + if (texsource->palette != nullptr) texture->format = SDL_TEXFORMAT_RGB32_PALETTED; else texture->format = SDL_TEXFORMAT_RGB32; @@ -2375,7 +1912,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, texture->format = SDL_TEXFORMAT_PALETTE16A; break; case TEXFORMAT_YUY16: - if (texsource->palette != NULL) + if (texsource->palette != nullptr) texture->format = SDL_TEXFORMAT_YUY16_PALETTED; else texture->format = SDL_TEXFORMAT_YUY16; @@ -2400,7 +1937,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, if ( texture_shader_create(texsource, texture, flags) ) { global_free(texture); - return NULL; + return nullptr; } } else @@ -2417,7 +1954,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, glTexImage2D(texture->texTarget, 0, GL_RGBA8, texture->rawwidth_create, texture->rawheight_create, texture->borderpix ? 1 : 0, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr); if ((PRIMFLAG_GET_SCREENTEX(flags)) && video_config.filter) { @@ -2464,7 +2001,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, // set up the PBO dimension, .. pfn_glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, texture->rawwidth * texture->rawheight * sizeof(UINT32), - NULL, GL_STREAM_DRAW); + nullptr, GL_STREAM_DRAW); } if ( !texture->nocopy && texture->type!=TEXTURE_TYPE_DYNAMIC ) @@ -2474,13 +2011,13 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, } // add us to the texture list - if (m_texhash[texture->hash] == NULL) + if (m_texhash[texture->hash] == nullptr) m_texhash[texture->hash] = texture; else { int i; for (i = HASH_SIZE; i < HASH_SIZE + OVERFLOW_SIZE; i++) - if (m_texhash[i] == NULL) + if (m_texhash[i] == nullptr) { m_texhash[i] = texture; break; @@ -2495,7 +2032,7 @@ ogl_texture_info *sdl_info_ogl::texture_create(const render_texinfo *texsource, pfn_glBindBuffer( GL_ARRAY_BUFFER_ARB, texture->texCoordBufferName ); // Load The Data pfn_glBufferData( GL_ARRAY_BUFFER_ARB, 4*2*sizeof(GLfloat), texture->texCoord, GL_STREAM_DRAW ); - glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // we are using ARB VBO buffers + glTexCoordPointer( 2, GL_FLOAT, 0, (char *) nullptr ); // we are using ARB VBO buffers } else { @@ -2562,7 +2099,7 @@ static inline void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, con assert(xborderpix == 0 || xborderpix == 1); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2614,7 +2151,7 @@ static inline void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, co assert(xborderpix == 0 || xborderpix == 1); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2703,7 +2240,7 @@ static inline void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int wi assert(width % 2 == 0); // palette (really RGB map) case - if (palette != NULL) + if (palette != nullptr) { if (xborderpix) { @@ -2876,7 +2413,7 @@ static void texture_set_data(ogl_texture_info *texture, const render_texinfo *te // kick off the DMA glTexSubImage2D(texture->texTarget, 0, 0, 0, texture->rawwidth, texture->rawheight, - GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); + GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, nullptr); } else { @@ -2911,13 +2448,13 @@ static int compare_texture_primitive(const ogl_texture_info *texture, const rend return 0; } -ogl_texture_info *sdl_info_ogl::texture_find(const render_primitive *prim) +ogl_texture_info *renderer_ogl::texture_find(const render_primitive *prim) { HashT texhash = texture_compute_hash(&prim->texture, prim->flags); ogl_texture_info *texture; texture = m_texhash[texhash]; - if (texture != NULL) + if (texture != nullptr) { int i; if (compare_texture_primitive(texture, prim)) @@ -2925,18 +2462,18 @@ ogl_texture_info *sdl_info_ogl::texture_find(const render_primitive *prim) for (i=HASH_SIZE; i<HASH_SIZE + OVERFLOW_SIZE; i++) { texture = m_texhash[i]; - if (texture != NULL && compare_texture_primitive(texture, prim)) + if (texture != nullptr && compare_texture_primitive(texture, prim)) return texture; } } - return NULL; + return nullptr; } //============================================================ // texture_update //============================================================ -void sdl_info_ogl::texture_coord_update(ogl_texture_info *texture, const render_primitive *prim, int shaderIdx) +void renderer_ogl::texture_coord_update(ogl_texture_info *texture, const render_primitive *prim, int shaderIdx) { float ustart = 0.0f, ustop = 0.0f; // beginning/ending U coordinates float vstart = 0.0f, vstop = 0.0f; // beginning/ending V coordinates @@ -3013,7 +2550,7 @@ void sdl_info_ogl::texture_coord_update(ogl_texture_info *texture, const render_ } } -void sdl_info_ogl::texture_mpass_flip(ogl_texture_info *texture, int shaderIdx) +void renderer_ogl::texture_mpass_flip(ogl_texture_info *texture, int shaderIdx) { UINT32 mpass_src_idx = texture->mpass_dest_idx; @@ -3085,12 +2622,12 @@ void sdl_info_ogl::texture_mpass_flip(ogl_texture_info *texture, int shaderIdx) } } -void sdl_info_ogl::texture_shader_update(ogl_texture_info *texture, render_container *container, int shaderIdx) +void renderer_ogl::texture_shader_update(ogl_texture_info *texture, render_container *container, int shaderIdx) { int uniform_location; GLfloat vid_attributes[4]; - if (container!=NULL) + if (container!=nullptr) { render_container::user_settings settings; container->get_user_settings(settings); @@ -3110,17 +2647,17 @@ void sdl_info_ogl::texture_shader_update(ogl_texture_info *texture, render_conta } } -ogl_texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, int shaderIdx) +ogl_texture_info * renderer_ogl::texture_update(const render_primitive *prim, int shaderIdx) { ogl_texture_info *texture = texture_find(prim); int texBound = 0; // if we didn't find one, create a new texture - if (texture == NULL && prim->texture.base != NULL) + if (texture == nullptr && prim->texture.base != nullptr) { texture = texture_create(&prim->texture, prim->flags); } - else if (texture != NULL) + else if (texture != nullptr) { if ( texture->type == TEXTURE_TYPE_SHADER ) { @@ -3138,7 +2675,7 @@ ogl_texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, in } } - if (texture != NULL) + if (texture != nullptr) { if ( texture->type == TEXTURE_TYPE_SHADER ) { @@ -3151,7 +2688,7 @@ ogl_texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, in if ( shaderIdx==0 ) // redundant for subsequent multipass shader { - if (prim->texture.base != NULL && texture->texinfo.seqid != prim->texture.seqid) + if (prim->texture.base != nullptr && texture->texinfo.seqid != prim->texture.seqid) { texture->texinfo.seqid = prim->texture.seqid; @@ -3172,7 +2709,7 @@ ogl_texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, in pfn_glBindBuffer( GL_ARRAY_BUFFER_ARB, texture->texCoordBufferName ); // Load The Data pfn_glBufferSubData( GL_ARRAY_BUFFER_ARB, 0, 4*2*sizeof(GLfloat), texture->texCoord ); - glTexCoordPointer( 2, GL_FLOAT, 0, (char *) NULL ); // we are using ARB VBO buffers + glTexCoordPointer( 2, GL_FLOAT, 0, (char *) nullptr ); // we are using ARB VBO buffers } else { @@ -3183,7 +2720,7 @@ ogl_texture_info * sdl_info_ogl::texture_update(const render_primitive *prim, in return texture; } -void sdl_info_ogl::texture_disable(ogl_texture_info * texture) +void renderer_ogl::texture_disable(ogl_texture_info * texture) { if ( texture->type == TEXTURE_TYPE_SHADER ) { @@ -3198,7 +2735,7 @@ void sdl_info_ogl::texture_disable(ogl_texture_info * texture) } } -void sdl_info_ogl::texture_all_disable() +void renderer_ogl::texture_all_disable() { if ( m_useglsl ) { diff --git a/src/osd/modules/render/drawogl.h b/src/osd/modules/render/drawogl.h new file mode 100644 index 00000000000..5c96277f247 --- /dev/null +++ b/src/osd/modules/render/drawogl.h @@ -0,0 +1,233 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont +//============================================================ +// +// drawogl.h - SDL software and OpenGL implementation +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#pragma once + +#ifndef __DRAWOGL__ +#define __DRAWOGL__ + +// OSD headers +#ifndef OSD_WINDOWS +#include "osdsdl.h" +#include "window.h" +#else +#include "../windows/window.h" +typedef UINT64 HashT; +#endif + +#if defined(OSD_WINDOWS) +#include "winglcontext.h" +#else +#include "sdlglcontext.h" +#endif + +#include "modules/opengl/gl_shader_mgr.h" + +//============================================================ +// Textures +//============================================================ + +/* ogl_texture_info holds information about a texture */ +class ogl_texture_info +{ +public: + ogl_texture_info() + : hash(0), flags(0), rawwidth(0), rawheight(0), + rawwidth_create(0), rawheight_create(0), + type(0), format(0), borderpix(0), xprescale(0), yprescale(0), nocopy(0), + texture(0), texTarget(0), texpow2(0), mpass_dest_idx(0), pbo(0), data(NULL), + data_own(0), texCoordBufferName(0) + { + for (int i=0; i<2; i++) + { + mpass_textureunit[i] = 0; + mpass_texture_mamebm[i] = 0; + mpass_fbo_mamebm[i] = 0; + mpass_texture_scrn[i] = 0; + mpass_fbo_scrn[i] = 0; + } + for (int i=0; i<8; i++) + texCoord[i] = 0.0f; + } + + HashT hash; // hash value for the texture (must be >= pointer size) + UINT32 flags; // rendering flags + render_texinfo texinfo; // copy of the texture info + int rawwidth, rawheight; // raw width/height of the texture + int rawwidth_create; // raw width/height, pow2 compatible, if needed + int rawheight_create; // (create and initial set the texture, not for copy!) + int type; // what type of texture are we? + int format; // texture format + int borderpix; // do we have a 1 pixel border? + int xprescale; // what is our X prescale factor? + int yprescale; // what is our Y prescale factor? + int nocopy; // must the texture date be copied? + + UINT32 texture; // OpenGL texture "name"/ID + + GLenum texTarget; // OpenGL texture target + int texpow2; // Is this texture pow2 + + UINT32 mpass_dest_idx; // Multipass dest idx [0..1] + UINT32 mpass_textureunit[2]; // texture unit names for GLSL + + UINT32 mpass_texture_mamebm[2];// Multipass OpenGL texture "name"/ID for the shader + UINT32 mpass_fbo_mamebm[2]; // framebuffer object for this texture, multipass + UINT32 mpass_texture_scrn[2]; // Multipass OpenGL texture "name"/ID for the shader + UINT32 mpass_fbo_scrn[2]; // framebuffer object for this texture, multipass + + UINT32 pbo; // pixel buffer object for this texture (DYNAMIC only!) + UINT32 *data; // pixels for the texture + int data_own; // do we own / allocated it ? + GLfloat texCoord[8]; + GLuint texCoordBufferName; + +}; + +/* sdl_info is the information about SDL for the current screen */ +class renderer_ogl : public osd_renderer +{ +public: + renderer_ogl(osd_window *window) + : osd_renderer(window, FLAG_NEEDS_OPENGL) + , m_blittimer(0) + , m_width(0) + , m_height(0) + , m_blit_dim(0, 0) + , m_gl_context(NULL) + , m_initialized(0) + , m_last_blendmode(0) + , m_texture_max_width(0) + , m_texture_max_height(0) + , m_texpoweroftwo(0) + , m_usevbo(0) + , m_usepbo(0) + , m_usefbo(0) + , m_useglsl(0) + , m_glsl(nullptr) + , m_glsl_program_num(0) + , m_glsl_program_mb2sc(0) + , m_usetexturerect(0) + , m_init_context(0) + , m_last_hofs(0.0f) + , m_last_vofs(0.0f) + , m_surf_w(0) + , m_surf_h(0) + { + for (int i=0; i < HASH_SIZE + OVERFLOW_SIZE; i++) + m_texhash[i] = NULL; + for (int i=0; i < 2*GLSL_SHADER_MAX; i++) + m_glsl_program[i] = 0; + for (int i=0; i < 8; i++) + m_texVerticex[i] = 0.0f; + } + virtual ~renderer_ogl(); + + virtual int create() override; + static bool init(running_machine &machine); + virtual int draw(const int update) override; + +#ifndef OSD_WINDOWS + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; +#endif + virtual render_primitive_list *get_primitives() override + { +#ifdef OSD_WINDOWS + osd_dim nd = window().get_size(); +#else + osd_dim nd = window().blit_surface_size(); +#endif + if (nd != m_blit_dim) + { + m_blit_dim = nd; + notify_changed(); + } + window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); + return &window().target()->get_primitives(); + } + +#ifdef OSD_WINDOWS + virtual void save() override { } + virtual void record() override { } + virtual void toggle_fsfx() override { } +#endif + +private: + static const UINT32 HASH_SIZE = ((1 << 10) + 1); + static const UINT32 OVERFLOW_SIZE = (1 << 10); + + void destroy_all_textures(); + + static void load_gl_lib(running_machine &machine); + void loadGLExtensions(); + void initialize_gl(); + void set_blendmode(int blendmode); + HashT texture_compute_hash(const render_texinfo *texture, UINT32 flags); + void texture_compute_type_subroutine(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); + void texture_compute_size_subroutine(ogl_texture_info *texture, UINT32 flags, + UINT32 width, UINT32 height, + int* p_width, int* p_height, int* p_width_create, int* p_height_create); + void texture_compute_size_type(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); + ogl_texture_info *texture_create(const render_texinfo *texsource, UINT32 flags); + int texture_shader_create(const render_texinfo *texsource, ogl_texture_info *texture, UINT32 flags); + ogl_texture_info *texture_find(const render_primitive *prim); + void texture_coord_update(ogl_texture_info *texture, const render_primitive *prim, int shaderIdx); + void texture_mpass_flip(ogl_texture_info *texture, int shaderIdx); + void texture_shader_update(ogl_texture_info *texture, render_container *container, int shaderIdx); + ogl_texture_info * texture_update(const render_primitive *prim, int shaderIdx); + void texture_disable(ogl_texture_info * texture); + void texture_all_disable(); + + INT32 m_blittimer; + int m_width; + int m_height; + osd_dim m_blit_dim; + + osd_gl_context *m_gl_context; + + int m_initialized; // is everything well initialized, i.e. all GL stuff etc. + // 3D info (GL mode only) + ogl_texture_info * m_texhash[HASH_SIZE + OVERFLOW_SIZE]; + int m_last_blendmode; // previous blendmode + INT32 m_texture_max_width; // texture maximum width + INT32 m_texture_max_height; // texture maximum height + int m_texpoweroftwo; // must textures be power-of-2 sized? + int m_usevbo; // runtime check if VBO is available + int m_usepbo; // runtime check if PBO is available + int m_usefbo; // runtime check if FBO is available + int m_useglsl; // runtime check if GLSL is available + + glsl_shader_info *m_glsl; // glsl_shader_info + + GLhandleARB m_glsl_program[2*GLSL_SHADER_MAX]; // GLSL programs, or 0 + int m_glsl_program_num; // number of GLSL programs + int m_glsl_program_mb2sc; // GLSL program idx, which transforms + // the mame-bitmap. screen-bitmap (size/rotation/..) + // All progs <= glsl_program_mb2sc using the mame bitmap + // as input, otherwise the screen bitmap. + // All progs >= glsl_program_mb2sc using the screen bitmap + // as output, otherwise the mame bitmap. + int m_usetexturerect; // use ARB_texture_rectangle for non-power-of-2, general use + + int m_init_context; // initialize context before next draw + + float m_last_hofs; + float m_last_vofs; + + // Static vars from draogl_window_dra + INT32 m_surf_w; + INT32 m_surf_h; + GLfloat m_texVerticex[8]; + + static bool s_shown_video_info; + static bool s_dll_loaded; +}; + +#endif // __DRAWOGL__
\ No newline at end of file diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index b9a40038082..005d523cf9a 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -26,6 +26,8 @@ #include "osdsdl.h" #include "window.h" +#include "drawsdl.h" + //============================================================ // DEBUGGING //============================================================ @@ -34,99 +36,14 @@ // CONSTANTS //============================================================ -//============================================================ -// TYPES -//============================================================ - -struct sdl_scale_mode; - #define DRAW2_SCALEMODE_NEAREST "0" #define DRAW2_SCALEMODE_LINEAR "1" #define DRAW2_SCALEMODE_BEST "2" -/* sdl_info is the information about SDL for the current screen */ -class sdl_info : public osd_renderer -{ -public: - - sdl_info(osd_window *w, int extra_flags) - : osd_renderer(w, extra_flags), - m_sdl_renderer(NULL), - m_texture_id(NULL), - m_yuv_lookup(NULL), - m_yuv_bitmap(NULL), - //m_hw_scale_width(0), - //m_hw_scale_height(0), - m_last_hofs(0), - m_last_vofs(0), - m_blit_dim(0, 0), - m_last_dim(0, 0) - { } - - /* virtual */ int create() override; - /* virtual */ int draw(const int update) override; - /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; - /* virtual */ void destroy() override; - /* virtual */ render_primitive_list *get_primitives() override - { - osd_dim nd = window().blit_surface_size(); - if (nd != m_blit_dim) - { - m_blit_dim = nd; - notify_changed(); - } - window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); - return &window().target()->get_primitives(); - } - -private: - void destroy_all_textures(); - void yuv_init(); - void setup_texture(const osd_dim &size); - void yuv_lookup_set(unsigned int pen, unsigned char red, - unsigned char green, unsigned char blue); - - INT32 m_blittimer; - - SDL_Renderer *m_sdl_renderer; - SDL_Texture *m_texture_id; - - // YUV overlay - UINT32 *m_yuv_lookup; - UINT16 *m_yuv_bitmap; - - // if we leave scaling to SDL and the underlying driver, this - // is the render_target_width/height to use - - int m_last_hofs; - int m_last_vofs; - osd_dim m_blit_dim; - osd_dim m_last_dim; -}; - -struct sdl_scale_mode -{ - const char *name; - int is_scale; /* Scale mode? */ - int is_yuv; /* Yuv mode? */ - int mult_w; /* Width multiplier */ - int mult_h; /* Height multiplier */ - const char *sdl_scale_mode_hint; /* what to use as a hint ? */ - int pixel_format; /* Pixel/Overlay format */ - void (*yuv_blit)(const UINT16 *bitmap, UINT8 *ptr, const int pitch, const UINT32 *lookup, const int width, const int height); -}; - -//============================================================ -// INLINES -//============================================================ - //============================================================ // PROTOTYPES //============================================================ -// core functions -static void drawsdl_exit(void); - // YUV overlays static void yuv_RGB_to_YV12(const UINT16 *bitmap, UINT8 *ptr, const int pitch, \ @@ -150,25 +67,7 @@ static const sdl_scale_mode scale_modes[] = { "yv12x2", 1, 1, 2, 2, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YV12, yuv_RGB_to_YV12X2 }, { "yuy2", 1, 1, 1, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2 }, { "yuy2x2", 1, 1, 2, 1, DRAW2_SCALEMODE_BEST, SDL_PIXELFORMAT_YUY2, yuv_RGB_to_YUY2X2 }, - { NULL } -}; - -//============================================================ -// drawsdl_scale_mode -//============================================================ - -const char *drawsdl_scale_mode_str(int index) -{ - const sdl_scale_mode *sm = scale_modes; - - while (index>0) - { - if (sm->name == NULL) - return NULL; - index--; - sm++; - } - return sm->name; + { nullptr } }; int drawsdl_scale_mode(const char *s) @@ -177,7 +76,7 @@ int drawsdl_scale_mode(const char *s) int index; index = 0; - while (sm->name != NULL) + while (sm->name != nullptr) { if (strcmp(sm->name, s) == 0) return index; @@ -187,40 +86,21 @@ int drawsdl_scale_mode(const char *s) return -1; } - -static osd_renderer *drawsdl_create(osd_window *window) -{ - // FIXME: QUALITY HINTS - return global_alloc(sdl_info(window, osd_renderer::FLAG_NONE)); -} - //============================================================ // drawsdl_init //============================================================ -int drawsdl_init(osd_draw_callbacks *callbacks) +bool renderer_sdl2::init(running_machine &machine) { - // fill in the callbacks - callbacks->create = drawsdl_create; - callbacks->exit = drawsdl_exit; - osd_printf_verbose("Using SDL multi-window soft driver (SDL 2.0+)\n"); - return 0; -} - -//============================================================ -// drawsdl_exit -//============================================================ - -static void drawsdl_exit(void) -{ + return false; } //============================================================ // setup_texture for window //============================================================ -void sdl_info::setup_texture(const osd_dim &size) +void renderer_sdl2::setup_texture(const osd_dim &size) { const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; SDL_DisplayMode mode; @@ -232,7 +112,7 @@ void sdl_info::setup_texture(const osd_dim &size) if (m_yuv_bitmap) { global_free_array(m_yuv_bitmap); - m_yuv_bitmap = NULL; + m_yuv_bitmap = nullptr; } fmt = (sdl_sm->pixel_format ? sdl_sm->pixel_format : mode.format); @@ -271,10 +151,11 @@ void sdl_info::setup_texture(const osd_dim &size) // drawsdl_show_info //============================================================ -static void drawsdl_show_info(struct SDL_RendererInfo *render_info) +void renderer_sdl2::show_info(struct SDL_RendererInfo *render_info) { #define RF_ENTRY(x) {x, #x } - static struct { + static struct + { int flag; const char *name; } rflist[] = @@ -288,22 +169,20 @@ static void drawsdl_show_info(struct SDL_RendererInfo *render_info) #endif RF_ENTRY(SDL_RENDERER_PRESENTVSYNC), RF_ENTRY(SDL_RENDERER_ACCELERATED), - {-1, NULL} + {-1, nullptr} }; - int i; osd_printf_verbose("window: using renderer %s\n", render_info->name ? render_info->name : "<unknown>"); - for (i = 0; rflist[i].name != NULL; i++) + for (int i = 0; rflist[i].name != nullptr; i++) if (render_info->flags & rflist[i].flag) osd_printf_verbose("renderer: flag %s\n", rflist[i].name); } //============================================================ -// sdl_info::create +// renderer_sdl2::create //============================================================ - -int sdl_info::create() +int renderer_sdl2::create() { const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; @@ -331,27 +210,25 @@ int sdl_info::create() fatalerror("Error on creating renderer: %s\n", SDL_GetError()); } - { - struct SDL_RendererInfo render_info; + struct SDL_RendererInfo render_info; - SDL_GetRendererInfo(m_sdl_renderer, &render_info); - drawsdl_show_info(&render_info); + SDL_GetRendererInfo(m_sdl_renderer, &render_info); + show_info(&render_info); - // Check scale mode + // Check scale mode - if (sm->pixel_format) - { - int i; - int found = 0; + if (sm->pixel_format) + { + int i; + int found = 0; - for (i=0; i < render_info.num_texture_formats; i++) - if (sm->pixel_format == render_info.texture_formats[i]) - found = 1; + for (i=0; i < render_info.num_texture_formats; i++) + if (sm->pixel_format == render_info.texture_formats[i]) + found = 1; - if (!found) - { - fatalerror("window: Scale mode %s not supported!", sm->name); - } + if (!found) + { + fatalerror("window: Scale mode %s not supported!", sm->name); } } @@ -361,33 +238,31 @@ int sdl_info::create() setup_texture(w, h); #endif - m_yuv_lookup = NULL; + m_yuv_lookup = nullptr; m_blittimer = 0; yuv_init(); - osd_printf_verbose("Leave sdl_info::create\n"); + osd_printf_verbose("Leave renderer_sdl2::create\n"); return 0; } //============================================================ -// sdl_info::destroy +// DESTRUCTOR //============================================================ -void sdl_info::destroy() +renderer_sdl2::~renderer_sdl2() { - // free the memory in the window - destroy_all_textures(); - if (m_yuv_lookup != NULL) + if (m_yuv_lookup != nullptr) { global_free_array(m_yuv_lookup); - m_yuv_lookup = NULL; + m_yuv_lookup = nullptr; } - if (m_yuv_bitmap != NULL) + if (m_yuv_bitmap != nullptr) { global_free_array(m_yuv_bitmap); - m_yuv_bitmap = NULL; + m_yuv_bitmap = nullptr; } SDL_DestroyRenderer(m_sdl_renderer); } @@ -396,7 +271,7 @@ void sdl_info::destroy() // drawsdl_xy_to_render_target //============================================================ -int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt) +int renderer_sdl2::xy_to_render_target(int x, int y, int *xt, int *yt) { *xt = x - m_last_hofs; *yt = y - m_last_vofs; @@ -411,18 +286,18 @@ int sdl_info::xy_to_render_target(int x, int y, int *xt, int *yt) // drawsdl_destroy_all_textures //============================================================ -void sdl_info::destroy_all_textures() +void renderer_sdl2::destroy_all_textures() { SDL_DestroyTexture(m_texture_id); - m_texture_id = NULL; + m_texture_id = nullptr; } //============================================================ -// sdl_info::draw +// renderer_sdl2::draw //============================================================ -int sdl_info::draw(int update) +int renderer_sdl2::draw(int update) { const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode]; UINT8 *surfptr; @@ -444,8 +319,8 @@ int sdl_info::draw(int update) clear_flags(FI_CHANGED); m_blittimer = 3; m_last_dim = wdim; - SDL_RenderSetViewport(m_sdl_renderer, NULL); - if (m_texture_id != NULL) + SDL_RenderSetViewport(m_sdl_renderer, nullptr); + if (m_texture_id != nullptr) SDL_DestroyTexture(m_texture_id); setup_texture(m_blit_dim); m_blittimer = 3; @@ -467,12 +342,12 @@ int sdl_info::draw(int update) { /* SDL Underlays need alpha = 0 ! */ SDL_SetRenderDrawColor(m_sdl_renderer,0,0,0,0); - SDL_RenderFillRect(m_sdl_renderer,NULL); - //SDL_RenderFill(0,0,0,0 /*255*/,NULL); + SDL_RenderFillRect(m_sdl_renderer,nullptr); + //SDL_RenderFill(0,0,0,0 /*255*/,nullptr); m_blittimer--; } - SDL_LockTexture(m_texture_id, NULL, (void **) &surfptr, &pitch); + SDL_LockTexture(m_texture_id, nullptr, (void **) &surfptr, &pitch); // get ready to center the image vofs = hofs = 0; @@ -522,7 +397,7 @@ int sdl_info::draw(int update) // FIXME: this could be a lot easier if we get the primlist here! // Bounds would be set fit for purpose and done! - for (render_primitive *prim = window().m_primlist->first(); prim != NULL; prim = prim->next()) + for (render_primitive *prim = window().m_primlist->first(); prim != nullptr; prim = prim->next()) { prim->bounds.x0 = floor(fw * prim->bounds.x0 + 0.5f); prim->bounds.x1 = floor(fw * prim->bounds.x1 + 0.5f); @@ -562,8 +437,8 @@ int sdl_info::draw(int update) } else { - assert (m_yuv_bitmap != NULL); - assert (surfptr != NULL); + assert (m_yuv_bitmap != nullptr); + assert (surfptr != nullptr); software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window().m_primlist, m_yuv_bitmap, mamewidth, mameheight, mamewidth); sm->yuv_blit((UINT16 *)m_yuv_bitmap, surfptr, pitch, m_yuv_lookup, mamewidth, mameheight); } @@ -580,8 +455,8 @@ int sdl_info::draw(int update) r.w=blitwidth; r.h=blitheight; //printf("blitwidth %d %d - %d %d\n", blitwidth, blitheight, window().width, window().height); - //SDL_UpdateTexture(sdltex, NULL, sdlsurf->pixels, pitch); - SDL_RenderCopy(m_sdl_renderer,m_texture_id, NULL, &r); + //SDL_UpdateTexture(sdltex, nullptr, sdlsurf->pixels, pitch); + SDL_RenderCopy(m_sdl_renderer,m_texture_id, nullptr, &r); SDL_RenderPresent(m_sdl_renderer); } return 0; @@ -627,7 +502,7 @@ int sdl_info::draw(int update) #define YMASK (Y1MASK|Y2MASK) #define UVMASK (UMASK|VMASK) -void sdl_info::yuv_lookup_set(unsigned int pen, unsigned char red, +void renderer_sdl2::yuv_lookup_set(unsigned int pen, unsigned char red, unsigned char green, unsigned char blue) { UINT32 y,u,v; @@ -639,10 +514,10 @@ void sdl_info::yuv_lookup_set(unsigned int pen, unsigned char red, m_yuv_lookup[pen]=(y<<Y1SHIFT)|(u<<USHIFT)|(y<<Y2SHIFT)|(v<<VSHIFT); } -void sdl_info::yuv_init() +void renderer_sdl2::yuv_init() { unsigned char r,g,b; - if (m_yuv_lookup == NULL) + if (m_yuv_lookup == nullptr) m_yuv_lookup = global_alloc_array(UINT32, 65536); for (r = 0; r < 32; r++) for (g = 0; g < 32; g++) @@ -794,3 +669,15 @@ static void yuv_RGB_to_YUY2X2(const UINT16 *bitmap, UINT8 *ptr, const int pitch, } } } + +render_primitive_list *renderer_sdl2::get_primitives() +{ + osd_dim nd = window().blit_surface_size(); + if (nd != m_blit_dim) + { + m_blit_dim = nd; + notify_changed(); + } + window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); + return &window().target()->get_primitives(); +} diff --git a/src/osd/modules/render/drawsdl.h b/src/osd/modules/render/drawsdl.h new file mode 100644 index 00000000000..28ddd7ebc36 --- /dev/null +++ b/src/osd/modules/render/drawsdl.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:Couriersud, Olivier Galibert, R. Belmont +//============================================================ +// +// drawsdl.h - SDL software and OpenGL implementation +// +// SDLMAME by Olivier Galibert and R. Belmont +// +// yuvmodes by Couriersud +// +//============================================================ + +#pragma once + +#ifndef __DRAWSDL2__ +#define __DRAWSDL2__ + +/* renderer_sdl2 is the information about SDL for the current screen */ +class renderer_sdl2 : public osd_renderer +{ +public: + + renderer_sdl2(osd_window *w, int extra_flags) + : osd_renderer(w, extra_flags) + , m_sdl_renderer(nullptr) + , m_texture_id(nullptr) + , m_yuv_lookup(nullptr) + , m_yuv_bitmap(nullptr) + //, m_hw_scale_width(0) + //, m_hw_scale_height(0) + , m_last_hofs(0) + , m_last_vofs(0) + , m_blit_dim(0, 0) + , m_last_dim(0, 0) + { + } + virtual ~renderer_sdl2(); + + virtual int create() override; + virtual int draw(const int update) override; + virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) override; + virtual render_primitive_list *get_primitives() override; + + static bool init(running_machine &machine); + +private: + void show_info(struct SDL_RendererInfo *render_info); + + void destroy_all_textures(); + void yuv_init(); + void setup_texture(const osd_dim &size); + void yuv_lookup_set(unsigned int pen, unsigned char red, + unsigned char green, unsigned char blue); + + INT32 m_blittimer; + + SDL_Renderer *m_sdl_renderer; + SDL_Texture *m_texture_id; + + // YUV overlay + UINT32 *m_yuv_lookup; + UINT16 *m_yuv_bitmap; + + // if we leave scaling to SDL and the underlying driver, this + // is the render_target_width/height to use + + int m_last_hofs; + int m_last_vofs; + osd_dim m_blit_dim; + osd_dim m_last_dim; +}; + +struct sdl_scale_mode +{ + const char *name; + int is_scale; /* Scale mode? */ + int is_yuv; /* Yuv mode? */ + int mult_w; /* Width multiplier */ + int mult_h; /* Height multiplier */ + const char *sdl_scale_mode_hint; /* what to use as a hint ? */ + int pixel_format; /* Pixel/Overlay format */ + void (*yuv_blit)(const UINT16 *bitmap, UINT8 *ptr, const int pitch, const UINT32 *lookup, const int width, const int height); +}; + +#endif // __DRAWSDL2__
\ No newline at end of file diff --git a/src/osd/modules/render/sdlglcontext.h b/src/osd/modules/render/sdlglcontext.h new file mode 100644 index 00000000000..27c0bbe68a6 --- /dev/null +++ b/src/osd/modules/render/sdlglcontext.h @@ -0,0 +1,67 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont +//============================================================ +// +// sdlglcontext.h - SDL-specific GL context +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#pragma once + +#ifndef __SDL_GL_CONTEXT__ +#define __SDL_GL_CONTEXT__ + +#include "modules/opengl/osd_opengl.h" + +class sdl_gl_context : public osd_gl_context +{ +public: + sdl_gl_context(SDL_Window *window) : osd_gl_context(), m_context(0), m_window(window) + { + m_error[0] = 0; + m_context = SDL_GL_CreateContext(window); + if (!m_context) + { + snprintf(m_error,255, "OpenGL not supported on this driver: %s", SDL_GetError()); + } + } + virtual ~sdl_gl_context() + { + SDL_GL_DeleteContext(m_context); + } + virtual void MakeCurrent() override + { + SDL_GL_MakeCurrent(m_window, m_context); + } + + virtual int SetSwapInterval(const int swap) override + { + return SDL_GL_SetSwapInterval(swap); + } + + virtual const char *LastErrorMsg() override + { + if (m_error[0] == 0) + return NULL; + else + return m_error; + } + virtual void *getProcAddress(const char *proc) override + { + return SDL_GL_GetProcAddress(proc); + } + + virtual void SwapBuffer() override + { + SDL_GL_SwapWindow(m_window); + } + +private: + SDL_GLContext m_context; + SDL_Window *m_window; + char m_error[256]; +}; + +#endif // __SDL_GL_CONTEXT__
\ No newline at end of file diff --git a/src/osd/modules/render/winglcontext.h b/src/osd/modules/render/winglcontext.h new file mode 100644 index 00000000000..44a30888fa5 --- /dev/null +++ b/src/osd/modules/render/winglcontext.h @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert, R. Belmont +//============================================================ +// +// winglcontext.h - Windows-specific GL context +// +// SDLMAME by Olivier Galibert and R. Belmont +// +//============================================================ + +#pragma once + +#ifndef __WIN_GL_CONTEXT__ +#define __WIN_GL_CONTEXT__ + +#include "modules/opengl/osd_opengl.h" + +class win_gl_context : public osd_gl_context +{ +public: + win_gl_context(HWND window) : osd_gl_context(), m_context(0), m_window(NULL), m_hdc(0) + { + m_error[0] = 0; + + this->pfn_wglGetProcAddress = (PROC (WINAPI *)(LPCSTR lpszProc)) GetProcAddress(m_module, "wglGetProcAddress"); + this->pfn_wglCreateContext = (HGLRC (WINAPI *)(HDC hdc)) GetProcAddress(m_module, "wglCreateContext"); + this->pfn_wglDeleteContext = (BOOL (WINAPI *)(HGLRC hglrc)) GetProcAddress(m_module, "wglDeleteContext"); + this->pfn_wglMakeCurrent = (BOOL (WINAPI *)(HDC hdc, HGLRC hglrc)) GetProcAddress(m_module, "wglMakeCurrent"); + + this->pfn_wglGetExtensionsStringEXT = (const char *(WINAPI *) (void)) pfn_wglGetProcAddress("wglGetExtensionsStringEXT"); + + if (WGLExtensionSupported("WGL_EXT_swap_control")) + { + this->pfn_wglSwapIntervalEXT = (BOOL (WINAPI *) (int)) getProcAddress("wglSwapIntervalEXT"); + this->pfn_wglGetSwapIntervalEXT = (int (WINAPI *) (void)) getProcAddress("wglGetSwapIntervalEXT"); + } + else + { + pfn_wglSwapIntervalEXT = NULL; + pfn_wglGetSwapIntervalEXT = NULL; + } + + m_hdc = GetDC(window); + if (!setupPixelFormat(m_hdc)) + { + m_context = this->pfn_wglCreateContext(m_hdc); + if (!m_context) + { + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, m_error, 255, NULL); + return; + } + this->pfn_wglMakeCurrent(m_hdc, m_context); + } + } + + virtual ~win_gl_context() + { + this->pfn_wglDeleteContext(m_context); + ReleaseDC(m_window, m_hdc); + } + + virtual void MakeCurrent() override + { + this->pfn_wglMakeCurrent(m_hdc, m_context); + } + + virtual const char *LastErrorMsg() override + { + if (m_error[0] == 0) + return NULL; + else + return m_error; + } + + virtual void *getProcAddress(const char *proc) override + { + void *ret = (void *) GetProcAddress(m_module, proc); + if (ret == NULL) + ret = (void *) this->pfn_wglGetProcAddress(proc); + return ret; + } + + virtual int SetSwapInterval(const int swap) override + { + if (this->pfn_wglSwapIntervalEXT != NULL) + { + this->pfn_wglSwapIntervalEXT(swap ? 1 : 0); + } + return 0; + } + + virtual void SwapBuffer() override + { + SwapBuffers(m_hdc); + //wglSwapLayerBuffers(GetDC(window().m_hwnd), WGL_SWAP_MAIN_PLANE); + } + + static void load_library() + { + m_module = LoadLibraryA("opengl32.dll"); + } + +private: + + int setupPixelFormat(HDC hDC) + { + PIXELFORMATDESCRIPTOR pfd = { + sizeof(PIXELFORMATDESCRIPTOR), /* size */ + 1, /* version */ + PFD_SUPPORT_OPENGL | + PFD_DRAW_TO_WINDOW | + PFD_DOUBLEBUFFER, /* support double-buffering */ + PFD_TYPE_RGBA, /* color type */ + 32, /* prefered color depth */ + 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ + 0, /* no alpha buffer */ + 0, /* alpha bits (ignored) */ + 0, /* no accumulation buffer */ + 0, 0, 0, 0, /* accum bits (ignored) */ + 16, /* depth buffer */ + 0, /* no stencil buffer */ + 0, /* no auxiliary buffers */ + PFD_MAIN_PLANE, /* main layer */ + 0, /* reserved */ + 0, 0, 0, /* no layer, visible, damage masks */ + }; + int pixelFormat; + + pixelFormat = ChoosePixelFormat(hDC, &pfd); + if (pixelFormat == 0) { + strcpy(m_error, "ChoosePixelFormat failed"); + return 1; + } + + if (SetPixelFormat(hDC, pixelFormat, &pfd) != TRUE) { + strcpy(m_error, "SetPixelFormat failed."); + return 1; + } + return 0; + } + + bool WGLExtensionSupported(const char *extension_name) + { + //if (pfn_wglGetExtensionsStringEXT != NULL) + // printf("%s\n", this->pfn_wglGetExtensionsStringEXT()); + + if (pfn_wglGetExtensionsStringEXT != NULL && strstr(pfn_wglGetExtensionsStringEXT(), extension_name) != NULL) + return true; + else + return false; + } + + HGLRC m_context; + HWND m_window; + HDC m_hdc; + char m_error[256]; + + PROC (WINAPI *pfn_wglGetProcAddress)(LPCSTR lpszProc); + HGLRC (WINAPI *pfn_wglCreateContext)(HDC hdc); + BOOL (WINAPI *pfn_wglDeleteContext)(HGLRC hglrc); + BOOL (WINAPI *pfn_wglMakeCurrent)(HDC hdc, HGLRC hglrc); + + const char *(WINAPI *pfn_wglGetExtensionsStringEXT) (void); + BOOL (WINAPI *pfn_wglSwapIntervalEXT) (int interval); + int (WINAPI * pfn_wglGetSwapIntervalEXT) (void); + + static HMODULE m_module; +}; + +#endif // __WIN_GL_CONTEXT__
\ No newline at end of file diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index 5b57f55881c..3e5b7d91e8f 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -41,6 +41,8 @@ public: // ======================> osd_interface +struct slider_state; + // description of the currently-running machine class osd_interface { @@ -63,7 +65,7 @@ public: virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0; // video overridables - virtual void *get_slider_list() = 0; // FIXME: returns slider_state * + virtual slider_state *get_slider_list() = 0; // font interface virtual osd_font *font_alloc() = 0; diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index ca7286d5696..b0d2e383c11 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -83,7 +83,7 @@ bool sdl_osd_interface::video_init() get_resolution(options().resolution(), options().resolution(index), &conf, TRUE); // create window ... - sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, sdl_monitor_info::pick_monitor(options(), index), &conf)); + sdl_window_info *win = global_alloc(sdl_window_info(machine(), index, osd_monitor_info::pick_monitor(reinterpret_cast<osd_options &>(options()), index), &conf)); if (win->window_init()) return false; @@ -229,8 +229,9 @@ void sdl_monitor_info::exit() // pick_monitor //============================================================ -osd_monitor_info *osd_monitor_info::pick_monitor(sdl_options &options, int index) +osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &generic_options, int index) { + sdl_options &options = reinterpret_cast<sdl_options &>(generic_options); osd_monitor_info *monitor; const char *scrname, *scrname2; int moncount = 0; diff --git a/src/osd/sdl/video.h b/src/osd/sdl/video.h index a811a417ef4..307f3a898c9 100644 --- a/src/osd/sdl/video.h +++ b/src/osd/sdl/video.h @@ -12,6 +12,7 @@ #define __SDLVIDEO__ #include "osdsdl.h" +#include "modules/osdwindow.h" //============================================================ // CONSTANTS @@ -19,13 +20,6 @@ #define MAX_VIDEO_WINDOWS (4) -enum { - VIDEO_MODE_SOFT = 0, - VIDEO_MODE_OPENGL, - VIDEO_MODE_SDL2ACCEL, - VIDEO_MODE_BGFX -}; - #define VIDEO_SCALE_MODE_NONE (0) #define GLSL_SHADER_MAX 10 @@ -34,114 +28,11 @@ enum { // TYPE DEFINITIONS //============================================================ -class osd_dim -{ -public: - osd_dim(const int &w, const int &h) - : m_w(w), m_h(h) - { - } - int width() const { return m_w; } - int height() const { return m_h; } - - bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); } - bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); } -private: - int m_w; - int m_h; -}; - -class osd_rect -{ -public: - osd_rect() - : m_x(0), m_y(0), m_d(0,0) - { - } - osd_rect(const int x, const int y, const int &w, const int &h) - : m_x(x), m_y(y), m_d(w,h) - { - } - osd_rect(const int x, const int y, const osd_dim &d) - : m_x(x), m_y(y), m_d(d) - { - } - int top() const { return m_y; } - int left() const { return m_x; } - int width() const { return m_d.width(); } - int height() const { return m_d.height(); } - - osd_dim dim() const { return m_d; } - - int bottom() const { return m_y + m_d.height(); } - int right() const { return m_x + m_d.width(); } - - osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); } - osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); } - -private: - int m_x; - int m_y; - osd_dim m_d; -}; - inline osd_rect SDL_Rect_to_osd_rect(const SDL_Rect &r) { return osd_rect(r.x, r.y, r.w, r.h); } -class osd_monitor_info -{ -public: - -#if 0 - osd_monitor_info() - : m_next(NULL), m_handle(NULL), m_aspect(0.0f) - { - strcpy(m_name, ""); - } -#endif - osd_monitor_info(void *handle, const char *monitor_device, float aspect) - : m_next(NULL), m_handle(handle), m_aspect(aspect) - { - strncpy(m_name, monitor_device, ARRAY_LENGTH(m_name) - 1); - } - - virtual ~osd_monitor_info() { } - - virtual void refresh() = 0; - - const void *oshandle() { return m_handle; } - - const osd_rect &position_size() { return m_pos_size; } - const osd_rect &usuable_position_size() { return m_usuable_pos_size; } - - const char *devicename() { return m_name[0] ? m_name : "UNKNOWN"; } - - float aspect(); - - void set_aspect(const float a) { m_aspect = a; } - bool is_primary() { return m_is_primary; } - - osd_monitor_info * next() { return m_next; } // pointer to next monitor in list - - static osd_monitor_info *pick_monitor(sdl_options &options, int index); - static osd_monitor_info *list; - - // FIXME: should be private! - osd_monitor_info *m_next; // pointer to next monitor in list -protected: - osd_rect m_pos_size; - osd_rect m_usuable_pos_size; - bool m_is_primary; - char m_name[64]; -private: - - void * m_handle; // handle to the monitor - float m_aspect; // computed/configured aspect ratio of the physical device -}; - - class sdl_monitor_info : public osd_monitor_info { public: diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 113a00b47bf..49e8ed48477 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -36,6 +36,12 @@ #include "window.h" #include "input.h" #include "osdsdl.h" +#include "modules/render/drawbgfx.h" +#include "modules/render/drawsdl.h" +#include "modules/render/draw13.h" +#if (USE_OPENGL) +#include "modules/render/drawogl.h" +#endif //============================================================ // PARAMETERS @@ -94,11 +100,9 @@ static SDL_threadID window_threadid; // debugger //static int in_background; -static osd_draw_callbacks draw; - struct worker_param { worker_param() - : m_window(NULL), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0) + : m_window(nullptr), m_list(nullptr), m_resize_new_width(0), m_resize_new_height(0) { } worker_param(sdl_window_info *awindow, render_primitive_list &alist) @@ -106,14 +110,14 @@ struct worker_param { { } worker_param(sdl_window_info *awindow, int anew_width, int anew_height) - : m_window(awindow), m_list(NULL), m_resize_new_width(anew_width), m_resize_new_height(anew_height) + : m_window(awindow), m_list(nullptr), m_resize_new_width(anew_width), m_resize_new_height(anew_height) { } worker_param(sdl_window_info *awindow) - : m_window(awindow), m_list(NULL), m_resize_new_width(0), m_resize_new_height(0) + : m_window(awindow), m_list(nullptr), m_resize_new_width(0), m_resize_new_height(0) { } - sdl_window_info *window() const { assert(m_window != NULL); return m_window; } + sdl_window_info *window() const { assert(m_window != nullptr); return m_window; } render_primitive_list *list() const { return m_list; } int new_width() const { return m_resize_new_width; } int new_height() const { return m_resize_new_height; } @@ -187,7 +191,7 @@ static OSDWORK_CALLBACK(sdlwindow_thread_id) exit(-1); } } - return NULL; + return nullptr; } @@ -210,40 +214,50 @@ bool sdl_osd_interface::window_init() { // create a thread to run the windows from work_queue = osd_work_queue_alloc(WORK_QUEUE_FLAG_IO); - if (work_queue == NULL) + if (work_queue == nullptr) return false; - osd_work_item_queue(work_queue, &sdlwindow_thread_id, NULL, WORK_ITEM_FLAG_AUTO_RELEASE); + osd_work_item_queue(work_queue, &sdlwindow_thread_id, nullptr, WORK_ITEM_FLAG_AUTO_RELEASE); sdlwindow_sync(); } else { // otherwise, treat the window thread as the main thread //window_threadid = main_threadid; - sdlwindow_thread_id(NULL, 0); + sdlwindow_thread_id(nullptr, 0); } // initialize the drawers -#if USE_OPENGL - if (video_config.mode == VIDEO_MODE_OPENGL) + if (video_config.mode == VIDEO_MODE_BGFX) { - if (drawogl_init(machine(), &draw)) - video_config.mode = VIDEO_MODE_SOFT; + if (renderer_bgfx::init(machine())) + { +#if (USE_OPENGL) + video_config.mode = VIDEO_MODE_OPENGL; + } } -#endif - if (video_config.mode == VIDEO_MODE_SDL2ACCEL) + if (video_config.mode == VIDEO_MODE_OPENGL) { - if (drawsdl2_init(machine(), &draw)) + if (renderer_ogl::init(machine())) + { + video_config.mode = VIDEO_MODE_SOFT; +#else video_config.mode = VIDEO_MODE_SOFT; +#endif + } } - if (video_config.mode == VIDEO_MODE_BGFX) + if (video_config.mode == VIDEO_MODE_SDL2ACCEL) { - if (drawbgfx_init(machine(), &draw)) + if (renderer_sdl2::init(machine())) + { video_config.mode = VIDEO_MODE_SOFT; + } } if (video_config.mode == VIDEO_MODE_SOFT) { - if (drawsdl_init(&draw)) + if (renderer_sdl1::init(machine())) + { return false; + } } /* We may want to set a number of the hints SDL2 provides. @@ -271,11 +285,11 @@ bool sdl_osd_interface::window_init() SDL_HINT_WINRT_PRIVACY_POLICY_URL, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL, SDL_HINT_WINRT_HANDLE_BACK_BUTTON, #endif - NULL + nullptr }; osd_printf_verbose("\nHints:\n"); - for (int i = 0; hints[i] != NULL; i++) + for (int i = 0; hints[i] != nullptr; i++) osd_printf_verbose("\t%-40s %s\n", hints[i], SDL_GetHint(hints[i])); // set up the window list @@ -315,7 +329,7 @@ static OSDWORK_CALLBACK( sdlwindow_exit_wt ) if (param) osd_free(param); - return NULL; + return nullptr; } @@ -328,7 +342,7 @@ void sdl_osd_interface::window_exit() osd_printf_verbose("Enter sdlwindow_exit\n"); // free all the windows - while (sdl_window_list != NULL) + while (sdl_window_list != nullptr) { sdl_window_info *temp = sdl_window_list; sdl_window_list = temp->m_next; @@ -343,9 +357,6 @@ void sdl_osd_interface::window_exit() sdlwindow_sync(); } - // kill the drawers - (*draw.exit)(); - execute_async_wait(&sdlwindow_exit_wt, wp_dummy); if (multithreading_enabled) @@ -464,7 +475,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_resize_wt ) window->renderer().notify_changed(); osd_free(wp); - return NULL; + return nullptr; } void sdl_window_info::resize(INT32 width, INT32 height) @@ -492,7 +503,7 @@ OSDWORK_CALLBACK( sdl_window_info::notify_changed_wt ) window->renderer().notify_changed(); osd_free(wp); - return NULL; + return nullptr; } void sdl_window_info::notify_changed() @@ -522,7 +533,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) // if we are in debug mode, never go full screen if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) - return NULL; + return nullptr; // If we are going fullscreen (leaving windowed) remember our windowed size if (!window->fullscreen()) @@ -530,9 +541,8 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) window->m_windowed_dim = window->get_size(); } - window->renderer().destroy(); - global_free(window->m_renderer); - window->m_renderer = NULL; + delete window->m_renderer; + window->m_renderer = nullptr; bool is_osx = false; #ifdef SDLMAME_MACOSX @@ -548,14 +558,14 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_toggle_full_screen_wt ) SDL_DestroyWindow(window->sdl_window()); sdlinput_release_keys(); - window->set_renderer(draw.create(window)); + window->set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(window))); // toggle the window mode window->set_fullscreen(!window->fullscreen()); complete_create_wt(param, 0); - return NULL; + return nullptr; } void sdl_window_info::toggle_full_screen() @@ -632,7 +642,7 @@ void sdl_window_info::update_cursor_state() SDL_SetWindowGrab(sdl_window(), SDL_TRUE); SDL_SetRelativeMouseMode(SDL_TRUE); } - SDL_SetCursor(NULL); // Force an update in case the underlying driver has changed visibility + SDL_SetCursor(nullptr); // Force an update in case the underlying driver has changed visibility } #endif } @@ -645,7 +655,7 @@ OSDWORK_CALLBACK( sdl_window_info::update_cursor_state_wt ) window->update_cursor_state(); osd_free(wp); - return NULL; + return nullptr; } int sdl_window_info::xy_to_render_target(int x, int y, int *xt, int *yt) @@ -674,7 +684,7 @@ int sdl_window_info::window_init() *last_window_ptr = this; last_window_ptr = &this->m_next; - set_renderer(draw.create(this)); + set_renderer(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this))); // create an event that we can use to skip blitting m_rendered_event = osd_event_alloc(FALSE, TRUE); @@ -731,7 +741,8 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) ASSERT_WINDOW_THREAD(); // free the textures etc - window->renderer().destroy(); + global_free(window->m_renderer); + window->m_renderer = nullptr; if (window->fullscreen() && video_config.switchres) { @@ -745,7 +756,7 @@ OSDWORK_CALLBACK( sdl_window_info::sdlwindow_video_window_destroy_wt ) osd_free(wp); - return NULL; + return nullptr; } void sdl_window_info::destroy() @@ -761,7 +772,7 @@ void sdl_window_info::destroy() //osd_event_wait(window->rendered_event, osd_ticks_per_second()*10); // remove us from the list - for (prevptr = &sdl_window_list; *prevptr != NULL; prevptr = &(*prevptr)->m_next) + for (prevptr = &sdl_window_list; *prevptr != nullptr; prevptr = &(*prevptr)->m_next) if (*prevptr == this) { *prevptr = this->m_next; @@ -869,7 +880,7 @@ void sdl_window_info::update() execute_async(&update_cursor_state_wt, worker_param(this)); // if we're visible and running and not in the middle of a resize, draw - if (m_target != NULL) + if (m_target != nullptr) { int tempwidth, tempheight; @@ -1033,7 +1044,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) //window().sdl_window() = SDL_CreateWindow(window().m_title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, // width, height, m_extra_flags); - if ( window->m_sdl_window == NULL ) + if ( window->m_sdl_window == nullptr ) { if (window->renderer().has_flags(osd_renderer::FLAG_NEEDS_OPENGL)) osd_printf_error("OpenGL not supported on this driver: %s\n", SDL_GetError()); @@ -1064,7 +1075,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) } else { - //SDL_SetWindowDisplayMode(window().sdl_window(), NULL); // Use desktop + //SDL_SetWindowDisplayMode(window().sdl_window(), nullptr); // Use desktop } // show window @@ -1082,7 +1093,7 @@ OSDWORK_CALLBACK( sdl_window_info::complete_create_wt ) // set main window if (window->m_index > 0) { - for (auto w = sdl_window_list; w != NULL; w = w->m_next) + for (auto w = sdl_window_list; w != nullptr; w = w->m_next) { if (w->m_index == 0) { @@ -1169,7 +1180,7 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt ) int scrnum = 0; int is_vector = 0; screen_device_iterator iter(window->machine().root_device()); - for (const screen_device *screen = iter.first(); screen != NULL; screen = iter.next()) + for (const screen_device *screen = iter.first(); screen != nullptr; screen = iter.next()) { if (scrnum == window->m_index) { @@ -1192,7 +1203,7 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt ) window->m_primlist = wp->list(); // if no bitmap, just fill - if (window->m_primlist == NULL) + if (window->m_primlist == nullptr) { } // otherwise, render with our drawing system @@ -1208,7 +1219,7 @@ OSDWORK_CALLBACK( sdl_window_info::draw_video_contents_wt ) osd_event_set(window->m_rendered_event); osd_free(wp); - return NULL; + return nullptr; } int sdl_window_info::wnd_extra_width() diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index bdaaa311330..f10bf6fbd92 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -161,7 +161,6 @@ private: struct osd_draw_callbacks { osd_renderer *(*create)(osd_window *window); - void (*exit)(void); }; //============================================================ @@ -179,8 +178,6 @@ extern sdl_window_info *sdl_window_list; // PROTOTYPES - drawsdl.c //============================================================ -int drawsdl_init(osd_draw_callbacks *callbacks); -const char *drawsdl_scale_mode_str(int index); int drawsdl_scale_mode(const char *s); //============================================================ diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index b441121f1ca..6406221a471 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -12,6 +12,7 @@ // MAME headers #include "emu.h" +#include "ui/ui.h" #include "emuopts.h" #include "render.h" #include "uiinput.h" @@ -23,6 +24,8 @@ #include "input.h" #include "strconv.h" +#include "modules/osdwindow.h" + //============================================================ // CONSTANTS //============================================================ @@ -64,8 +67,6 @@ static osd_window_config windows[MAX_WINDOWS]; // configuration data pe bool windows_osd_interface::video_init() { - int index; - // extract data from the options extract_video_config(); @@ -77,14 +78,25 @@ bool windows_osd_interface::video_init() // create the windows windows_options &options = downcast<windows_options &>(machine().options()); - for (index = 0; index < video_config.numscreens; index++) + for (int index = 0; index < video_config.numscreens; index++) + { win_window_info::create(machine(), index, osd_monitor_info::pick_monitor(options, index), &windows[index]); + } + if (video_config.mode != VIDEO_MODE_NONE) SetForegroundWindow(win_window_list->m_hwnd); return true; } +//============================================================ +// get_slider_list +//============================================================ + +slider_state *windows_osd_interface::get_slider_list() +{ + return m_sliders; +} //============================================================ // video_exit @@ -181,6 +193,8 @@ void windows_osd_interface::update(bool skip_redraw) // ping the watchdog on each update winmain_watchdog_ping(); + update_slider_list(); + // if we're not skipping this redraw, update all windows if (!skip_redraw) { @@ -266,8 +280,9 @@ static void init_monitors(void) // pick_monitor //============================================================ -osd_monitor_info *osd_monitor_info::pick_monitor(windows_options &options, int index) +osd_monitor_info *osd_monitor_info::pick_monitor(osd_options &osdopts, int index) { + windows_options &options = reinterpret_cast<windows_options &>(osdopts); osd_monitor_info *monitor; const char *scrname, *scrname2; int moncount = 0; diff --git a/src/osd/windows/video.h b/src/osd/windows/video.h index 87612fb51fe..e3c895c1726 100644 --- a/src/osd/windows/video.h +++ b/src/osd/windows/video.h @@ -11,6 +11,7 @@ #include "render.h" #include "winmain.h" +#include "modules/osdwindow.h" //============================================================ // CONSTANTS @@ -18,129 +19,17 @@ #define MAX_WINDOWS 4 -enum { - VIDEO_MODE_NONE, - VIDEO_MODE_GDI, - VIDEO_MODE_BGFX, -#if (USE_OPENGL) - VIDEO_MODE_OPENGL, -#endif - VIDEO_MODE_D3D -}; - #define GLSL_SHADER_MAX 10 //============================================================ // TYPE DEFINITIONS //============================================================ -class osd_dim -{ -public: - osd_dim(const int &w, const int &h) - : m_w(w), m_h(h) - { - } - int width() const { return m_w; } - int height() const { return m_h; } - - bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); } - bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); } -private: - int m_w; - int m_h; -}; - -class osd_rect -{ -public: - osd_rect() - : m_x(0), m_y(0), m_d(0,0) - { - } - osd_rect(const int x, const int y, const int &w, const int &h) - : m_x(x), m_y(y), m_d(w,h) - { - } - osd_rect(const int x, const int y, const osd_dim &d) - : m_x(x), m_y(y), m_d(d) - { - } - int top() const { return m_y; } - int left() const { return m_x; } - int width() const { return m_d.width(); } - int height() const { return m_d.height(); } - - osd_dim dim() const { return m_d; } - - int bottom() const { return m_y + m_d.height(); } - int right() const { return m_x + m_d.width(); } - - osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); } - osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); } - -private: - int m_x; - int m_y; - osd_dim m_d; -}; - inline osd_rect RECT_to_osd_rect(const RECT &r) { return osd_rect(r.left, r.top, r.right - r.left, r.bottom - r.top); } -class osd_monitor_info -{ -public: - -#if 0 - osd_monitor_info() - : m_next(NULL), m_handle(NULL), m_aspect(0.0f) - { - strcpy(m_name, ""); - } -#endif - osd_monitor_info(void *handle, const char *monitor_device, float aspect) - : m_next(NULL), m_handle(handle), m_aspect(aspect) - { - strncpy(m_name, monitor_device, ARRAY_LENGTH(m_name) - 1); - } - - virtual ~osd_monitor_info() { } - - virtual void refresh() = 0; - - const void *oshandle() { return m_handle; } - - const osd_rect &position_size() { return m_pos_size; } - const osd_rect &usuable_position_size() { return m_usuable_pos_size; } - - const char *devicename() { return m_name[0] ? m_name : "UNKNOWN"; } - - float aspect(); - - void set_aspect(const float a) { m_aspect = a; } - bool is_primary() { return m_is_primary; } - - osd_monitor_info * next() { return m_next; } // pointer to next monitor in list - - static osd_monitor_info *pick_monitor(windows_options &options, int index); - static osd_monitor_info *list; - - // FIXME: should be private! - osd_monitor_info *m_next; // pointer to next monitor in list -protected: - osd_rect m_pos_size; - osd_rect m_usuable_pos_size; - bool m_is_primary; - char m_name[64]; -private: - - void * m_handle; // handle to the monitor - float m_aspect; // computed/configured aspect ratio of the physical device -}; - class win_monitor_info : public osd_monitor_info { public: diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 0fbfae9c481..bbf59077f8f 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -12,12 +12,6 @@ // Needed for RAW Input #define WM_INPUT 0x00FF -// standard windows headers -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <windowsx.h> -#include <mmsystem.h> - // standard C headers #include <process.h> @@ -34,12 +28,12 @@ #include "winutil.h" -extern int drawnone_init(running_machine &machine, osd_draw_callbacks *callbacks); -extern int drawgdi_init(running_machine &machine, osd_draw_callbacks *callbacks); -extern int drawd3d_init(running_machine &machine, osd_draw_callbacks *callbacks); -extern int drawbgfx_init(running_machine &machine, osd_draw_callbacks *callbacks); +#include "modules/render/drawbgfx.h" +#include "modules/render/drawnone.h" +#include "modules/render/drawd3d.h" +#include "modules/render/drawgdi.h" #if (USE_OPENGL) -extern int drawogl_init(running_machine &machine, osd_draw_callbacks *callbacks); +#include "modules/render/drawogl.h" #endif //============================================================ @@ -107,8 +101,6 @@ static DWORD window_threadid; static DWORD last_update_time; -static osd_draw_callbacks draw; - static HANDLE ui_pause_event; static HANDLE window_thread_ready_event; @@ -183,7 +175,7 @@ bool windows_osd_interface::window_init() create_window_class(); // create an event to signal UI pausing - ui_pause_event = CreateEvent(NULL, TRUE, FALSE, NULL); + ui_pause_event = CreateEvent(nullptr, TRUE, FALSE, nullptr); if (!ui_pause_event) fatalerror("Failed to create pause event\n"); @@ -191,14 +183,14 @@ bool windows_osd_interface::window_init() if (multithreading_enabled) { // create an event to signal when the window thread is ready - window_thread_ready_event = CreateEvent(NULL, TRUE, FALSE, NULL); + window_thread_ready_event = CreateEvent(nullptr, TRUE, FALSE, nullptr); if (!window_thread_ready_event) fatalerror("Failed to create window thread ready event\n"); // create a thread to run the windows from - temp = _beginthreadex(NULL, 0, win_window_info::thread_entry, NULL, 0, (unsigned *)&window_threadid); + temp = _beginthreadex(nullptr, 0, win_window_info::thread_entry, nullptr, 0, (unsigned *)&window_threadid); window_thread = (HANDLE)temp; - if (window_thread == NULL) + if (window_thread == nullptr) fatalerror("Failed to create window thread\n"); // set the thread priority equal to the main MAME thread @@ -212,29 +204,108 @@ bool windows_osd_interface::window_init() window_threadid = main_threadid; } - // initialize the drawers - if (video_config.mode == VIDEO_MODE_D3D) + const int fallbacks[VIDEO_MODE_COUNT] = { + -1, // NONE -> no fallback + VIDEO_MODE_NONE, // GDI -> NONE + VIDEO_MODE_D3D, // BGFX -> D3D +#if (USE_OPENGL) + VIDEO_MODE_GDI, // OPENGL -> GDI +#endif + -1, // No SDL2ACCEL on Windows OSD +#if (USE_OPENGL) + VIDEO_MODE_OPENGL, // D3D -> OPENGL +#else + VIDEO_MODE_GDI, // D3D -> GDI +#endif + -1 // No SOFT on Windows OSD + }; + + int current_mode = video_config.mode; + while (current_mode != VIDEO_MODE_NONE) { - if (drawd3d_init(machine(), &draw)) - video_config.mode = VIDEO_MODE_GDI; - } - if (video_config.mode == VIDEO_MODE_GDI) - drawgdi_init(machine(), &draw); - if (video_config.mode == VIDEO_MODE_BGFX) - drawbgfx_init(machine(), &draw); - if (video_config.mode == VIDEO_MODE_NONE) - drawnone_init(machine(), &draw); + bool error = false; + switch(current_mode) + { + case VIDEO_MODE_NONE: + error = renderer_none::init(machine()); + break; + case VIDEO_MODE_GDI: + error = renderer_gdi::init(machine()); + break; + case VIDEO_MODE_BGFX: + error = renderer_bgfx::init(machine()); + break; #if (USE_OPENGL) - if (video_config.mode == VIDEO_MODE_OPENGL) - drawogl_init(machine(), &draw); + case VIDEO_MODE_OPENGL: + error = renderer_ogl::init(machine()); + break; #endif + case VIDEO_MODE_SDL2ACCEL: + fatalerror("SDL2-Accel renderer unavailable on Windows OSD."); + break; + case VIDEO_MODE_D3D: + error = renderer_d3d9::init(machine()); + break; + case VIDEO_MODE_SOFT: + fatalerror("SDL1 renderer unavailable on Windows OSD."); + break; + default: + fatalerror("Unknown video mode."); + break; + } + if (error) + { + current_mode = fallbacks[current_mode]; + } + else + { + break; + } + } + video_config.mode = current_mode; + // set up the window list last_window_ptr = &win_window_list; return true; } +void windows_osd_interface::update_slider_list() +{ + for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) + { + if (window->m_renderer->sliders_dirty()) + { + build_slider_list(); + return; + } + } +} +void windows_osd_interface::build_slider_list() +{ + m_sliders = nullptr; + slider_state *curr = m_sliders; + for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next) + { + slider_state *window_sliders = info->m_renderer->get_slider_list(); + if (window_sliders != nullptr) + { + if (m_sliders == nullptr) + { + m_sliders = curr = window_sliders; + } + else + { + while (curr->next != nullptr) + { + curr = curr->next; + } + curr->next = window_sliders; + } + } + } +} //============================================================ // winwindow_exit @@ -246,7 +317,7 @@ void windows_osd_interface::window_exit() assert(GetCurrentThreadId() == main_threadid); // free all the windows - while (win_window_list != NULL) + while (win_window_list != nullptr) { win_window_info *temp = win_window_list; win_window_list = temp->m_next; @@ -254,9 +325,6 @@ void windows_osd_interface::window_exit() global_free(temp); } - // kill the drawers - (*draw.exit)(); - // if we're multithreaded, clean up the window thread if (multithreading_enabled) { @@ -278,24 +346,23 @@ void windows_osd_interface::window_exit() while (ShowCursor(TRUE) < 0) ; } - win_window_info::win_window_info(running_machine &machine) - : osd_window(), m_next(NULL), + : osd_window(), m_next(nullptr), m_init_state(0), m_startmaximized(0), m_isminimized(0), m_ismaximized(0), - m_monitor(NULL), + m_monitor(nullptr), m_fullscreen(0), m_fullscreen_safe(0), m_aspect(0), - m_target(NULL), + m_target(nullptr), m_targetview(0), m_targetorient(0), m_lastclicktime(0), m_lastclickx(0), m_lastclicky(0), - m_renderer(NULL), + m_renderer(nullptr), m_machine(machine) { memset(m_title,0,sizeof(m_title)); @@ -336,9 +403,7 @@ void winwindow_process_events_periodic(running_machine &machine) static BOOL is_mame_window(HWND hwnd) { - win_window_info *window; - - for (window = win_window_list; window != NULL; window = window->m_next) + for (win_window_info *window = win_window_list; window != nullptr; window = window->m_next) if (window->m_hwnd == hwnd) return TRUE; @@ -368,12 +433,12 @@ void winwindow_process_events(running_machine &machine, int ingame, bool nodispa WaitMessage(); // loop over all messages in the queue - while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) + while (PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { // prevent debugger windows from getting messages during reset int dispatch = TRUE && !nodispatch; - if (message.hwnd == NULL || is_mame_window(message.hwnd)) + if (message.hwnd == nullptr || is_mame_window(message.hwnd)) { dispatch = TRUE; switch (message.message) @@ -485,7 +550,7 @@ void winwindow_take_snap(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) { window->m_renderer->save(); } @@ -505,7 +570,7 @@ void winwindow_toggle_fsfx(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) { window->m_renderer->toggle_fsfx(); } @@ -525,7 +590,7 @@ void winwindow_take_video(void) assert(GetCurrentThreadId() == main_threadid); // iterate over windows and request a snap - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) { window->m_renderer->record(); } @@ -545,7 +610,7 @@ void winwindow_toggle_full_screen(void) assert(GetCurrentThreadId() == main_threadid); // if we are in debug mode, never go full screen - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED) return; @@ -553,7 +618,7 @@ void winwindow_toggle_full_screen(void) video_config.windowed = !video_config.windowed; // iterate over windows and toggle their fullscreen state - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) SendMessage(window->m_hwnd, WM_USER_SET_FULLSCREEN, !video_config.windowed, 0); SetForegroundWindow(win_window_list->m_hwnd); } @@ -571,7 +636,7 @@ BOOL winwindow_has_focus(void) win_window_info *window; // see if one of the video windows has focus - for (window = win_window_list; window != NULL; window = window->m_next) + for (window = win_window_list; window != nullptr; window = window->m_next) if (focuswnd == window->m_hwnd) return TRUE; @@ -621,7 +686,7 @@ void winwindow_update_cursor_state(running_machine &machine) ShowCursor(FALSE); // allow cursor to move freely - ClipCursor(NULL); + ClipCursor(nullptr); if (saved_cursor_pos.x != -1 || saved_cursor_pos.y != -1) { SetCursorPos(saved_cursor_pos.x, saved_cursor_pos.y); @@ -639,13 +704,12 @@ void winwindow_update_cursor_state(running_machine &machine) void win_window_info::create(running_machine &machine, int index, osd_monitor_info *monitor, const osd_window_config *config) { - win_window_info *window, *win; + win_window_info *win; assert(GetCurrentThreadId() == main_threadid); // allocate a new window object - window = global_alloc(win_window_info(machine)); - //printf("%d, %d\n", config->width, config->height); + win_window_info *window = global_alloc(win_window_info(machine)); window->m_win_config = *config; window->m_monitor = monitor; window->m_fullscreen = !video_config.windowed; @@ -654,7 +718,7 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in // set main window if (index > 0) { - for (auto w = win_window_list; w != NULL; w = w->m_next) + for (auto w = win_window_list; w != nullptr; w = w->m_next) { if (w->m_index == 0) { @@ -665,7 +729,7 @@ void win_window_info::create(running_machine &machine, int index, osd_monitor_in } // see if we are safe for fullscreen window->m_fullscreen_safe = TRUE; - for (win = win_window_list; win != NULL; win = win->m_next) + for (win = win_window_list; win != nullptr; win = win->m_next) if (win->m_monitor == monitor) window->m_fullscreen_safe = FALSE; @@ -731,7 +795,7 @@ void win_window_info::destroy() assert(GetCurrentThreadId() == main_threadid); // remove us from the list - for (prevptr = &win_window_list; *prevptr != NULL; prevptr = &(*prevptr)->m_next) + for (prevptr = &win_window_list; *prevptr != nullptr; prevptr = &(*prevptr)->m_next) if (*prevptr == this) { *prevptr = this->m_next; @@ -739,7 +803,7 @@ void win_window_info::destroy() } // destroy the window - if (m_hwnd != NULL) + if (m_hwnd != nullptr) SendMessage(m_hwnd, WM_USER_SELF_TERMINATE, 0, 0); // free the render target @@ -783,7 +847,7 @@ void win_window_info::update() } // if we're visible and running and not in the middle of a resize, draw - if (m_hwnd != NULL && m_target != NULL && m_renderer != NULL) + if (m_hwnd != nullptr && m_target != nullptr && m_renderer != nullptr) { bool got_lock = true; @@ -836,7 +900,7 @@ osd_monitor_info *win_window_info::winwindow_video_window_monitor(const osd_rect // in window mode, find the nearest if (!m_fullscreen) { - if (proposed != NULL) + if (proposed != nullptr) { RECT p; p.top = proposed->top(); @@ -879,7 +943,7 @@ static void create_window_class(void) wc.lpszClassName = TEXT("MAME"); wc.hInstance = GetModuleHandleUni(); wc.lpfnWndProc = winwindow_video_window_proc_ui; - wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hCursor = LoadCursor(nullptr, IDC_ARROW); wc.hIcon = LoadIcon(wc.hInstance, MAKEINTRESOURCE(2)); UnregisterClass(wc.lpszClassName, wc.hInstance); @@ -1053,8 +1117,6 @@ int win_window_info::wnd_extra_height() return rect_height(&temprect) - 100; } - - //============================================================ // thread_entry // (window thread) @@ -1065,7 +1127,7 @@ unsigned __stdcall win_window_info::thread_entry(void *param) MSG message; // make a bogus user call to make us a message thread - PeekMessage(&message, NULL, 0, 0, PM_NOREMOVE); + PeekMessage(&message, nullptr, 0, 0, PM_NOREMOVE); // attach our input to the main thread AttachThreadInput(main_threadid, window_threadid, TRUE); @@ -1074,11 +1136,11 @@ unsigned __stdcall win_window_info::thread_entry(void *param) SetEvent(window_thread_ready_event); // run the message pump - while (GetMessage(&message, NULL, 0, 0)) + while (GetMessage(&message, nullptr, 0, 0)) { int dispatch = TRUE; - if ((message.hwnd == NULL) || is_mame_window(message.hwnd)) + if ((message.hwnd == nullptr) || is_mame_window(message.hwnd)) { switch (message.message) { @@ -1160,7 +1222,7 @@ int win_window_info::complete_create() { RECT client; int tempwidth, tempheight; - HMENU menu = NULL; + HMENU menu = nullptr; HDC dc; assert(GetCurrentThreadId() == window_threadid); @@ -1183,11 +1245,11 @@ int win_window_info::complete_create() m_fullscreen ? FULLSCREEN_STYLE : WINDOW_STYLE, monitorbounds.left() + 20, monitorbounds.top() + 20, monitorbounds.left() + 100, monitorbounds.top() + 100, - NULL,//(win_window_list != NULL) ? win_window_list->m_hwnd : NULL, + nullptr,//(win_window_list != nullptr) ? win_window_list->m_hwnd : nullptr, menu, GetModuleHandleUni(), - NULL); - if (m_hwnd == NULL) + nullptr); + if (m_hwnd == nullptr) return 1; // set window #0 as the focus window for all windows, required for D3D & multimonitor @@ -1203,7 +1265,7 @@ int win_window_info::complete_create() // adjust the window position to the initial width/height tempwidth = (m_win_config.width != 0) ? m_win_config.width : 640; tempheight = (m_win_config.height != 0) ? m_win_config.height : 480; - SetWindowPos(m_hwnd, NULL, monitorbounds.left() + 20, monitorbounds.top() + 20, + SetWindowPos(m_hwnd, nullptr, monitorbounds.left() + 20, monitorbounds.top() + 20, monitorbounds.left() + tempwidth + wnd_extra_width(), monitorbounds.top() + tempheight + wnd_extra_height(), SWP_NOZORDER); @@ -1219,9 +1281,14 @@ int win_window_info::complete_create() if (!m_fullscreen || m_fullscreen_safe) { // finish off by trying to initialize DirectX; if we fail, ignore it - m_renderer = draw.create(this); + if (m_renderer != nullptr) + { + global_free(m_renderer); + } + m_renderer = osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this)); if (m_renderer->create()) return 1; + ShowWindow(m_hwnd, SW_SHOW); } @@ -1246,7 +1313,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR win_window_info *window = (win_window_info *)ptr; // we may get called before SetWindowLongPtr is called - if (window != NULL) + if (window != nullptr) { assert(GetCurrentThreadId() == window_threadid); window->update_minmax_state(); @@ -1342,7 +1409,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->m_resize_state = RESIZE_STATE_PENDING; case WM_EXITMENULOOP: winwindow_ui_pause_from_window_thread(window->machine(), FALSE); - InvalidateRect(wnd, NULL, FALSE); + InvalidateRect(wnd, nullptr, FALSE); break; // get min/max info: set the minimum window size @@ -1366,7 +1433,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR rect->bottom = r.bottom(); rect->right = r.right(); } - InvalidateRect(wnd, NULL, FALSE); + InvalidateRect(wnd, nullptr, FALSE); break; } @@ -1380,7 +1447,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR return 1; // most SYSCOMMANDs require us to invalidate the window - InvalidateRect(wnd, NULL, FALSE); + InvalidateRect(wnd, nullptr, FALSE); // handle maximize if (cmd == SC_MAXIMIZE) @@ -1408,15 +1475,11 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR window->machine().schedule_exit(); break; - // destroy: clean up all attached rendering bits and NULL out our hwnd + // destroy: clean up all attached rendering bits and nullptr out our hwnd case WM_DESTROY: - if (!(window->m_renderer == NULL)) - { - window->m_renderer->destroy(); global_free(window->m_renderer); - window->m_renderer = NULL; - } - window->m_hwnd = NULL; + window->m_renderer = nullptr; + window->m_hwnd = nullptr; return DefWindowProc(wnd, message, wparam, lparam); // self redraw: draw ourself in a non-painty way @@ -1467,7 +1530,7 @@ LRESULT CALLBACK win_window_info::video_window_proc(HWND wnd, UINT message, WPAR // set focus: if we're not the primary window, switch back // commented out ATM because this prevents us from resizing secondary windows // case WM_SETFOCUS: -// if (window != win_window_list && win_window_list != NULL) +// if (window != win_window_list && win_window_list != nullptr) // SetFocus(win_window_list->m_hwnd); // break; @@ -1497,10 +1560,10 @@ void win_window_info::draw_video_contents(HDC dc, int update) mtlog_add("draw_video_contents: render lock acquired"); // if we're iconic, don't bother - if (m_hwnd != NULL && !IsIconic(m_hwnd)) + if (m_hwnd != nullptr && !IsIconic(m_hwnd)) { // if no bitmap, just fill - if (m_primlist == NULL) + if (m_primlist == nullptr) { RECT fill; GetClientRect(m_hwnd, &fill); @@ -1786,7 +1849,7 @@ void win_window_info::minimize_window() osd_rect newrect(bounds.left, bounds.top, newsize ); - SetWindowPos(m_hwnd, NULL, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(m_hwnd, nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1808,7 +1871,7 @@ void win_window_info::maximize_window() work.top() + (work.height() - newsize.height()) / 2, newsize); - SetWindowPos(m_hwnd, NULL, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); + SetWindowPos(m_hwnd, nullptr, newrect.left(), newrect.top(), newrect.width(), newrect.height(), SWP_NOZORDER); } @@ -1839,7 +1902,7 @@ void win_window_info::adjust_window_position_after_major_change() // in full screen, make sure it covers the primary display else { - osd_monitor_info *monitor = winwindow_video_window_monitor(NULL); + osd_monitor_info *monitor = winwindow_video_window_monitor(nullptr); newrect = monitor->position_size(); } @@ -1875,9 +1938,8 @@ void win_window_info::set_fullscreen(int fullscreen) m_fullscreen = fullscreen; // kill off the drawers - m_renderer->destroy(); global_free(m_renderer); - m_renderer = NULL; + m_renderer = nullptr; // hide ourself ShowWindow(m_hwnd, SW_HIDE); @@ -1933,7 +1995,12 @@ void win_window_info::set_fullscreen(int fullscreen) { if (video_config.mode != VIDEO_MODE_NONE) ShowWindow(m_hwnd, SW_SHOW); - m_renderer = draw.create(this); + + if (m_renderer != nullptr) + { + delete m_renderer; + } + m_renderer = reinterpret_cast<osd_renderer *>(osd_renderer::make_for_type(video_config.mode, reinterpret_cast<osd_window *>(this))); if (m_renderer->create()) exit(1); } diff --git a/src/osd/windows/window.h b/src/osd/windows/window.h index 6a925494f93..bc3544ba637 100644 --- a/src/osd/windows/window.h +++ b/src/osd/windows/window.h @@ -9,6 +9,12 @@ #ifndef __WIN_WINDOW__ #define __WIN_WINDOW__ +// standard windows headers +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#include <windowsx.h> +#include <mmsystem.h> + #include <mutex> #include "video.h" #include "render.h" diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index a7fda58c835..5277fcec3d0 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -58,15 +58,15 @@ class dynamic_bind public: // constructor which looks up the function dynamic_bind(const TCHAR *dll, const char *symbol) - : m_function(NULL) + : m_function(nullptr) { HMODULE module = LoadLibrary(dll); - if (module != NULL) + if (module != nullptr) m_function = reinterpret_cast<_FunctionPtr>(GetProcAddress(module, symbol)); } - // bool to test if the function is NULL or not - operator bool() const { return (m_function != NULL); } + // bool to test if the function is nullptr or not + operator bool() const { return (m_function != nullptr); } // dereference to get the underlying pointer _FunctionPtr operator *() const { return m_function; } @@ -132,14 +132,14 @@ private: bool parse_sym_line(const char *line, FPTR &address, std::string &symbol); bool parse_map_line(const char *line, FPTR &address, std::string &symbol); void scan_cache_for_address(FPTR address); - void format_symbol(const char *name, UINT32 displacement, const char *filename = NULL, int linenumber = 0); + void format_symbol(const char *name, UINT32 displacement, const char *filename = nullptr, int linenumber = 0); static FPTR get_text_section_base(); struct cache_entry { cache_entry(FPTR address, const char *symbol) : - m_next(NULL), m_address(address), m_name(symbol) { } + m_next(nullptr), m_address(address), m_name(symbol) { } cache_entry *next() const { return m_next; } cache_entry * m_next; @@ -206,11 +206,11 @@ public: char buffer[1024]; // if we are in fullscreen mode, go to windowed mode - if ((video_config.windowed == 0) && (win_window_list != NULL)) + if ((video_config.windowed == 0) && (win_window_list != nullptr)) winwindow_toggle_full_screen(); vsnprintf(buffer, ARRAY_LENGTH(buffer), msg, args); - win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK); + win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : nullptr, buffer, emulator_info::get_appname(), MB_OK); } else chain_output(channel, msg, args); @@ -242,8 +242,8 @@ static running_machine *g_current_machine; static int timeresult = !TIMERR_NOERROR; static TIMECAPS timecaps; -static sampling_profiler *profiler = NULL; -static symbol_manager *symbols = NULL; +static sampling_profiler *profiler = nullptr; +static symbol_manager *symbols = nullptr; bool stack_walker::s_initialized = false; @@ -267,23 +267,23 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info); const options_entry windows_options::s_option_entries[] = { // performance options - { NULL, NULL, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" }, { WINOPTION_PRIORITY "(-15-1)", "0", OPTION_INTEGER, "thread priority for the main game thread; range from -15 to 1" }, { WINOPTION_PROFILE, "0", OPTION_INTEGER, "enables profiling, specifying the stack depth to track" }, // video options - { NULL, NULL, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "WINDOWS VIDEO OPTIONS" }, { WINOPTION_MENU, "0", OPTION_BOOLEAN, "enables menu bar if available by UI implementation" }, // DirectDraw-specific options - { NULL, NULL, OPTION_HEADER, "DIRECTDRAW-SPECIFIC OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "DIRECTDRAW-SPECIFIC OPTIONS" }, { WINOPTION_HWSTRETCH ";hws", "1", OPTION_BOOLEAN, "enables hardware stretching" }, // post-processing options - { NULL, NULL, OPTION_HEADER, "DIRECT3D POST-PROCESSING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "DIRECT3D POST-PROCESSING OPTIONS" }, { WINOPTION_HLSL_ENABLE";hlsl", "0", OPTION_BOOLEAN, "enables HLSL post-processing (PS3.0 required)" }, { WINOPTION_HLSLPATH, "hlsl", OPTION_STRING, "path to hlsl files" }, - { WINOPTION_HLSL_WRITE, NULL, OPTION_STRING, "enables HLSL AVI writing (huge disk bandwidth suggested)" }, + { WINOPTION_HLSL_WRITE, nullptr, OPTION_STRING, "enables HLSL AVI writing (huge disk bandwidth suggested)" }, { WINOPTION_HLSL_SNAP_WIDTH, "2048", OPTION_STRING, "HLSL upscaled-snapshot width" }, { WINOPTION_HLSL_SNAP_HEIGHT, "1536", OPTION_STRING, "HLSL upscaled-snapshot height" }, { WINOPTION_SHADOW_MASK_TILE_MODE, "0", OPTION_INTEGER, "shadow mask tile mode (0 for screen based, 1 for source based)" }, @@ -324,7 +324,7 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_FLOOR";fs_floor", "0.05,0.05,0.05", OPTION_STRING, "signal floor level" }, { WINOPTION_PHOSPHOR";fs_phosphor", "0.4,0.4,0.4", OPTION_STRING, "phosphorescence decay rate (0.0 is instant, 1.0 is forever)" }, /* NTSC simulation below this line */ - { NULL, NULL, OPTION_HEADER, "NTSC POST-PROCESSING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "NTSC POST-PROCESSING OPTIONS" }, { WINOPTION_YIQ_ENABLE";yiq", "0", OPTION_BOOLEAN, "enables YIQ-space HLSL post-processing" }, { WINOPTION_YIQ_JITTER";yiqj", "0.0", OPTION_FLOAT, "Jitter for the NTSC signal processing" }, { WINOPTION_YIQ_CCVALUE";yiqcc", "3.57954545", OPTION_FLOAT, "Color Carrier frequency for NTSC signal processing" }, @@ -339,11 +339,11 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_YIQ_SCAN_TIME";yiqsc", "52.6", OPTION_FLOAT, "Horizontal scanline duration for NTSC signal processing (in usec)" }, { WINOPTION_YIQ_PHASE_COUNT";yiqp", "2", OPTION_INTEGER, "Phase Count value for NTSC signal processing" }, /* Vector simulation below this line */ - { NULL, NULL, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "VECTOR POST-PROCESSING OPTIONS" }, { WINOPTION_VECTOR_LENGTH_SCALE";veclength", "0.5", OPTION_FLOAT, "How much length affects vector fade" }, { WINOPTION_VECTOR_LENGTH_RATIO";vecsize", "500.0", OPTION_FLOAT, "Vector fade length (4.0 - vectors fade the most at and above 4 pixels, etc.)" }, /* Bloom below this line */ - { NULL, NULL, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "BLOOM POST-PROCESSING OPTIONS" }, { WINOPTION_BLOOM_BLEND_MODE, "0", OPTION_INTEGER, "bloom blend mode (0 for addition, 1 for darken)" }, { WINOPTION_BLOOM_SCALE, "0.25", OPTION_FLOAT, "Intensity factor for bloom" }, { WINOPTION_BLOOM_OVERDRIVE, "1.0,1.0,1.0", OPTION_STRING, "Overdrive factor for bloom" }, @@ -360,18 +360,18 @@ const options_entry windows_options::s_option_entries[] = { WINOPTION_BLOOM_LEVEL10_WEIGHT, "0.01", OPTION_FLOAT, "Bloom level 10 (1x1 target) weight" }, // full screen options - { NULL, NULL, OPTION_HEADER, "FULL SCREEN OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "FULL SCREEN OPTIONS" }, { WINOPTION_TRIPLEBUFFER ";tb", "0", OPTION_BOOLEAN, "enables triple buffering" }, { WINOPTION_FULLSCREENBRIGHTNESS ";fsb(0.1-2.0)", "1.0", OPTION_FLOAT, "brightness value in full screen mode" }, { WINOPTION_FULLSCREENCONTRAST ";fsc(0.1-2.0)", "1.0", OPTION_FLOAT, "contrast value in full screen mode" }, { WINOPTION_FULLSCREENGAMMA ";fsg(0.1-3.0)", "1.0", OPTION_FLOAT, "gamma value in full screen mode" }, // input options - { NULL, NULL, OPTION_HEADER, "INPUT DEVICE OPTIONS" }, + { nullptr, nullptr, OPTION_HEADER, "INPUT DEVICE OPTIONS" }, { WINOPTION_GLOBAL_INPUTS ";global_inputs", "0", OPTION_BOOLEAN, "enables global inputs" }, { WINOPTION_DUAL_LIGHTGUN ";dual", "0", OPTION_BOOLEAN, "enables dual lightgun input" }, - { NULL } + { nullptr } }; //************************************************************************** @@ -387,9 +387,9 @@ int main(int argc, char *argv[]) { // use small output buffers on non-TTYs (i.e. pipes) if (!isatty(fileno(stdout))) - setvbuf(stdout, (char *) NULL, _IOFBF, 64); + setvbuf(stdout, (char *) nullptr, _IOFBF, 64); if (!isatty(fileno(stderr))) - setvbuf(stderr, (char *) NULL, _IOFBF, 64); + setvbuf(stderr, (char *) nullptr, _IOFBF, 64); // initialize common controls InitCommonControls(); @@ -432,7 +432,7 @@ int main(int argc, char *argv[]) osd_output::pop(&winerror); } // free symbols - symbols = NULL; + symbols = nullptr; return result; } @@ -467,7 +467,7 @@ static BOOL WINAPI control_handler(DWORD type) // if we don't have a machine yet, or if we are handling ctrl+c/ctrl+break, // just terminate hard, without throwing or handling any atexit stuff - if (g_current_machine == NULL || type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT) + if (g_current_machine == nullptr || type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT) { fprintf(stderr, ", exiting\n"); TerminateProcess(GetCurrentProcess(), MAMERR_FATALERROR); @@ -503,7 +503,9 @@ static void output_oslog(const running_machine &machine, const char *buffer) //============================================================ windows_osd_interface::windows_osd_interface(windows_options &options) -: osd_common_t(options), m_options(options) + : osd_common_t(options) + , m_options(options) + , m_sliders(nullptr) { } @@ -523,10 +525,10 @@ windows_osd_interface::~windows_osd_interface() void windows_osd_interface::video_register() { - video_options_add("gdi", NULL); - video_options_add("d3d", NULL); - video_options_add("bgfx", NULL); - //video_options_add("auto", NULL); // making d3d video default one + video_options_add("gdi", nullptr); + video_options_add("d3d", nullptr); + video_options_add("bgfx", nullptr); + //video_options_add("auto", nullptr); // making d3d video default one } //============================================================ @@ -587,7 +589,7 @@ void windows_osd_interface::init(running_machine &machine) // notify listeners of screen configuration std::string tempstring; - for (win_window_info *info = win_window_list; info != NULL; info = info->m_next) + for (win_window_info *info = win_window_list; info != nullptr; info = info->m_next) { strprintf(tempstring, "Orientation(%s)", info->m_monitor->devicename()); machine.output().set_value(tempstring.c_str(), info->m_targetorient); @@ -607,12 +609,12 @@ void windows_osd_interface::init(running_machine &machine) int watchdog = options.watchdog(); if (watchdog != 0) { - watchdog_reset_event = CreateEvent(NULL, FALSE, FALSE, NULL); - assert_always(watchdog_reset_event != NULL, "Failed to create watchdog reset event"); - watchdog_exit_event = CreateEvent(NULL, TRUE, FALSE, NULL); - assert_always(watchdog_exit_event != NULL, "Failed to create watchdog exit event"); - watchdog_thread = CreateThread(NULL, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, NULL); - assert_always(watchdog_thread != NULL, "Failed to create watchdog thread"); + watchdog_reset_event = CreateEvent(nullptr, FALSE, FALSE, nullptr); + assert_always(watchdog_reset_event != nullptr, "Failed to create watchdog reset event"); + watchdog_exit_event = CreateEvent(nullptr, TRUE, FALSE, nullptr); + assert_always(watchdog_exit_event != nullptr, "Failed to create watchdog exit event"); + watchdog_thread = CreateThread(nullptr, 0, watchdog_thread_entry, (LPVOID)(FPTR)watchdog, 0, nullptr); + assert_always(watchdog_thread != nullptr, "Failed to create watchdog thread"); } // create and start the profiler @@ -637,7 +639,7 @@ void windows_osd_interface::init(running_machine &machine) void windows_osd_interface::osd_exit() { // no longer have a machine - g_current_machine = NULL; + g_current_machine = nullptr; // cleanup sockets win_cleanup_sockets(); @@ -645,20 +647,20 @@ void windows_osd_interface::osd_exit() osd_common_t::osd_exit(); // take down the watchdog thread if it exists - if (watchdog_thread != NULL) + if (watchdog_thread != nullptr) { SetEvent(watchdog_exit_event); WaitForSingleObject(watchdog_thread, INFINITE); CloseHandle(watchdog_reset_event); CloseHandle(watchdog_exit_event); CloseHandle(watchdog_thread); - watchdog_reset_event = NULL; - watchdog_exit_event = NULL; - watchdog_thread = NULL; + watchdog_reset_event = nullptr; + watchdog_exit_event = nullptr; + watchdog_thread = nullptr; } // stop the profiler - if (profiler != NULL) + if (profiler != nullptr) { profiler->stop(); profiler->print_results(*symbols); @@ -686,7 +688,7 @@ void winmain_dump_stack() // walk the stack while (walker.unwind()) - fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == NULL) ? "" : symbols->symbol_for_address(walker.ip())); + fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip())); } @@ -751,7 +753,7 @@ static DWORD WINAPI watchdog_thread_entry(LPVOID lpParameter) void winmain_watchdog_ping(void) { // if we have a watchdog, reset it - if (watchdog_reset_event != NULL) + if (watchdog_reset_event != nullptr) SetEvent(watchdog_reset_event); } @@ -864,7 +866,7 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info) // walk the stack while (walker.unwind()) - fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == NULL) ? "" : symbols->symbol_for_address(walker.ip())); + fprintf(stderr, " %p: %p%s\n", (void *)walker.frame(), (void *)walker.ip(), (symbols == nullptr) ? "" : symbols->symbol_for_address(walker.ip())); // flush stderr, so the data is actually written when output is being redirected fflush(stderr); @@ -899,7 +901,7 @@ stack_walker::stack_walker() // initialize the symbols if (!s_initialized && m_sym_initialize && m_stack_walk_64 && m_sym_function_table_access_64 && m_sym_get_module_base_64) { - (*m_sym_initialize)(m_process, NULL, TRUE); + (*m_sym_initialize)(m_process, nullptr, TRUE); s_initialized = true; } } @@ -973,9 +975,9 @@ bool stack_walker::unwind() if (s_initialized) { #ifdef PTR64 - return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_AMD64, m_process, m_thread, &m_stackframe, &m_context, NULL, *m_sym_function_table_access_64, *m_sym_get_module_base_64, NULL); + return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_AMD64, m_process, m_thread, &m_stackframe, &m_context, nullptr, *m_sym_function_table_access_64, *m_sym_get_module_base_64, nullptr); #else - return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_I386, m_process, m_thread, &m_stackframe, &m_context, NULL, *m_sym_function_table_access_64, *m_sym_get_module_base_64, NULL); + return (*m_stack_walk_64)(IMAGE_FILE_MACHINE_I386, m_process, m_thread, &m_stackframe, &m_context, nullptr, *m_sym_function_table_access_64, *m_sym_get_module_base_64, nullptr); #endif } @@ -1054,7 +1056,7 @@ const char *symbol_manager::symbol_for_address(FPTR address) if (!query_system_for_address(address)) { // if that fails, scan the cache if we have one - if (m_cache.first() != NULL) + if (m_cache.first() != nullptr) scan_cache_for_address(address); // or else try to open a sym/map file and find it there @@ -1111,20 +1113,20 @@ bool symbol_manager::query_system_for_address(FPTR address) void symbol_manager::scan_file_for_address(FPTR address, bool create_cache) { bool is_symfile = false; - FILE *srcfile = NULL; + FILE *srcfile = nullptr; #ifdef __GNUC__ // see if we have a symbol file (gcc only) srcfile = fopen(m_symfile.c_str(), "r"); - is_symfile = (srcfile != NULL); + is_symfile = (srcfile != nullptr); #endif // if not, see if we have a map file - if (srcfile == NULL) + if (srcfile == nullptr) srcfile = fopen(m_mapfile.c_str(), "r"); // if not, fail - if (srcfile == NULL) + if (srcfile == nullptr) return; // reset the best info @@ -1177,7 +1179,7 @@ void symbol_manager::scan_cache_for_address(FPTR address) FPTR best_addr = 0; // walk the cache, looking for valid entries - for (cache_entry *entry = m_cache.first(); entry != NULL; entry = entry->next()) + for (cache_entry *entry = m_cache.first(); entry != nullptr; entry = entry->next()) // if this is the best one so far, remember it if (entry->m_address <= address && entry->m_address > best_addr) @@ -1210,7 +1212,7 @@ bool symbol_manager::parse_sym_line(const char *line, FPTR &address, std::string // first look for a (ty) entry const char *type = strstr(line, "(ty 20)"); - if (type == NULL) + if (type == nullptr) return false; // scan forward in the line to find the address @@ -1297,7 +1299,7 @@ void symbol_manager::format_symbol(const char *name, UINT32 displacement, const strcatprintf(m_buffer, "+0x%04x", (UINT32)displacement); // append file/line if present - if (filename != NULL) + if (filename != nullptr) strcatprintf(m_buffer, ", %s:%d", filename, linenumber); // close up the string @@ -1317,18 +1319,18 @@ FPTR symbol_manager::get_text_section_base() // start with the image base PVOID base = reinterpret_cast<PVOID>(GetModuleHandleUni()); - assert(base != NULL); + assert(base != nullptr); // make sure we have the functions we need if (image_nt_header && image_rva_to_section) { // get the NT header PIMAGE_NT_HEADERS headers = (*image_nt_header)(base); - assert(headers != NULL); + assert(headers != nullptr); // look ourself up (assuming we are in the .text section) PIMAGE_SECTION_HEADER section = (*image_rva_to_section)(headers, base, reinterpret_cast<FPTR>(get_text_section_base) - reinterpret_cast<FPTR>(base)); - if (section != NULL) + if (section != nullptr) return reinterpret_cast<FPTR>(base) + section->VirtualAddress; } @@ -1347,8 +1349,8 @@ FPTR symbol_manager::get_text_section_base() //------------------------------------------------- sampling_profiler::sampling_profiler(UINT32 max_seconds, UINT8 stack_depth = 0) - : m_target_thread(NULL), - m_thread(NULL), + : m_target_thread(nullptr), + m_thread(nullptr), m_thread_id(0), m_thread_exit(false), m_stack_depth(stack_depth), @@ -1384,8 +1386,8 @@ void sampling_profiler::start() m_thread_exit = false; // start the thread - m_thread = CreateThread(NULL, 0, thread_entry, (LPVOID)this, 0, &m_thread_id); - assert_always(m_thread != NULL, "Failed to create profiler thread\n"); + m_thread = CreateThread(nullptr, 0, thread_entry, (LPVOID)this, 0, &m_thread_id); + assert_always(m_thread != nullptr, "Failed to create profiler thread\n"); // max out the priority SetThreadPriority(m_thread, THREAD_PRIORITY_TIME_CRITICAL); @@ -1553,7 +1555,7 @@ void sampling_profiler::thread_run() *count += 1; } - // fill in any missing parts with NULLs + // fill in any missing parts with nulls for (; frame <= m_stack_depth; frame++) *m_buffer_ptr++ = 0; diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index a17f3a77f1f..666c533e182 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -246,7 +246,7 @@ public: virtual void update(bool skip_redraw) override; // video overridables - virtual void *get_slider_list() override; + virtual slider_state *get_slider_list() override; // input overridables virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) override; @@ -271,7 +271,11 @@ public: private: virtual void osd_exit() override; - windows_options &m_options; + void build_slider_list(); + void update_slider_list(); + + windows_options & m_options; + slider_state * m_sliders; static const int DEFAULT_FONT_HEIGHT = 200; }; |