diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index c9ef6d3465afe..0df34f5d12bef 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -9,11 +9,11 @@ All Platforms ------------- * To compile MAME, you need a C++17 compiler and runtime library. We - support building with GCC version 7.2 or later and clang version 6 or - later. MAME should run with GNU libstdc++ version 7.2 or later or - libc++ version 7 or later. The initial release of any major version + support building with GCC version 10.3 or later and clang version 11 + or later. MAME should run with GNU libstdc++ version 10.3 or later or + libc++ version 11 or later. The initial release of any major version of GCC should be avoided. For example, if you want to compile MAME - with GCC 10, you should use version 10.3 or later. + with GCC 12, you should use version 12.1 or later. * Whenever you are changing build parameters, (for example changing optimisation settings, or adding tools to the compile list), or system @@ -98,7 +98,7 @@ building MAME on a 64-bit system. Instructions may need to be adjusted for use the portable SDL (Simple DirectMedia Layer) interfaces instead, you can add **OSD=sdl** to the make options. The main emulator binary will have an ``sdl`` prefix prepended (e.g. ``sdlmame.exe``). You - will need to install the MSYS2 packages for SDL 2 version 2.0.6 or later. + will need to install the MSYS2 packages for SDL 2 version 2.0.14 or later. * By default, MAME will include the native Windows debugger. To also include the portable Qt debugger, add **USE_QTDEBUG=1** to the make options. You will need to install the MSYS2 packages for Qt 5. @@ -251,10 +251,15 @@ Fedora Linux ------------ You’ll need a few prerequisites from your Linux distribution. Make sure you get -SDL2 2.0.6 or later as earlier versions lack required functionality:: +SDL 2 version 2.0.14 or later as earlier versions lack required functionality:: sudo dnf install gcc gcc-c++ SDL2-devel SDL2_ttf-devel libXi-devel libXinerama-devel qt5-qtbase-devel qt5-qttools expat-devel fontconfig-devel alsa-lib-devel pulseaudio-libs-devel +If you want to use the more efficient LLVM tools for archiving static libraries +and linking, you’ll need to install the corresponding packages:: + + sudo dnf install lld llvm + Compilation is exactly as described above in All Platforms. To build the HTML user/developer documentation, you’ll need Sphinx, as well as @@ -273,7 +278,7 @@ Debian and Ubuntu (including Raspberry Pi and ODROID devices) ------------------------------------------------------------- You’ll need a few prerequisites from your Linux distribution. Make sure you get -SDL2 2.0.6 or later as earlier versions lack required functionality:: +SDL 2 version 2.0.14 or later as earlier versions lack required functionality:: sudo apt-get install git build-essential python3 libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev qtbase5-dev qtbase5-dev-tools qtchooser qt5-qmake @@ -299,9 +304,8 @@ Compilation is exactly as described above in All Platforms. Apple macOS ----------- -You’ll need a few prerequisites to get started. Make sure you’re on OS X 10.14 -Mojave or later for Intel Macs or macOS 11.0 Big Sur for Apple Silicon. You will -need SDL2 2.0.6 or later for Intel or SDL2 2.0.14 on Apple Silicon. You’ll also +You’ll need a few prerequisites to get started. Make sure you’re on macOS 11.0 +Big Sur or later. You will need SDL 2 version 2.0.14 or later. You’ll also need to install Python 3 – it’s currently included with the Xcode command line tools, but you can also install a stand-alone version or get it via the Homebrew package manager. @@ -317,7 +321,7 @@ package manager. * Type **xcode-select --install** to install additional tools necessary for MAME (also available as a package on ADC). -Next you’ll need to get SDL2 installed. +Next you’ll need to get SDL 2 installed. * Go to `this site `_ and download the *macOS* .dmg file @@ -677,11 +681,6 @@ USE_SYSTEM_LIB_PORTMIDI USE_SYSTEM_LIB_PORTAUDIO Set to **1** to prefer the system installation of the PortAudio library over the version provided with the MAME source. -USE_BUNDLED_LIB_SDL2 - Set to **1** to prefer the version of SDL provided with the MAME source over - the system installation. (This is enabled by default for Visual Studio and - Android builds. For other configurations, the system installation of SDL is - preferred.) USE_SYSTEM_LIB_UTF8PROC Set to **1** to prefer the system installation of the Julia utf8proc library over the version provided with the MAME source. diff --git a/scripts/genie.lua b/scripts/genie.lua index 3fe609600bea4..fe64dfe711e50 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1035,8 +1035,8 @@ end local version = str_to_version(_OPTIONS["gcc_version"]) if string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "asmjs") or string.find(_OPTIONS["gcc"], "android") then - if version < 60000 then - print("Clang version 6.0 or later needed") + if version < 70000 then + print("Clang version 7.0 or later needed") os.exit(-1) end buildoptions { @@ -1052,12 +1052,6 @@ end "-Wno-unused-value", "-Wno-unused-const-variable", } - if (version < 70000) or ((version < 100001) and (_OPTIONS["targetos"] == 'macosx')) then - buildoptions { -- clang 6.0 complains that [[maybe_unused]] is ignored for static data members - "-Wno-error=ignored-attributes", - "-Wno-error=unused-const-variable", - } - end if ((version >= 100000) and (_OPTIONS["targetos"] ~= 'macosx')) or (version >= 120000) then buildoptions { "-Wno-xor-used-as-pow", -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention @@ -1069,8 +1063,8 @@ end } end else - if version < 70000 then - print("GCC version 7.0 or later needed") + if version < 100300 then + print("GCC version 10.3 or later needed") os.exit(-1) end buildoptions_cpp { @@ -1082,23 +1076,14 @@ end buildoptions { "-Wno-error=unused-result", -- needed for fgets,fread on linux -- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds) - "-Wno-array-bounds", + "-Wno-error=array-bounds", "-Wno-error=attributes", -- GCC fails to recognize some uses of [[maybe_unused]] + "-Wno-error=stringop-truncation", -- ImGui again + "-Wno-error=stringop-overflow", -- formats/victor9k_dsk.cpp bugs the compiler + } + buildoptions_cpp { + "-Wno-error=class-memaccess", -- many instances in ImGui and BGFX } - if version < 100300 then - buildoptions_cpp { - "-flifetime-dse=1", -- GCC 10.2 and earlier take issue with Sol's get >() otherwise - possibly an issue with libstdc++ itself - } - end - if version >= 80000 then - buildoptions { - "-Wno-stringop-truncation", -- ImGui again - "-Wno-stringop-overflow", -- formats/victor9k_dsk.cpp bugs the compiler - } - buildoptions_cpp { - "-Wno-class-memaccess", -- many instances in ImGui and BGFX - } - end if version >= 110000 then buildoptions { "-Wno-nonnull", -- luaengine.cpp lambdas do not need "this" captured but GCC 11.1 erroneously insists diff --git a/src/devices/bus/gameboy/mbc6.cpp b/src/devices/bus/gameboy/mbc6.cpp index 46fcc9a0f0720..7e1594f1b2b58 100644 --- a/src/devices/bus/gameboy/mbc6.cpp +++ b/src/devices/bus/gameboy/mbc6.cpp @@ -102,8 +102,7 @@ class mbc6_device : public mbc_8k_device_base void install_ram() ATTR_COLD; required_device m_flash; - memory_view m_view_rom_low; - memory_view m_view_rom_high; + memory_view m_view_rom[2]; memory_view m_view_ram; memory_bank_array_creator<2> m_bank_ram; u8 m_bank_mask_ram; @@ -123,8 +122,7 @@ mbc6_device::mbc6_device( u32 clock) : mbc_8k_device_base(mconfig, GB_ROM_MBC6, tag, owner, clock), m_flash(*this, "flash"), - m_view_rom_low(*this, "romlow"), - m_view_rom_high(*this, "romhigh" ), + m_view_rom{ { *this, "romlow"}, { *this, "romhigh" } }, m_view_ram(*this, "ram"), m_bank_ram(*this, { "ramlow", "ramhigh" }), m_bank_mask_ram(0U), @@ -145,12 +143,12 @@ std::error_condition mbc6_device::load(std::string &message) return image_error::BADSOFTWARE; // install views for ROM/flash and RAM - cart_space()->install_view(0x4000, 0x5fff, m_view_rom_low); - cart_space()->install_view(0x6000, 0x7fff, m_view_rom_high); + cart_space()->install_view(0x4000, 0x5fff, m_view_rom[0]); + cart_space()->install_view(0x6000, 0x7fff, m_view_rom[1]); cart_space()->install_view(0xa000, 0xbfff, m_view_ram); // set up ROM and RAM as appropriate - install_rom(*cart_space(), m_view_rom_low[0], m_view_rom_high[0]); + install_rom(*cart_space(), m_view_rom[0][0], m_view_rom[1][0]); install_ram(); // install memory controller handlers @@ -177,11 +175,11 @@ std::error_condition mbc6_device::load(std::string &message) emu::rw_delegate(*this, FUNC(mbc6_device::select_flash))); // install Flash handlers - m_view_rom_low[1].install_readwrite_handler( + m_view_rom[0][1].install_readwrite_handler( 0x4000, 0x5fff, emu::rw_delegate(*this, FUNC(mbc6_device::read_flash<0>)), emu::rw_delegate(*this, FUNC(mbc6_device::write_flash<0>))); - m_view_rom_high[1].install_readwrite_handler( + m_view_rom[1][1].install_readwrite_handler( 0x6000, 0x7fff, emu::rw_delegate(*this, FUNC(mbc6_device::read_flash<1>)), emu::rw_delegate(*this, FUNC(mbc6_device::write_flash<1>))); @@ -230,8 +228,8 @@ void mbc6_device::device_reset() m_flash_enable = 0U; m_flash_writable = 0U; - m_view_rom_low.select(0); - m_view_rom_high.select(0); + m_view_rom[0].select(0); + m_view_rom[1].select(0); m_view_ram.disable(); if (m_bank_mask_ram) @@ -270,7 +268,6 @@ void mbc6_device::write_flash(offs_t offset, u8 data) void mbc6_device::bank_switch_rom(offs_t offset, u8 data) { auto const bank(BIT(offset, 12)); - memory_view &view(bank ? m_view_rom_high : m_view_rom_low); m_bank_sel_rom[bank] = data; if (!m_flash_select[bank]) @@ -281,11 +278,11 @@ void mbc6_device::bank_switch_rom(offs_t offset, u8 data) "%s: ROM bank %s unmapped\n", machine().describe_context(), bank ? "high" : "low"); - view.disable(); // is there a chip select for a second program ROM? + m_view_rom[bank].disable(); // is there a chip select for a second program ROM? } else { - view.select(0); + m_view_rom[bank].select(0); } } @@ -299,7 +296,6 @@ void mbc6_device::bank_switch_rom(offs_t offset, u8 data) void mbc6_device::select_flash(offs_t offset, u8 data) { auto const bank(BIT(offset, 12)); - memory_view &view(bank ? m_view_rom_high : m_view_rom_low); m_flash_select[bank] = BIT(data, 3); if (m_flash_select[bank]) { @@ -309,9 +305,9 @@ void mbc6_device::select_flash(offs_t offset, u8 data) bank ? "high" : "low", m_flash_enable ? "enabled" : "disabled"); if (m_flash_enable) - view.select(1); + m_view_rom[bank].select(1); else - view.disable(); + m_view_rom[bank].disable(); } else if (BIT(m_bank_sel_rom[bank], 7)) { @@ -319,7 +315,7 @@ void mbc6_device::select_flash(offs_t offset, u8 data) "%s: ROM bank %s unmapped\n", machine().describe_context(), bank ? "high" : "low"); - view.disable(); // is there a chip select for a second program ROM? + m_view_rom[bank].disable(); // is there a chip select for a second program ROM? } else { @@ -327,7 +323,7 @@ void mbc6_device::select_flash(offs_t offset, u8 data) "%s: ROM bank %s selected\n", machine().describe_context(), bank ? "high" : "low"); - view.select(0); + m_view_rom[bank].select(0); } // game writes 0xc6 when selecting ROM during boot - what do the other bits do? @@ -368,17 +364,17 @@ void mbc6_device::enable_flash(u8 data) { LOG("%s: Flash enabled\n", machine().describe_context()); if (m_flash_select[0]) - m_view_rom_low.select(1); + m_view_rom[0].select(1); if (m_flash_select[1]) - m_view_rom_high.select(1); + m_view_rom[1].select(1); } else { LOG("%s: Flash disabled\n", machine().describe_context()); if (m_flash_select[0]) - m_view_rom_low.disable(); + m_view_rom[0].disable(); if (m_flash_select[1]) - m_view_rom_high.disable(); + m_view_rom[1].disable(); } if (data & ~0x01) diff --git a/src/osd/modules/debugger/qt/debuggerview.cpp b/src/osd/modules/debugger/qt/debuggerview.cpp index e50659fcf3a91..84035c07ed4cb 100644 --- a/src/osd/modules/debugger/qt/debuggerview.cpp +++ b/src/osd/modules/debugger/qt/debuggerview.cpp @@ -16,10 +16,6 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) -#define horizontalAdvance width -#endif - namespace osd::debugger::qt { diff --git a/src/osd/modules/debugger/qt/memorywindow.cpp b/src/osd/modules/debugger/qt/memorywindow.cpp index 030eb4ab24d96..f5e7502f4d4f9 100644 --- a/src/osd/modules/debugger/qt/memorywindow.cpp +++ b/src/osd/modules/debugger/qt/memorywindow.cpp @@ -25,10 +25,6 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) -#define horizontalAdvance width -#endif - namespace osd::debugger::qt { diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index fb478511a99eb..cc7cb2f145160 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -63,7 +63,7 @@ char const *const CONTROLLER_AXIS_XBOX[]{ "LT", "RT" }; -[[maybe_unused]] char const *const CONTROLLER_AXIS_PS[]{ +char const *const CONTROLLER_AXIS_PS[]{ "LSX", "LSY", "RSX", @@ -71,7 +71,7 @@ char const *const CONTROLLER_AXIS_XBOX[]{ "L2", "R2" }; -[[maybe_unused]] char const *const CONTROLLER_AXIS_SWITCH[]{ +char const *const CONTROLLER_AXIS_SWITCH[]{ "LSX", "LSY", "RSX", @@ -102,7 +102,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{ "P4", "Touchpad" }; -[[maybe_unused]] char const *const CONTROLLER_BUTTON_XBOXONE[]{ +char const *const CONTROLLER_BUTTON_XBOXONE[]{ "A", "B", "X", @@ -125,7 +125,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{ "P4", "Touchpad" }; -[[maybe_unused]] char const *const CONTROLLER_BUTTON_PS3[]{ +char const *const CONTROLLER_BUTTON_PS3[]{ "Cross", "Circle", "Square", @@ -148,7 +148,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{ "P4", "Touchpad" }; -[[maybe_unused]] char const *const CONTROLLER_BUTTON_PS4[]{ +char const *const CONTROLLER_BUTTON_PS4[]{ "Cross", "Circle", "Square", @@ -171,7 +171,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{ "P4", "Touchpad" }; -[[maybe_unused]] char const *const CONTROLLER_BUTTON_PS5[]{ +char const *const CONTROLLER_BUTTON_PS5[]{ "Cross", "Circle", "Square", @@ -194,7 +194,7 @@ char const *const CONTROLLER_BUTTON_XBOX360[]{ "P4", "Touchpad" }; -[[maybe_unused]] char const *const CONTROLLER_BUTTON_SWITCH[]{ +char const *const CONTROLLER_BUTTON_SWITCH[]{ "A", "B", "X", @@ -1288,10 +1288,7 @@ class sdl_game_controller_device : public sdl_joystick_device_base char const *const *axisnames = CONTROLLER_AXIS_XBOX; char const *const *buttonnames = CONTROLLER_BUTTON_XBOX360; bool digitaltriggers = false; -#if SDL_VERSION_ATLEAST(2, 0, 14) bool avoidpaddles = false; -#endif -#if SDL_VERSION_ATLEAST(2, 0, 12) auto const ctrltype = SDL_GameControllerGetType(m_ctrldevice); switch (ctrltype) { @@ -1324,14 +1321,12 @@ class sdl_game_controller_device : public sdl_joystick_device_base buttonnames = CONTROLLER_BUTTON_SWITCH; digitaltriggers = true; break; -#if SDL_VERSION_ATLEAST(2, 0, 14) //case SDL_CONTROLLER_TYPE_VIRTUAL: case SDL_CONTROLLER_TYPE_PS5: osd_printf_verbose("Game Controller: ... PlayStation 5 type\n"); axisnames = CONTROLLER_AXIS_PS; buttonnames = CONTROLLER_BUTTON_PS5; break; -#endif #if SDL_VERSION_ATLEAST(2, 0, 16) //case SDL_CONTROLLER_TYPE_AMAZON_LUNA: case SDL_CONTROLLER_TYPE_GOOGLE_STADIA: @@ -1360,7 +1355,6 @@ class sdl_game_controller_device : public sdl_joystick_device_base osd_printf_verbose("Game Controller: ... unrecognized type (%d)\n", int(ctrltype)); break; } -#endif // keep track of item numbers as we add controls std::pair axisitems[SDL_CONTROLLER_AXIS_MAX]; @@ -1390,9 +1384,7 @@ class sdl_game_controller_device : public sdl_joystick_device_base for (auto [axis, item, buttontest] : axes) { bool avail = !buttontest || !digitaltriggers; -#if SDL_VERSION_ATLEAST(2, 0, 14) avail = avail && SDL_GameControllerHasAxis(m_ctrldevice, axis); -#endif if (avail) { auto const binding = SDL_GameControllerGetBindForAxis(m_ctrldevice, axis); @@ -1432,17 +1424,13 @@ class sdl_game_controller_device : public sdl_joystick_device_base { SDL_CONTROLLER_BUTTON_INVALID, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, true }, { SDL_CONTROLLER_BUTTON_LEFTSTICK, SDL_CONTROLLER_AXIS_INVALID, true }, { SDL_CONTROLLER_BUTTON_RIGHTSTICK, SDL_CONTROLLER_AXIS_INVALID, true }, -#if SDL_VERSION_ATLEAST(2, 0, 14) { SDL_CONTROLLER_BUTTON_PADDLE1, SDL_CONTROLLER_AXIS_INVALID, true }, { SDL_CONTROLLER_BUTTON_PADDLE2, SDL_CONTROLLER_AXIS_INVALID, true }, { SDL_CONTROLLER_BUTTON_PADDLE3, SDL_CONTROLLER_AXIS_INVALID, true }, { SDL_CONTROLLER_BUTTON_PADDLE4, SDL_CONTROLLER_AXIS_INVALID, true }, -#endif { SDL_CONTROLLER_BUTTON_GUIDE, SDL_CONTROLLER_AXIS_INVALID, false }, -#if SDL_VERSION_ATLEAST(2, 0, 14) { SDL_CONTROLLER_BUTTON_MISC1, SDL_CONTROLLER_AXIS_INVALID, false }, { SDL_CONTROLLER_BUTTON_TOUCHPAD, SDL_CONTROLLER_AXIS_INVALID, false }, -#endif }; input_item_id button_item = ITEM_ID_BUTTON1; unsigned buttoncount = 0; @@ -1452,9 +1440,7 @@ class sdl_game_controller_device : public sdl_joystick_device_base input_item_id actual = ITEM_ID_INVALID; if (SDL_CONTROLLER_BUTTON_INVALID != button) { -#if SDL_VERSION_ATLEAST(2, 0, 14) avail = SDL_GameControllerHasButton(m_ctrldevice, button); -#endif if (avail) { auto const binding = SDL_GameControllerGetBindForButton(m_ctrldevice, button); @@ -1481,9 +1467,7 @@ class sdl_game_controller_device : public sdl_joystick_device_base } else { -#if SDL_VERSION_ATLEAST(2, 0, 14) avail = SDL_GameControllerHasAxis(m_ctrldevice, axis); -#endif if (avail) { auto const binding = SDL_GameControllerGetBindForAxis(m_ctrldevice, axis); @@ -1533,9 +1517,7 @@ class sdl_game_controller_device : public sdl_joystick_device_base for (auto [button, item] : fixedbuttons) { bool avail = true; -#if SDL_VERSION_ATLEAST(2, 0, 14) avail = SDL_GameControllerHasButton(m_ctrldevice, button); -#endif if (avail) { auto const binding = SDL_GameControllerGetBindForButton(m_ctrldevice, button); @@ -1606,7 +1588,6 @@ class sdl_game_controller_device : public sdl_joystick_device_base { // took trigger buttons } -#if SDL_VERSION_ATLEAST(2, 0, 14) else if (add_axis_inc_dec_assignment(assignments, IPT_AD_STICK_Z, buttonitems[SDL_CONTROLLER_BUTTON_PADDLE1], buttonitems[SDL_CONTROLLER_BUTTON_PADDLE2])) { // took P1/P2 @@ -1615,7 +1596,6 @@ class sdl_game_controller_device : public sdl_joystick_device_base { // took P3/P4 } -#endif } // prefer trigger axes for pedals, otherwise take half axes and buttons @@ -1701,22 +1681,18 @@ class sdl_game_controller_device : public sdl_joystick_device_base { // took digital triggers } -#if SDL_VERSION_ATLEAST(2, 0, 14) else if (!avoidpaddles && consume_button_pair(assignments, IPT_UI_PREV_GROUP, IPT_UI_NEXT_GROUP, buttonitems[SDL_CONTROLLER_BUTTON_PADDLE1], buttonitems[SDL_CONTROLLER_BUTTON_PADDLE2])) { // took upper paddles } -#endif else if (consume_trigger_pair(assignments, IPT_UI_PREV_GROUP, IPT_UI_NEXT_GROUP, axisitems[SDL_CONTROLLER_AXIS_TRIGGERLEFT].first, axisitems[SDL_CONTROLLER_AXIS_TRIGGERRIGHT].first)) { // took analog triggers } -#if SDL_VERSION_ATLEAST(2, 0, 14) else if (!avoidpaddles && consume_button_pair(assignments, IPT_UI_PREV_GROUP, IPT_UI_NEXT_GROUP, buttonitems[SDL_CONTROLLER_BUTTON_PADDLE3], buttonitems[SDL_CONTROLLER_BUTTON_PADDLE4])) { // took lower paddles } -#endif else if (consume_axis_pair(assignments, IPT_UI_PREV_GROUP, IPT_UI_NEXT_GROUP, diraxis[1][1])) { // took secondary Y @@ -1727,7 +1703,6 @@ class sdl_game_controller_device : public sdl_joystick_device_base } // try to get a matching pair of buttons for page up/down -#if SDL_VERSION_ATLEAST(2, 0, 14) if (!avoidpaddles && consume_button_pair(assignments, IPT_UI_PAGE_UP, IPT_UI_PAGE_DOWN, buttonitems[SDL_CONTROLLER_BUTTON_PADDLE1], buttonitems[SDL_CONTROLLER_BUTTON_PADDLE2])) { // took upper paddles @@ -1737,7 +1712,6 @@ class sdl_game_controller_device : public sdl_joystick_device_base // took lower paddles } else -#endif if (consume_trigger_pair(assignments, IPT_UI_PAGE_UP, IPT_UI_PAGE_DOWN, axisitems[SDL_CONTROLLER_AXIS_TRIGGERLEFT].first, axisitems[SDL_CONTROLLER_AXIS_TRIGGERRIGHT].first)) { // took analog triggers @@ -2197,10 +2171,7 @@ class sdl_joystick_module_base : public sdl_input_module