From 96c6dd334432aa2ed8efd5f46ab60eb072b30c7c Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 26 Mar 2016 01:17:01 -0400 Subject: Allow software selected from UI to install slot defaults Prevent clang warning about unused variable in BGFX target_manager (nw) --- src/emu/emuopts.cpp | 63 ++++++++++++++++++++++----- src/emu/mame.cpp | 33 +------------- src/osd/modules/render/bgfx/targetmanager.cpp | 1 + 3 files changed, 55 insertions(+), 42 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 35a8fae6333..2da58c5e177 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -376,6 +376,9 @@ void emu_options::remove_device_options() remove_entry(*curentry); } + // take also care of ramsize options + set_default_value(OPTION_RAMSIZE, ""); + // reset counters m_slot_options = 0; m_device_options = 0; @@ -550,17 +553,57 @@ void emu_options::set_system_name(const char *name) set_value(OPTION_SYSTEMNAME, name, OPTION_PRIORITY_CMDLINE, error); assert(error.empty()); - // remove any existing device options and then add them afresh + // remove any existing device options remove_device_options(); - while (add_slot_options()) { } - - // then add the options - add_device_options(); - int num; - do { - num = options_count(); - update_slot_options(); - } while(num != options_count()); + const game_driver *cursystem = system(); + if (cursystem == nullptr) + return; + + if (software_name()) + { + std::string sw_load(software_name()); + std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string; + int left = sw_load.find_first_of(':'); + int middle = sw_load.find_first_of(':', left + 1); + int right = sw_load.find_last_of(':'); + + sw_list = sw_load.substr(0, left - 1); + sw_name = sw_load.substr(left + 1, middle - left - 1); + sw_part = sw_load.substr(middle + 1, right - middle - 1); + sw_instance = sw_load.substr(right + 1); + sw_load.assign(sw_load.substr(0, right)); + + // look up the software part + machine_config config(*cursystem, *this); + software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); + software_info *swinfo = swlist->find(sw_name.c_str()); + software_part *swpart = swinfo->find_part(sw_part.c_str()); + + // then add the options + while (add_slot_options(swpart)) { } + add_device_options(); + + set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (exists(sw_instance.c_str())) + set_value(sw_instance.c_str(), sw_load.c_str(), OPTION_PRIORITY_SUBCMD, error_string); + + int num; + do { + num = options_count(); + update_slot_options(swpart); + } while(num != options_count()); + } + else + { + // add the options afresh + while (add_slot_options()) { } + add_device_options(); + int num; + do { + num = options_count(); + update_slot_options(); + } while(num != options_count()); + } } } diff --git a/src/emu/mame.cpp b/src/emu/mame.cpp index 9232ee9443f..9e872c7a96f 100644 --- a/src/emu/mame.cpp +++ b/src/emu/mame.cpp @@ -251,40 +251,9 @@ int machine_manager::execute() // check the state of the machine if (m_new_driver_pending) { - std::string old_system_name(m_options.system_name()); - bool new_system = (old_system_name.compare(m_new_driver_pending->name)!=0); - // first: if we scheduled a new system, remove device options of the old system - // notice that, if we relaunch the same system, there is no effect on the emulation - if (new_system) - m_options.remove_device_options(); - // second: set up new system name (and the related device options) + // set up new system name and adjust device options accordingly m_options.set_system_name(m_new_driver_pending->name); - // third: if we scheduled a new system, take also care of ramsize options - if (new_system) - { - std::string error_string; - m_options.set_value(OPTION_RAMSIZE, "", OPTION_PRIORITY_CMDLINE, error_string); - } firstrun = true; - if (m_options.software_name()) - { - std::string sw_load(m_options.software_name()); - std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string; - int left = sw_load.find_first_of(':'); - int middle = sw_load.find_first_of(':', left + 1); - int right = sw_load.find_last_of(':'); - - sw_list = sw_load.substr(0, left - 1); - sw_name = sw_load.substr(left + 1, middle - left - 1); - sw_part = sw_load.substr(middle + 1, right - middle - 1); - sw_instance = sw_load.substr(right + 1); - sw_load.assign(sw_load.substr(0, right)); - - char arg[] = "mame"; - char *argv = &arg[0]; - m_options.set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - m_options.parse_slot_devices(1, &argv, option_errors, sw_instance.c_str(), sw_load.c_str()); - } } else { diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp index 7702d0700b4..9820f237a48 100644 --- a/src/osd/modules/render/bgfx/targetmanager.cpp +++ b/src/osd/modules/render/bgfx/targetmanager.cpp @@ -26,6 +26,7 @@ target_manager::target_manager(osd_options& options, texture_manager& textures) , m_options(options) , m_screen_count(0) { + (void)m_options; // prevent carping about unused variable } target_manager::~target_manager() -- cgit v1.2.3 From dee9b2d34a4826c1b9d83e2b5602c2093f7eb4bc Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 26 Mar 2016 01:43:37 -0400 Subject: Remember to load software when the system name doesn't change (nw) --- src/emu/emuopts.cpp | 94 ++++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 2da58c5e177..38bcee35467 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -544,9 +544,10 @@ void emu_options::set_system_name(const char *name) { // remember the original system name std::string old_system_name(system_name()); + bool new_system = old_system_name.compare(name)!=0; // if the system name changed, fix up the device options - if (old_system_name.compare(name)!=0) + if (new_system) { // first set the new name std::string error; @@ -555,55 +556,60 @@ void emu_options::set_system_name(const char *name) // remove any existing device options remove_device_options(); - const game_driver *cursystem = system(); - if (cursystem == nullptr) - return; + } - if (software_name()) + // get the new system + const game_driver *cursystem = system(); + if (cursystem == nullptr) + return; + + if (software_name()) + { + std::string sw_load(software_name()); + std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string; + int left = sw_load.find_first_of(':'); + int middle = sw_load.find_first_of(':', left + 1); + int right = sw_load.find_last_of(':'); + + sw_list = sw_load.substr(0, left - 1); + sw_name = sw_load.substr(left + 1, middle - left - 1); + sw_part = sw_load.substr(middle + 1, right - middle - 1); + sw_instance = sw_load.substr(right + 1); + sw_load.assign(sw_load.substr(0, right)); + + // look up the software part + machine_config config(*cursystem, *this); + software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); + software_info *swinfo = swlist->find(sw_name.c_str()); + software_part *swpart = swinfo->find_part(sw_part.c_str()); + + // then add the options + if (new_system) { - std::string sw_load(software_name()); - std::string sw_list, sw_name, sw_part, sw_instance, option_errors, error_string; - int left = sw_load.find_first_of(':'); - int middle = sw_load.find_first_of(':', left + 1); - int right = sw_load.find_last_of(':'); - - sw_list = sw_load.substr(0, left - 1); - sw_name = sw_load.substr(left + 1, middle - left - 1); - sw_part = sw_load.substr(middle + 1, right - middle - 1); - sw_instance = sw_load.substr(right + 1); - sw_load.assign(sw_load.substr(0, right)); - - // look up the software part - machine_config config(*cursystem, *this); - software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); - software_info *swinfo = swlist->find(sw_name.c_str()); - software_part *swpart = swinfo->find_part(sw_part.c_str()); - - // then add the options while (add_slot_options(swpart)) { } add_device_options(); + } - set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - if (exists(sw_instance.c_str())) - set_value(sw_instance.c_str(), sw_load.c_str(), OPTION_PRIORITY_SUBCMD, error_string); + set_value(OPTION_SOFTWARENAME, sw_name.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (exists(sw_instance.c_str())) + set_value(sw_instance.c_str(), sw_load.c_str(), OPTION_PRIORITY_SUBCMD, error_string); - int num; - do { - num = options_count(); - update_slot_options(swpart); - } while(num != options_count()); - } - else - { - // add the options afresh - while (add_slot_options()) { } - add_device_options(); - int num; - do { - num = options_count(); - update_slot_options(); - } while(num != options_count()); - } + int num; + do { + num = options_count(); + update_slot_options(swpart); + } while(num != options_count()); + } + else if (new_system) + { + // add the options afresh + while (add_slot_options()) { } + add_device_options(); + int num; + do { + num = options_count(); + update_slot_options(); + } while(num != options_count()); } } -- cgit v1.2.3 From c7f6012372f8c2f4245b8463c60674dd24723496 Mon Sep 17 00:00:00 2001 From: rootfather Date: Sat, 26 Mar 2016 10:47:02 +0100 Subject: Update German strings.po --- language/German/strings.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/language/German/strings.po b/language/German/strings.po index cdd4a7d0c44..b46aca2b54b 100644 --- a/language/German/strings.po +++ b/language/German/strings.po @@ -9,7 +9,7 @@ msgstr "" "Project-Id-Version: MAME\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2016-03-25 23:59+0100\n" -"PO-Revision-Date: 2016-03-25 12:00+0100\n" +"PO-Revision-Date: 2016-03-26 10:46+0100\n" "Last-Translator: Lothar Serra Mari \n" "Language-Team: MAME Language Team\n" "Language: de\n" @@ -445,7 +445,7 @@ msgstr "Mamespielstand" #: src/emu/ui/datmenu.cpp:294 src/emu/ui/selgame.cpp:44 msgid "Gameinit" -msgstr "" +msgstr "Gameinit" #: src/emu/ui/datmenu.cpp:296 src/emu/ui/selgame.cpp:43 msgid "Command" @@ -1030,7 +1030,7 @@ msgstr "Im TXT-Format exportieren" #: src/emu/ui/miscmenu.cpp:854 msgid "Dummy" -msgstr "Dummy" +msgstr "Platzhalter" #: src/emu/ui/miscmenu.cpp:856 msgid "Save machine configuration" -- cgit v1.2.3 From 3921d6bf8b39fdf6591d978e09077f1ffef67353 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sat, 26 Mar 2016 15:44:28 +0100 Subject: Improved documentation for SMS software and input devices [Enik] --- hash/sms.xml | 105 ++++++++++++++++++++++++++++++++-- src/devices/bus/sms_ctrl/joypad.cpp | 17 +++++- src/devices/bus/sms_ctrl/joypad.h | 2 +- src/devices/bus/sms_ctrl/lphaser.cpp | 8 +++ src/devices/bus/sms_ctrl/paddle.cpp | 19 +++++- src/devices/bus/sms_ctrl/paddle.h | 2 +- src/devices/bus/sms_ctrl/rfu.cpp | 18 ++++-- src/devices/bus/sms_ctrl/rfu.h | 2 +- src/devices/bus/sms_ctrl/sports.cpp | 58 ++++++++++++------- src/devices/bus/sms_ctrl/sportsjp.cpp | 23 ++++++-- src/devices/bus/sms_exp/gender.cpp | 14 ++--- 11 files changed, 221 insertions(+), 47 deletions(-) diff --git a/hash/sms.xml b/hash/sms.xml index 4a5e8e0bc2d..80d88195eee 100644 --- a/hash/sms.xml +++ b/hash/sms.xml @@ -252,6 +252,7 @@ + @@ -392,6 +393,7 @@ + Altered Beast (Euro, USA, Bra) 1989 @@ -534,6 +536,7 @@ 1990 Sega + @@ -665,6 +668,7 @@ + Alien Syndrome (Euro, USA, Bra) 1987 @@ -752,6 +756,7 @@ Back to the Future Part III (Euro) 1992 Image Works + @@ -1022,6 +1027,7 @@ + Blade Eagle (USA, Prototype) 1988 @@ -1245,6 +1251,7 @@ + California Games (Euro, USA, Bra) 1989 @@ -1278,6 +1285,7 @@ + Captain Silver (USA) 1988 @@ -1290,6 +1298,7 @@ + Casino Games (Euro, USA) 1989 @@ -1505,6 +1514,7 @@ + Cloud Master (Euro, USA) 1989 @@ -1603,10 +1613,12 @@ + Cosmic Spacehead (Euro) 1993 Codemasters + @@ -1639,6 +1651,7 @@ + Cyborg Hunter (Euro, USA, Bra) 1988 @@ -1719,6 +1732,7 @@ + Double Dragon (Kor) 198? @@ -1828,6 +1842,7 @@ + Doki Doki Penguin Land - Uchuu Daibouken (Jpn, Prototype) 1987 @@ -2139,10 +2154,12 @@ + The Excellent Dizzy Collection (Euro, USA, Prototype) 19?? Codemasters + @@ -2249,10 +2266,12 @@ + Fantastic Dizzy (Euro) 1993 Codemasters + @@ -2262,6 +2281,7 @@ + Fantasy Zone II - The Tears of Opa-Opa (Euro, USA, Bra) 1987 @@ -2350,6 +2370,7 @@ + Fantasy Zone - The Maze (Euro, USA) 1987 @@ -2547,6 +2568,8 @@ + + @@ -2569,6 +2592,7 @@ + Galaxy Force (Euro, Bra) 1989 @@ -2585,6 +2609,7 @@ + Galaxy Force (USA) 1989 @@ -2597,6 +2622,7 @@ + Game Box Série Esportes Radicais (Bra) 19?? @@ -2634,6 +2660,8 @@ 1987 Sega + + @@ -2778,6 +2806,7 @@ + Global Defense (Euro, USA) 1987 @@ -2793,6 +2822,7 @@ + Global Defense (Euro, USA, Prototype) 1987 @@ -2816,6 +2846,7 @@ + Golfamania (Euro, Bra) 1990 @@ -2836,6 +2867,7 @@ + Golfamania (Prototype) 1990 @@ -2850,6 +2882,7 @@ + Golvellius (Euro, USA) 1988 @@ -2955,6 +2988,7 @@ + Great Golf (Euro, USA, v1.0) 1987 @@ -3008,6 +3042,8 @@ 1987 Sega + + @@ -3270,6 +3306,7 @@ + Hwarang Ui Geom (Kor) 1988 @@ -3484,6 +3521,7 @@ + Kenseiden (Euro, USA, Bra) 1988 @@ -3631,6 +3669,7 @@ + Laser Ghost (Euro) 1991 @@ -3695,10 +3734,12 @@ + Line of Fire (Euro, Bra, Kor) 1991 Sega + @@ -3720,6 +3761,7 @@ + Lord of the Sword (Euro, USA, Bra) 1988 @@ -3881,6 +3923,7 @@ 1986 Sega + @@ -3897,6 +3940,7 @@ 1986 Sega + @@ -3931,6 +3975,7 @@ + Maze Hunter 3-D (Euro, USA, Bra) 1988 @@ -3972,6 +4017,7 @@ + @@ -4022,10 +4068,12 @@ + Micro Machines (Euro) 1994 Codemasters + @@ -4046,6 +4094,7 @@ + Miracle Warriors - Seal of the Dark Lord (Euro, USA, Bra) 1987 @@ -4061,6 +4110,7 @@ + Miracle Warriors - Seal of the Dark Lord (Prototype) 1987 @@ -4075,11 +4125,13 @@ + Missile Defense 3-D (Euro, USA, Bra) 19?? Sega + @@ -4129,6 +4181,7 @@ + Mônica no Castelo do Dragao (Bra) 1991 @@ -4457,6 +4510,7 @@ 1990 Sega + @@ -4476,7 +4530,7 @@ - + Out Run (World) 1987 @@ -4494,6 +4548,7 @@ + Out Run 3-D (Euro, Bra) 1991 @@ -4560,6 +4615,7 @@ + Parlour Games (Euro, USA) 1987 @@ -4600,6 +4656,7 @@ + Penguin Land (Euro, USA) 1987 @@ -4680,6 +4737,7 @@ + Poseidon Wars 3-D (Euro, USA, Bra) 1988 @@ -4695,6 +4753,7 @@ + Power Strike (Euro, Bra, Kor) 1988 @@ -4866,6 +4925,7 @@ + @@ -5026,6 +5086,7 @@ 1988 Sega + @@ -5036,6 +5097,7 @@ + Rampage (Euro, USA, Bra) 1988 @@ -5063,6 +5125,7 @@ + Rastan (Euro, USA, Bra) 1988 @@ -5125,11 +5188,13 @@ + Rescue Mission (Euro, USA, Bra) 1988 Sega + @@ -5236,6 +5301,7 @@ + R-Type (Prototype) 1988 @@ -5381,6 +5447,7 @@ + Scramble Spirits (Euro, Bra) 1989 @@ -5438,6 +5505,7 @@ Sega Graphic Board (Jpn, Prototype v2.0) 1987 Sega + @@ -5528,6 +5596,7 @@ + Shanghai (Euro, USA) 1988 @@ -5540,6 +5609,7 @@ + Shanghai (Prototype) 1988 @@ -5566,6 +5636,7 @@ + Space Harrier 3-D (Euro, USA, Bra) 1988 @@ -5616,6 +5687,7 @@ + Shinobi (Euro, USA, Bra, v1) 1988 @@ -5648,6 +5720,7 @@ 1987 Sega + @@ -5944,6 +6017,7 @@ 1992 Sega + @@ -5991,6 +6065,7 @@ + SpellCaster (Euro, USA, Bra) 1988 @@ -6039,6 +6114,8 @@ 1987 Sega + + @@ -6046,7 +6123,6 @@ - Sports Pad Soccer (Jpn) 1988 @@ -6054,6 +6130,8 @@ + + @@ -6284,10 +6362,13 @@ + Super Arkanoid (Kor) 1989 HiCom + @@ -6396,7 +6477,7 @@ - + Super Racing (Jpn) 1988 @@ -6528,6 +6609,7 @@ + Tennis Ace (Euro, Bra) 1989 @@ -6591,6 +6673,7 @@ + Thunder Blade (Euro, USA, Bra) 1988 @@ -6621,6 +6704,7 @@ + Time Soldiers (Euro, USA, Bra) 1989 @@ -6733,6 +6817,7 @@ + Turma da Mônica em O Resgate (Bra) 1993 @@ -6760,6 +6845,7 @@ + Ultima IV - Quest of the Avatar (Euro, Bra) 1990 @@ -6780,6 +6866,7 @@ + Ultima IV - Quest of the Avatar (Euro, Prototype) 1990 @@ -6829,6 +6916,7 @@ + Vigilante (Euro, USA, Bra) 1989 @@ -6861,6 +6949,7 @@ 1989 Sega + @@ -6898,6 +6987,7 @@ + Wonder Boy III - The Dragon's Trap (Euro, USA, Kor) 1989 @@ -6913,6 +7003,7 @@ + Wonder Boy in Monster Land (Euro, USA) 1988 @@ -6928,6 +7019,7 @@ + Wonder Boy in Monster Land (Prototype) 1988 @@ -6954,6 +7046,7 @@ + @@ -7187,6 +7280,7 @@ + World Soccer (Euro, Jpn, Kor) ~ Great Soccer (USA) 1987 @@ -7288,11 +7382,12 @@ - + Ys (Jpn) 1988 Sega + @@ -7354,6 +7449,7 @@ + Zaxxon 3-D (World, Prototype) 1987 @@ -7792,6 +7888,7 @@ Sega + diff --git a/src/devices/bus/sms_ctrl/joypad.cpp b/src/devices/bus/sms_ctrl/joypad.cpp index b2537453c6a..99ca264cec4 100644 --- a/src/devices/bus/sms_ctrl/joypad.cpp +++ b/src/devices/bus/sms_ctrl/joypad.cpp @@ -2,7 +2,22 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Control Pad"/generic joystick emulation + Sega Mark III "Joypad" / Master System "Control Pad" emulation + + +Release data from the Sega Retro project: + +- Joypad: + + Year: 1985 Country/region: JP Model code: SJ-152 + +- Control Pad: + + Year: 1986 Country/region: US Model code: 3020 + Year: 1987 Country/region: JP Model code: 3020 + Year: 1987 Country/region: EU Model code: ? + Year: 1989 Country/region: BR Model code: 011770 + Year: 1989 Country/region: KR Model code: ? **********************************************************************/ diff --git a/src/devices/bus/sms_ctrl/joypad.h b/src/devices/bus/sms_ctrl/joypad.h index a67dd5f78b0..d8028bef6c3 100644 --- a/src/devices/bus/sms_ctrl/joypad.h +++ b/src/devices/bus/sms_ctrl/joypad.h @@ -2,7 +2,7 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Control Pad"/generic joystick emulation + Sega Mark III "Joypad" / Master System "Control Pad" emulation **********************************************************************/ diff --git a/src/devices/bus/sms_ctrl/lphaser.cpp b/src/devices/bus/sms_ctrl/lphaser.cpp index 7c1056da5f0..8a49c9a1554 100644 --- a/src/devices/bus/sms_ctrl/lphaser.cpp +++ b/src/devices/bus/sms_ctrl/lphaser.cpp @@ -4,6 +4,14 @@ Sega Master System "Light Phaser" (light gun) emulation + +Release data from the Sega Retro project: + + Year: 1986 Country/region: US Model code: 3050 + Year: 1987 Country/region: EU Model code: ? + Year: 1989 Country/region: BR Model code: 010470 + Year: 198? Country/region: KR Model code: ? + **********************************************************************/ #include "lphaser.h" diff --git a/src/devices/bus/sms_ctrl/paddle.cpp b/src/devices/bus/sms_ctrl/paddle.cpp index 5486c9a50bd..ec5acd4a5ee 100644 --- a/src/devices/bus/sms_ctrl/paddle.cpp +++ b/src/devices/bus/sms_ctrl/paddle.cpp @@ -2,7 +2,24 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Paddle Control" emulation + Sega Mark III "Paddle Control" emulation + + +Release data from the Sega Retro project: + + Year: 1987 Country/region: JP Model code: HPD-200 + +Notes: + + The main chip contained in the device is labeled 315-5243. + + The Paddle Control was only released in Japan. To work with the device, + paddle games need to detect the system region as Japanese, else they switch + to a different mode that uses the TH line as output to select which nibble + of the X axis will be read. This other mode is similar to how the US Sports + Pad works, so on an Export system, paddle games are somewhat playable with + that device, though it needs to be used inverted and the trackball needs to + be moved slowly, else the software for the paddle think it's moving backward. **********************************************************************/ diff --git a/src/devices/bus/sms_ctrl/paddle.h b/src/devices/bus/sms_ctrl/paddle.h index 8e092d63afe..fae7a93fb19 100644 --- a/src/devices/bus/sms_ctrl/paddle.h +++ b/src/devices/bus/sms_ctrl/paddle.h @@ -2,7 +2,7 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Paddle Control" emulation + Sega Mark III "Paddle Control" emulation **********************************************************************/ diff --git a/src/devices/bus/sms_ctrl/rfu.cpp b/src/devices/bus/sms_ctrl/rfu.cpp index 0ccc5ae4e9c..3c27307c137 100644 --- a/src/devices/bus/sms_ctrl/rfu.cpp +++ b/src/devices/bus/sms_ctrl/rfu.cpp @@ -2,12 +2,22 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Rapid Fire Unit" emulation + Sega SG-1000/Mark-III/SMS "Rapid Fire Unit" emulation -**********************************************************************/ -// This emulated device is the version released by Sega. In Brazil, Tec Toy -// released a version that does not have any switch to turn on/off auto-repeat. +Release data from the Sega Retro project: + + Year: 1985 Country/region: JP Model code: RF-150 + Year: 1987 Country/region: US Model code: 3046 + Year: 1988 Country/region: EU Model code: MK-3046-50 + Year: 1989 Country/region: BR Model code: 011050 + +Notes: + + This emulated device is the version released by Sega. In Brazil, Tec Toy + released a version that does not have any switch to turn on/off auto-repeat. + +**********************************************************************/ #include "rfu.h" diff --git a/src/devices/bus/sms_ctrl/rfu.h b/src/devices/bus/sms_ctrl/rfu.h index adc9a3443ba..6a56b06ae3a 100644 --- a/src/devices/bus/sms_ctrl/rfu.h +++ b/src/devices/bus/sms_ctrl/rfu.h @@ -2,7 +2,7 @@ // copyright-holders:Fabio Priuli /********************************************************************** - Sega Master System "Rapid Fire Unit" emulation + Sega SG-1000/Mark-III/SMS "Rapid Fire Unit" emulation **********************************************************************/ diff --git a/src/devices/bus/sms_ctrl/sports.cpp b/src/devices/bus/sms_ctrl/sports.cpp index 77356cec41f..b4bd54d81a1 100644 --- a/src/devices/bus/sms_ctrl/sports.cpp +++ b/src/devices/bus/sms_ctrl/sports.cpp @@ -4,29 +4,43 @@ Sega Master System "Sports Pad" (US model) emulation -**********************************************************************/ -// The games designed for the US model of the Sports Pad controller use the -// TH line of the controller port to select which nibble, of the two axis -// bytes, will be read at a time. The Japanese cartridge Sports Pad Soccer -// uses a different mode, because the Sega Mark III lacks the TH line, so -// there is a different Sports Pad model released in Japan (see sportsjp.c). - -// The Japanese SMS has the TH line connected, but doesn't report TH input -// on port 0xDD. However, a magazine raffled the US Sports Pad along with a -// Great Ice Hockey cartridge, in Japanese format, to owners of that console. -// So, Great Ice Hockey seems to just need TH pin as output to work, while -// other games designed for the US Sports Pad don't work on the Japanese SMS. - -// It was discovered that games designed for the Paddle Controller, released -// in Japan, switch to a mode incompatible with the original Paddle when -// detect the system region as Export. Similar to how the US model of the -// Sports Pad works, that mode uses the TH line as output to select which -// nibble of the X axis will be read. So, on an Export console version, paddle -// games are somewhat playable with the US Sport Pad model, though it needs to -// be used inverted and the trackball needs to be moved slowly, else the -// software for the paddle think it's moving backward. -// See http://mametesters.org/view.php?id=5872 for discussion. +Release data from the Sega Retro project: + + Year: 1987 Country/region: US Model code: 3040 + +TODO: + +- For low-level emulation, a device for the TMP42C66P, a Toshiba 4bit + microcontroller, needs to be created, but a dump of its internal ROM + seems to be required. +- Auto-repeat and Control/Sports mode switches are not emulated. + +Notes: + + Games designed for the US model of the Sports Pad controller use the + TH line of the controller port to select which nibble, of the two axis + bytes, will be read at a time. The Japanese cartridge Sports Pad Soccer + uses a different mode, because the Sega Mark III lacks the TH line, so + there is a different Sports Pad model released in Japan (see sportsjp.c). + + The Japanese SMS has the TH line connected, but doesn't report TH input + on port 0xDD. However, a magazine raffled the US Sports Pad along with a + Great Ice Hockey cartridge, in Japanese format, to owners of that console. + So, Great Ice Hockey seems to just need TH pin as output to work, while + other games designed for the US Sports Pad don't work on the Japanese SMS. + + It was discovered that games designed for the Paddle Controller, released + in Japan, switch to a mode incompatible with the original Paddle when + detect the system region as Export. Similar to how the US model of the + Sports Pad works, that mode uses the TH line as output to select which + nibble of the X axis will be read. So, on an Export console version, + paddle games are somewhat playable with the US Sport Pad model, though it + needs to be used inverted and the trackball needs to be moved slowly, else + the software for the paddle think it's moving backward. + See http://mametesters.org/view.php?id=5872 for discussion. + +**********************************************************************/ #include "sports.h" diff --git a/src/devices/bus/sms_ctrl/sportsjp.cpp b/src/devices/bus/sms_ctrl/sportsjp.cpp index 16c5198721c..ca2c3de1748 100644 --- a/src/devices/bus/sms_ctrl/sportsjp.cpp +++ b/src/devices/bus/sms_ctrl/sportsjp.cpp @@ -4,12 +4,25 @@ Sega Master System "Sports Pad" (Japanese model) emulation -**********************************************************************/ -// The Japanese Sports Pad controller is only required to play the cartridge -// Sports Pad Soccer, released in Japan. It uses a different mode than the -// used by the US model, due to the missing TH line on Sega Mark III -// controller ports. +Release data from the Sega Retro project: + + Year: 1988 Country/region: JP Model code: SP-500 + +TODO: + +- For low-level emulation, a device for the TMP42C66P, a Toshiba 4bit + microcontroller, needs to be created, but a dump of its internal ROM + seems to be required. + +Notes: + + The Japanese Sports Pad controller is only required to play the cartridge + Sports Pad Soccer, released in Japan. It uses a different mode than the + used by the US model, due to the missing TH line on Sega Mark III + controller ports. + +**********************************************************************/ #include "sportsjp.h" diff --git a/src/devices/bus/sms_exp/gender.cpp b/src/devices/bus/sms_exp/gender.cpp index 3de8961050c..49ccc50e24e 100644 --- a/src/devices/bus/sms_exp/gender.cpp +++ b/src/devices/bus/sms_exp/gender.cpp @@ -4,14 +4,14 @@ Sega Master System "Gender Adapter" emulation -**********************************************************************/ +The Gender Adapter is not an official Sega product. It is produced since 2006 +by the SMSPower website to permit to plug a cartridge on the expansion slot +on any SMS 1 model. This includes the Japanese SMS, which has FM sound, so +it is a way to get FM music of western cartridges that have FM code but were +not released in Japan. Some games have compatibility issues, confirmed on the +real hardware, when run plugged-in to the SMS expansion slot. -// The Gender Adapter is not an official Sega product. It is produced by the -// SMSPower website to permit to plug a cartridge on the expansion slot on any -// SMS 1 model. This includes the Japanese SMS, which has FM sound, so it is -// a way to get FM music of western cartridges that have FM code but were not -// released in Japan. Some games have compatibility issues, confirmed on the -// real hardware, when run plugged-in to the SMS expansion slot. +**********************************************************************/ #include "gender.h" -- cgit v1.2.3 From 3e12728afa1158109263e29fee896ac8e08cd284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Milanovi=C4=87?= Date: Sat, 26 Mar 2016 15:56:48 +0100 Subject: Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4cdcd8e7d03..9064cac894f 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,12 @@ All contributors need to either add a standard header for license info (on new f License ======= -The MAME project as a whole is distributed under the terms of the [GNU General Public License, version 2 or later](http://opensource.org/licenses/GPL-2.0) (GPL-2.0+), since it contains code made available under multiple GPL-compatible licenses. A great majority of files (over 90% including core files) are under the [BSD-3-Clause License](http://opensource.org/licenses/BSD-3-Clause) and we would encourage new contributors to distribute files under this license. +The MAME project as a whole is distributed under the terms of the [GNU General Public License, version 2](http://opensource.org/licenses/GPL-2.0) or later (GPL-2.0+) or later, since it contains code made available under multiple GPL-compatible licenses. A great majority of files (over 90% including core files) are under the [BSD-3-Clause License](http://opensource.org/licenses/BSD-3-Clause) and we would encourage new contributors to distribute files under this license. Please note that MAME is a registered trademark of Nicola Salmoria, and permission is required to use the "MAME" name, logo, or wordmark. + + + Copyright (C) 1997-2016 MAMEDev and contributors -- cgit v1.2.3 From 9e6f6624fcc8603c85411cd3701135e5ab05f8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Milanovi=C4=87?= Date: Sat, 26 Mar 2016 15:57:42 +0100 Subject: Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9064cac894f..bd89327d5db 100644 --- a/README.md +++ b/README.md @@ -73,9 +73,10 @@ All contributors need to either add a standard header for license info (on new f License ======= -The MAME project as a whole is distributed under the terms of the [GNU General Public License, version 2](http://opensource.org/licenses/GPL-2.0) or later (GPL-2.0+) or later, since it contains code made available under multiple GPL-compatible licenses. A great majority of files (over 90% including core files) are under the [BSD-3-Clause License](http://opensource.org/licenses/BSD-3-Clause) and we would encourage new contributors to distribute files under this license. +The MAME project as a whole is distributed under the terms of the [GNU General Public License, version 2](http://opensource.org/licenses/GPL-2.0) or later (GPL-2.0+), since it contains code made available under multiple GPL-compatible licenses. A great majority of files (over 90% including core files) are under the [BSD-3-Clause License](http://opensource.org/licenses/BSD-3-Clause) and we would encourage new contributors to distribute files under this license. Please note that MAME is a registered trademark of Nicola Salmoria, and permission is required to use the "MAME" name, logo, or wordmark. + -- cgit v1.2.3 From 2ac1e54bd987a6c3b3664a690dfbf428999a18c2 Mon Sep 17 00:00:00 2001 From: couriersud Date: Thu, 24 Mar 2016 01:38:36 +0100 Subject: Fix a bug. --- src/lib/netlist/macro/nlm_ttl74xx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/netlist/macro/nlm_ttl74xx.cpp b/src/lib/netlist/macro/nlm_ttl74xx.cpp index de42f26d730..49fea3c55c8 100644 --- a/src/lib/netlist/macro/nlm_ttl74xx.cpp +++ b/src/lib/netlist/macro/nlm_ttl74xx.cpp @@ -84,7 +84,7 @@ NETLIST_START(TTL74XX_lib) TT_FAMILY("74XX") TRUTHTABLE_END() - TRUTHTABLE_START(TTL_7400_NAND, 2, 1, 0, "+A,B") + TRUTHTABLE_START(TTL_7400_NAND, 2, 1, 0, "A,B") TT_HEAD("A,B|Q ") TT_LINE("0,X|1|22") TT_LINE("X,0|1|22") -- cgit v1.2.3 From f5bcee0db382987888d308ab61f02b43ee3b0169 Mon Sep 17 00:00:00 2001 From: couriersud Date: Fri, 25 Mar 2016 02:17:54 +0100 Subject: netlist: prepare code so that matrices can be allocated in one chunk of memory. --- src/lib/netlist/nl_base.h | 2 +- src/lib/netlist/solver/nld_ms_direct.h | 72 ++++++++++++++++++++++++--------- src/lib/netlist/solver/nld_ms_direct1.h | 4 +- src/lib/netlist/solver/nld_ms_direct2.h | 6 +-- src/lib/netlist/solver/nld_ms_sor_mat.h | 4 +- 5 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 24f2cde585a..bf7e8e41c41 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -586,7 +586,7 @@ namespace netlist virtual void reset() override; private: - ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val) + ATTR_HOT void set_ptr(nl_double *ptr, const nl_double val) { if (ptr != NULL && *ptr != val) { diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index bdcec31ad44..ab67795507f 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -13,6 +13,13 @@ #include "solver/nld_solver.h" #include "solver/vector_base.h" +/* Disabling dynamic allocation gives a ~10% boost in performance + * This flag has been added to support continuous storage for arrays + * going forward in case we implement cuda solvers in the future. + */ +#define NL_USE_DYNAMIC_ALLOCATION (0) + + NETLIB_NAMESPACE_DEVICES_START() //#define nl_ext_double __float128 // slow, very slow @@ -43,7 +50,7 @@ protected: ATTR_HOT int solve_non_dynamic(const bool newton_raphson); ATTR_HOT void build_LE_A(); - ATTR_HOT void build_LE_RHS(nl_double * RESTRICT rhs); + ATTR_HOT void build_LE_RHS(); ATTR_HOT void LE_solve(); ATTR_HOT void LE_back_subst(nl_double * RESTRICT x); @@ -60,10 +67,19 @@ protected: */ ATTR_HOT nl_double compute_next_timestep(); + +#if (NL_USE_DYNAMIC_ALLOCATION) template - inline nl_ext_double &A(const T1 r, const T2 c) { return m_A[r][c]; } + inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r * m_pitch + c]; } + template + inline nl_ext_double &RHS(const T1 &r) { return m_A[r * m_pitch + N()]; } +#else + template + inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; } + template + inline nl_ext_double &RHS(const T1 &r) { return m_A[r][N()]; } - ATTR_ALIGN nl_double m_RHS[_storage_N]; +#endif ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents ATTR_ALIGN nl_double m_last_V[_storage_N]; @@ -71,7 +87,13 @@ protected: terms_t *m_rails_temp; private: - ATTR_ALIGN nl_ext_double m_A[_storage_N][((_storage_N + 7) / 8) * 8]; + static const unsigned m_pitch = (((_storage_N + 1) + 7) / 8) * 8; +#if (NL_USE_DYNAMIC_ALLOCATION) + ATTR_ALIGN nl_ext_double * RESTRICT m_A; +#else + ATTR_ALIGN nl_ext_double m_A[_storage_N][m_pitch]; +#endif + //ATTR_ALIGN nl_ext_double m_RHSx[_storage_N]; const unsigned m_dim; }; @@ -89,6 +111,9 @@ matrix_solver_direct_t::~matrix_solver_direct_t() } pfree_array(m_terms); pfree_array(m_rails_temp); +#if (NL_USE_DYNAMIC_ALLOCATION) + pfree_array(m_A); +#endif } template @@ -304,7 +329,6 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis /* * save states */ - save(NLNAME(m_RHS)); save(NLNAME(m_last_RHS)); save(NLNAME(m_last_V)); @@ -312,6 +336,8 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis { pstring num = pfmt("{1}")(k); + save(RHS(k), "RHS" + num); + save(m_terms[k]->go(),"GO" + num, m_terms[k]->count()); save(m_terms[k]->gt(),"GT" + num, m_terms[k]->count()); save(m_terms[k]->Idr(),"IDR" + num , m_terms[k]->count()); @@ -350,7 +376,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_A() } template -ATTR_HOT void matrix_solver_direct_t::build_LE_RHS(nl_double * RESTRICT rhs) +ATTR_HOT void matrix_solver_direct_t::build_LE_RHS() { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -370,7 +396,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_RHS(nl_double * //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); rhsk_b = rhsk_b + go[i] * *other_cur_analog[i]; - rhs[k] = rhsk_a + rhsk_b; + RHS(k) = rhsk_a + rhsk_b; } } @@ -398,7 +424,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_solve() for (unsigned k = 0; k < kN; k++) { std::swap(A(i,k), A(maxrow,k)); } - std::swap(m_RHS[i], m_RHS[maxrow]); + std::swap(RHS(i), RHS(maxrow)); } /* FIXME: Singular matrix? */ const nl_double f = 1.0 / A(i,i); @@ -410,14 +436,18 @@ ATTR_HOT void matrix_solver_direct_t::LE_solve() const nl_double f1 = - A(j,i) * f; if (f1 != NL_FCONST(0.0)) { - nl_double * RESTRICT pi = &m_A[i][i+1]; - nl_double * RESTRICT pj = &m_A[j][i+1]; + nl_double * RESTRICT pi = &A(i,i+1); + nl_double * RESTRICT pj = &A(j,i+1); +#if 1 + vec_add_mult_scalar(kN-i,pj,f1,pi); +#else vec_add_mult_scalar(kN-i-1,pj,f1,pi); //for (unsigned k = i+1; k < kN; k++) // pj[k] = pj[k] + pi[k] * f1; //for (unsigned k = i+1; k < kN; k++) //A(j,k) += A(i,k) * f1; - m_RHS[j] += m_RHS[i] * f1; + RHS(j) += RHS(i) * f1; +#endif } } } @@ -444,7 +474,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_solve() for (unsigned k = 0; k < e; k++) A(j,p[k]) += A(i,p[k]) * f1; #endif - m_RHS[j] += m_RHS[i] * f1; + RHS(j) += RHS(i) * f1; } } } @@ -464,7 +494,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst( nl_double tmp = 0; for (unsigned k = j+1; k < kN; k++) tmp += A(j,k) * x[k]; - x[j] = (m_RHS[j] - tmp) / A(j,j); + x[j] = (RHS(j) - tmp) / A(j,j); } } else @@ -481,7 +511,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst( const unsigned pk = p[k]; tmp += A(j,pk) * x[pk]; } - x[j] = (m_RHS[j] - tmp) / A(j,j); + x[j] = (RHS(j) - tmp) / A(j,j); } } } @@ -505,7 +535,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst_full( //ip=indx[i]; USE_PIVOT_SEARCH //sum=b[ip]; //b[ip]=b[i]; - double sum=m_RHS[i];//x[i]; + double sum=RHS(i);//x[i]; for (int j=0; j < i; j++) sum -= A(i,j) * x[j]; x[i]=sum; @@ -580,10 +610,10 @@ template ATTR_HOT inline int matrix_solver_direct_t::vsolve_non_dynamic(const bool newton_raphson) { this->build_LE_A(); - this->build_LE_RHS(m_last_RHS); + this->build_LE_RHS(); for (unsigned i=0, iN=N(); i < iN; i++) - m_RHS[i] = m_last_RHS[i]; + m_last_RHS[i] = RHS(i); this->LE_solve(); @@ -599,7 +629,9 @@ matrix_solver_direct_t::matrix_solver_direct_t(const solver_par { m_terms = palloc_array(terms_t *, N()); m_rails_temp = palloc_array(terms_t, N()); - +#if (NL_USE_DYNAMIC_ALLOCATION) + m_A = palloc_array(nl_ext_double, N() * m_pitch); +#endif for (unsigned k = 0; k < N(); k++) { m_terms[k] = palloc(terms_t); @@ -615,7 +647,9 @@ matrix_solver_direct_t::matrix_solver_direct_t(const eSolverTyp { m_terms = palloc_array(terms_t *, N()); m_rails_temp = palloc_array(terms_t, N()); - +#if (NL_USE_DYNAMIC_ALLOCATION) + m_A = palloc_array(nl_ext_double, N() * m_pitch); +#endif for (unsigned k = 0; k < N(); k++) { m_terms[k] = palloc(terms_t); diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h index fe5a439a9db..81e8c329edf 100644 --- a/src/lib/netlist/solver/nld_ms_direct1.h +++ b/src/lib/netlist/solver/nld_ms_direct1.h @@ -40,10 +40,10 @@ ATTR_HOT inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED cons { analog_net_t *net = m_nets[0]; this->build_LE_A(); - this->build_LE_RHS(m_RHS); + this->build_LE_RHS(); //NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]); - nl_double new_val = m_RHS[0] / A(0,0); + nl_double new_val = RHS(0) / A(0,0); nl_double e = (new_val - net->Q_Analog()); nl_double cerr = nl_math::abs(e); diff --git a/src/lib/netlist/solver/nld_ms_direct2.h b/src/lib/netlist/solver/nld_ms_direct2.h index 06f00302d3c..4a6d768fe06 100644 --- a/src/lib/netlist/solver/nld_ms_direct2.h +++ b/src/lib/netlist/solver/nld_ms_direct2.h @@ -39,7 +39,7 @@ ATTR_HOT nl_double matrix_solver_direct2_t::vsolve() ATTR_HOT inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { build_LE_A(); - build_LE_RHS(m_RHS); + build_LE_RHS(); const nl_double a = A(0,0); const nl_double b = A(0,1); @@ -47,8 +47,8 @@ ATTR_HOT inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED cons const nl_double d = A(1,1); nl_double new_val[2]; - new_val[1] = (a * m_RHS[1] - c * m_RHS[0]) / (a * d - b * c); - new_val[0] = (m_RHS[0] - b * new_val[1]) / a; + new_val[1] = (a * RHS(1) - c * RHS(0)) / (a * d - b * c); + new_val[0] = (RHS(0) - b * new_val[1]) / a; if (is_dynamic()) { diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h index 4312c3039be..34c40c34d79 100644 --- a/src/lib/netlist/solver/nld_ms_sor_mat.h +++ b/src/lib/netlist/solver/nld_ms_sor_mat.h @@ -129,7 +129,7 @@ ATTR_HOT inline int matrix_solver_SOR_mat_t::vsolve_non_dynamic int resched_cnt = 0; this->build_LE_A(); - this->build_LE_RHS(this->m_RHS); + this->build_LE_RHS(); #if 0 static int ws_cnt = 0; @@ -184,7 +184,7 @@ ATTR_HOT inline int matrix_solver_SOR_mat_t::vsolve_non_dynamic for (unsigned i = 0; i < e; i++) Idrive = Idrive + this->A(k,p[i]) * new_v[p[i]]; - const nl_double delta = m_omega * (this->m_RHS[k] - Idrive) / this->A(k,k); + const nl_double delta = m_omega * (this->RHS(k) - Idrive) / this->A(k,k); cerr = std::max(cerr, nl_math::abs(delta)); new_v[k] += delta; } -- cgit v1.2.3 From 1a36bfd0eb4e615d6c8efc47298d3bfcf9c14360 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 26 Mar 2016 15:29:31 +0100 Subject: Fix kidniki sound speed. Make more class members private. --- nl_examples/kidniki.c | 1 + src/lib/netlist/nl_base.cpp | 2 +- src/lib/netlist/nl_base.h | 18 +++++++++++++----- src/lib/netlist/solver/nld_solver.cpp | 4 +--- src/mame/audio/irem.cpp | 4 ++-- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/nl_examples/kidniki.c b/nl_examples/kidniki.c index ba53fb3867b..b1d0a87317b 100644 --- a/nl_examples/kidniki.c +++ b/nl_examples/kidniki.c @@ -14,6 +14,7 @@ NETLIST_START(dummy) PARAM(Solver.NR_LOOPS, 300) PARAM(Solver.GS_LOOPS, 1) PARAM(Solver.GS_THRESHOLD, 6) + //PARAM(Solver.ITERATIVE, "MAT") PARAM(Solver.ITERATIVE, "SOR") PARAM(Solver.PARALLEL, 0) PARAM(Solver.SOR_FACTOR, 1.00) diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 6ea052b4132..9ebb1378e5b 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -840,10 +840,10 @@ ATTR_COLD void core_terminal_t::set_net(net_t &anet) ATTR_COLD terminal_t::terminal_t() : analog_t(TERMINAL) +, m_otherterm(NULL) , m_Idr1(NULL) , m_go1(NULL) , m_gt1(NULL) -, m_otherterm(NULL) { } diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index bf7e8e41c41..e4374b75ad3 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -551,10 +551,6 @@ namespace netlist ATTR_COLD terminal_t(); - nl_double *m_Idr1; // drive current - nl_double *m_go1; // conductance for Voltage from other term - nl_double *m_gt1; // conductance for total conductance - terminal_t *m_otherterm; ATTR_HOT void set(const nl_double G) @@ -581,6 +577,13 @@ namespace netlist ATTR_HOT void schedule_solve(); ATTR_HOT void schedule_after(const netlist_time &after); + void set_ptrs(nl_double *gt, nl_double *go, nl_double *Idr) + { + m_gt1 = gt; + m_go1 = go; + m_Idr1 = Idr; + } + protected: virtual void save_register() override; @@ -593,7 +596,12 @@ namespace netlist *ptr = val; } } - }; + + nl_double *m_Idr1; // drive current + nl_double *m_go1; // conductance for Voltage from other term + nl_double *m_gt1; // conductance for total conductance + +}; // ----------------------------------------------------------------------------- diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 3c8b0f4a663..701e418d4ef 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -79,9 +79,7 @@ ATTR_COLD void terms_t::set_pointers() { for (unsigned i = 0; i < count(); i++) { - m_term[i]->m_gt1 = &m_gt[i]; - m_term[i]->m_go1 = &m_go[i]; - m_term[i]->m_Idr1 = &m_Idr[i]; + m_term[i]->set_ptrs(&m_gt[i], &m_go[i], &m_Idr[i]); m_other_curanalog[i] = &m_term[i]->m_otherterm->net().m_cur_Analog; } } diff --git a/src/mame/audio/irem.cpp b/src/mame/audio/irem.cpp index 0020c880c30..0d16b99e066 100644 --- a/src/mame/audio/irem.cpp +++ b/src/mame/audio/irem.cpp @@ -419,9 +419,9 @@ NETLIST_START(kidniki_interface) PARAM(Solver.NR_LOOPS, 300) PARAM(Solver.GS_LOOPS, 1) PARAM(Solver.GS_THRESHOLD, 6) - //PARAM(Solver.ITERATIVE, "SOR") + PARAM(Solver.ITERATIVE, "SOR") //PARAM(Solver.ITERATIVE, "MAT") - PARAM(Solver.ITERATIVE, "GMRES") + //PARAM(Solver.ITERATIVE, "GMRES") PARAM(Solver.PARALLEL, 1) PARAM(Solver.SOR_FACTOR, 1.00) #else -- cgit v1.2.3 From 6b3f31219db34464dc2cc32367a5816957070fec Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 26 Mar 2016 20:57:34 +0100 Subject: marked bzaxxon as playable --- src/mame/drivers/hh_hmcs40.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index acf581c19b5..783f16be481 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -1035,7 +1035,7 @@ INPUT_CHANGED_MEMBER(bzaxxon_state::input_changed) static MACHINE_CONFIG_START( bzaxxon, bzaxxon_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation + MCFG_CPU_ADD("maincpu", HD38800, 450000) // approximation MCFG_HMCS40_WRITE_R_CB(0, WRITE8(bzaxxon_state, plate_w)) MCFG_HMCS40_WRITE_R_CB(1, WRITE8(bzaxxon_state, plate_w)) MCFG_HMCS40_WRITE_R_CB(2, WRITE8(bzaxxon_state, plate_w)) @@ -4087,7 +4087,7 @@ CONS( 1979, bmboxing, 0, 0, bmboxing, bmboxing, driver_device, 0, "Bambi CONS( 1982, bfriskyt, 0, 0, bfriskyt, bfriskyt, driver_device, 0, "Bandai", "Frisky Tom (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1981, packmon, 0, 0, packmon, packmon, driver_device, 0, "Bandai", "Packri Monster", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1982, msthawk, 0, 0, msthawk, msthawk, driver_device, 0, "Bandai (Mattel license)", "Star Hawk (Mattel)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -CONS( 1982, bzaxxon, 0, 0, bzaxxon, bzaxxon, driver_device, 0, "Bandai", "Zaxxon (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK | MACHINE_NOT_WORKING ) +CONS( 1982, bzaxxon, 0, 0, bzaxxon, bzaxxon, driver_device, 0, "Bandai", "Zaxxon (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1983, zackman, 0, 0, zackman, zackman, driver_device, 0, "Bandai", "Zackman", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1983, bpengo, 0, 0, bpengo, bpengo, driver_device, 0, "Bandai", "Pengo (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1983, bbtime, 0, 0, bbtime, bbtime, driver_device, 0, "Bandai", "Burger Time (Bandai)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) -- cgit v1.2.3 From a693f74843e1134ef7ce1a30cc5534a772077c97 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Sun, 27 Mar 2016 00:58:35 +0100 Subject: tweaks and fixes (nw) --- language/Dutch/strings.po | 164 +++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/language/Dutch/strings.po b/language/Dutch/strings.po index 730f1f8ba97..ff6dda456ca 100644 --- a/language/Dutch/strings.po +++ b/language/Dutch/strings.po @@ -40,7 +40,7 @@ msgid "" "Cheat Comment:\n" "%s" msgstr "" -"Valsspeel commentaar:\n" +"Cheat commentaar:\n" "\n" #: src/emu/ui/cheatopt.cpp:90 @@ -97,7 +97,7 @@ msgstr "Geen knoppen gevonden op deze machine!" #: src/emu/ui/cheatopt.cpp:312 src/emu/ui/cheatopt.cpp:316 msgid "Autofire Delay" -msgstr "Autofire vertraging" +msgstr "Vertraging autofire" #: src/emu/ui/ctrlmenu.cpp:20 msgid "Lightgun Device Assignment" @@ -121,11 +121,11 @@ msgstr "Paddle toewijzing" #: src/emu/ui/ctrlmenu.cpp:25 msgid "Dial Device Assignment" -msgstr "Dial toewijzing" +msgstr "Dial-apparaat toewijzing" #: src/emu/ui/ctrlmenu.cpp:26 msgid "Positional Device Assignment" -msgstr "Positie toewijzing" +msgstr "Positie-apparaat toewijzing" #: src/emu/ui/ctrlmenu.cpp:27 msgid "Mouse Device Assignment" @@ -134,7 +134,7 @@ msgstr "Muis toewijzing" #: src/emu/ui/ctrlmenu.cpp:106 src/emu/ui/ctrlmenu.cpp:126 #: src/emu/ui/optsmenu.cpp:264 msgid "Device Mapping" -msgstr "Invoerapparaat toewijzing" +msgstr "Invoerapparaat mapping" #: src/emu/ui/custmenu.cpp:157 src/emu/ui/custmenu.cpp:445 msgid "Main filter" @@ -172,7 +172,7 @@ msgstr "^!Uitgever" #: src/emu/ui/custmenu.cpp:481 msgid "^!Software List" -msgstr "^!Software lijst" +msgstr "^!Softwarelijst" #: src/emu/ui/custmenu.cpp:490 msgid "^!Device type" @@ -240,15 +240,15 @@ msgstr "Lijnen" #: src/emu/ui/custui.cpp:364 msgid "Infos text size" -msgstr "Infos tekst grootte" +msgstr "Tekstgrootte informatie" #: src/emu/ui/custui.cpp:381 msgid "UI Fonts Settings" -msgstr "UI Lettertype Instellingen" +msgstr "Instellingen lettertype gebruikersinterface" #: src/emu/ui/custui.cpp:408 msgid "Sample text - Lorem ipsum dolor sit amet, consectetur adipiscing elit." -msgstr "Voorbeeld tekst - De kat krabt de krullen van de trap." +msgstr "Voorbeeldtekst - Lorem ipsum dolor sit amet, consectetur adipiscing elit." #: src/emu/ui/custui.cpp:506 msgid "Normal text" @@ -264,15 +264,15 @@ msgstr "Normale tekst achtergrond" #: src/emu/ui/custui.cpp:509 msgid "Selected background color" -msgstr "Geselecteerde achtergrond kleur" +msgstr "Geselecteerde achtergrondkleur" #: src/emu/ui/custui.cpp:510 msgid "Subitem color" -msgstr "Subitem kleur" +msgstr "Kleur subitem" #: src/emu/ui/custui.cpp:511 src/emu/ui/custui.cpp:606 msgid "Clone" -msgstr "Kloon" +msgstr "Clone/Variant" #: src/emu/ui/custui.cpp:512 msgid "Border" @@ -292,11 +292,11 @@ msgstr "Niet beschikbaar kleur" #: src/emu/ui/custui.cpp:516 msgid "Slider color" -msgstr "Schuif kleur" +msgstr "Slider kleur" #: src/emu/ui/custui.cpp:517 msgid "Gfx viewer background" -msgstr "Gfx viewer achtergrond" +msgstr "Gfx-viewer achtergrond" #: src/emu/ui/custui.cpp:518 msgid "Mouse over color" @@ -320,7 +320,7 @@ msgstr "Herstel originele kleuren" #: src/emu/ui/custui.cpp:540 msgid "UI Colors Settings" -msgstr "UI Kleur Instellingen" +msgstr "Kleurinstellingen gebruikersinterface" #: src/emu/ui/custui.cpp:568 #, c-format @@ -479,7 +479,7 @@ msgstr "Iconen" #: src/emu/ui/dirmenu.cpp:39 src/emu/ui/miscmenu.cpp:560 msgid "Cheats" -msgstr "Valsspelen" +msgstr "Cheats" #: src/emu/ui/dirmenu.cpp:40 src/emu/ui/menu.cpp:43 msgid "Snapshots" @@ -523,7 +523,7 @@ msgstr "Artwork" #: src/emu/ui/dirmenu.cpp:50 src/emu/ui/menu.cpp:51 msgid "Bosses" -msgstr "Bazen" +msgstr "Eindbazen" #: src/emu/ui/dirmenu.cpp:51 msgid "Artworks Preview" @@ -535,7 +535,7 @@ msgstr "Selecteer" #: src/emu/ui/dirmenu.cpp:53 msgid "GameOver" -msgstr "Einde spel" +msgstr "Game over" #: src/emu/ui/dirmenu.cpp:54 src/emu/ui/menu.cpp:55 msgid "HowTo" @@ -564,7 +564,7 @@ msgstr "Map instellingen" #: src/emu/ui/dirmenu.cpp:183 #, c-format msgid "Current %1$s Folders" -msgstr "Huidige %$1s mappen" +msgstr "Huidige %1$s mappen" #: src/emu/ui/dirmenu.cpp:195 msgid "Change Folder" @@ -581,12 +581,12 @@ msgstr "Verwijder map" #: src/emu/ui/dirmenu.cpp:496 #, c-format msgid "Change %1$s Folder - Search: %2$s_" -msgstr "Wijzig %$1s map - Zoek: %2$s_" +msgstr "Wijzig %1$s map - Zoek: %2$s_" #: src/emu/ui/dirmenu.cpp:497 #, c-format msgid "Add %1$s Folder - Search: %2$s_" -msgstr "Voeg %$1s map toe - Zoek: %2$s_" +msgstr "Voeg %1$s map toe - Zoek: %2$s_" #: src/emu/ui/dirmenu.cpp:534 msgid "Press TAB to set" @@ -595,7 +595,7 @@ msgstr "Druk op TAB om te kiezen" #: src/emu/ui/dirmenu.cpp:640 #, c-format msgid "Remove %1$s Folder" -msgstr "Verwijder %$1s map" +msgstr "Verwijder %1$s map" #: src/emu/ui/dsplmenu.cpp:38 msgid "Video Mode" @@ -603,7 +603,7 @@ msgstr "Video modus" #: src/emu/ui/dsplmenu.cpp:40 msgid "Triple Buffering" -msgstr "Driedubbele buffering" +msgstr "Drievoudige buffering" #: src/emu/ui/dsplmenu.cpp:41 msgid "HLSL" @@ -619,7 +619,7 @@ msgstr "Bilineaire filtering" #: src/emu/ui/dsplmenu.cpp:45 msgid "Bitmap Prescaling" -msgstr "Bitmapvoorschaling" +msgstr "Bitmap prescaling" #: src/emu/ui/dsplmenu.cpp:46 msgid "Window Mode" @@ -639,12 +639,12 @@ msgstr "Gesynchroniseerde verversing" #: src/emu/ui/dsplmenu.cpp:50 msgid "Wait Vertical Sync" -msgstr "Wacht verticale synchronisatie" +msgstr "Wacht V-Sync" #: src/emu/ui/dsplmenu.cpp:202 src/emu/ui/dsplmenu.cpp:222 #: src/emu/ui/optsmenu.cpp:261 msgid "Display Options" -msgstr "Schermopties" +msgstr "Video-opties" #: src/emu/ui/filesel.cpp:159 msgid "File Already Exists - Override?" @@ -668,7 +668,7 @@ msgstr "Ja" #: src/emu/ui/filesel.cpp:271 msgid "New Image Name:" -msgstr "Naam nieuw bestand:" +msgstr "Nieuwe bestandsnaam:" #: src/emu/ui/filesel.cpp:277 msgid "Image Format:" @@ -676,7 +676,7 @@ msgstr "Bestandsformaat:" #: src/emu/ui/filesel.cpp:283 msgid "Create" -msgstr "Creëer" +msgstr "Aanmaken" #: src/emu/ui/filesel.cpp:314 msgid "Please enter a file extension too" @@ -688,7 +688,7 @@ msgstr "[lege plek]" #: src/emu/ui/filesel.cpp:506 msgid "[create]" -msgstr "[creëer]" +msgstr "[aanmaken]" #: src/emu/ui/filesel.cpp:510 src/emu/ui/swlist.cpp:76 msgid "[software list]" @@ -837,7 +837,7 @@ msgstr "Vizieropties" #: src/emu/ui/mainmenu.cpp:132 msgid "Cheat" -msgstr "Valsspelen" +msgstr "Cheat" #: src/emu/ui/mainmenu.cpp:136 msgid "External DAT View" @@ -849,7 +849,7 @@ msgstr "Voeg toe aan favorieten" #: src/emu/ui/mainmenu.cpp:144 msgid "Remove From Favorites" -msgstr "Verwijder uit favorieten" +msgstr "Verwijder van favorieten" #: src/emu/ui/mainmenu.cpp:151 msgid "Select New Machine" @@ -861,7 +861,7 @@ msgstr "Bedieningspanelen" #: src/emu/ui/menu.cpp:50 msgid "Artwork Preview" -msgstr "Artwork voorvertoning" +msgstr "Voorvertoning Artwork" #: src/emu/ui/menu.cpp:54 msgid "Game Over" @@ -873,7 +873,7 @@ msgstr "Naar of van favorietenlijst" #: src/emu/ui/menu.cpp:65 msgid "Export displayed list to file" -msgstr "Exporteer lijst naar bestand" +msgstr "Exporteer getoonde lijst naar bestand" #: src/emu/ui/menu.cpp:66 msgid "Show DATs view" @@ -957,7 +957,7 @@ msgstr " (afgeschermd)" #: src/emu/ui/miscmenu.cpp:518 msgid "Visible Delay" -msgstr "Zichtbaar vertraging" +msgstr "Vertraging zichtbaarheid" #: src/emu/ui/miscmenu.cpp:557 msgid "Re-select last machine played" @@ -965,7 +965,7 @@ msgstr "Kies laatst gespeelde machine opnieuw" #: src/emu/ui/miscmenu.cpp:558 msgid "Enlarge images in the right panel" -msgstr "Vergroot plaatsen in het rechter paneel" +msgstr "Vergroot plaatjes in het rechter paneel" #: src/emu/ui/miscmenu.cpp:559 msgid "DATs info" @@ -985,7 +985,7 @@ msgstr "Sla informatiescherm bij het opstarten over" #: src/emu/ui/miscmenu.cpp:564 msgid "Force 4:3 appearance for software snapshot" -msgstr "Toon software snapshot geforceerd in 4:3 formaat" +msgstr "Toon software snapshot altijd in 4:3 formaat" #: src/emu/ui/miscmenu.cpp:565 msgid "Use image as background" @@ -1007,7 +1007,7 @@ msgstr "Overige opties" #: src/emu/ui/miscmenu.cpp:737 #, c-format msgid "%s.xml saved under ui folder." -msgstr "%s.xml opgeslagen in 'ui' map." +msgstr "%s.xml is opgeslagen in de map 'ui'." #: src/emu/ui/miscmenu.cpp:765 msgid "Name: Description:\n" @@ -1016,7 +1016,7 @@ msgstr "Naam: Omschrijving:\n" #: src/emu/ui/miscmenu.cpp:777 #, c-format msgid "%s.txt saved under ui folder." -msgstr "%s.txt opgeslagen in 'ui' map." +msgstr "%s.txt is opgeslagen in de map 'ui'." #: src/emu/ui/miscmenu.cpp:795 msgid "Export XML format (like -listxml)" @@ -1037,7 +1037,7 @@ msgstr "Sla machineconfiguratie op" #: src/emu/ui/miscmenu.cpp:967 src/emu/ui/miscmenu.cpp:987 #: src/emu/ui/selgame.cpp:587 msgid "Plugins" -msgstr "" +msgstr "Plugins" #: src/emu/ui/optsmenu.cpp:214 msgid "Filter" @@ -1057,7 +1057,7 @@ msgstr "^!Stel eigen filter in" #: src/emu/ui/optsmenu.cpp:258 msgid "Customize UI" -msgstr "Pas UI aan" +msgstr "Pas gebruikersinterface aan" #: src/emu/ui/optsmenu.cpp:259 msgid "Configure Directories" @@ -1119,7 +1119,7 @@ msgid "" " added to favorites list." msgstr "" "%s\n" -" toegevoegd aan favorieten." +" toegevoegd aan favorietenlijst." #: src/emu/ui/selgame.cpp:376 src/emu/ui/selgame.cpp:385 #: src/emu/ui/selsoft.cpp:283 @@ -1129,7 +1129,7 @@ msgid "" " removed from favorites list." msgstr "" "%s\n" -" verwijderd van favorieten." +" verwijderd van favorietenlijst." #: src/emu/ui/selgame.cpp:446 msgid "" @@ -1182,11 +1182,11 @@ msgstr "%1$s, %2$-.100s" #: src/emu/ui/selgame.cpp:839 src/emu/ui/selsoft.cpp:755 #, c-format msgid "Driver is clone of: %1$-.100s" -msgstr "Driver is een kloon van: %1$-.100s" +msgstr "Driver is een variant van: %1$-.100s" #: src/emu/ui/selgame.cpp:841 src/emu/ui/selsoft.cpp:757 msgid "Driver is parent" -msgstr "Driver is ouder" +msgstr "Driver is hoofddriver" #: src/emu/ui/selgame.cpp:845 src/emu/ui/selsoft.cpp:761 #: src/emu/ui/simpleselgame.cpp:332 @@ -1231,11 +1231,11 @@ msgstr "Systeem: %1$-.100s" #: src/emu/ui/selgame.cpp:886 src/emu/ui/selsoft.cpp:803 #, c-format msgid "Software is clone of: %1$-.100s" -msgstr "Software is kloon van: %1$-.100s" +msgstr "Software is een variant van: %1$-.100s" #: src/emu/ui/selgame.cpp:888 src/emu/ui/selsoft.cpp:805 msgid "Software is parent" -msgstr "Software is ouder" +msgstr "Software is hoofdsoftware" #: src/emu/ui/selgame.cpp:893 src/emu/ui/selsoft.cpp:810 msgid "Supported: No" @@ -1277,11 +1277,11 @@ msgstr "Fabrikant: %1$-.100s\n" #: src/emu/ui/selgame.cpp:1533 #, c-format msgid "Driver is Clone of: %1$-.100s\n" -msgstr "Driver is kloon van: %1$-.100s\n" +msgstr "Driver is een variant van: %1$-.100s\n" #: src/emu/ui/selgame.cpp:1535 msgid "Driver is Parent\n" -msgstr "Driver is ouder\n" +msgstr "Driver is hoofddriver\n" #: src/emu/ui/selgame.cpp:1538 msgid "Overall: NOT WORKING\n" @@ -1342,7 +1342,7 @@ msgstr "Vereist klikbare artwork: %1$s\n" #: src/emu/ui/selgame.cpp:1564 #, c-format msgid "Support Cocktail: %1$s\n" -msgstr "Ondersteund cocktail: %1$s\n" +msgstr "Ondersteunt cocktail: %1$s\n" #: src/emu/ui/selgame.cpp:1565 #, c-format @@ -1374,31 +1374,31 @@ msgstr "Vereist CHD: %1$s\n" #: src/emu/ui/selgame.cpp:1588 msgid "Roms Audit Pass: OK\n" -msgstr "Roms controle stap: OK\n" +msgstr "Roms controle: OK\n" #: src/emu/ui/selgame.cpp:1590 msgid "Roms Audit Pass: BAD\n" -msgstr "Roms controle stap: FOUT\n" +msgstr "Roms controle: FOUT\n" #: src/emu/ui/selgame.cpp:1593 msgid "Samples Audit Pass: None Needed\n" -msgstr "Samples controle stap: Geen benodigd\n" +msgstr "Samples controle: Niet nodig\n" #: src/emu/ui/selgame.cpp:1595 msgid "Samples Audit Pass: OK\n" -msgstr "Samples controle stap: OK\n" +msgstr "Samples controle: OK\n" #: src/emu/ui/selgame.cpp:1597 msgid "Samples Audit Pass: BAD\n" -msgstr "Samples controle stap: FOUT\n" +msgstr "Samples controle: FOUT\n" #: src/emu/ui/selgame.cpp:1600 msgid "" "Roms Audit Pass: Disabled\n" "Samples Audit Pass: Disabled\n" msgstr "" -"Roms controle stap: Uitgeschakeld\n" -"Samples controle stap: Uitgeschakeld\n" +"Roms controle: Uitgeschakeld\n" +"Samples controle: Uitgeschakeld\n" #: src/emu/ui/selgame.cpp:2039 src/emu/ui/selgame.cpp:2200 #: src/emu/ui/selsoft.cpp:1657 @@ -1428,7 +1428,7 @@ msgstr "" #: src/emu/ui/selsoft.cpp:682 #, c-format msgid "%1$s %2$s ( %3$d / %4$d softwares )" -msgstr "%1$s %2$s ( %3$d / %4$d softwares )" +msgstr "%1$s %2$s ( %3$d / %4$d software )" #: src/emu/ui/selsoft.cpp:683 #, c-format @@ -1546,12 +1546,12 @@ msgstr "[Bestandsbeheer]" #: src/emu/ui/swlist.cpp:235 msgid "Switch Item Ordering" -msgstr "Wissel onderdeel volgorde" +msgstr "Wijzig de volgorde van de onderdelen" #: src/emu/ui/swlist.cpp:268 #, c-format msgid "Switched Order: entries now ordered by %s" -msgstr "Volgorde gewijzigd: elementen zijn nu gesorteerd op %s" +msgstr "Volgorde gewijzigd: de elementen zijn nu gesorteerd op %s" #: src/emu/ui/swlist.cpp:268 msgid "shortname" @@ -1575,7 +1575,7 @@ msgstr "afspelen" #: src/emu/ui/tapectrl.cpp:86 msgid "(playing)" -msgstr "(afspelen)" +msgstr "(aan het afspelen)" #: src/emu/ui/tapectrl.cpp:87 msgid "recording" @@ -1583,7 +1583,7 @@ msgstr "opnemen" #: src/emu/ui/tapectrl.cpp:87 msgid "(recording)" -msgstr "(opnemen)" +msgstr "(aan het opnemen)" #: src/emu/ui/tapectrl.cpp:94 msgid "Pause/Stop" @@ -1591,7 +1591,7 @@ msgstr "Pauzeer/Stop" #: src/emu/ui/tapectrl.cpp:97 msgid "Play" -msgstr "Speel" +msgstr "Speel af" #: src/emu/ui/tapectrl.cpp:100 msgid "Record" @@ -1599,15 +1599,15 @@ msgstr "Neem op" #: src/emu/ui/tapectrl.cpp:103 msgid "Rewind" -msgstr "Terugspoelen" +msgstr "Terug spoelen" #: src/emu/ui/tapectrl.cpp:106 msgid "Fast Forward" -msgstr "Snel vooruit" +msgstr "Vooruit spoelen" #: src/emu/ui/ui.cpp:415 msgid "This driver requires images to be loaded in the following device(s): " -msgstr "Deze driver vereist images ingelezen in de volgende device(s): " +msgstr "Deze driver vereist software ingelezen in de volgende device(s): " #: src/emu/ui/ui.cpp:1043 #, c-format @@ -1634,13 +1634,13 @@ msgid "" "There are known problems with this machine\n" "\n" msgstr "" -"Er zijn bekende problemen met deze machine\n" +"Er zijn problemen bekend met de emulatie van deze machine\n" "\n" #: src/emu/ui/ui.cpp:1098 msgid "" "One or more ROMs/CHDs for this machine have not been correctly dumped.\n" -msgstr "Éémn of meerder ROMs/CHDs voor de machine zijn niet correct gedumpt.\n" +msgstr "Één of meerdere ROMs/CHDs voor deze machine zijn niet correct gedumpt.\n" #: src/emu/ui/ui.cpp:1102 #, c-format @@ -1672,11 +1672,11 @@ msgstr "Deze machine heeft geen geluid.\n" #: src/emu/ui/ui.cpp:1115 msgid "Screen flipping in cocktail mode is not supported.\n" -msgstr "Schermflippen in cocktail modus is niet ondersteund.\n" +msgstr "Schermflippen wordt in cocktailmodus niet ondersteund.\n" #: src/emu/ui/ui.cpp:1119 msgid "The machine requires external artwork files\n" -msgstr "Deze machine vereist extern artwork bestanden\n" +msgstr "Deze machine vereist externe artwork bestanden\n" #: src/emu/ui/ui.cpp:1124 msgid "" @@ -1684,19 +1684,19 @@ msgid "" "elements that are not bugs in the emulation.\n" msgstr "" "Deze machine was nooit afgemaakt. Het kan vreemd gedrag vertonen of " -"elementen missen die geen fouten zijn met de emulatie.\n" +"elementen missen; dit zijn geen fouten van de emulatie.\n" #: src/emu/ui/ui.cpp:1129 msgid "" "This machine has no sound hardware, MAME will produce no sounds, this is " "expected behaviour.\n" msgstr "" -"Deze machine heeft geen geluidhardware, MAME zal geen geluid produceren, dit " +"Deze machine heeft geen geluidshardware, MAME zal geen geluid produceren, dit " "is verwacht gedrag.\n" #: src/emu/ui/ui.cpp:1137 msgid "The machine has protection which isn't fully emulated.\n" -msgstr "Deze machine heeft beveiliging die nog niet volledig is geëmuleerd.\n" +msgstr "Deze machine heeft een beveiliging die nog niet volledig is geëmuleerd.\n" #: src/emu/ui/ui.cpp:1140 msgid "" @@ -1707,7 +1707,7 @@ msgid "" msgstr "" "DEZE MACHINE DOET HET NIET. De emulatie van deze machine is nog niet " "compleet. Er is niets wat je kunt doen om dit probleem te verhelpen afgezien " -"van het afwachten tot de ontwikkelaars de emulatie verder verbeteren.\n" +"van het afwachten tot ontwikkelaars de emulatie verder verbeteren.\n" #: src/emu/ui/ui.cpp:1144 msgid "" @@ -1719,7 +1719,7 @@ msgstr "" "\n" "Bepaalde onderdelen van deze machine kunnen niet worden geëmuleerd in " "verband met fysieke interactie of het gebruik van mechanische componenten. " -"Het is niet mogelijk deze machine volledig te spelen.\n" +"Het is niet mogelijk om deze machine volledig te spelen.\n" #: src/emu/ui/ui.cpp:1163 msgid "" @@ -1901,7 +1901,7 @@ msgstr "%1$s gamma" #: src/emu/ui/ui.cpp:2035 #, c-format msgid "%1$s Horiz Stretch" -msgstr "%1$s horizontale strekking" +msgstr "%1$s horizontale stretch" #: src/emu/ui/ui.cpp:2038 #, c-format @@ -1911,7 +1911,7 @@ msgstr "%1$s horizontale positie" #: src/emu/ui/ui.cpp:2041 #, c-format msgid "%1$s Vert Stretch" -msgstr "%1$s verticale strekking" +msgstr "%1$s verticale stretch" #: src/emu/ui/ui.cpp:2044 #, c-format @@ -1921,7 +1921,7 @@ msgstr "%1$s verticale positie" #: src/emu/ui/ui.cpp:2062 #, c-format msgid "Laserdisc '%1$s' Horiz Stretch" -msgstr "Laserdisc '%1$s' horizontale strekking" +msgstr "Laserdisc '%1$s' horizontale stretch" #: src/emu/ui/ui.cpp:2065 #, c-format @@ -1931,7 +1931,7 @@ msgstr "Laserdisc '%1$s' horizontale positie" #: src/emu/ui/ui.cpp:2068 #, c-format msgid "Laserdisc '%1$s' Vert Stretch" -msgstr "Laserdic '%1$s' verticale strekking" +msgstr "Laserdic '%1$s' verticale stretch" #: src/emu/ui/ui.cpp:2071 #, c-format @@ -1944,15 +1944,15 @@ msgstr "" #: src/emu/ui/ui.cpp:2082 msgid "Beam Width Minimum" -msgstr "Minimale straal breedte" +msgstr "Minimale straalbreedte" #: src/emu/ui/ui.cpp:2084 msgid "Beam Width Maximum" -msgstr "Maximale straal breedte" +msgstr "Maximale straalbreedte" #: src/emu/ui/ui.cpp:2086 msgid "Beam Intensity Weight" -msgstr "Gewicht straal intensiteit" +msgstr "Gewicht straalintensiteit" #: src/emu/ui/ui.cpp:2098 #, c-format @@ -2084,4 +2084,4 @@ msgstr " PENNEN" #~ msgstr "Configureer machine" #~ msgid "Multi-Threaded Rendering" -#~ msgstr "Multithreaded tekenen" +#~ msgstr "Multithreaded renderen" -- cgit v1.2.3 From c9bd18a22de57f99733fac624ce0ad323ebb572b Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 26 Mar 2016 21:04:15 -0400 Subject: apple2: start reverse-engineering the AE PC Transporter card [R. Belmont] --- scripts/src/bus.lua | 2 + src/devices/bus/a2bus/pc_xporter.cpp | 255 +++++++++++++++++++++++++++++++++++ src/devices/bus/a2bus/pc_xporter.h | 53 ++++++++ src/mame/drivers/apple2e.cpp | 2 + 4 files changed, 312 insertions(+) create mode 100644 src/devices/bus/a2bus/pc_xporter.cpp create mode 100644 src/devices/bus/a2bus/pc_xporter.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 76010b7679d..5423c224127 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1445,6 +1445,8 @@ if (BUSES["A2BUS"]~=null) then MAME_DIR .. "src/devices/bus/a2bus/ramcard128k.h", MAME_DIR .. "src/devices/bus/a2bus/ezcgi.cpp", MAME_DIR .. "src/devices/bus/a2bus/ezcgi.h", + MAME_DIR .. "src/devices/bus/a2bus/pc_xporter.cpp", + MAME_DIR .. "src/devices/bus/a2bus/pc_xporter.h", } end diff --git a/src/devices/bus/a2bus/pc_xporter.cpp b/src/devices/bus/a2bus/pc_xporter.cpp new file mode 100644 index 00000000000..2a5f9b38acf --- /dev/null +++ b/src/devices/bus/a2bus/pc_xporter.cpp @@ -0,0 +1,255 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + pcxporter.cpp + + Implementation of the Applied Engineering PC Transporter card + Preliminary version by R. Belmont + + The PC Transporter is basically a PC-XT on an Apple II card. + Features include: + - V30 CPU @ 4.77 MHz + - 768K of RAM, which defines the V30 address space from 0x00000 to 0xBFFFF + and is fully read/writable by the Apple's CPU. + - Usual XT hardware, mostly inside custom ASICs. There's a discrete + NEC uPD71054 (i8254-compatible PIT) though. + - CGA-compatible video, output to a separate CGA monitor or NTSC-compliant analog + RGB monitor (e.g. the IIgs RGB monitor). + - XT-compatible keyboard interface. + - PC-style floppy controller: supports 360K 5.25" disks and 720K 3.5" disks + - HDD controller which is redirected to a file on the Apple's filesystem + + The V30 BIOS is downloaded by the Apple; the Apple also writes text to the CGA screen prior to + the V30's being launched. + + The board was developed by The Engineering Department, a company made up mostly of early Apple + engineers including Apple /// designer Dr. Wendall Sander and ProDOS creator Dick Huston. + + Software and user documentation at: + http://mirrors.apple2.org.za/Apple%20II%20Documentation%20Project/Interface%20Cards/CPU/AE%20PC%20Transporter/ + + Notes: + Registers live at CFxx; access CFFF to clear C800 reservation, + then read Cn00 to map C800-CFFF first. + + PC RAM from 0xA0000-0xAFFFF is where the V30 BIOS is downloaded, + plus used for general storage by the system. + RAM from 0xB0000-0xBFFFF is the CGA framebuffer as usual. + + CF00: PC memory pointer (bits 0-7) + CF01: PC memory pointer (bits 8-15) + CF02: PC memory pointer (bits 16-23) + CF03: read/write PC memory at the pointer and increment the pointer + CF04: read/write PC memory at the pointer and *don't* increment the pointer + + TODO: + - A2 probably also can access the V30's I/O space: where's that at? CF0E/CF0F + are suspects... + - There's likely A2 ROM at CnXX and C800-CBFF to support the "Slinky" memory + expansion card emulation function inside one of the custom ASICs. Need to + dump this... + +*********************************************************************/ + +#include "pc_xporter.h" + +/*************************************************************************** + PARAMETERS +***************************************************************************/ + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +const device_type A2BUS_PCXPORTER = &device_creator; + +static MACHINE_CONFIG_FRAGMENT( pcxporter ) +MACHINE_CONFIG_END + +/*************************************************************************** + FUNCTION PROTOTYPES +***************************************************************************/ + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor a2bus_pcxporter_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( pcxporter ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +a2bus_pcxporter_device::a2bus_pcxporter_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : + device_t(mconfig, type, name, tag, owner, clock, shortname, source), + device_a2bus_card_interface(mconfig, *this) +{ +} + +a2bus_pcxporter_device::a2bus_pcxporter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, A2BUS_PCXPORTER, "Applied Engineering PC Transporter", tag, owner, clock, "a2pcxport", __FILE__), + device_a2bus_card_interface(mconfig, *this) +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void a2bus_pcxporter_device::device_start() +{ + // set_a2bus_device makes m_slot valid + set_a2bus_device(); + + memset(m_ram, 0, 768*1024); + memset(m_regs, 0, 0x400); + m_offset = 0; + + save_item(NAME(m_ram)); + save_item(NAME(m_regs)); + save_item(NAME(m_offset)); +} + +void a2bus_pcxporter_device::device_reset() +{ +} + + +/*------------------------------------------------- + read_c0nx - called for reads from this card's c0nx space +-------------------------------------------------*/ + +UINT8 a2bus_pcxporter_device::read_c0nx(address_space &space, UINT8 offset) +{ + switch (offset) + { + default: + printf("Read c0n%x (PC=%x)\n", offset, space.device().safe_pc()); + break; + } + + return 0xff; +} + + +/*------------------------------------------------- + write_c0nx - called for writes to this card's c0nx space +-------------------------------------------------*/ + +void a2bus_pcxporter_device::write_c0nx(address_space &space, UINT8 offset, UINT8 data) +{ + switch (offset) + { + default: + printf("Write %02x to c0n%x (PC=%x)\n", data, offset, space.device().safe_pc()); + break; + } +} + +/*------------------------------------------------- + read_cnxx - called for reads from this card's cnxx space +-------------------------------------------------*/ + +UINT8 a2bus_pcxporter_device::read_cnxx(address_space &space, UINT8 offset) +{ + // read only to trigger C800? + return 0xff; +} + +void a2bus_pcxporter_device::write_cnxx(address_space &space, UINT8 offset, UINT8 data) +{ + printf("Write %02x to cn%02x (PC=%x)\n", data, offset, space.device().safe_pc()); +} + +/*------------------------------------------------- + read_c800 - called for reads from this card's c800 space +-------------------------------------------------*/ + +UINT8 a2bus_pcxporter_device::read_c800(address_space &space, UINT16 offset) +{ +// printf("Read C800 at %x\n", offset + 0xc800); + + if (offset < 0x400) + { + return 0xff; + } + else + { + UINT8 rv; + + switch (offset) + { + case 0x700: + return m_offset & 0xff; + + case 0x701: + return (m_offset >> 8) & 0xff; + + case 0x702: + return (m_offset >> 16) & 0xff; + + case 0x703: // read with increment + rv = m_ram[m_offset]; + m_offset++; + return rv; + + case 0x704: // read w/o increment + rv = m_ram[m_offset]; + return rv; + } + + return m_regs[offset]; + } +} + +/*------------------------------------------------- + write_c800 - called for writes to this card's c800 space +-------------------------------------------------*/ +void a2bus_pcxporter_device::write_c800(address_space &space, UINT16 offset, UINT8 data) +{ + if (offset < 0x400) + { + } + else + { + switch (offset) + { + case 0x700: + m_offset &= ~0xff; + m_offset |= data; +// printf("offset now %x (PC=%x)\n", m_offset, space.device().safe_pc()); + break; + + case 0x701: + m_offset &= ~0xff00; + m_offset |= (data<<8); +// printf("offset now %x (PC=%x)\n", m_offset, space.device().safe_pc()); + break; + + case 0x702: + m_offset &= ~0xff0000; + m_offset |= (data<<16); +// printf("offset now %x (PC=%x)\n", m_offset, space.device().safe_pc()); + break; + + case 0x703: // write w/increment + m_ram[m_offset] = data; + m_offset++; + break; + + case 0x704: // write w/o increment + m_ram[m_offset] = data; + break; + + default: + printf("%02x to C800 at %x\n", data, offset + 0xc800); + m_regs[offset] = data; + break; + } + } +} diff --git a/src/devices/bus/a2bus/pc_xporter.h b/src/devices/bus/a2bus/pc_xporter.h new file mode 100644 index 00000000000..7126439a265 --- /dev/null +++ b/src/devices/bus/a2bus/pc_xporter.h @@ -0,0 +1,53 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************* + + pc_xporter.h + + Implementation of the Applied Engineering PC Transporter card + +*********************************************************************/ + +#pragma once + +#include "emu.h" +#include "a2bus.h" +#include "machine/genpc.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_pcxporter_device: + public device_t, + public device_a2bus_card_interface +{ +public: + // construction/destruction + a2bus_pcxporter_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); + a2bus_pcxporter_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + // overrides of standard a2bus slot functions + virtual UINT8 read_c0nx(address_space &space, UINT8 offset) override; + virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) override; + virtual UINT8 read_cnxx(address_space &space, UINT8 offset) override; + virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) override; + virtual UINT8 read_c800(address_space &space, UINT16 offset) override; + virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) override; + +private: + UINT8 m_ram[768*1024]; + UINT8 m_regs[0x400]; + UINT32 m_offset; +}; + +// device type definition +extern const device_type A2BUS_PCXPORTER; + diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 7727c74379f..27b3dd0fc59 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -144,6 +144,7 @@ Address bus A0-A11 is Y0-Y11 #include "bus/a2bus/timemasterho.h" #include "bus/a2bus/mouse.h" #include "bus/a2bus/ezcgi.h" +#include "bus/a2bus/pc_xporter.h" #include "bus/a2bus/a2eauxslot.h" #include "bus/a2bus/a2estd80col.h" #include "bus/a2bus/a2eext80col.h" @@ -3188,6 +3189,7 @@ static SLOT_INTERFACE_START(apple2_cards) SLOT_INTERFACE("ezcgi9938", A2BUS_EZCGI_9938) /* E-Z Color Graphics Interface (TMS9938) */ SLOT_INTERFACE("ezcgi9958", A2BUS_EZCGI_9958) /* E-Z Color Graphics Interface (TMS9958) */ // SLOT_INTERFACE("magicmusician", A2BUS_MAGICMUSICIAN) /* Magic Musician Card */ + SLOT_INTERFACE("pcxport", A2BUS_PCXPORTER) /* Applied Engineering PC Transporter */ SLOT_INTERFACE_END static SLOT_INTERFACE_START(apple2eaux_cards) -- cgit v1.2.3 From d8ade1e5ddb4a78d0345655ba800a96627aa558e Mon Sep 17 00:00:00 2001 From: system11b Date: Sun, 27 Mar 2016 03:16:45 +0100 Subject: World rev of Crime Fighters now default, 4P version was made purely for the US market. No longer loading unused ROMs in one version of Penfan girls since that board physically doesn't have the chips. --- src/mame/drivers/crimfght.cpp | 94 +++++++++++++++++++++++++------------------ src/mame/drivers/eolith.cpp | 8 ++-- src/mame/mame.lst | 4 +- 3 files changed, 61 insertions(+), 45 deletions(-) diff --git a/src/mame/drivers/crimfght.cpp b/src/mame/drivers/crimfght.cpp index 460e133caa6..d2d96443c6d 100644 --- a/src/mame/drivers/crimfght.cpp +++ b/src/mame/drivers/crimfght.cpp @@ -134,8 +134,8 @@ static INPUT_PORTS_START( crimfght ) PORT_DIPSETTING( 0x0b, DEF_STR( 1C_5C )) PORT_DIPSETTING( 0x0a, DEF_STR( 1C_6C )) PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C )) - PORT_DIPSETTING( 0x00, "Void") - PORT_DIPNAME(0xf0, 0x00, "Coin B (unused)") PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING( 0x00, DEF_STR( Free_Play )) + PORT_DIPNAME(0xf0, 0xf0, "Coin B") PORT_DIPLOCATION("SW1:5,6,7,8") PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C )) PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C )) PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C )) @@ -151,11 +151,14 @@ static INPUT_PORTS_START( crimfght ) PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C )) PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C )) PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C )) - PORT_DIPSETTING( 0x00, "Void") + PORT_DIPSETTING( 0x00, DEF_STR( Unused )) PORT_START("DSW2") - PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW2:1") - PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW2:2") + PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x03, "1" ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x01, "3" ) + PORT_DIPSETTING( 0x00, "4" ) PORT_DIPUNUSED_DIPLOC(0x04, 0x04, "SW2:3") PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "SW2:4") PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "SW2:5") @@ -178,63 +181,74 @@ static INPUT_PORTS_START( crimfght ) PORT_BIT(0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, crimfght_state, system_r, NULL) PORT_START("P1") - KONAMI8_B12_UNK(1) + KONAMI8_B123_START(1) PORT_START("P2") - KONAMI8_B12_UNK(2) + KONAMI8_B123_START(2) PORT_START("P3") - KONAMI8_B12_UNK(3) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("P4") - KONAMI8_B12_UNK(4) + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("SYSTEM") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_COIN1) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_COIN2) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_COIN3) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN4) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_SERVICE1) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_SERVICE2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE3) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_SERVICE4) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) INPUT_PORTS_END -static INPUT_PORTS_START( crimfghtj ) +static INPUT_PORTS_START( crimfghtu ) PORT_INCLUDE( crimfght ) PORT_MODIFY("DSW1") - KONAMI_COINAGE_LOC(DEF_STR( Free_Play ), "No Coin B", SW1) - /* "No Coin B" = coins produce sound, but no effect on coin counter */ + PORT_DIPNAME(0xf0, 0x00, "Coin B (Unused)") PORT_DIPLOCATION("SW1:5,6,7,8") + PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C )) + PORT_DIPSETTING( 0x50, DEF_STR( 3C_1C )) + PORT_DIPSETTING( 0x80, DEF_STR( 2C_1C )) + PORT_DIPSETTING( 0x40, DEF_STR( 3C_2C )) + PORT_DIPSETTING( 0x10, DEF_STR( 4C_3C )) + PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C )) + PORT_DIPSETTING( 0x30, DEF_STR( 3C_4C )) + PORT_DIPSETTING( 0x70, DEF_STR( 2C_3C )) + PORT_DIPSETTING( 0xe0, DEF_STR( 1C_2C )) + PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C )) + PORT_DIPSETTING( 0xd0, DEF_STR( 1C_3C )) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C )) + PORT_DIPSETTING( 0xb0, DEF_STR( 1C_5C )) + PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C )) + PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C )) + PORT_DIPSETTING( 0x00, DEF_STR( Unused )) PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") - PORT_DIPSETTING( 0x03, "1" ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x01, "3" ) - PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPUNUSED_DIPLOC(0x01, 0x01, "SW2:1") + PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "SW2:2") - PORT_MODIFY("P1") - KONAMI8_B123_START(1) + PORT_MODIFY("P1") + KONAMI8_B12_UNK(1) - PORT_MODIFY("P2") - KONAMI8_B123_START(2) + PORT_MODIFY("P2") + KONAMI8_B12_UNK(2) - PORT_MODIFY("P3") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_MODIFY("P3") + KONAMI8_B12_UNK(3) - PORT_MODIFY("P4") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_MODIFY("P4") + KONAMI8_B12_UNK(4) PORT_MODIFY("SYSTEM") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) INPUT_PORTS_END - /*************************************************************************** Machine Driver @@ -344,7 +358,7 @@ MACHINE_CONFIG_END ROM_START( crimfght ) ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "821l02.f24", 0x00000, 0x20000, CRC(588e7da6) SHA1(285febb3bcca31f82b34af3695a59eafae01cd30) ) + ROM_LOAD( "821r02.f24", 0x00000, 0x20000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ ROM_LOAD( "821l01.h4", 0x0000, 0x8000, CRC(0faca89e) SHA1(21c9c6d736b398a29e8709e1187c5bf3cacdc99d) ) @@ -386,9 +400,9 @@ ROM_START( crimfghtj ) ROM_LOAD( "821k03.e5", 0x00000, 0x40000, CRC(fef8505a) SHA1(5c5121609f69001838963e961cb227d6b64e4f5f) ) ROM_END -ROM_START( crimfght2 ) +ROM_START( crimfghtu ) ROM_REGION( 0x20000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "821r02.f24", 0x00000, 0x20000, CRC(4ecdd923) SHA1(78e5260c4bb9b18d7818fb6300d7e1d3a577fb63) ) + ROM_LOAD( "821l02.f24", 0x00000, 0x20000, CRC(588e7da6) SHA1(285febb3bcca31f82b34af3695a59eafae01cd30) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ ROM_LOAD( "821l01.h4", 0x0000, 0x8000, CRC(0faca89e) SHA1(21c9c6d736b398a29e8709e1187c5bf3cacdc99d) ) @@ -414,6 +428,6 @@ ROM_END ***************************************************************************/ -GAME( 1989, crimfght, 0, crimfght, crimfght, driver_device, 0, ROT0, "Konami", "Crime Fighters (US 4 players)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, crimfght2, crimfght, crimfght, crimfghtj, driver_device,0, ROT0, "Konami", "Crime Fighters (World 2 Players)", MACHINE_SUPPORTS_SAVE ) -GAME( 1989, crimfghtj, crimfght, crimfght, crimfghtj, driver_device,0, ROT0, "Konami", "Crime Fighters (Japan 2 Players)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, crimfght, 0, crimfght, crimfght, driver_device, 0, ROT0, "Konami", "Crime Fighters (World 2 players)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, crimfghtu, crimfght, crimfght, crimfghtu, driver_device,0, ROT0, "Konami", "Crime Fighters (US 4 Players)", MACHINE_SUPPORTS_SAVE ) +GAME( 1989, crimfghtj, crimfght, crimfght, crimfght, driver_device,0, ROT0, "Konami", "Crime Fighters (Japan 2 Players)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/eolith.cpp b/src/mame/drivers/eolith.cpp index 101d6788365..80879dbb7ae 100644 --- a/src/mame/drivers/eolith.cpp +++ b/src/mame/drivers/eolith.cpp @@ -36,7 +36,8 @@ 1999 - Land Breaker (pcb ver 3.03) (MCU internal flash dump is missing) 1999 - Land Breaker (pcb ver 3.02) 1999 - New Hidden Catch (pcb ver 3.02) - 1999 - Penfan Girls + 1999 - Penfan Girls (set 1, pcb ver 3.03) + 1999 - Penfan Girls (set 2, pcb ver 3.03P) 2000 - Hidden Catch 3 (v. 1.00 / pcb ver 3.05) 2001 - Fortress 2 Blue Arcade (v. 1.01 / pcb ver 3.05) 2001 - Fortress 2 Blue Arcade (v. 1.00 / pcb ver 3.05) @@ -1199,8 +1200,9 @@ ROM_START( penfana ) ROM_LOAD32_WORD_SWAP( "11.u11", 0x1400002, 0x200000, CRC(ddcd2bae) SHA1(c4fa5ebbaf801a7f06222150658033955966fe1b) ) ROM_LOAD32_WORD_SWAP( "12.u17", 0x1800000, 0x200000, CRC(2eed0f64) SHA1(3b9e65e41d8699a93ea74225ba12a3f66ecba11d) ) ROM_LOAD32_WORD_SWAP( "13.u12", 0x1800002, 0x200000, CRC(cc3068a8) SHA1(0022fad5a4d36678d35e99092c870f2b99d3d8d4) ) - ROM_LOAD32_WORD_SWAP( "14.u18", 0x1c00000, 0x200000, CRC(20a9a08e) SHA1(fe4071cdf78d362bccaee92cdc70c66f7e30f817) ) // not checked by rom check - ROM_LOAD32_WORD_SWAP( "15.u13", 0x1c00002, 0x200000, CRC(872fa9c4) SHA1(4902faa97c9a3a9671cfefc6a711cfcd25f2d6bc) ) // not checked by rom check + // The 3.03P version doesn't even have these populated + //ROM_LOAD32_WORD_SWAP( "14.u18", 0x1c00000, 0x200000, CRC(20a9a08e) SHA1(fe4071cdf78d362bccaee92cdc70c66f7e30f817) ) // not checked by rom check + //ROM_LOAD32_WORD_SWAP( "15.u13", 0x1c00002, 0x200000, CRC(872fa9c4) SHA1(4902faa97c9a3a9671cfefc6a711cfcd25f2d6bc) ) // not checked by rom check ROM_REGION( 0x008000, "soundcpu", 0 ) /* Sound (80c301) CPU Code */ ROM_LOAD( "pfg.u111", 0x0000, 0x8000, CRC(79012474) SHA1(09a2d5705d7bc52cc2d1644c87c1e31ee44813ef) ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 2c65ae0d192..e24dcdf01bb 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -9935,8 +9935,8 @@ crgolfc // (c) 1984 Nasco Japan crgolfhi // (c) 1984 Nasco Japan @source:crimfght.cpp -crimfght // GX821 (c) 1989 (US) -crimfght2 // GX821 (c) 1989 (World) +crimfght // GX821 (c) 1989 (World) +crimfghtu // GX821 (c) 1989 (US) crimfghtj // GX821 (c) 1989 (Japan) @source:crospang.cpp -- cgit v1.2.3 From 852240ddf238b9b7f518292a407b655ff92c04ee Mon Sep 17 00:00:00 2001 From: Lord-Nightmare Date: Sat, 26 Mar 2016 22:22:34 -0400 Subject: fix compile (nw) --- src/osd/modules/render/bgfx/targetmanager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/osd/modules/render/bgfx/targetmanager.cpp b/src/osd/modules/render/bgfx/targetmanager.cpp index 1aa0418938a..5b342f077fc 100644 --- a/src/osd/modules/render/bgfx/targetmanager.cpp +++ b/src/osd/modules/render/bgfx/targetmanager.cpp @@ -25,7 +25,6 @@ target_manager::target_manager(texture_manager& textures) : m_textures(textures) , m_screen_count(0) { - (void)m_options; // prevent carping about unused variable } target_manager::~target_manager() -- cgit v1.2.3 From 39db5d582e3199ce4eb8d71b41dd14c0d918e9e3 Mon Sep 17 00:00:00 2001 From: briantro Date: Sun, 27 Mar 2016 00:54:20 -0500 Subject: tourvis.cpp: Added redump of the Volfied cart. [system11, The Dumping Union] --- src/mame/drivers/tourvis.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/tourvis.cpp b/src/mame/drivers/tourvis.cpp index 769171d5b2f..153c8f6e2ce 100644 --- a/src/mame/drivers/tourvis.cpp +++ b/src/mame/drivers/tourvis.cpp @@ -92,13 +92,12 @@ USA Pro Basketball Veigues * Vigilante - # Volfied + Volfied W-Ring Winning Shot Xevious * Denotes Not Dumped -# Denotes Redump Needed _______________________________________________________________________________________________________________________________________________ | | @@ -1008,7 +1007,7 @@ ROM_END /* Volfied - Taito */ ROM_START(tvvolfd) ROM_REGION( 0x100000, "maincpu", 0 ) - ROM_LOAD( "tourv_volfd.bin", 0x00000, 0x100000, BAD_DUMP CRC(c33efba5) SHA1(41ad4f85e551321487be61e2adbeae67e65c47de) ) + ROM_LOAD( "tourv_volfd.bin", 0x00000, 0x100000, CRC(6349113d) SHA1(b413342122409ea4ed981bd5077285cdcf337890) ) TOURVISION_BIOS ROM_END -- cgit v1.2.3 From beb8dbe1d24d28a0a4e5d0c89b151a4b7d71b349 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 27 Mar 2016 02:18:33 -0400 Subject: Avoid dereferencing null pointers in set_system_name (nw) --- src/emu/emuopts.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/emu/emuopts.cpp b/src/emu/emuopts.cpp index 38bcee35467..38624009588 100644 --- a/src/emu/emuopts.cpp +++ b/src/emu/emuopts.cpp @@ -580,8 +580,8 @@ void emu_options::set_system_name(const char *name) // look up the software part machine_config config(*cursystem, *this); software_list_device *swlist = software_list_device::find_by_name(config, sw_list.c_str()); - software_info *swinfo = swlist->find(sw_name.c_str()); - software_part *swpart = swinfo->find_part(sw_part.c_str()); + software_info *swinfo = swlist != nullptr ? swlist->find(sw_name.c_str()) : nullptr; + software_part *swpart = swinfo != nullptr ? swinfo->find_part(sw_part.c_str()) : nullptr; // then add the options if (new_system) -- cgit v1.2.3 From 38ebda11b46953d2ba3e957ae1dbdec3a9bf49d9 Mon Sep 17 00:00:00 2001 From: sum2012 Date: Sun, 27 Mar 2016 21:15:53 +0800 Subject: Fix compile win 64 bit with mingw 32 bit Fix #739 --- makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makefile b/makefile index 31782fa36fe..7b7bba3a782 100644 --- a/makefile +++ b/makefile @@ -273,6 +273,9 @@ endif endif ifeq ($(OS),windows) +ifndef $(MINGW64) +ARCHITECTURE := _x86 +endif ifeq ($(ARCHITECTURE),_x64) WINDRES := $(MINGW64)/bin/windres else -- cgit v1.2.3 From 2e21930b27320bfdd50b536191143849d98d2815 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sat, 26 Mar 2016 17:59:25 +0100 Subject: netlist: - Simply solver code. - Remove ATTR_HOT from solver code. - make virtual members protected --- src/lib/netlist/solver/nld_ms_direct.h | 59 +++++++++++++------------------ src/lib/netlist/solver/nld_ms_direct1.h | 14 ++------ src/lib/netlist/solver/nld_ms_direct2.h | 14 ++------ src/lib/netlist/solver/nld_ms_direct_lu.h | 51 +++++++++++--------------- src/lib/netlist/solver/nld_ms_gmres.h | 13 ++----- src/lib/netlist/solver/nld_ms_sor.h | 13 ++----- src/lib/netlist/solver/nld_ms_sor_mat.h | 13 ++++--- src/lib/netlist/solver/nld_solver.cpp | 24 ++++++------- src/lib/netlist/solver/nld_solver.h | 59 +++++++++++++++---------------- 9 files changed, 102 insertions(+), 158 deletions(-) diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index ab67795507f..586b71a2bbe 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -39,33 +39,31 @@ public: virtual void vsetup(analog_net_t::list_t &nets) override; virtual void reset() override { matrix_solver_t::reset(); } - ATTR_HOT inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } - ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); + virtual int vsolve_non_dynamic(const bool newton_raphson) override; protected: virtual void add_term(int net_idx, terminal_t *term) override; - ATTR_HOT virtual nl_double vsolve() override; - - ATTR_HOT int solve_non_dynamic(const bool newton_raphson); - ATTR_HOT void build_LE_A(); - ATTR_HOT void build_LE_RHS(); - ATTR_HOT void LE_solve(); - ATTR_HOT void LE_back_subst(nl_double * RESTRICT x); + int solve_non_dynamic(const bool newton_raphson); + void build_LE_A(); + void build_LE_RHS(); + void LE_solve(); + void LE_back_subst(nl_double * RESTRICT x); /* Full LU back substitution, not used currently, in for future use */ - ATTR_HOT void LE_back_subst_full(nl_double * RESTRICT x); + void LE_back_subst_full(nl_double * RESTRICT x); - ATTR_HOT nl_double delta(const nl_double * RESTRICT V); - ATTR_HOT void store(const nl_double * RESTRICT V); + nl_double delta(const nl_double * RESTRICT V); + void store(const nl_double * RESTRICT V); /* bring the whole system to the current time * Don't schedule a new calculation time. The recalculation has to be * triggered by the caller after the netlist element was changed. */ - ATTR_HOT nl_double compute_next_timestep(); + virtual nl_double compute_next_timestep() override; #if (NL_USE_DYNAMIC_ALLOCATION) @@ -117,7 +115,7 @@ matrix_solver_direct_t::~matrix_solver_direct_t() } template -ATTR_HOT nl_double matrix_solver_direct_t::compute_next_timestep() +nl_double matrix_solver_direct_t::compute_next_timestep() { nl_double new_solver_timestep = m_params.m_max_timestep; @@ -146,6 +144,8 @@ ATTR_HOT nl_double matrix_solver_direct_t::compute_next_timeste if (new_net_timestep < new_solver_timestep) new_solver_timestep = new_net_timestep; + + m_last_V[k] = n->Q_Analog(); } if (new_solver_timestep < m_params.m_min_timestep) new_solver_timestep = m_params.m_min_timestep; @@ -191,7 +191,7 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis m_rails_temp[k].clear(); } - matrix_solver_t::setup(nets); + matrix_solver_t::setup_base(nets); for (unsigned k = 0; k < N(); k++) { @@ -347,7 +347,7 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis template -ATTR_HOT void matrix_solver_direct_t::build_LE_A() +void matrix_solver_direct_t::build_LE_A() { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -376,7 +376,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_A() } template -ATTR_HOT void matrix_solver_direct_t::build_LE_RHS() +void matrix_solver_direct_t::build_LE_RHS() { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -401,7 +401,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_RHS() } template -ATTR_HOT void matrix_solver_direct_t::LE_solve() +void matrix_solver_direct_t::LE_solve() { const unsigned kN = N(); @@ -481,7 +481,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_solve() } template -ATTR_HOT void matrix_solver_direct_t::LE_back_subst( +void matrix_solver_direct_t::LE_back_subst( nl_double * RESTRICT x) { const unsigned kN = N(); @@ -517,7 +517,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst( } template -ATTR_HOT void matrix_solver_direct_t::LE_back_subst_full( +void matrix_solver_direct_t::LE_back_subst_full( nl_double * RESTRICT x) { const unsigned kN = N(); @@ -551,7 +551,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst_full( } template -ATTR_HOT nl_double matrix_solver_direct_t::delta( +nl_double matrix_solver_direct_t::delta( const nl_double * RESTRICT V) { /* FIXME: Ideally we should also include currents (RHS) here. This would @@ -567,7 +567,7 @@ ATTR_HOT nl_double matrix_solver_direct_t::delta( } template -ATTR_HOT void matrix_solver_direct_t::store( +void matrix_solver_direct_t::store( const nl_double * RESTRICT V) { for (unsigned i = 0, iN=N(); i < iN; i++) @@ -576,19 +576,13 @@ ATTR_HOT void matrix_solver_direct_t::store( } } -template -ATTR_HOT nl_double matrix_solver_direct_t::vsolve() -{ - this->solve_base(this); - return this->compute_next_timestep(); -} - template -ATTR_HOT int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { nl_double new_V[_storage_N]; // = { 0.0 }; + this->LE_solve(); this->LE_back_subst(new_V); if (newton_raphson) @@ -607,7 +601,7 @@ ATTR_HOT int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNU } template -ATTR_HOT inline int matrix_solver_direct_t::vsolve_non_dynamic(const bool newton_raphson) +inline int matrix_solver_direct_t::vsolve_non_dynamic(const bool newton_raphson) { this->build_LE_A(); this->build_LE_RHS(); @@ -615,10 +609,7 @@ ATTR_HOT inline int matrix_solver_direct_t::vsolve_non_dynamic( for (unsigned i=0, iN=N(); i < iN; i++) m_last_RHS[i] = RHS(i); - this->LE_solve(); - this->m_stat_calculations++; - return this->solve_non_dynamic(newton_raphson); } diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h index 81e8c329edf..909792a2787 100644 --- a/src/lib/netlist/solver/nld_ms_direct1.h +++ b/src/lib/netlist/solver/nld_ms_direct1.h @@ -20,23 +20,15 @@ public: matrix_solver_direct1_t(const solver_parameters_t *params) : matrix_solver_direct_t<1, 1>(params, 1) {} - ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve() override; -private: + virtual int vsolve_non_dynamic(const bool newton_raphson) override; + }; // ---------------------------------------------------------------------------------------- // matrix_solver - Direct1 // ---------------------------------------------------------------------------------------- -ATTR_HOT nl_double matrix_solver_direct1_t::vsolve() -{ - solve_base(this); - return this->compute_next_timestep(); -} - -ATTR_HOT inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { analog_net_t *net = m_nets[0]; this->build_LE_A(); diff --git a/src/lib/netlist/solver/nld_ms_direct2.h b/src/lib/netlist/solver/nld_ms_direct2.h index 4a6d768fe06..2488e573bf2 100644 --- a/src/lib/netlist/solver/nld_ms_direct2.h +++ b/src/lib/netlist/solver/nld_ms_direct2.h @@ -20,23 +20,15 @@ public: matrix_solver_direct2_t(const solver_parameters_t *params) : matrix_solver_direct_t<2, 2>(params, 2) {} - ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve() override; -private: + virtual int vsolve_non_dynamic(const bool newton_raphson) override; + }; // ---------------------------------------------------------------------------------------- // matrix_solver - Direct2 // ---------------------------------------------------------------------------------------- -ATTR_HOT nl_double matrix_solver_direct2_t::vsolve() -{ - solve_base(this); - return this->compute_next_timestep(); -} - -ATTR_HOT inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +inline int matrix_solver_direct2_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { build_LE_A(); build_LE_RHS(); diff --git a/src/lib/netlist/solver/nld_ms_direct_lu.h b/src/lib/netlist/solver/nld_ms_direct_lu.h index 07b3b9cb568..5efbe38ddab 100644 --- a/src/lib/netlist/solver/nld_ms_direct_lu.h +++ b/src/lib/netlist/solver/nld_ms_direct_lu.h @@ -33,18 +33,16 @@ public: virtual void vsetup(analog_net_t::list_t &nets) override; virtual void reset() override { matrix_solver_t::reset(); } - ATTR_HOT inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } - ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); + inline int vsolve_non_dynamic(const bool newton_raphson); protected: virtual void add_term(int net_idx, terminal_t *term) override; - ATTR_HOT virtual nl_double vsolve() override; - - ATTR_HOT int solve_non_dynamic(const bool newton_raphson); - ATTR_HOT void build_LE_A(); - ATTR_HOT void build_LE_RHS(nl_double * RESTRICT rhs); + int solve_non_dynamic(const bool newton_raphson); + void build_LE_A(); + void build_LE_RHS(nl_double * RESTRICT rhs); template void LEk() @@ -68,7 +66,7 @@ protected: } } - ATTR_HOT void LE_solve() + void LE_solve() { const unsigned kN = N(); unsigned sk = 1; @@ -127,15 +125,15 @@ protected: } } } - ATTR_HOT void LE_back_subst(nl_double * RESTRICT x); - ATTR_HOT nl_double delta(const nl_double * RESTRICT V); - ATTR_HOT void store(const nl_double * RESTRICT V); + void LE_back_subst(nl_double * RESTRICT x); + nl_double delta(const nl_double * RESTRICT V); + void store(const nl_double * RESTRICT V); /* bring the whole system to the current time * Don't schedule a new calculation time. The recalculation has to be * triggered by the caller after the netlist element was changed. */ - ATTR_HOT nl_double compute_next_timestep(); + nl_double compute_next_timestep(); template inline nl_ext_double &A(const T1 r, const T2 c) { return m_A[r][c]; } @@ -171,7 +169,7 @@ matrix_solver_direct_t::~matrix_solver_direct_t() } template -ATTR_HOT nl_double matrix_solver_direct_t::compute_next_timestep() +nl_double matrix_solver_direct_t::compute_next_timestep() { nl_double new_solver_timestep = m_params.m_max_timestep; @@ -245,7 +243,7 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis m_rails_temp[k].clear(); } - matrix_solver_t::setup(nets); + matrix_solver_t::setup_base(nets); for (unsigned k = 0; k < N(); k++) { @@ -373,7 +371,7 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis template -ATTR_HOT void matrix_solver_direct_t::build_LE_A() +void matrix_solver_direct_t::build_LE_A() { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -399,7 +397,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_A() } template -ATTR_HOT void matrix_solver_direct_t::build_LE_RHS(nl_double * RESTRICT rhs) +void matrix_solver_direct_t::build_LE_RHS(nl_double * RESTRICT rhs) { const unsigned iN = N(); for (unsigned k = 0; k < iN; k++) @@ -427,7 +425,7 @@ ATTR_HOT void matrix_solver_direct_t::build_LE_RHS(nl_double * #else // Crout algo template -ATTR_HOT void matrix_solver_direct_t::LE_solve() +void matrix_solver_direct_t::LE_solve() { const unsigned kN = N(); @@ -509,7 +507,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_solve() #endif template -ATTR_HOT void matrix_solver_direct_t::LE_back_subst( +void matrix_solver_direct_t::LE_back_subst( nl_double * RESTRICT x) { const unsigned kN = N(); @@ -543,7 +541,7 @@ ATTR_HOT void matrix_solver_direct_t::LE_back_subst( } template -ATTR_HOT nl_double matrix_solver_direct_t::delta( +nl_double matrix_solver_direct_t::delta( const nl_double * RESTRICT V) { /* FIXME: Ideally we should also include currents (RHS) here. This would @@ -559,7 +557,7 @@ ATTR_HOT nl_double matrix_solver_direct_t::delta( } template -ATTR_HOT void matrix_solver_direct_t::store( +void matrix_solver_direct_t::store( const nl_double * RESTRICT V) { for (unsigned i = 0, iN=N(); i < iN; i++) @@ -568,16 +566,9 @@ ATTR_HOT void matrix_solver_direct_t::store( } } -template -ATTR_HOT nl_double matrix_solver_direct_t::vsolve() -{ - this->solve_base(this); - return this->compute_next_timestep(); -} - template -ATTR_HOT int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) +int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { nl_double new_V[_storage_N]; // = { 0.0 }; @@ -599,7 +590,7 @@ ATTR_HOT int matrix_solver_direct_t::solve_non_dynamic(ATTR_UNU } template -ATTR_HOT inline int matrix_solver_direct_t::vsolve_non_dynamic(const bool newton_raphson) +inline int matrix_solver_direct_t::vsolve_non_dynamic(const bool newton_raphson) { this->build_LE_A(); this->build_LE_RHS(m_last_RHS); @@ -607,8 +598,6 @@ ATTR_HOT inline int matrix_solver_direct_t::vsolve_non_dynamic( for (unsigned i=0, iN=N(); i < iN; i++) m_RHS[i] = m_last_RHS[i]; - this->LE_solve(); - return this->solve_non_dynamic(newton_raphson); } diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h index 0ae7f5eab56..483decbd05d 100644 --- a/src/lib/netlist/solver/nld_ms_gmres.h +++ b/src/lib/netlist/solver/nld_ms_gmres.h @@ -54,9 +54,7 @@ public: } virtual void vsetup(analog_net_t::list_t &nets) override; - ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve() override; + virtual int vsolve_non_dynamic(const bool newton_raphson) override; private: @@ -126,14 +124,7 @@ void matrix_solver_GMRES_t::vsetup(analog_net_t::list_t &nets) } template -ATTR_HOT nl_double matrix_solver_GMRES_t::vsolve() -{ - this->solve_base(this); - return this->compute_next_timestep(); -} - -template -ATTR_HOT inline int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton_raphson) +int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton_raphson) { const unsigned iN = this->N(); diff --git a/src/lib/netlist/solver/nld_ms_sor.h b/src/lib/netlist/solver/nld_ms_sor.h index 556e9fddd7f..1805b23a9d0 100644 --- a/src/lib/netlist/solver/nld_ms_sor.h +++ b/src/lib/netlist/solver/nld_ms_sor.h @@ -33,9 +33,7 @@ public: virtual ~matrix_solver_SOR_t() {} virtual void vsetup(analog_net_t::list_t &nets) override; - ATTR_HOT virtual int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve() override; + virtual int vsolve_non_dynamic(const bool newton_raphson) override; private: nl_double m_lp_fact; @@ -54,14 +52,7 @@ void matrix_solver_SOR_t::vsetup(analog_net_t::list_t &nets) } template -ATTR_HOT nl_double matrix_solver_SOR_t::vsolve() -{ - this->solve_base(this); - return this->compute_next_timestep(); -} - -template -ATTR_HOT inline int matrix_solver_SOR_t::vsolve_non_dynamic(const bool newton_raphson) +int matrix_solver_SOR_t::vsolve_non_dynamic(const bool newton_raphson) { const unsigned iN = this->N(); bool resched = false; diff --git a/src/lib/netlist/solver/nld_ms_sor_mat.h b/src/lib/netlist/solver/nld_ms_sor_mat.h index 34c40c34d79..a4fce8dec2a 100644 --- a/src/lib/netlist/solver/nld_ms_sor_mat.h +++ b/src/lib/netlist/solver/nld_ms_sor_mat.h @@ -37,9 +37,7 @@ public: virtual void vsetup(analog_net_t::list_t &nets) override; - ATTR_HOT inline int vsolve_non_dynamic(const bool newton_raphson); -protected: - ATTR_HOT virtual nl_double vsolve() override; + virtual int vsolve_non_dynamic(const bool newton_raphson) override; private: nl_double m_Vdelta[_storage_N]; @@ -65,9 +63,10 @@ void matrix_solver_SOR_mat_t::vsetup(analog_net_t::list_t &nets this->save(NLNAME(m_Vdelta)); } - +#if 0 +//FIXME: move to solve_base template -ATTR_HOT nl_double matrix_solver_SOR_mat_t::vsolve() +nl_double matrix_solver_SOR_mat_t::vsolve() { /* * enable linear prediction on first newton pass @@ -111,9 +110,10 @@ ATTR_HOT nl_double matrix_solver_SOR_mat_t::vsolve() return this->compute_next_timestep(); } +#endif template -ATTR_HOT inline int matrix_solver_SOR_mat_t::vsolve_non_dynamic(const bool newton_raphson) +int matrix_solver_SOR_mat_t::vsolve_non_dynamic(const bool newton_raphson) { /* The matrix based code looks a lot nicer but actually is 30% slower than * the optimized code which works directly on the data structures. @@ -204,7 +204,6 @@ ATTR_HOT inline int matrix_solver_SOR_mat_t::vsolve_non_dynamic //this->netlist().warning("Falling back to direct solver .. Consider increasing RESCHED_LOOPS"); this->m_gs_fail++; - this->LE_solve(); return matrix_solver_direct_t::solve_non_dynamic(newton_raphson); } else { diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 701e418d4ef..39e4fdaacf2 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -105,7 +105,7 @@ ATTR_COLD matrix_solver_t::~matrix_solver_t() m_inps.clear_and_free(); } -ATTR_COLD void matrix_solver_t::setup(analog_net_t::list_t &nets) +ATTR_COLD void matrix_solver_t::setup_base(analog_net_t::list_t &nets) { log().debug("New solver setup\n"); @@ -185,14 +185,14 @@ ATTR_COLD void matrix_solver_t::setup(analog_net_t::list_t &nets) } -ATTR_HOT void matrix_solver_t::update_inputs() +void matrix_solver_t::update_inputs() { // avoid recursive calls. Inputs are updated outside this call for (std::size_t i=0; iset_Q(m_inps[i]->m_proxied_net->Q_Analog()); } -ATTR_HOT void matrix_solver_t::update_dynamic() +void matrix_solver_t::update_dynamic() { /* update all non-linear devices */ for (std::size_t i=0; i < m_dynamic_devices.size(); i++) @@ -236,15 +236,14 @@ ATTR_COLD void matrix_solver_t::update_forced() m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep)); } -ATTR_HOT void matrix_solver_t::step(const netlist_time delta) +void matrix_solver_t::step(const netlist_time delta) { const nl_double dd = delta.as_double(); for (std::size_t k=0; k < m_step_devices.size(); k++) m_step_devices[k]->step_time(dd); } -template -void matrix_solver_t::solve_base(C *p) +nl_double matrix_solver_t::solve_base() { m_stat_vsolver_calls++; if (is_dynamic()) @@ -255,7 +254,7 @@ void matrix_solver_t::solve_base(C *p) { update_dynamic(); // Gauss-Seidel will revert to Gaussian elemination if steps exceeded. - this_resched = p->vsolve_non_dynamic(true); + this_resched = this->vsolve_non_dynamic(true); newton_loops++; } while (this_resched > 1 && newton_loops < m_params.m_nr_loops); @@ -269,11 +268,12 @@ void matrix_solver_t::solve_base(C *p) } else { - p->vsolve_non_dynamic(false); + this->vsolve_non_dynamic(false); } + return this->compute_next_timestep(); } -ATTR_HOT nl_double matrix_solver_t::solve() +nl_double matrix_solver_t::solve() { const netlist_time now = netlist().time(); const netlist_time delta = now - m_last_step; @@ -289,7 +289,7 @@ ATTR_HOT nl_double matrix_solver_t::solve() step(delta); - const nl_double next_time_step = vsolve(); + const nl_double next_time_step = solve_base(); update_inputs(); return next_time_step; @@ -358,7 +358,7 @@ NETLIB_START(solver) /* automatic time step */ register_param("DYNAMIC_TS", m_dynamic, 0); - register_param("LTE", m_lte, 5e-5); // diff/timestep + register_param("DYNAMIC_LTE", m_lte, 5e-5); // diff/timestep register_param("MIN_TIMESTEP", m_min_timestep, 1e-6); // nl_double timestep resolution register_param("LOG_STATS", m_log_stats, 1); // nl_double timestep resolution @@ -618,7 +618,7 @@ ATTR_COLD void NETLIB_NAME(solver)::post_start() register_sub(pfmt("Solver_{1}")(m_mat_solvers.size()), *ms); - ms->vsetup(grp); + ms->setup(grp); m_mat_solvers.push_back(ms); diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h index 06a98d063c6..93d1e18be0e 100644 --- a/src/lib/netlist/solver/nld_solver.h +++ b/src/lib/netlist/solver/nld_solver.h @@ -68,14 +68,14 @@ class terms_t ATTR_COLD void add(terminal_t *term, int net_other, bool sorted); - ATTR_HOT inline unsigned count() { return m_term.size(); } + inline unsigned count() { return m_term.size(); } - ATTR_HOT inline terminal_t **terms() { return m_term.data(); } - ATTR_HOT inline int *net_other() { return m_net_other.data(); } - ATTR_HOT inline nl_double *gt() { return m_gt.data(); } - ATTR_HOT inline nl_double *go() { return m_go.data(); } - ATTR_HOT inline nl_double *Idr() { return m_Idr.data(); } - ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog.data(); } + inline terminal_t **terms() { return m_term.data(); } + inline int *net_other() { return m_net_other.data(); } + inline nl_double *gt() { return m_gt.data(); } + inline nl_double *go() { return m_go.data(); } + inline nl_double *Idr() { return m_Idr.data(); } + inline nl_double **other_curanalog() { return m_other_curanalog.data(); } ATTR_COLD void set_pointers(); @@ -108,43 +108,42 @@ public: ATTR_COLD matrix_solver_t(const eSolverType type, const solver_parameters_t *params); virtual ~matrix_solver_t(); - virtual void vsetup(analog_net_t::list_t &nets) = 0; + void setup(analog_net_t::list_t &nets) { vsetup(nets); } - template - void solve_base(C *p); + nl_double solve_base(); - ATTR_HOT nl_double solve(); + nl_double solve(); - ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.size() > 0; } - ATTR_HOT inline bool is_timestep() { return m_step_devices.size() > 0; } + inline bool is_dynamic() const { return m_dynamic_devices.size() > 0; } + inline bool is_timestep() const { return m_step_devices.size() > 0; } - ATTR_HOT void update_forced(); - ATTR_HOT inline void update_after(const netlist_time after) + void update_forced(); + void update_after(const netlist_time after) { m_Q_sync.net().reschedule_in_queue(after); } /* netdevice functions */ - ATTR_HOT virtual void update() override; + virtual void update() override; virtual void start() override; virtual void reset() override; ATTR_COLD int get_net_idx(net_t *net); - inline eSolverType type() const { return m_type; } + eSolverType type() const { return m_type; } plog_base &log() { return netlist().log(); } virtual void log_stats(); protected: - ATTR_COLD void setup(analog_net_t::list_t &nets); - ATTR_HOT void update_dynamic(); - - // should return next time step - ATTR_HOT virtual nl_double vsolve() = 0; + ATTR_COLD void setup_base(analog_net_t::list_t &nets); + void update_dynamic(); virtual void add_term(int net_idx, terminal_t *term) = 0; + virtual void vsetup(analog_net_t::list_t &nets) = 0; + virtual int vsolve_non_dynamic(const bool newton_raphson) = 0; + virtual nl_double compute_next_timestep() = 0; pvector_t m_nets; pvector_t m_inps; @@ -157,7 +156,7 @@ protected: const solver_parameters_t &m_params; - ATTR_HOT inline nl_double current_timestep() { return m_cur_ts; } + inline nl_double current_timestep() { return m_cur_ts; } private: netlist_time m_last_step; @@ -168,9 +167,9 @@ private: logic_input_t m_fb_sync; logic_output_t m_Q_sync; - ATTR_HOT void step(const netlist_time delta); + void step(const netlist_time delta); - ATTR_HOT void update_inputs(); + void update_inputs(); const eSolverType m_type; }; @@ -188,13 +187,13 @@ public: ATTR_COLD void post_start(); ATTR_COLD void stop() override; - ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); } + inline nl_double gmin() { return m_gmin.Value(); } protected: - ATTR_HOT void update() override; - ATTR_HOT void start() override; - ATTR_HOT void reset() override; - ATTR_HOT void update_param() override; + void update() override; + void start() override; + void reset() override; + void update_param() override; logic_input_t m_fb_step; logic_output_t m_Q_step; -- cgit v1.2.3 From 9d2f61ee92b9e1116ad4afdc51551546c729a551 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sun, 27 Mar 2016 03:15:27 +0200 Subject: netlist: - more code optimization - hide matrix_solver_t implementation - use netlist_time for time deltas --- nl_examples/kidniki.c | 23 +++-- scripts/src/netlist.lua | 1 + src/lib/netlist/devices/nld_mm5837.cpp | 2 +- src/lib/netlist/devices/nld_system.cpp | 1 + src/lib/netlist/nl_base.cpp | 3 +- src/lib/netlist/nl_base.h | 2 +- src/lib/netlist/solver/nld_matrix_solver.h | 144 +++++++++++++++++++++++++++++ src/lib/netlist/solver/nld_ms_direct.h | 105 ++++++++------------- src/lib/netlist/solver/nld_ms_direct1.h | 22 ++--- src/lib/netlist/solver/nld_ms_gmres.h | 31 +++---- src/lib/netlist/solver/nld_solver.cpp | 35 +++---- src/lib/netlist/solver/nld_solver.h | 130 +------------------------- src/mame/audio/irem.cpp | 5 +- 13 files changed, 248 insertions(+), 256 deletions(-) create mode 100644 src/lib/netlist/solver/nld_matrix_solver.h diff --git a/nl_examples/kidniki.c b/nl_examples/kidniki.c index b1d0a87317b..3b51e40328f 100644 --- a/nl_examples/kidniki.c +++ b/nl_examples/kidniki.c @@ -8,14 +8,18 @@ #define USE_FIXED_STV 1 NETLIST_START(dummy) -#if (USE_FRONTIERS) +#if (1 || USE_FRONTIERS) SOLVER(Solver, 18000) PARAM(Solver.ACCURACY, 1e-8) PARAM(Solver.NR_LOOPS, 300) PARAM(Solver.GS_LOOPS, 1) PARAM(Solver.GS_THRESHOLD, 6) //PARAM(Solver.ITERATIVE, "MAT") + //PARAM(Solver.ITERATIVE, "GMRES") PARAM(Solver.ITERATIVE, "SOR") + PARAM(Solver.DYNAMIC_TS, 0) + PARAM(Solver.DYNAMIC_LTE, 5e-3) + PARAM(Solver.MIN_TIMESTEP, 10e-6) PARAM(Solver.PARALLEL, 0) PARAM(Solver.SOR_FACTOR, 1.00) #else @@ -46,14 +50,15 @@ NETLIST_START(dummy) //ANALOG_INPUT(I_V0, 0) ALIAS(I_V0.Q, GND) #if 0 - ANALOG_INPUT(I_SD0, 0) - ANALOG_INPUT(I_BD0, 0) - ANALOG_INPUT(I_CH0, 0) - ANALOG_INPUT(I_OH0, 0) - ANALOG_INPUT(I_SOUNDIC0, 0) - ANALOG_INPUT(I_OKI0, 0) - ANALOG_INPUT(I_SOUND0, 0) - ANALOG_INPUT(I_SINH0, 0) + TTL_INPUT(I_SD0, 0) + TTL_INPUT(I_BD0, 0) + TTL_INPUT(I_CH0, 0) + TTL_INPUT(I_OH0, 0) + TTL_INPUT(I_SOUNDIC0, 0) + ANALOG_INPUT(I_MSM2K0, 0) + ANALOG_INPUT(I_MSM3K0, 0) + TTL_INPUT(I_SOUND0, 0) + TTL_INPUT(I_SINH0, 0) #else TTL_INPUT(I_SD0, 1) //CLOCK(I_SD0, 5) diff --git a/scripts/src/netlist.lua b/scripts/src/netlist.lua index 65b8ca29336..29bc8f0a7bb 100644 --- a/scripts/src/netlist.lua +++ b/scripts/src/netlist.lua @@ -73,6 +73,7 @@ project "netlist" MAME_DIR .. "src/lib/netlist/analog/nld_opamps.h", MAME_DIR .. "src/lib/netlist/solver/nld_solver.cpp", MAME_DIR .. "src/lib/netlist/solver/nld_solver.h", + MAME_DIR .. "src/lib/netlist/solver/nld_matrix_solver.h", MAME_DIR .. "src/lib/netlist/solver/nld_ms_direct.h", MAME_DIR .. "src/lib/netlist/solver/nld_ms_direct1.h", MAME_DIR .. "src/lib/netlist/solver/nld_ms_direct2.h", diff --git a/src/lib/netlist/devices/nld_mm5837.cpp b/src/lib/netlist/devices/nld_mm5837.cpp index 7f7ab6f8660..82e774b4923 100644 --- a/src/lib/netlist/devices/nld_mm5837.cpp +++ b/src/lib/netlist/devices/nld_mm5837.cpp @@ -5,7 +5,7 @@ * */ -#include +#include #include "nld_mm5837.h" #include "nl_setup.h" diff --git a/src/lib/netlist/devices/nld_system.cpp b/src/lib/netlist/devices/nld_system.cpp index dbf6926437d..e861bf05171 100644 --- a/src/lib/netlist/devices/nld_system.cpp +++ b/src/lib/netlist/devices/nld_system.cpp @@ -6,6 +6,7 @@ */ #include +#include #include "nld_system.h" NETLIB_NAMESPACE_DEVICES_START() diff --git a/src/lib/netlist/nl_base.cpp b/src/lib/netlist/nl_base.cpp index 9ebb1378e5b..7afa0285ef8 100644 --- a/src/lib/netlist/nl_base.cpp +++ b/src/lib/netlist/nl_base.cpp @@ -5,7 +5,8 @@ * */ -#include +#include + #include #include diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index e4374b75ad3..52a91704607 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -1062,7 +1062,7 @@ namespace netlist ATTR_HOT nl_double INPANALOG(const analog_input_t &inp) const { return inp.Q_Analog(); } - ATTR_HOT nl_double TERMANALOG(const terminal_t &term) const { return term.net().as_analog().Q_Analog(); } + ATTR_HOT nl_double TERMANALOG(const terminal_t &term) const { return term.net().Q_Analog(); } ATTR_HOT void OUTANALOG(analog_output_t &out, const nl_double val) { diff --git a/src/lib/netlist/solver/nld_matrix_solver.h b/src/lib/netlist/solver/nld_matrix_solver.h new file mode 100644 index 00000000000..40896d431e5 --- /dev/null +++ b/src/lib/netlist/solver/nld_matrix_solver.h @@ -0,0 +1,144 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nld_matrix_solver.h + * + */ + +#ifndef NLD_MATRIX_SOLVER_H_ +#define NLD_MATRIX_SOLVER_H_ + +#include "solver/nld_solver.h" + +NETLIB_NAMESPACE_DEVICES_START() + +class terms_t +{ + P_PREVENT_COPYING(terms_t) + + public: + ATTR_COLD terms_t() : m_railstart(0) + {} + + ATTR_COLD void clear() + { + m_term.clear(); + m_net_other.clear(); + m_gt.clear(); + m_go.clear(); + m_Idr.clear(); + m_other_curanalog.clear(); + } + + ATTR_COLD void add(terminal_t *term, int net_other, bool sorted); + + inline unsigned count() { return m_term.size(); } + + inline terminal_t **terms() { return m_term.data(); } + inline int *net_other() { return m_net_other.data(); } + inline nl_double *gt() { return m_gt.data(); } + inline nl_double *go() { return m_go.data(); } + inline nl_double *Idr() { return m_Idr.data(); } + inline nl_double **other_curanalog() { return m_other_curanalog.data(); } + + ATTR_COLD void set_pointers(); + + unsigned m_railstart; + + pvector_t m_nz; /* all non zero for multiplication */ + pvector_t m_nzrd; /* non zero right of the diagonal for elimination, includes RHS element */ + pvector_t m_nzbd; /* non zero below of the diagonal for elimination */ +private: + pvector_t m_term; + pvector_t m_net_other; + pvector_t m_go; + pvector_t m_gt; + pvector_t m_Idr; + pvector_t m_other_curanalog; +}; + +class matrix_solver_t : public device_t +{ +public: + typedef pvector_t list_t; + typedef core_device_t::list_t dev_list_t; + + enum eSolverType + { + GAUSSIAN_ELIMINATION, + GAUSS_SEIDEL + }; + + matrix_solver_t(const eSolverType type, const solver_parameters_t *params); + virtual ~matrix_solver_t(); + + void setup(analog_net_t::list_t &nets) { vsetup(nets); } + + netlist_time solve_base(); + + netlist_time solve(); + + inline bool is_dynamic() const { return m_dynamic_devices.size() > 0; } + inline bool is_timestep() const { return m_step_devices.size() > 0; } + + void update_forced(); + void update_after(const netlist_time after) + { + m_Q_sync.net().reschedule_in_queue(after); + } + + /* netdevice functions */ + virtual void update() override; + virtual void start() override; + virtual void reset() override; + + ATTR_COLD int get_net_idx(net_t *net); + + eSolverType type() const { return m_type; } + plog_base &log() { return netlist().log(); } + + virtual void log_stats(); + +protected: + + ATTR_COLD void setup_base(analog_net_t::list_t &nets); + void update_dynamic(); + + virtual void add_term(int net_idx, terminal_t *term) = 0; + virtual void vsetup(analog_net_t::list_t &nets) = 0; + virtual int vsolve_non_dynamic(const bool newton_raphson) = 0; + virtual netlist_time compute_next_timestep() = 0; + + pvector_t m_nets; + pvector_t m_inps; + + int m_stat_calculations; + int m_stat_newton_raphson; + int m_stat_vsolver_calls; + int m_iterative_fail; + int m_iterative_total; + + const solver_parameters_t &m_params; + + inline nl_double current_timestep() { return m_cur_ts; } +private: + + netlist_time m_last_step; + nl_double m_cur_ts; + dev_list_t m_step_devices; + dev_list_t m_dynamic_devices; + + logic_input_t m_fb_sync; + logic_output_t m_Q_sync; + + void step(const netlist_time &delta); + + void update_inputs(); + + const eSolverType m_type; +}; + + +NETLIB_NAMESPACE_DEVICES_END() + +#endif /* NLD_MS_DIRECT_H_ */ diff --git a/src/lib/netlist/solver/nld_ms_direct.h b/src/lib/netlist/solver/nld_ms_direct.h index 586b71a2bbe..5d0167f8758 100644 --- a/src/lib/netlist/solver/nld_ms_direct.h +++ b/src/lib/netlist/solver/nld_ms_direct.h @@ -39,32 +39,30 @@ public: virtual void vsetup(analog_net_t::list_t &nets) override; virtual void reset() override { matrix_solver_t::reset(); } - inline unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } - - virtual int vsolve_non_dynamic(const bool newton_raphson) override; - protected: virtual void add_term(int net_idx, terminal_t *term) override; - + virtual int vsolve_non_dynamic(const bool newton_raphson) override; int solve_non_dynamic(const bool newton_raphson); + + inline const unsigned N() const { if (m_N == 0) return m_dim; else return m_N; } + void build_LE_A(); void build_LE_RHS(); void LE_solve(); - void LE_back_subst(nl_double * RESTRICT x); - /* Full LU back substitution, not used currently, in for future use */ + template + void LE_back_subst(T * RESTRICT x); - void LE_back_subst_full(nl_double * RESTRICT x); + template + T delta(const T * RESTRICT V); - nl_double delta(const nl_double * RESTRICT V); - void store(const nl_double * RESTRICT V); + template + void store(const T * RESTRICT V); - /* bring the whole system to the current time - * Don't schedule a new calculation time. The recalculation has to be - * triggered by the caller after the netlist element was changed. - */ - virtual nl_double compute_next_timestep() override; + virtual netlist_time compute_next_timestep() override; + terms_t **m_terms; + terms_t *m_rails_temp; #if (NL_USE_DYNAMIC_ALLOCATION) template @@ -76,13 +74,11 @@ protected: inline nl_ext_double &A(const T1 &r, const T2 &c) { return m_A[r][c]; } template inline nl_ext_double &RHS(const T1 &r) { return m_A[r][N()]; } - #endif ATTR_ALIGN nl_double m_last_RHS[_storage_N]; // right hand side - contains currents ATTR_ALIGN nl_double m_last_V[_storage_N]; - terms_t **m_terms; - terms_t *m_rails_temp; + private: static const unsigned m_pitch = (((_storage_N + 1) + 7) / 8) * 8; @@ -94,6 +90,7 @@ private: //ATTR_ALIGN nl_ext_double m_RHSx[_storage_N]; const unsigned m_dim; + }; // ---------------------------------------------------------------------------------------- @@ -115,7 +112,7 @@ matrix_solver_direct_t::~matrix_solver_direct_t() } template -nl_double matrix_solver_direct_t::compute_next_timestep() +netlist_time matrix_solver_direct_t::compute_next_timestep() { nl_double new_solver_timestep = m_params.m_max_timestep; @@ -152,7 +149,7 @@ nl_double matrix_solver_direct_t::compute_next_timestep() } //if (new_solver_timestep > 10.0 * hn) // new_solver_timestep = 10.0 * hn; - return new_solver_timestep; + return netlist_time::from_double(new_solver_timestep); } template @@ -284,9 +281,15 @@ ATTR_COLD void matrix_solver_direct_t::vsetup(analog_net_t::lis t->m_nz.push_back(other[i]); } } + /* Add RHS element */ + if (!t->m_nzrd.contains(N())) + t->m_nzrd.push_back(N()); + + /* and sort */ psort_list(t->m_nzrd); t->m_nz.push_back(k); // add diagonal + psort_list(t->m_nz); } @@ -437,7 +440,7 @@ void matrix_solver_direct_t::LE_solve() if (f1 != NL_FCONST(0.0)) { nl_double * RESTRICT pi = &A(i,i+1); - nl_double * RESTRICT pj = &A(j,i+1); + const nl_double * RESTRICT pj = &A(j,i+1); #if 1 vec_add_mult_scalar(kN-i,pj,f1,pi); #else @@ -466,23 +469,18 @@ void matrix_solver_direct_t::LE_solve() { const unsigned j = pb[jb]; const nl_double f1 = - A(j,i) * f; -#if 0 - nl_double * RESTRICT pi = &m_A[i][i+1]; - nl_double * RESTRICT pj = &m_A[j][i+1]; - vec_add_mult_scalar(kN-i-1,pi,f1,pj); -#else for (unsigned k = 0; k < e; k++) A(j,p[k]) += A(i,p[k]) * f1; -#endif - RHS(j) += RHS(i) * f1; + //RHS(j) += RHS(i) * f1; } } } } template +template void matrix_solver_direct_t::LE_back_subst( - nl_double * RESTRICT x) + T * RESTRICT x) { const unsigned kN = N(); @@ -491,7 +489,7 @@ void matrix_solver_direct_t::LE_back_subst( { for (int j = kN - 1; j >= 0; j--) { - nl_double tmp = 0; + T tmp = 0; for (unsigned k = j+1; k < kN; k++) tmp += A(j,k) * x[k]; x[j] = (RHS(j) - tmp) / A(j,j); @@ -501,10 +499,10 @@ void matrix_solver_direct_t::LE_back_subst( { for (int j = kN - 1; j >= 0; j--) { - nl_double tmp = 0; + T tmp = 0; const unsigned *p = m_terms[j]->m_nzrd.data(); - const unsigned e = m_terms[j]->m_nzrd.size(); + const unsigned e = m_terms[j]->m_nzrd.size() - 1; /* exclude RHS element */ for (unsigned k = 0; k < e; k++) { @@ -516,43 +514,11 @@ void matrix_solver_direct_t::LE_back_subst( } } -template -void matrix_solver_direct_t::LE_back_subst_full( - nl_double * RESTRICT x) -{ - const unsigned kN = N(); - - /* back substitution */ - - // int ip; - // ii=-1 - - //for (int i=0; i < kN; i++) - // x[i] = m_RHS[i]; - - for (int i=0; i < kN; i++) - { - //ip=indx[i]; USE_PIVOT_SEARCH - //sum=b[ip]; - //b[ip]=b[i]; - double sum=RHS(i);//x[i]; - for (int j=0; j < i; j++) - sum -= A(i,j) * x[j]; - x[i]=sum; - } - for (int i=kN-1; i >= 0; i--) - { - double sum=x[i]; - for (int j = i+1; j < kN; j++) - sum -= A(i,j)*x[j]; - x[i] = sum / A(i,i); - } - -} template -nl_double matrix_solver_direct_t::delta( - const nl_double * RESTRICT V) +template +T matrix_solver_direct_t::delta( + const T * RESTRICT V) { /* FIXME: Ideally we should also include currents (RHS) here. This would * need a revaluation of the right hand side after voltages have been updated @@ -560,15 +526,16 @@ nl_double matrix_solver_direct_t::delta( */ const unsigned iN = this->N(); - nl_double cerr = 0; + T cerr = 0; for (unsigned i = 0; i < iN; i++) cerr = std::max(cerr, nl_math::abs(V[i] - this->m_nets[i]->m_cur_Analog)); return cerr; } template +template void matrix_solver_direct_t::store( - const nl_double * RESTRICT V) + const T * RESTRICT V) { for (unsigned i = 0, iN=N(); i < iN; i++) { diff --git a/src/lib/netlist/solver/nld_ms_direct1.h b/src/lib/netlist/solver/nld_ms_direct1.h index 909792a2787..ab19c92a4cb 100644 --- a/src/lib/netlist/solver/nld_ms_direct1.h +++ b/src/lib/netlist/solver/nld_ms_direct1.h @@ -30,25 +30,23 @@ public: inline int matrix_solver_direct1_t::vsolve_non_dynamic(ATTR_UNUSED const bool newton_raphson) { - analog_net_t *net = m_nets[0]; this->build_LE_A(); this->build_LE_RHS(); //NL_VERBOSE_OUT(("{1} {2}\n", new_val, m_RHS[0] / m_A[0][0]); - nl_double new_val = RHS(0) / A(0,0); + nl_double new_val[1] = { RHS(0) / A(0,0) }; - nl_double e = (new_val - net->Q_Analog()); - nl_double cerr = nl_math::abs(e); - - net->m_cur_Analog = new_val; - - if (is_dynamic() && (cerr > m_params.m_accuracy)) + if (is_dynamic()) { - return 2; + nl_double err = this->delta(new_val); + store(new_val); + if (err > m_params.m_accuracy ) + return 2; + else + return 1; } - else - return 1; - + store(new_val); + return 1; } NETLIB_NAMESPACE_DEVICES_END() diff --git a/src/lib/netlist/solver/nld_ms_gmres.h b/src/lib/netlist/solver/nld_ms_gmres.h index 483decbd05d..6ff0d43f421 100644 --- a/src/lib/netlist/solver/nld_ms_gmres.h +++ b/src/lib/netlist/solver/nld_ms_gmres.h @@ -58,7 +58,7 @@ public: private: - int solve_ilu_gmres(nl_double * RESTRICT x, nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy); + int solve_ilu_gmres(nl_double * RESTRICT x, const nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy); pvector_t m_term_cr[_storage_N]; @@ -157,6 +157,7 @@ int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton const nl_double * const * RESTRICT other_cur_analog = this->m_terms[k]->other_curanalog(); l_V[k] = new_V[k] = this->m_nets[k]->m_cur_Analog; + for (unsigned i = 0; i < term_count; i++) { gtot_t = gtot_t + gt[i]; @@ -180,7 +181,7 @@ int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton mat.ia[iN] = mat.nz_num; const nl_double accuracy = this->m_params.m_accuracy; -#if 1 + int mr = _storage_N; if (_storage_N > 3 ) mr = (int) sqrt(iN); @@ -188,19 +189,12 @@ int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton int iter = 4; int gsl = solve_ilu_gmres(new_V, RHS, iter, mr, accuracy); int failed = mr * iter; -#else - int failed = 6; - //int gsl = tt_ilu_cr(new_V, RHS, failed, accuracy); - int gsl = tt_gs_cr(new_V, RHS, failed, accuracy); -#endif + this->m_iterative_total += gsl; this->m_stat_calculations++; if (gsl>=failed) { - //for (int k = 0; k < iN; k++) - // this->m_nets[k]->m_cur_Analog = new_V[k]; - // Fallback to direct solver ... this->m_iterative_fail++; return matrix_solver_direct_t::vsolve_non_dynamic(newton_raphson); } @@ -226,17 +220,18 @@ int matrix_solver_GMRES_t::vsolve_non_dynamic(const bool newton } } -static inline void givens_mult( const nl_double c, const nl_double s, nl_double * RESTRICT g0, nl_double * RESTRICT g1 ) +template +inline void givens_mult( const T c, const T s, T & g0, T & g1 ) { - const double tg0 = c * *g0 - s * *g1; - const double tg1 = s * *g0 + c * *g1; + const T tg0 = c * g0 - s * g1; + const T tg1 = s * g0 + c * g1; - *g0 = tg0; - *g1 = tg1; + g0 = tg0; + g1 = tg1; } template -int matrix_solver_GMRES_t::solve_ilu_gmres (nl_double * RESTRICT x, nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy) +int matrix_solver_GMRES_t::solve_ilu_gmres (nl_double * RESTRICT x, const nl_double * RESTRICT rhs, const unsigned restart_max, const unsigned mr, nl_double accuracy) { /*------------------------------------------------------------------------- * The code below was inspired by code published by John Burkardt under @@ -342,7 +337,7 @@ int matrix_solver_GMRES_t::solve_ilu_gmres (nl_double * RESTRIC vec_scale(n, m_v[k1], NL_FCONST(1.0) / m_ht[k1][k]); for (unsigned j = 0; j < k; j++) - givens_mult(m_c[j], m_s[j], &m_ht[j][k], &m_ht[j+1][k]); + givens_mult(m_c[j], m_s[j], m_ht[j][k], m_ht[j+1][k]); mu = std::sqrt(std::pow(m_ht[k][k], 2) + std::pow(m_ht[k1][k], 2)); @@ -351,7 +346,7 @@ int matrix_solver_GMRES_t::solve_ilu_gmres (nl_double * RESTRIC m_ht[k][k] = m_c[k] * m_ht[k][k] - m_s[k] * m_ht[k1][k]; m_ht[k1][k] = 0.0; - givens_mult(m_c[k], m_s[k], &m_g[k], &m_g[k1]); + givens_mult(m_c[k], m_s[k], m_g[k], m_g[k1]); rho = std::abs(m_g[k1]); diff --git a/src/lib/netlist/solver/nld_solver.cpp b/src/lib/netlist/solver/nld_solver.cpp index 39e4fdaacf2..5a7c8fecd40 100644 --- a/src/lib/netlist/solver/nld_solver.cpp +++ b/src/lib/netlist/solver/nld_solver.cpp @@ -31,7 +31,16 @@ #include #include +//#include "nld_twoterm.h" +#include "nl_lists.h" + +#if HAS_OPENMP +#include "omp.h" +#endif + #include "nld_solver.h" +#include "nld_matrix_solver.h" + #if 1 #include "nld_ms_direct.h" #else @@ -42,12 +51,6 @@ #include "nld_ms_sor.h" #include "nld_ms_sor_mat.h" #include "nld_ms_gmres.h" -//#include "nld_twoterm.h" -#include "nl_lists.h" - -#if HAS_OPENMP -#include "omp.h" -#endif NETLIB_NAMESPACE_DEVICES_START() @@ -222,28 +225,28 @@ ATTR_COLD void matrix_solver_t::reset() ATTR_COLD void matrix_solver_t::update() { - const nl_double new_timestep = solve(); + const netlist_time new_timestep = solve(); - if (m_params.m_dynamic && is_timestep() && new_timestep > 0) - m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(new_timestep)); + if (m_params.m_dynamic && is_timestep() && new_timestep > netlist_time::zero) + m_Q_sync.net().reschedule_in_queue(new_timestep); } ATTR_COLD void matrix_solver_t::update_forced() { - ATTR_UNUSED const nl_double new_timestep = solve(); + ATTR_UNUSED const netlist_time new_timestep = solve(); if (m_params.m_dynamic && is_timestep()) m_Q_sync.net().reschedule_in_queue(netlist_time::from_double(m_params.m_min_timestep)); } -void matrix_solver_t::step(const netlist_time delta) +void matrix_solver_t::step(const netlist_time &delta) { const nl_double dd = delta.as_double(); for (std::size_t k=0; k < m_step_devices.size(); k++) m_step_devices[k]->step_time(dd); } -nl_double matrix_solver_t::solve_base() +netlist_time matrix_solver_t::solve_base() { m_stat_vsolver_calls++; if (is_dynamic()) @@ -273,7 +276,7 @@ nl_double matrix_solver_t::solve_base() return this->compute_next_timestep(); } -nl_double matrix_solver_t::solve() +netlist_time matrix_solver_t::solve() { const netlist_time now = netlist().time(); const netlist_time delta = now - m_last_step; @@ -281,7 +284,7 @@ nl_double matrix_solver_t::solve() // We are already up to date. Avoid oscillations. // FIXME: Make this a parameter! if (delta < netlist_time::from_nsec(1)) // 20000 - return -1.0; + return netlist_time::from_nsec(0); /* update all terminals for new time step */ m_last_step = now; @@ -289,7 +292,7 @@ nl_double matrix_solver_t::solve() step(delta); - const nl_double next_time_step = solve_base(); + const netlist_time next_time_step = solve_base(); update_inputs(); return next_time_step; @@ -427,7 +430,7 @@ NETLIB_UPDATE(solver) for (auto & solver : m_mat_solvers) if (solver->is_timestep()) // Ignore return value - ATTR_UNUSED const nl_double ts = solver->solve(); + ATTR_UNUSED const netlist_time ts = solver->solve(); #endif /* step circuit */ diff --git a/src/lib/netlist/solver/nld_solver.h b/src/lib/netlist/solver/nld_solver.h index 93d1e18be0e..6d08e0bbb73 100644 --- a/src/lib/netlist/solver/nld_solver.h +++ b/src/lib/netlist/solver/nld_solver.h @@ -48,133 +48,7 @@ struct solver_parameters_t }; -class terms_t -{ - P_PREVENT_COPYING(terms_t) - - public: - ATTR_COLD terms_t() : m_railstart(0) - {} - - ATTR_COLD void clear() - { - m_term.clear(); - m_net_other.clear(); - m_gt.clear(); - m_go.clear(); - m_Idr.clear(); - m_other_curanalog.clear(); - } - - ATTR_COLD void add(terminal_t *term, int net_other, bool sorted); - - inline unsigned count() { return m_term.size(); } - - inline terminal_t **terms() { return m_term.data(); } - inline int *net_other() { return m_net_other.data(); } - inline nl_double *gt() { return m_gt.data(); } - inline nl_double *go() { return m_go.data(); } - inline nl_double *Idr() { return m_Idr.data(); } - inline nl_double **other_curanalog() { return m_other_curanalog.data(); } - - ATTR_COLD void set_pointers(); - - unsigned m_railstart; - - pvector_t m_nz; /* all non zero for multiplication */ - pvector_t m_nzrd; /* non zero right of the diagonal for elimination */ - pvector_t m_nzbd; /* non zero below of the diagonal for elimination */ -private: - pvector_t m_term; - pvector_t m_net_other; - pvector_t m_go; - pvector_t m_gt; - pvector_t m_Idr; - pvector_t m_other_curanalog; -}; - -class matrix_solver_t : public device_t -{ -public: - typedef pvector_t list_t; - typedef core_device_t::list_t dev_list_t; - - enum eSolverType - { - GAUSSIAN_ELIMINATION, - GAUSS_SEIDEL - }; - - ATTR_COLD matrix_solver_t(const eSolverType type, const solver_parameters_t *params); - virtual ~matrix_solver_t(); - - void setup(analog_net_t::list_t &nets) { vsetup(nets); } - - nl_double solve_base(); - - nl_double solve(); - - inline bool is_dynamic() const { return m_dynamic_devices.size() > 0; } - inline bool is_timestep() const { return m_step_devices.size() > 0; } - - void update_forced(); - void update_after(const netlist_time after) - { - m_Q_sync.net().reschedule_in_queue(after); - } - - /* netdevice functions */ - virtual void update() override; - virtual void start() override; - virtual void reset() override; - - ATTR_COLD int get_net_idx(net_t *net); - - eSolverType type() const { return m_type; } - plog_base &log() { return netlist().log(); } - - virtual void log_stats(); - -protected: - - ATTR_COLD void setup_base(analog_net_t::list_t &nets); - void update_dynamic(); - - virtual void add_term(int net_idx, terminal_t *term) = 0; - virtual void vsetup(analog_net_t::list_t &nets) = 0; - virtual int vsolve_non_dynamic(const bool newton_raphson) = 0; - virtual nl_double compute_next_timestep() = 0; - - pvector_t m_nets; - pvector_t m_inps; - - int m_stat_calculations; - int m_stat_newton_raphson; - int m_stat_vsolver_calls; - int m_iterative_fail; - int m_iterative_total; - - const solver_parameters_t &m_params; - - inline nl_double current_timestep() { return m_cur_ts; } -private: - - netlist_time m_last_step; - nl_double m_cur_ts; - dev_list_t m_step_devices; - dev_list_t m_dynamic_devices; - - logic_input_t m_fb_sync; - logic_output_t m_Q_sync; - - void step(const netlist_time delta); - - void update_inputs(); - - const eSolverType m_type; -}; - - +class matrix_solver_t; class NETLIB_NAME(solver) : public device_t { @@ -216,7 +90,7 @@ protected: param_logic_t m_log_stats; - matrix_solver_t::list_t m_mat_solvers; + pvector_t m_mat_solvers; private: solver_parameters_t m_params; diff --git a/src/mame/audio/irem.cpp b/src/mame/audio/irem.cpp index 0d16b99e066..0a7469091fc 100644 --- a/src/mame/audio/irem.cpp +++ b/src/mame/audio/irem.cpp @@ -422,8 +422,11 @@ NETLIST_START(kidniki_interface) PARAM(Solver.ITERATIVE, "SOR") //PARAM(Solver.ITERATIVE, "MAT") //PARAM(Solver.ITERATIVE, "GMRES") - PARAM(Solver.PARALLEL, 1) + PARAM(Solver.PARALLEL, 0) PARAM(Solver.SOR_FACTOR, 1.00) + PARAM(Solver.DYNAMIC_TS, 0) + PARAM(Solver.DYNAMIC_LTE, 5e-4) + PARAM(Solver.MIN_TIMESTEP, 20e-6) #else SOLVER(Solver, 12000) PARAM(Solver.ACCURACY, 1e-8) -- cgit v1.2.3 From 5640305d0ecfdbf6a1a456688f48f6f0fe22adb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miodrag=20Milanovi=C4=87?= Date: Sun, 27 Mar 2016 17:16:49 +0200 Subject: Fix compile on x64 --- makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makefile b/makefile index 7b7bba3a782..123592099b4 100644 --- a/makefile +++ b/makefile @@ -273,7 +273,7 @@ endif endif ifeq ($(OS),windows) -ifndef $(MINGW64) +ifndef MINGW64 ARCHITECTURE := _x86 endif ifeq ($(ARCHITECTURE),_x64) -- cgit v1.2.3 From 158c90cf1196f219e6a7c9c3e23ca47129429a7b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Sun, 27 Mar 2016 14:06:51 +0200 Subject: Initial work to make MAME work on Android [Miodrag Milanovic] --- .gitignore | 1 + android-project/.gitignore | 7 + android-project/app/build.gradle | 29 + android-project/app/src/main/AndroidManifest.xml | 53 + .../src/main/java/org/libsdl/app/SDLActivity.java | 1661 ++++++++++++++++++++ .../app/src/main/java/org/mamedev/mame/MAME.java | 9 + .../app/src/main/libs/arm64-v8a/.gitignore | 1 + .../app/src/main/libs/armeabi-v7a/.gitignore | 1 + android-project/app/src/main/libs/mips/.gitignore | 1 + .../app/src/main/libs/mips64/.gitignore | 1 + android-project/app/src/main/libs/x86/.gitignore | 1 + .../app/src/main/libs/x86_64/.gitignore | 1 + .../app/src/main/res/drawable-hdpi/ic_launcher.png | Bin 0 -> 2683 bytes .../app/src/main/res/drawable-mdpi/ic_launcher.png | Bin 0 -> 1698 bytes .../src/main/res/drawable-xhdpi/ic_launcher.png | Bin 0 -> 3872 bytes .../src/main/res/drawable-xxhdpi/ic_launcher.png | Bin 0 -> 6874 bytes android-project/app/src/main/res/layout/main.xml | 13 + .../app/src/main/res/values/strings.xml | 4 + android-project/build.gradle | 15 + android-project/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 49896 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + android-project/gradlew | 164 ++ android-project/gradlew.bat | 90 ++ android-project/settings.gradle | 1 + makefile | 60 +- scripts/src/3rdparty.lua | 35 +- scripts/src/main.lua | 38 +- scripts/src/osd/modules.lua | 6 + scripts/src/osd/sdl.lua | 8 +- src/osd/modules/file/posixfile.cpp | 14 +- src/osd/modules/file/posixptty.cpp | 7 +- src/osd/modules/font/font_sdl.cpp | 2 +- src/osd/modules/render/drawbgfx.cpp | 6 +- src/osd/sdl/sdldir.cpp | 2 +- src/osd/sdl/sdlmain.cpp | 6 +- src/osd/sdl/sdlos_unix.cpp | 8 + src/osd/sdl/sdlprefix.h | 4 + 37 files changed, 2197 insertions(+), 58 deletions(-) create mode 100644 android-project/.gitignore create mode 100644 android-project/app/build.gradle create mode 100644 android-project/app/src/main/AndroidManifest.xml create mode 100644 android-project/app/src/main/java/org/libsdl/app/SDLActivity.java create mode 100644 android-project/app/src/main/java/org/mamedev/mame/MAME.java create mode 100644 android-project/app/src/main/libs/arm64-v8a/.gitignore create mode 100644 android-project/app/src/main/libs/armeabi-v7a/.gitignore create mode 100644 android-project/app/src/main/libs/mips/.gitignore create mode 100644 android-project/app/src/main/libs/mips64/.gitignore create mode 100644 android-project/app/src/main/libs/x86/.gitignore create mode 100644 android-project/app/src/main/libs/x86_64/.gitignore create mode 100644 android-project/app/src/main/res/drawable-hdpi/ic_launcher.png create mode 100644 android-project/app/src/main/res/drawable-mdpi/ic_launcher.png create mode 100644 android-project/app/src/main/res/drawable-xhdpi/ic_launcher.png create mode 100644 android-project/app/src/main/res/drawable-xxhdpi/ic_launcher.png create mode 100644 android-project/app/src/main/res/layout/main.xml create mode 100644 android-project/app/src/main/res/values/strings.xml create mode 100644 android-project/build.gradle create mode 100644 android-project/gradle/wrapper/gradle-wrapper.jar create mode 100644 android-project/gradle/wrapper/gradle-wrapper.properties create mode 100644 android-project/gradlew create mode 100644 android-project/gradlew.bat create mode 100644 android-project/settings.gradle diff --git a/.gitignore b/.gitignore index 083e0369858..aec8b94c19b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ /* /*/ !/3rdparty/ +!/android-project/ !/benchmarks/ !/artwork/ !/bgfx/ diff --git a/android-project/.gitignore b/android-project/.gitignore new file mode 100644 index 00000000000..731d58fc5e5 --- /dev/null +++ b/android-project/.gitignore @@ -0,0 +1,7 @@ +.idea +.gradle +local.properties +*.iml +*.so +*.apk +build diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle new file mode 100644 index 00000000000..1e913c88438 --- /dev/null +++ b/android-project/app/build.gradle @@ -0,0 +1,29 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 18 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "org.mamedev.mame" + minSdkVersion 18 + targetSdkVersion 18 + + ndk { + moduleName 'main' + } + + } + + sourceSets.main { + jni.srcDirs = [] + jniLibs.srcDir 'src/main/libs' + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' + } + } +} diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..abe6f84cb04 --- /dev/null +++ b/android-project/app/src/main/AndroidManifest.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java new file mode 100644 index 00000000000..0a2e5d87e31 --- /dev/null +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -0,0 +1,1661 @@ +package org.libsdl.app; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.lang.reflect.Method; + +import android.app.*; +import android.content.*; +import android.text.InputType; +import android.view.*; +import android.view.inputmethod.BaseInputConnection; +import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputConnection; +import android.view.inputmethod.InputMethodManager; +import android.widget.AbsoluteLayout; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.os.*; +import android.util.Log; +import android.util.SparseArray; +import android.graphics.*; +import android.graphics.drawable.Drawable; +import android.media.*; +import android.hardware.*; +import android.content.pm.ActivityInfo; + +/** + SDL Activity +*/ +public class SDLActivity extends Activity { + private static final String TAG = "SDL"; + + // Keep track of the paused state + public static boolean mIsPaused, mIsSurfaceReady, mHasFocus; + public static boolean mExitCalledFromJava; + + /** If shared libraries (e.g. SDL or the native application) could not be loaded. */ + public static boolean mBrokenLibraries; + + // If we want to separate mouse and touch events. + // This is only toggled in native code when a hint is set! + public static boolean mSeparateMouseAndTouch; + + // Main components + protected static SDLActivity mSingleton; + protected static SDLSurface mSurface; + protected static View mTextEdit; + protected static ViewGroup mLayout; + protected static SDLJoystickHandler mJoystickHandler; + + // This is what SDL runs in. It invokes SDL_main(), eventually + protected static Thread mSDLThread; + + // Audio + protected static AudioTrack mAudioTrack; + + /** + * This method is called by SDL before loading the native shared libraries. + * It can be overridden to provide names of shared libraries to be loaded. + * The default implementation returns the defaults. It never returns null. + * An array returned by a new implementation must at least contain "SDL2". + * Also keep in mind that the order the libraries are loaded may matter. + * @return names of shared libraries to be loaded (e.g. "SDL2", "main"). + */ + protected String[] getLibraries() { + return new String[] { + "SDL2", + // "SDL2_image", + // "SDL2_mixer", + // "SDL2_net", + // "SDL2_ttf", + "main" + }; + } + + // Load the .so + public void loadLibraries() { + for (String lib : getLibraries()) { + System.loadLibrary(lib); + } + } + + /** + * This method is called by SDL before starting the native application thread. + * It can be overridden to provide the arguments after the application name. + * The default implementation returns an empty array. It never returns null. + * @return arguments for the native application. + */ + protected String[] getArguments() { + return new String[0]; + } + + public static void initialize() { + // The static nature of the singleton and Android quirkyness force us to initialize everything here + // Otherwise, when exiting the app and returning to it, these variables *keep* their pre exit values + mSingleton = null; + mSurface = null; + mTextEdit = null; + mLayout = null; + mJoystickHandler = null; + mSDLThread = null; + mAudioTrack = null; + mExitCalledFromJava = false; + mBrokenLibraries = false; + mIsPaused = false; + mIsSurfaceReady = false; + mHasFocus = true; + } + + // Setup + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.v(TAG, "Device: " + android.os.Build.DEVICE); + Log.v(TAG, "Model: " + android.os.Build.MODEL); + Log.v(TAG, "onCreate(): " + mSingleton); + super.onCreate(savedInstanceState); + + SDLActivity.initialize(); + // So we can call stuff from static callbacks + mSingleton = this; + + // Load shared libraries + String errorMsgBrokenLib = ""; + try { + loadLibraries(); + } catch(UnsatisfiedLinkError e) { + System.err.println(e.getMessage()); + mBrokenLibraries = true; + errorMsgBrokenLib = e.getMessage(); + } catch(Exception e) { + System.err.println(e.getMessage()); + mBrokenLibraries = true; + errorMsgBrokenLib = e.getMessage(); + } + + if (mBrokenLibraries) + { + AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); + dlgAlert.setMessage("An error occurred while trying to start the application. Please try again and/or reinstall." + + System.getProperty("line.separator") + + System.getProperty("line.separator") + + "Error: " + errorMsgBrokenLib); + dlgAlert.setTitle("SDL Error"); + dlgAlert.setPositiveButton("Exit", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog,int id) { + // if this button is clicked, close current activity + SDLActivity.mSingleton.finish(); + } + }); + dlgAlert.setCancelable(false); + dlgAlert.create().show(); + + return; + } + + // Set up the surface + mSurface = new SDLSurface(getApplication()); + + if(Build.VERSION.SDK_INT >= 12) { + mJoystickHandler = new SDLJoystickHandler_API12(); + } + else { + mJoystickHandler = new SDLJoystickHandler(); + } + + mLayout = new AbsoluteLayout(this); + mLayout.addView(mSurface); + + setContentView(mLayout); + + // Get filename from "Open with" of another application + Intent intent = getIntent(); + + if (intent != null && intent.getData() != null) { + String filename = intent.getData().getPath(); + if (filename != null) { + Log.v(TAG, "Got filename: " + filename); + SDLActivity.onNativeDropFile(filename); + } + } + } + + // Events + @Override + protected void onPause() { + Log.v(TAG, "onPause()"); + super.onPause(); + + if (SDLActivity.mBrokenLibraries) { + return; + } + + SDLActivity.handlePause(); + } + + @Override + protected void onResume() { + Log.v(TAG, "onResume()"); + super.onResume(); + + if (SDLActivity.mBrokenLibraries) { + return; + } + + SDLActivity.handleResume(); + } + + + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + Log.v(TAG, "onWindowFocusChanged(): " + hasFocus); + + if (SDLActivity.mBrokenLibraries) { + return; + } + + SDLActivity.mHasFocus = hasFocus; + if (hasFocus) { + SDLActivity.handleResume(); + } + } + + @Override + public void onLowMemory() { + Log.v(TAG, "onLowMemory()"); + super.onLowMemory(); + + if (SDLActivity.mBrokenLibraries) { + return; + } + + SDLActivity.nativeLowMemory(); + } + + @Override + protected void onDestroy() { + Log.v(TAG, "onDestroy()"); + + if (SDLActivity.mBrokenLibraries) { + super.onDestroy(); + // Reset everything in case the user re opens the app + SDLActivity.initialize(); + return; + } + + // Send a quit message to the application + SDLActivity.mExitCalledFromJava = true; + SDLActivity.nativeQuit(); + + // Now wait for the SDL thread to quit + if (SDLActivity.mSDLThread != null) { + try { + SDLActivity.mSDLThread.join(); + } catch(Exception e) { + Log.v(TAG, "Problem stopping thread: " + e); + } + SDLActivity.mSDLThread = null; + + //Log.v(TAG, "Finished waiting for SDL thread"); + } + + super.onDestroy(); + // Reset everything in case the user re opens the app + SDLActivity.initialize(); + } + + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + + if (SDLActivity.mBrokenLibraries) { + return false; + } + + int keyCode = event.getKeyCode(); + // Ignore certain special keys so they're handled by Android + if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || + keyCode == KeyEvent.KEYCODE_VOLUME_UP || + keyCode == KeyEvent.KEYCODE_CAMERA || + keyCode == 168 || /* API 11: KeyEvent.KEYCODE_ZOOM_IN */ + keyCode == 169 /* API 11: KeyEvent.KEYCODE_ZOOM_OUT */ + ) { + return false; + } + return super.dispatchKeyEvent(event); + } + + /** Called by onPause or surfaceDestroyed. Even if surfaceDestroyed + * is the first to be called, mIsSurfaceReady should still be set + * to 'true' during the call to onPause (in a usual scenario). + */ + public static void handlePause() { + if (!SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady) { + SDLActivity.mIsPaused = true; + SDLActivity.nativePause(); + mSurface.handlePause(); + } + } + + /** Called by onResume or surfaceCreated. An actual resume should be done only when the surface is ready. + * Note: Some Android variants may send multiple surfaceChanged events, so we don't need to resume + * every time we get one of those events, only if it comes after surfaceDestroyed + */ + public static void handleResume() { + if (SDLActivity.mIsPaused && SDLActivity.mIsSurfaceReady && SDLActivity.mHasFocus) { + SDLActivity.mIsPaused = false; + SDLActivity.nativeResume(); + mSurface.handleResume(); + } + } + + /* The native thread has finished */ + public static void handleNativeExit() { + SDLActivity.mSDLThread = null; + mSingleton.finish(); + } + + + // Messages from the SDLMain thread + static final int COMMAND_CHANGE_TITLE = 1; + static final int COMMAND_UNUSED = 2; + static final int COMMAND_TEXTEDIT_HIDE = 3; + static final int COMMAND_SET_KEEP_SCREEN_ON = 5; + + protected static final int COMMAND_USER = 0x8000; + + /** + * This method is called by SDL if SDL did not handle a message itself. + * This happens if a received message contains an unsupported command. + * Method can be overwritten to handle Messages in a different class. + * @param command the command of the message. + * @param param the parameter of the message. May be null. + * @return if the message was handled in overridden method. + */ + protected boolean onUnhandledMessage(int command, Object param) { + return false; + } + + /** + * A Handler class for Messages from native SDL applications. + * It uses current Activities as target (e.g. for the title). + * static to prevent implicit references to enclosing object. + */ + protected static class SDLCommandHandler extends Handler { + @Override + public void handleMessage(Message msg) { + Context context = getContext(); + if (context == null) { + Log.e(TAG, "error handling message, getContext() returned null"); + return; + } + switch (msg.arg1) { + case COMMAND_CHANGE_TITLE: + if (context instanceof Activity) { + ((Activity) context).setTitle((String)msg.obj); + } else { + Log.e(TAG, "error handling message, getContext() returned no Activity"); + } + break; + case COMMAND_TEXTEDIT_HIDE: + if (mTextEdit != null) { + mTextEdit.setVisibility(View.GONE); + + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0); + } + break; + case COMMAND_SET_KEEP_SCREEN_ON: + { + Window window = ((Activity) context).getWindow(); + if (window != null) { + if ((msg.obj instanceof Integer) && (((Integer) msg.obj).intValue() != 0)) { + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } else { + window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + } + } + break; + } + default: + if ((context instanceof SDLActivity) && !((SDLActivity) context).onUnhandledMessage(msg.arg1, msg.obj)) { + Log.e(TAG, "error handling message, command is " + msg.arg1); + } + } + } + } + + // Handler for the messages + Handler commandHandler = new SDLCommandHandler(); + + // Send a message from the SDLMain thread + boolean sendCommand(int command, Object data) { + Message msg = commandHandler.obtainMessage(); + msg.arg1 = command; + msg.obj = data; + return commandHandler.sendMessage(msg); + } + + // C functions we call + public static native int nativeInit(Object arguments); + public static native void nativeLowMemory(); + public static native void nativeQuit(); + public static native void nativePause(); + public static native void nativeResume(); + public static native void onNativeDropFile(String filename); + public static native void onNativeResize(int x, int y, int format, float rate); + public static native int onNativePadDown(int device_id, int keycode); + public static native int onNativePadUp(int device_id, int keycode); + public static native void onNativeJoy(int device_id, int axis, + float value); + public static native void onNativeHat(int device_id, int hat_id, + int x, int y); + public static native void onNativeKeyDown(int keycode); + public static native void onNativeKeyUp(int keycode); + public static native void onNativeKeyboardFocusLost(); + public static native void onNativeMouse(int button, int action, float x, float y); + public static native void onNativeTouch(int touchDevId, int pointerFingerId, + int action, float x, + float y, float p); + public static native void onNativeAccel(float x, float y, float z); + public static native void onNativeSurfaceChanged(); + public static native void onNativeSurfaceDestroyed(); + public static native int nativeAddJoystick(int device_id, String name, + int is_accelerometer, int nbuttons, + int naxes, int nhats, int nballs); + public static native int nativeRemoveJoystick(int device_id); + public static native String nativeGetHint(String name); + + /** + * This method is called by SDL using JNI. + */ + public static boolean setActivityTitle(String title) { + // Called from SDLMain() thread and can't directly affect the view + return mSingleton.sendCommand(COMMAND_CHANGE_TITLE, title); + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean sendMessage(int command, int param) { + return mSingleton.sendCommand(command, Integer.valueOf(param)); + } + + /** + * This method is called by SDL using JNI. + */ + public static Context getContext() { + return mSingleton; + } + + /** + * This method is called by SDL using JNI. + * @return result of getSystemService(name) but executed on UI thread. + */ + public Object getSystemServiceFromUiThread(final String name) { + final Object lock = new Object(); + final Object[] results = new Object[2]; // array for writable variables + synchronized (lock) { + runOnUiThread(new Runnable() { + @Override + public void run() { + synchronized (lock) { + results[0] = getSystemService(name); + results[1] = Boolean.TRUE; + lock.notify(); + } + } + }); + if (results[1] == null) { + try { + lock.wait(); + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } + } + return results[0]; + } + + static class ShowTextInputTask implements Runnable { + /* + * This is used to regulate the pan&scan method to have some offset from + * the bottom edge of the input region and the top edge of an input + * method (soft keyboard) + */ + static final int HEIGHT_PADDING = 15; + + public int x, y, w, h; + + public ShowTextInputTask(int x, int y, int w, int h) { + this.x = x; + this.y = y; + this.w = w; + this.h = h; + } + + @Override + public void run() { + AbsoluteLayout.LayoutParams params = new AbsoluteLayout.LayoutParams( + w, h + HEIGHT_PADDING, x, y); + + if (mTextEdit == null) { + mTextEdit = new DummyEdit(getContext()); + + mLayout.addView(mTextEdit, params); + } else { + mTextEdit.setLayoutParams(params); + } + + mTextEdit.setVisibility(View.VISIBLE); + mTextEdit.requestFocus(); + + InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE); + imm.showSoftInput(mTextEdit, 0); + } + } + + /** + * This method is called by SDL using JNI. + */ + public static boolean showTextInput(int x, int y, int w, int h) { + // Transfer the task to the main thread as a Runnable + return mSingleton.commandHandler.post(new ShowTextInputTask(x, y, w, h)); + } + + /** + * This method is called by SDL using JNI. + */ + public static Surface getNativeSurface() { + return SDLActivity.mSurface.getNativeSurface(); + } + + // Audio + + /** + * This method is called by SDL using JNI. + */ + public static int audioInit(int sampleRate, boolean is16Bit, boolean isStereo, int desiredFrames) { + int channelConfig = isStereo ? AudioFormat.CHANNEL_CONFIGURATION_STEREO : AudioFormat.CHANNEL_CONFIGURATION_MONO; + int audioFormat = is16Bit ? AudioFormat.ENCODING_PCM_16BIT : AudioFormat.ENCODING_PCM_8BIT; + int frameSize = (isStereo ? 2 : 1) * (is16Bit ? 2 : 1); + + Log.v(TAG, "SDL audio: wanted " + (isStereo ? "stereo" : "mono") + " " + (is16Bit ? "16-bit" : "8-bit") + " " + (sampleRate / 1000f) + "kHz, " + desiredFrames + " frames buffer"); + + // Let the user pick a larger buffer if they really want -- but ye + // gods they probably shouldn't, the minimums are horrifyingly high + // latency already + desiredFrames = Math.max(desiredFrames, (AudioTrack.getMinBufferSize(sampleRate, channelConfig, audioFormat) + frameSize - 1) / frameSize); + + if (mAudioTrack == null) { + mAudioTrack = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRate, + channelConfig, audioFormat, desiredFrames * frameSize, AudioTrack.MODE_STREAM); + + // Instantiating AudioTrack can "succeed" without an exception and the track may still be invalid + // Ref: https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/media/java/android/media/AudioTrack.java + // Ref: http://developer.android.com/reference/android/media/AudioTrack.html#getState() + + if (mAudioTrack.getState() != AudioTrack.STATE_INITIALIZED) { + Log.e(TAG, "Failed during initialization of Audio Track"); + mAudioTrack = null; + return -1; + } + + mAudioTrack.play(); + } + + Log.v(TAG, "SDL audio: got " + ((mAudioTrack.getChannelCount() >= 2) ? "stereo" : "mono") + " " + ((mAudioTrack.getAudioFormat() == AudioFormat.ENCODING_PCM_16BIT) ? "16-bit" : "8-bit") + " " + (mAudioTrack.getSampleRate() / 1000f) + "kHz, " + desiredFrames + " frames buffer"); + + return 0; + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioWriteShortBuffer(short[] buffer) { + for (int i = 0; i < buffer.length; ) { + int result = mAudioTrack.write(buffer, i, buffer.length - i); + if (result > 0) { + i += result; + } else if (result == 0) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + // Nom nom + } + } else { + Log.w(TAG, "SDL audio: error return from write(short)"); + return; + } + } + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioWriteByteBuffer(byte[] buffer) { + for (int i = 0; i < buffer.length; ) { + int result = mAudioTrack.write(buffer, i, buffer.length - i); + if (result > 0) { + i += result; + } else if (result == 0) { + try { + Thread.sleep(1); + } catch(InterruptedException e) { + // Nom nom + } + } else { + Log.w(TAG, "SDL audio: error return from write(byte)"); + return; + } + } + } + + /** + * This method is called by SDL using JNI. + */ + public static void audioQuit() { + if (mAudioTrack != null) { + mAudioTrack.stop(); + mAudioTrack = null; + } + } + + // Input + + /** + * This method is called by SDL using JNI. + * @return an array which may be empty but is never null. + */ + public static int[] inputGetInputDeviceIds(int sources) { + int[] ids = InputDevice.getDeviceIds(); + int[] filtered = new int[ids.length]; + int used = 0; + for (int i = 0; i < ids.length; ++i) { + InputDevice device = InputDevice.getDevice(ids[i]); + if ((device != null) && ((device.getSources() & sources) != 0)) { + filtered[used++] = device.getId(); + } + } + return Arrays.copyOf(filtered, used); + } + + // Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance + public static boolean handleJoystickMotionEvent(MotionEvent event) { + return mJoystickHandler.handleMotionEvent(event); + } + + /** + * This method is called by SDL using JNI. + */ + public static void pollInputDevices() { + if (SDLActivity.mSDLThread != null) { + mJoystickHandler.pollInputDevices(); + } + } + + // APK expansion files support + + /** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */ + private Object expansionFile; + + /** com.android.vending.expansion.zipfile.ZipResourceFile's getInputStream() or null. */ + private Method expansionFileMethod; + + /** + * This method was called by SDL using JNI. + * @deprecated because of an incorrect name + */ + @Deprecated + public InputStream openAPKExtensionInputStream(String fileName) throws IOException { + return openAPKExpansionInputStream(fileName); + } + + /** + * This method is called by SDL using JNI. + * @return an InputStream on success or null if no expansion file was used. + * @throws IOException on errors. Message is set for the SDL error message. + */ + public InputStream openAPKExpansionInputStream(String fileName) throws IOException { + // Get a ZipResourceFile representing a merger of both the main and patch files + if (expansionFile == null) { + String mainHint = nativeGetHint("SDL_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION"); + if (mainHint == null) { + return null; // no expansion use if no main version was set + } + String patchHint = nativeGetHint("SDL_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION"); + if (patchHint == null) { + return null; // no expansion use if no patch version was set + } + + Integer mainVersion; + Integer patchVersion; + try { + mainVersion = Integer.valueOf(mainHint); + patchVersion = Integer.valueOf(patchHint); + } catch (NumberFormatException ex) { + ex.printStackTrace(); + throw new IOException("No valid file versions set for APK expansion files", ex); + } + + try { + // To avoid direct dependency on Google APK expansion library that is + // not a part of Android SDK we access it using reflection + expansionFile = Class.forName("com.android.vending.expansion.zipfile.APKExpansionSupport") + .getMethod("getAPKExpansionZipFile", Context.class, int.class, int.class) + .invoke(null, this, mainVersion, patchVersion); + + expansionFileMethod = expansionFile.getClass() + .getMethod("getInputStream", String.class); + } catch (Exception ex) { + ex.printStackTrace(); + expansionFile = null; + expansionFileMethod = null; + throw new IOException("Could not access APK expansion support library", ex); + } + } + + // Get an input stream for a known file inside the expansion file ZIPs + InputStream fileStream; + try { + fileStream = (InputStream)expansionFileMethod.invoke(expansionFile, fileName); + } catch (Exception ex) { + // calling "getInputStream" failed + ex.printStackTrace(); + throw new IOException("Could not open stream from APK expansion file", ex); + } + + if (fileStream == null) { + // calling "getInputStream" was successful but null was returned + throw new IOException("Could not find path in APK expansion file"); + } + + return fileStream; + } + + // Messagebox + + /** Result of current messagebox. Also used for blocking the calling thread. */ + protected final int[] messageboxSelection = new int[1]; + + /** Id of current dialog. */ + protected int dialogs = 0; + + /** + * This method is called by SDL using JNI. + * Shows the messagebox from UI thread and block calling thread. + * buttonFlags, buttonIds and buttonTexts must have same length. + * @param buttonFlags array containing flags for every button. + * @param buttonIds array containing id for every button. + * @param buttonTexts array containing text for every button. + * @param colors null for default or array of length 5 containing colors. + * @return button id or -1. + */ + public int messageboxShowMessageBox( + final int flags, + final String title, + final String message, + final int[] buttonFlags, + final int[] buttonIds, + final String[] buttonTexts, + final int[] colors) { + + messageboxSelection[0] = -1; + + // sanity checks + + if ((buttonFlags.length != buttonIds.length) && (buttonIds.length != buttonTexts.length)) { + return -1; // implementation broken + } + + // collect arguments for Dialog + + final Bundle args = new Bundle(); + args.putInt("flags", flags); + args.putString("title", title); + args.putString("message", message); + args.putIntArray("buttonFlags", buttonFlags); + args.putIntArray("buttonIds", buttonIds); + args.putStringArray("buttonTexts", buttonTexts); + args.putIntArray("colors", colors); + + // trigger Dialog creation on UI thread + + runOnUiThread(new Runnable() { + @Override + public void run() { + showDialog(dialogs++, args); + } + }); + + // block the calling thread + + synchronized (messageboxSelection) { + try { + messageboxSelection.wait(); + } catch (InterruptedException ex) { + ex.printStackTrace(); + return -1; + } + } + + // return selected value + + return messageboxSelection[0]; + } + + @Override + protected Dialog onCreateDialog(int ignore, Bundle args) { + + // TODO set values from "flags" to messagebox dialog + + // get colors + + int[] colors = args.getIntArray("colors"); + int backgroundColor; + int textColor; + int buttonBorderColor; + int buttonBackgroundColor; + int buttonSelectedColor; + if (colors != null) { + int i = -1; + backgroundColor = colors[++i]; + textColor = colors[++i]; + buttonBorderColor = colors[++i]; + buttonBackgroundColor = colors[++i]; + buttonSelectedColor = colors[++i]; + } else { + backgroundColor = Color.TRANSPARENT; + textColor = Color.TRANSPARENT; + buttonBorderColor = Color.TRANSPARENT; + buttonBackgroundColor = Color.TRANSPARENT; + buttonSelectedColor = Color.TRANSPARENT; + } + + // create dialog with title and a listener to wake up calling thread + + final Dialog dialog = new Dialog(this); + dialog.setTitle(args.getString("title")); + dialog.setCancelable(false); + dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { + @Override + public void onDismiss(DialogInterface unused) { + synchronized (messageboxSelection) { + messageboxSelection.notify(); + } + } + }); + + // create text + + TextView message = new TextView(this); + message.setGravity(Gravity.CENTER); + message.setText(args.getString("message")); + if (textColor != Color.TRANSPARENT) { + message.setTextColor(textColor); + } + + // create buttons + + int[] buttonFlags = args.getIntArray("buttonFlags"); + int[] buttonIds = args.getIntArray("buttonIds"); + String[] buttonTexts = args.getStringArray("buttonTexts"); + + final SparseArray