diff options
-rw-r--r-- | scripts/genie.lua | 2 | ||||
-rw-r--r-- | scripts/src/emu.lua | 121 | ||||
-rw-r--r-- | scripts/src/main.lua | 1 | ||||
-rw-r--r-- | scripts/src/mame/frontend.lua | 154 | ||||
-rw-r--r-- | scripts/src/osd/modules.lua | 1 | ||||
-rw-r--r-- | src/devices/bus/nes/namcot.cpp | 2 | ||||
-rw-r--r-- | src/devices/imagedev/cassette.cpp | 55 | ||||
-rw-r--r-- | src/devices/imagedev/floppy.cpp | 159 | ||||
-rw-r--r-- | src/devices/imagedev/floppy.h | 23 | ||||
-rw-r--r-- | src/devices/machine/hp_taco.cpp | 4 | ||||
-rw-r--r-- | src/emu/debug/debugcon.cpp | 2 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 3 | ||||
-rw-r--r-- | src/emu/diimage.cpp | 15 | ||||
-rw-r--r-- | src/emu/diimage.h | 3 | ||||
-rw-r--r-- | src/emu/drivers/empty.cpp | 10 | ||||
-rw-r--r-- | src/emu/emu.h | 3 | ||||
-rw-r--r-- | src/emu/image.cpp | 4 | ||||
-rw-r--r-- | src/emu/ioport.cpp | 4 | ||||
-rw-r--r-- | src/emu/machine.cpp | 60 | ||||
-rw-r--r-- | src/emu/machine.h | 18 | ||||
-rw-r--r-- | src/emu/main.h | 94 | ||||
-rw-r--r-- | src/emu/mame.h | 112 | ||||
-rw-r--r-- | src/emu/render.cpp | 2 | ||||
-rw-r--r-- | src/emu/romload.cpp | 4 | ||||
-rw-r--r-- | src/emu/screen.cpp | 2 | ||||
-rw-r--r-- | src/emu/screen.h | 1 | ||||
-rw-r--r-- | src/emu/ui/uimain.h | 130 | ||||
-rw-r--r-- | src/emu/video.cpp | 13 | ||||
-rw-r--r-- | src/frontend/mame/audit.cpp (renamed from src/emu/audit.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/audit.h (renamed from src/emu/audit.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/cheat.cpp (renamed from src/emu/cheat.cpp) | 6 | ||||
-rw-r--r-- | src/frontend/mame/cheat.h (renamed from src/emu/cheat.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/clifront.cpp (renamed from src/emu/clifront.cpp) | 95 | ||||
-rw-r--r-- | src/frontend/mame/clifront.h (renamed from src/emu/clifront.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/info.cpp (renamed from src/emu/info.cpp) | 1 | ||||
-rw-r--r-- | src/frontend/mame/info.h (renamed from src/emu/info.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/language.cpp (renamed from src/emu/language.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/language.h (renamed from src/emu/language.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/luaengine.cpp (renamed from src/emu/luaengine.cpp) | 32 | ||||
-rw-r--r-- | src/frontend/mame/luaengine.h (renamed from src/emu/luaengine.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/mame.cpp (renamed from src/emu/mame.cpp) | 135 | ||||
-rw-r--r-- | src/frontend/mame/mame.h | 92 | ||||
-rw-r--r-- | src/frontend/mame/mameopts.cpp (renamed from src/emu/mameopts.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/mameopts.h (renamed from src/emu/mameopts.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/pluginopts.cpp (renamed from src/emu/pluginopts.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/pluginopts.h (renamed from src/emu/pluginopts.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/auditmenu.cpp (renamed from src/emu/ui/auditmenu.cpp) | 6 | ||||
-rw-r--r-- | src/frontend/mame/ui/auditmenu.h (renamed from src/emu/ui/auditmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/barcode.cpp (renamed from src/emu/ui/barcode.cpp) | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/barcode.h (renamed from src/emu/ui/barcode.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/cheatopt.cpp (renamed from src/emu/ui/cheatopt.cpp) | 8 | ||||
-rw-r--r-- | src/frontend/mame/ui/cheatopt.h (renamed from src/emu/ui/cheatopt.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/custmenu.cpp (renamed from src/emu/ui/custmenu.cpp) | 12 | ||||
-rw-r--r-- | src/frontend/mame/ui/custmenu.h (renamed from src/emu/ui/custmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/custui.cpp (renamed from src/emu/ui/custui.cpp) | 24 | ||||
-rw-r--r-- | src/frontend/mame/ui/custui.h (renamed from src/emu/ui/custui.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/datfile.cpp (renamed from src/emu/ui/datfile.cpp) | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/datfile.h (renamed from src/emu/ui/datfile.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/datmenu.cpp (renamed from src/emu/ui/datmenu.cpp) | 26 | ||||
-rw-r--r-- | src/frontend/mame/ui/datmenu.h (renamed from src/emu/ui/datmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/defimg.h (renamed from src/emu/ui/defimg.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/devctrl.h (renamed from src/emu/ui/devctrl.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/devopt.cpp (renamed from src/emu/ui/devopt.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/devopt.h (renamed from src/emu/ui/devopt.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/dirmenu.cpp (renamed from src/emu/ui/dirmenu.cpp) | 46 | ||||
-rw-r--r-- | src/frontend/mame/ui/dirmenu.h (renamed from src/emu/ui/dirmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/filemngr.cpp (renamed from src/emu/ui/filemngr.cpp) | 18 | ||||
-rw-r--r-- | src/frontend/mame/ui/filemngr.h (renamed from src/emu/ui/filemngr.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/filesel.cpp (renamed from src/emu/ui/filesel.cpp) | 18 | ||||
-rw-r--r-- | src/frontend/mame/ui/filesel.h (renamed from src/emu/ui/filesel.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/floppycntrl.cpp | 170 | ||||
-rw-r--r-- | src/frontend/mame/ui/floppycntrl.h | 36 | ||||
-rw-r--r-- | src/frontend/mame/ui/icorender.h (renamed from src/emu/ui/icorender.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/imgcntrl.cpp (renamed from src/emu/ui/imgcntrl.cpp) | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/imgcntrl.h (renamed from src/emu/ui/imgcntrl.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/info.cpp (renamed from src/emu/ui/info.cpp) | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/info.h (renamed from src/emu/ui/info.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/info_pty.cpp (renamed from src/emu/ui/info_pty.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/info_pty.h (renamed from src/emu/ui/info_pty.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/inifile.cpp (renamed from src/emu/ui/inifile.cpp) | 8 | ||||
-rw-r--r-- | src/frontend/mame/ui/inifile.h (renamed from src/emu/ui/inifile.h) | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/inputmap.cpp (renamed from src/emu/ui/inputmap.cpp) | 8 | ||||
-rw-r--r-- | src/frontend/mame/ui/inputmap.h (renamed from src/emu/ui/inputmap.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/mainmenu.cpp (renamed from src/emu/ui/mainmenu.cpp) | 10 | ||||
-rw-r--r-- | src/frontend/mame/ui/mainmenu.h (renamed from src/emu/ui/mainmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/menu.cpp (renamed from src/emu/ui/menu.cpp) | 104 | ||||
-rw-r--r-- | src/frontend/mame/ui/menu.h (renamed from src/emu/ui/menu.h) | 39 | ||||
-rw-r--r-- | src/frontend/mame/ui/miscmenu.cpp (renamed from src/emu/ui/miscmenu.cpp) | 37 | ||||
-rw-r--r-- | src/frontend/mame/ui/miscmenu.h (renamed from src/emu/ui/miscmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/moptions.cpp (renamed from src/emu/ui/moptions.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/moptions.h (renamed from src/emu/ui/moptions.h) | 2 | ||||
-rw-r--r-- | src/frontend/mame/ui/optsmenu.cpp (renamed from src/emu/ui/optsmenu.cpp) | 28 | ||||
-rw-r--r-- | src/frontend/mame/ui/optsmenu.h (renamed from src/emu/ui/optsmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/pluginopt.cpp (renamed from src/emu/ui/pluginopt.cpp) | 7 | ||||
-rw-r--r-- | src/frontend/mame/ui/pluginopt.h (renamed from src/emu/ui/pluginopt.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/selector.cpp (renamed from src/emu/ui/selector.cpp) | 10 | ||||
-rw-r--r-- | src/frontend/mame/ui/selector.h (renamed from src/emu/ui/selector.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/selgame.cpp (renamed from src/emu/ui/selgame.cpp) | 81 | ||||
-rw-r--r-- | src/frontend/mame/ui/selgame.h (renamed from src/emu/ui/selgame.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/selsoft.cpp (renamed from src/emu/ui/selsoft.cpp) | 63 | ||||
-rw-r--r-- | src/frontend/mame/ui/selsoft.h (renamed from src/emu/ui/selsoft.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/simpleselgame.cpp (renamed from src/emu/ui/simpleselgame.cpp) | 25 | ||||
-rw-r--r-- | src/frontend/mame/ui/simpleselgame.h (renamed from src/emu/ui/simpleselgame.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/sliders.cpp (renamed from src/emu/ui/sliders.cpp) | 12 | ||||
-rw-r--r-- | src/frontend/mame/ui/sliders.h (renamed from src/emu/ui/sliders.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/slotopt.cpp (renamed from src/emu/ui/slotopt.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/slotopt.h (renamed from src/emu/ui/slotopt.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/sndmenu.cpp (renamed from src/emu/ui/sndmenu.cpp) | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/sndmenu.h (renamed from src/emu/ui/sndmenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/starimg.h (renamed from src/emu/ui/starimg.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/submenu.cpp (renamed from src/emu/ui/submenu.cpp) | 8 | ||||
-rw-r--r-- | src/frontend/mame/ui/submenu.h (renamed from src/emu/ui/submenu.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/swlist.cpp (renamed from src/emu/ui/swlist.cpp) | 4 | ||||
-rw-r--r-- | src/frontend/mame/ui/swlist.h (renamed from src/emu/ui/swlist.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/tapectrl.cpp (renamed from src/emu/ui/tapectrl.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/tapectrl.h (renamed from src/emu/ui/tapectrl.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/toolbar.h (renamed from src/emu/ui/toolbar.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/ui.cpp (renamed from src/emu/ui/ui.cpp) | 286 | ||||
-rw-r--r-- | src/frontend/mame/ui/ui.h (renamed from src/emu/ui/ui.h) | 62 | ||||
-rw-r--r-- | src/frontend/mame/ui/uicmd14.png (renamed from src/emu/ui/uicmd14.png) | bin | 3254 -> 3254 bytes | |||
-rw-r--r-- | src/frontend/mame/ui/utils.cpp (renamed from src/emu/ui/utils.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/utils.h (renamed from src/emu/ui/utils.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/videoopt.cpp (renamed from src/emu/ui/videoopt.cpp) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/videoopt.h (renamed from src/emu/ui/videoopt.h) | 0 | ||||
-rw-r--r-- | src/frontend/mame/ui/viewgfx.cpp (renamed from src/emu/ui/viewgfx.cpp) | 18 | ||||
-rw-r--r-- | src/frontend/mame/ui/viewgfx.h (renamed from src/emu/ui/viewgfx.h) | 0 | ||||
-rw-r--r-- | src/mame/audio/gamate.cpp | 1 | ||||
-rw-r--r-- | src/mame/drivers/gamate.cpp | 2 | ||||
-rw-r--r-- | src/mame/machine/cps2crpt.cpp | 2 | ||||
-rw-r--r-- | src/mame/machine/spec_snqk.cpp | 2 | ||||
-rw-r--r-- | src/mame/video/deco16ic.cpp | 5 | ||||
-rw-r--r-- | src/mame/video/ssv.cpp | 17 | ||||
-rw-r--r-- | src/mame/video/taito_f3.cpp | 5 | ||||
-rw-r--r-- | src/osd/modules/debugger/debugint.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_sdl.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/input/input_sdlcommon.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/lib/osdobj_common.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/osdwindow.h | 4 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/chainmanager.cpp | 3 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/slider.cpp | 2 | ||||
-rw-r--r-- | src/osd/modules/render/bgfx/slider.h | 2 | ||||
-rw-r--r-- | src/osd/modules/render/d3d/d3dhlsl.cpp | 5 | ||||
-rw-r--r-- | src/osd/modules/render/drawsdl.cpp | 2 | ||||
-rw-r--r-- | src/osd/osdepend.h | 2 | ||||
-rw-r--r-- | src/osd/sdl/sdlmain.cpp | 6 | ||||
-rw-r--r-- | src/osd/sdl/video.cpp | 2 | ||||
-rw-r--r-- | src/osd/sdl/window.cpp | 2 | ||||
-rw-r--r-- | src/osd/windows/video.cpp | 1 | ||||
-rw-r--r-- | src/osd/windows/winmain.cpp | 6 |
149 files changed, 1419 insertions, 1217 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua index f290dfde9e9..3281ca7813b 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -1317,6 +1317,8 @@ group "core" dofile(path.join("src", "emu.lua")) +dofile(path.join("src", "mame", "frontend.lua")) + group "devices" dofile(path.join("src", "devices.lua")) devicesProject(_OPTIONS["target"],_OPTIONS["subtarget"]) diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index 792b422785e..afedfcb1a1d 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -38,20 +38,9 @@ includedirs { ext_includedir("flac"), } -if (_OPTIONS["targetos"] == "windows" and _OPTIONS["osd"] ~= "osdmini") then - defines { - "UI_WINDOWS", - } -end - -if (_OPTIONS["osd"] == "sdl") then - defines { - "UI_SDL", - } -end - files { MAME_DIR .. "src/emu/emu.h", + MAME_DIR .. "src/emu/main.h", MAME_DIR .. "src/emu/gamedrv.h", MAME_DIR .. "src/emu/hashfile.cpp", MAME_DIR .. "src/emu/hashfile.h", @@ -59,14 +48,8 @@ files { MAME_DIR .. "src/emu/addrmap.h", MAME_DIR .. "src/emu/attotime.cpp", MAME_DIR .. "src/emu/attotime.h", - MAME_DIR .. "src/emu/audit.cpp", - MAME_DIR .. "src/emu/audit.h", MAME_DIR .. "src/emu/bookkeeping.cpp", MAME_DIR .. "src/emu/bookkeeping.h", - MAME_DIR .. "src/emu/cheat.cpp", - MAME_DIR .. "src/emu/cheat.h", - MAME_DIR .. "src/emu/clifront.cpp", - MAME_DIR .. "src/emu/clifront.h", MAME_DIR .. "src/emu/config.cpp", MAME_DIR .. "src/emu/config.h", MAME_DIR .. "src/emu/crsshair.cpp", @@ -141,21 +124,11 @@ files { MAME_DIR .. "src/emu/hash.h", MAME_DIR .. "src/emu/image.cpp", MAME_DIR .. "src/emu/image.h", - MAME_DIR .. "src/emu/info.cpp", - MAME_DIR .. "src/emu/info.h", MAME_DIR .. "src/emu/input.cpp", MAME_DIR .. "src/emu/input.h", MAME_DIR .. "src/emu/ioport.cpp", MAME_DIR .. "src/emu/ioport.h", MAME_DIR .. "src/emu/inpttype.h", - MAME_DIR .. "src/emu/luaengine.cpp", - MAME_DIR .. "src/emu/luaengine.h", - MAME_DIR .. "src/emu/language.cpp", - MAME_DIR .. "src/emu/language.h", - MAME_DIR .. "src/emu/mame.cpp", - MAME_DIR .. "src/emu/mame.h", - MAME_DIR .. "src/emu/mameopts.cpp", - MAME_DIR .. "src/emu/mameopts.h", MAME_DIR .. "src/emu/machine.cpp", MAME_DIR .. "src/emu/machine.h", MAME_DIR .. "src/emu/mconfig.cpp", @@ -166,8 +139,8 @@ files { MAME_DIR .. "src/emu/network.h", MAME_DIR .. "src/emu/parameters.cpp", MAME_DIR .. "src/emu/parameters.h", - MAME_DIR .. "src/emu/pluginopts.cpp", - MAME_DIR .. "src/emu/pluginopts.h", + MAME_DIR .. "src/emu/profiler.cpp", + MAME_DIR .. "src/emu/profiler.h", MAME_DIR .. "src/emu/output.cpp", MAME_DIR .. "src/emu/output.h", MAME_DIR .. "src/emu/render.cpp", @@ -200,92 +173,14 @@ files { MAME_DIR .. "src/emu/timer.h", MAME_DIR .. "src/emu/uiinput.cpp", MAME_DIR .. "src/emu/uiinput.h", - MAME_DIR .. "src/emu/ui/ui.cpp", - MAME_DIR .. "src/emu/ui/ui.h", - MAME_DIR .. "src/emu/ui/devctrl.h", - MAME_DIR .. "src/emu/ui/menu.cpp", - MAME_DIR .. "src/emu/ui/menu.h", - MAME_DIR .. "src/emu/ui/submenu.cpp", - MAME_DIR .. "src/emu/ui/submenu.h", - MAME_DIR .. "src/emu/ui/mainmenu.cpp", - MAME_DIR .. "src/emu/ui/mainmenu.h", - MAME_DIR .. "src/emu/ui/miscmenu.cpp", - MAME_DIR .. "src/emu/ui/miscmenu.h", - MAME_DIR .. "src/emu/ui/barcode.cpp", - MAME_DIR .. "src/emu/ui/barcode.h", - MAME_DIR .. "src/emu/ui/cheatopt.cpp", - MAME_DIR .. "src/emu/ui/cheatopt.h", - MAME_DIR .. "src/emu/ui/pluginopt.cpp", - MAME_DIR .. "src/emu/ui/pluginopt.h", - MAME_DIR .. "src/emu/ui/devopt.cpp", - MAME_DIR .. "src/emu/ui/devopt.h", - MAME_DIR .. "src/emu/ui/filemngr.cpp", - MAME_DIR .. "src/emu/ui/filemngr.h", - MAME_DIR .. "src/emu/ui/filesel.cpp", - MAME_DIR .. "src/emu/ui/filesel.h", - MAME_DIR .. "src/emu/ui/imgcntrl.cpp", - MAME_DIR .. "src/emu/ui/imgcntrl.h", - MAME_DIR .. "src/emu/ui/info.cpp", - MAME_DIR .. "src/emu/ui/info.h", - MAME_DIR .. "src/emu/ui/info_pty.cpp", - MAME_DIR .. "src/emu/ui/info_pty.h", - MAME_DIR .. "src/emu/ui/inputmap.cpp", - MAME_DIR .. "src/emu/ui/inputmap.h", - MAME_DIR .. "src/emu/ui/sliders.cpp", - MAME_DIR .. "src/emu/ui/sliders.h", - MAME_DIR .. "src/emu/ui/slotopt.cpp", - MAME_DIR .. "src/emu/ui/slotopt.h", - MAME_DIR .. "src/emu/ui/swlist.cpp", - MAME_DIR .. "src/emu/ui/swlist.h", - MAME_DIR .. "src/emu/ui/tapectrl.cpp", - MAME_DIR .. "src/emu/ui/tapectrl.h", - MAME_DIR .. "src/emu/ui/videoopt.cpp", - MAME_DIR .. "src/emu/ui/videoopt.h", - MAME_DIR .. "src/emu/ui/viewgfx.cpp", - MAME_DIR .. "src/emu/ui/viewgfx.h", - MAME_DIR .. "src/emu/ui/auditmenu.cpp", - MAME_DIR .. "src/emu/ui/auditmenu.h", - MAME_DIR .. "src/emu/ui/cmddata.h", - MAME_DIR .. "src/emu/ui/cmdrender.h", - MAME_DIR .. "src/emu/ui/custmenu.cpp", - MAME_DIR .. "src/emu/ui/custmenu.h", - MAME_DIR .. "src/emu/ui/custui.cpp", - MAME_DIR .. "src/emu/ui/custui.h", - MAME_DIR .. "src/emu/ui/datfile.cpp", - MAME_DIR .. "src/emu/ui/datfile.h", - MAME_DIR .. "src/emu/ui/datmenu.cpp", - MAME_DIR .. "src/emu/ui/datmenu.h", - MAME_DIR .. "src/emu/ui/defimg.h", - MAME_DIR .. "src/emu/ui/dirmenu.cpp", - MAME_DIR .. "src/emu/ui/dirmenu.h", - MAME_DIR .. "src/emu/ui/icorender.h", - MAME_DIR .. "src/emu/ui/inifile.cpp", - MAME_DIR .. "src/emu/ui/inifile.h", - MAME_DIR .. "src/emu/ui/miscmenu.cpp", - MAME_DIR .. "src/emu/ui/miscmenu.h", - MAME_DIR .. "src/emu/ui/moptions.cpp", - MAME_DIR .. "src/emu/ui/moptions.h", - MAME_DIR .. "src/emu/ui/optsmenu.cpp", - MAME_DIR .. "src/emu/ui/optsmenu.h", - MAME_DIR .. "src/emu/ui/selector.cpp", - MAME_DIR .. "src/emu/ui/selector.h", - MAME_DIR .. "src/emu/ui/selgame.cpp", - MAME_DIR .. "src/emu/ui/selgame.h", - MAME_DIR .. "src/emu/ui/simpleselgame.cpp", - MAME_DIR .. "src/emu/ui/simpleselgame.h", - MAME_DIR .. "src/emu/ui/selsoft.cpp", - MAME_DIR .. "src/emu/ui/selsoft.h", - MAME_DIR .. "src/emu/ui/sndmenu.cpp", - MAME_DIR .. "src/emu/ui/sndmenu.h", - MAME_DIR .. "src/emu/ui/starimg.h", - MAME_DIR .. "src/emu/ui/toolbar.h", - MAME_DIR .. "src/emu/ui/utils.cpp", - MAME_DIR .. "src/emu/ui/utils.h", MAME_DIR .. "src/emu/validity.cpp", MAME_DIR .. "src/emu/validity.h", MAME_DIR .. "src/emu/video.cpp", MAME_DIR .. "src/emu/video.h", MAME_DIR .. "src/emu/rendersw.inc", + MAME_DIR .. "src/emu/ui/uimain.h", + MAME_DIR .. "src/emu/ui/cmdrender.h", -- TODO: remove + MAME_DIR .. "src/emu/ui/cmddata.h", -- TODO: remove MAME_DIR .. "src/emu/debug/debugcmd.cpp", MAME_DIR .. "src/emu/debug/debugcmd.h", MAME_DIR .. "src/emu/debug/debugcon.cpp", @@ -312,8 +207,6 @@ files { MAME_DIR .. "src/emu/debug/express.h", MAME_DIR .. "src/emu/debug/textbuf.cpp", MAME_DIR .. "src/emu/debug/textbuf.h", - MAME_DIR .. "src/emu/profiler.cpp", - MAME_DIR .. "src/emu/profiler.h", MAME_DIR .. "src/emu/sound/filter.cpp", MAME_DIR .. "src/emu/sound/filter.h", MAME_DIR .. "src/devices/sound/flt_vol.cpp", @@ -417,7 +310,7 @@ custombuildtask { } custombuildtask { - { MAME_DIR .. "src/emu/ui/uicmd14.png" , GEN_DIR .. "emu/ui/uicmd14.fh", { MAME_DIR.. "scripts/build/png2bdc.py", MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting uicmd14.png...", PYTHON .. " $(1) $(<) temp_cmd.bdc", PYTHON .. " $(2) temp_cmd.bdc $(@) font_uicmd14 UINT8" }}, + { MAME_DIR .. "src/frontend/mame/ui/uicmd14.png" , GEN_DIR .. "emu/ui/uicmd14.fh", { MAME_DIR.. "scripts/build/png2bdc.py", MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting uicmd14.png...", PYTHON .. " $(1) $(<) temp_cmd.bdc", PYTHON .. " $(2) temp_cmd.bdc $(@) font_uicmd14 UINT8" }}, layoutbuildtask("emu/layout", "dualhovu"), layoutbuildtask("emu/layout", "dualhsxs"), diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 3b07a69211c..f8a983b297d 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -192,6 +192,7 @@ end links { "netlist", "optional", + "frontend", "emu", "formats", } diff --git a/scripts/src/mame/frontend.lua b/scripts/src/mame/frontend.lua new file mode 100644 index 00000000000..2e4a35bf8a9 --- /dev/null +++ b/scripts/src/mame/frontend.lua @@ -0,0 +1,154 @@ +-- license:BSD-3-Clause +-- copyright-holders:MAMEdev Team + +--------------------------------------------------------------------------- +-- +-- frontend.lua +-- +-- Rules for building frontend +-- +--------------------------------------------------------------------------- + +project ("frontend") +targetsubdir(_OPTIONS["target"] .."_" .. _OPTIONS["subtarget"]) +uuid ("e98e14c4-82a4-4988-ba29-01c90c817ab8") +kind (LIBTYPE) + +addprojectflags() +precompiledheaders() +options { + "ArchiveSplit", +} +includedirs { + MAME_DIR .. "src/osd", + MAME_DIR .. "src/emu", + MAME_DIR .. "src/frontend/mame", + MAME_DIR .. "src/devices", -- till deps are fixed + MAME_DIR .. "src/lib", + MAME_DIR .. "src/lib/util", + MAME_DIR .. "3rdparty/rapidjson/include", + MAME_DIR .. "3rdparty", + GEN_DIR .. "emu", + GEN_DIR .. "emu/layout", +} + +includedirs { + ext_includedir("expat"), + ext_includedir("lua"), + ext_includedir("zlib"), + ext_includedir("flac"), +} + +if (_OPTIONS["targetos"] == "windows") then + defines { + "UI_WINDOWS", + } +end + +if (_OPTIONS["osd"] == "sdl") then + defines { + "UI_SDL", + } +end + +files { + MAME_DIR .. "src/frontend/mame/audit.cpp", + MAME_DIR .. "src/frontend/mame/audit.h", + MAME_DIR .. "src/frontend/mame/cheat.cpp", + MAME_DIR .. "src/frontend/mame/cheat.h", + MAME_DIR .. "src/frontend/mame/clifront.cpp", + MAME_DIR .. "src/frontend/mame/clifront.h", + MAME_DIR .. "src/frontend/mame/info.cpp", + MAME_DIR .. "src/frontend/mame/info.h", + MAME_DIR .. "src/frontend/mame/language.cpp", + MAME_DIR .. "src/frontend/mame/language.h", + MAME_DIR .. "src/frontend/mame/luaengine.cpp", + MAME_DIR .. "src/frontend/mame/luaengine.h", + MAME_DIR .. "src/frontend/mame/mame.cpp", + MAME_DIR .. "src/frontend/mame/mame.h", + MAME_DIR .. "src/frontend/mame/mameopts.cpp", + MAME_DIR .. "src/frontend/mame/mameopts.h", + MAME_DIR .. "src/frontend/mame/pluginopts.cpp", + MAME_DIR .. "src/frontend/mame/pluginopts.h", + MAME_DIR .. "src/frontend/mame/ui/ui.cpp", + MAME_DIR .. "src/frontend/mame/ui/ui.h", + MAME_DIR .. "src/frontend/mame/ui/devctrl.h", + MAME_DIR .. "src/frontend/mame/ui/menu.cpp", + MAME_DIR .. "src/frontend/mame/ui/menu.h", + MAME_DIR .. "src/frontend/mame/ui/submenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/submenu.h", + MAME_DIR .. "src/frontend/mame/ui/mainmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/mainmenu.h", + MAME_DIR .. "src/frontend/mame/ui/miscmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/miscmenu.h", + MAME_DIR .. "src/frontend/mame/ui/barcode.cpp", + MAME_DIR .. "src/frontend/mame/ui/barcode.h", + MAME_DIR .. "src/frontend/mame/ui/cheatopt.cpp", + MAME_DIR .. "src/frontend/mame/ui/cheatopt.h", + MAME_DIR .. "src/frontend/mame/ui/pluginopt.cpp", + MAME_DIR .. "src/frontend/mame/ui/pluginopt.h", + MAME_DIR .. "src/frontend/mame/ui/devopt.cpp", + MAME_DIR .. "src/frontend/mame/ui/devopt.h", + MAME_DIR .. "src/frontend/mame/ui/filemngr.cpp", + MAME_DIR .. "src/frontend/mame/ui/filemngr.h", + MAME_DIR .. "src/frontend/mame/ui/filesel.cpp", + MAME_DIR .. "src/frontend/mame/ui/filesel.h", + MAME_DIR .. "src/frontend/mame/ui/floppycntrl.cpp", + MAME_DIR .. "src/frontend/mame/ui/floppycntrl.h", + MAME_DIR .. "src/frontend/mame/ui/imgcntrl.cpp", + MAME_DIR .. "src/frontend/mame/ui/imgcntrl.h", + MAME_DIR .. "src/frontend/mame/ui/info.cpp", + MAME_DIR .. "src/frontend/mame/ui/info.h", + MAME_DIR .. "src/frontend/mame/ui/info_pty.cpp", + MAME_DIR .. "src/frontend/mame/ui/info_pty.h", + MAME_DIR .. "src/frontend/mame/ui/inputmap.cpp", + MAME_DIR .. "src/frontend/mame/ui/inputmap.h", + MAME_DIR .. "src/frontend/mame/ui/sliders.cpp", + MAME_DIR .. "src/frontend/mame/ui/sliders.h", + MAME_DIR .. "src/frontend/mame/ui/slotopt.cpp", + MAME_DIR .. "src/frontend/mame/ui/slotopt.h", + MAME_DIR .. "src/frontend/mame/ui/swlist.cpp", + MAME_DIR .. "src/frontend/mame/ui/swlist.h", + MAME_DIR .. "src/frontend/mame/ui/tapectrl.cpp", + MAME_DIR .. "src/frontend/mame/ui/tapectrl.h", + MAME_DIR .. "src/frontend/mame/ui/videoopt.cpp", + MAME_DIR .. "src/frontend/mame/ui/videoopt.h", + MAME_DIR .. "src/frontend/mame/ui/viewgfx.cpp", + MAME_DIR .. "src/frontend/mame/ui/viewgfx.h", + MAME_DIR .. "src/frontend/mame/ui/auditmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/auditmenu.h", + MAME_DIR .. "src/frontend/mame/ui/custmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/custmenu.h", + MAME_DIR .. "src/frontend/mame/ui/custui.cpp", + MAME_DIR .. "src/frontend/mame/ui/custui.h", + MAME_DIR .. "src/frontend/mame/ui/datfile.cpp", + MAME_DIR .. "src/frontend/mame/ui/datfile.h", + MAME_DIR .. "src/frontend/mame/ui/datmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/datmenu.h", + MAME_DIR .. "src/frontend/mame/ui/defimg.h", + MAME_DIR .. "src/frontend/mame/ui/dirmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/dirmenu.h", + MAME_DIR .. "src/frontend/mame/ui/icorender.h", + MAME_DIR .. "src/frontend/mame/ui/inifile.cpp", + MAME_DIR .. "src/frontend/mame/ui/inifile.h", + MAME_DIR .. "src/frontend/mame/ui/miscmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/miscmenu.h", + MAME_DIR .. "src/frontend/mame/ui/moptions.cpp", + MAME_DIR .. "src/frontend/mame/ui/moptions.h", + MAME_DIR .. "src/frontend/mame/ui/optsmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/optsmenu.h", + MAME_DIR .. "src/frontend/mame/ui/selector.cpp", + MAME_DIR .. "src/frontend/mame/ui/selector.h", + MAME_DIR .. "src/frontend/mame/ui/selgame.cpp", + MAME_DIR .. "src/frontend/mame/ui/selgame.h", + MAME_DIR .. "src/frontend/mame/ui/simpleselgame.cpp", + MAME_DIR .. "src/frontend/mame/ui/simpleselgame.h", + MAME_DIR .. "src/frontend/mame/ui/selsoft.cpp", + MAME_DIR .. "src/frontend/mame/ui/selsoft.h", + MAME_DIR .. "src/frontend/mame/ui/sndmenu.cpp", + MAME_DIR .. "src/frontend/mame/ui/sndmenu.h", + MAME_DIR .. "src/frontend/mame/ui/starimg.h", + MAME_DIR .. "src/frontend/mame/ui/toolbar.h", + MAME_DIR .. "src/frontend/mame/ui/utils.cpp", + MAME_DIR .. "src/frontend/mame/ui/utils.h", +} diff --git a/scripts/src/osd/modules.lua b/scripts/src/osd/modules.lua index d372ed9761c..a05e55ee4c6 100644 --- a/scripts/src/osd/modules.lua +++ b/scripts/src/osd/modules.lua @@ -57,7 +57,6 @@ function osdmodulesbuild() MAME_DIR .. "src/osd/modules/diagnostics/none.cpp", MAME_DIR .. "src/osd/modules/diagnostics/diagnostics_win32.cpp", MAME_DIR .. "src/osd/modules/debugger/none.cpp", - MAME_DIR .. "src/osd/modules/debugger/debugint.cpp", MAME_DIR .. "src/osd/modules/debugger/debugwin.cpp", MAME_DIR .. "src/osd/modules/debugger/debugimgui.cpp", MAME_DIR .. "src/osd/modules/font/font_sdl.cpp", diff --git a/src/devices/bus/nes/namcot.cpp b/src/devices/bus/nes/namcot.cpp index 5d166114e49..2d9bf4bfc69 100644 --- a/src/devices/bus/nes/namcot.cpp +++ b/src/devices/bus/nes/namcot.cpp @@ -24,7 +24,7 @@ #include "emu.h" #include "namcot.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "cpu/m6502/m6502.h" diff --git a/src/devices/imagedev/cassette.cpp b/src/devices/imagedev/cassette.cpp index 0397c249fcb..c045533a1b3 100644 --- a/src/devices/imagedev/cassette.cpp +++ b/src/devices/imagedev/cassette.cpp @@ -11,11 +11,7 @@ #include "emu.h" #include "formats/imageutl.h" #include "cassette.h" -#include "ui/ui.h" - - -#define ANIMATION_FPS 1 -#define ANIMATION_FRAMES 4 +#include "ui/uimain.h" #define VERBOSE 0 #define LOG(x) do { if (VERBOSE) logerror x; } while (0) @@ -367,63 +363,18 @@ void cassette_image_device::call_unload() */ void cassette_image_device::call_display() { - char buf[65]; - float x, y; - int n; - double position, length; - cassette_state uistate; - static const UINT8 shapes[8] = { 0x2d, 0x5c, 0x7c, 0x2f, 0x2d, 0x20, 0x20, 0x20 }; - /* abort if we should not be showing the image */ if (!exists()) return; if (!is_motor_on()) return; - - /* figure out where we are in the cassette */ - position = get_position(); - length = get_length(); - uistate = (cassette_state)(get_state() & CASSETTE_MASK_UISTATE); - - /* choose a location on the screen */ - x = 0.2f; - y = 0.5f; - - y += cassette_device_iterator(device().machine().root_device()).indexof(*this); - - y *= device().machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; - /* choose which frame of the animation we are at */ - n = ((int) position / ANIMATION_FPS) % ANIMATION_FRAMES; - /* Since you can have anything in a BDF file, we will use crude ascii characters instead */ - snprintf(buf, ARRAY_LENGTH(buf), "%c%c %c %02d:%02d (%04d) [%02d:%02d (%04d)]", -#if 0 - /* THE ANIMATION HASN'T WORKED SINCE 0.114 - LEFT HERE FOR REFERENCE */ - /* NEVER SEEN THE PLAY / RECORD ICONS */ - /* character pairs 2-3, 4-5, 6-7, 8-9 form little tape cassette images */ - n * 2 + 2, /* cassette icon left */ - n * 2 + 3, /* cassette icon right */ - (uistate == CASSETTE_PLAY) ? 16 : 14, /* play or record icon */ -#else - shapes[n], /* cassette icon left */ - shapes[n|4], /* cassette icon right */ - (uistate == CASSETTE_PLAY) ? 0x50 : 0x52, /* play (P) or record (R) */ -#endif - ((int) position / 60), - ((int) position % 60), - (int) position, - ((int) length / 60), - ((int) length % 60), - (int) length); - - // draw the cassette - device().machine().ui().draw_text_box(&device().machine().render().ui_container(), buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); - + machine().ui().image_display(CASSETTE, this); // make sure tape stops at end when playing if ((m_state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) { if ( m_cassette ) { - if (position > length) + if (get_position() > get_length()) { m_state = (cassette_state)(( m_state & ~CASSETTE_MASK_UISTATE ) | CASSETTE_STOPPED); } diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp index 345d6bce3cd..d31c67f6072 100644 --- a/src/devices/imagedev/floppy.cpp +++ b/src/devices/imagedev/floppy.cpp @@ -7,8 +7,6 @@ *********************************************************************/ #include "emu.h" -#include "ui/menu.h" -#include "ui/filesel.h" #include "zippath.h" #include "floppy.h" #include "formats/imageutl.h" @@ -932,163 +930,6 @@ UINT32 floppy_image_device::get_variant() const return image ? image->get_variant() : 0; } -ui_menu *floppy_image_device::get_selection_menu(running_machine &machine, render_container *container) -{ - return global_alloc_clear<ui_menu_control_floppy_image>(machine, container, this); -} - -ui_menu_control_floppy_image::ui_menu_control_floppy_image(running_machine &machine, render_container *container, device_image_interface *_image) : ui_menu_control_device_image(machine, container, _image) -{ - floppy_image_device *fd = static_cast<floppy_image_device *>(image); - const floppy_image_format_t *fif_list = fd->get_formats(); - int fcnt = 0; - for(const floppy_image_format_t *i = fif_list; i; i = i->next) - fcnt++; - - format_array = global_alloc_array(floppy_image_format_t *, fcnt); - input_format = output_format = nullptr; - input_filename = output_filename = ""; -} - -ui_menu_control_floppy_image::~ui_menu_control_floppy_image() -{ - global_free_array(format_array); -} - -void ui_menu_control_floppy_image::do_load_create() -{ - floppy_image_device *fd = static_cast<floppy_image_device *>(image); - if(input_filename.compare("")==0) { - int err = fd->create(output_filename.c_str(), nullptr, nullptr); - if (err != 0) { - machine().popmessage("Error: %s", fd->error()); - return; - } - fd->setup_write(output_format); - } else { - int err = fd->load(input_filename.c_str()); - if (!err && output_filename.compare("") != 0) - err = fd->reopen_for_write(output_filename.c_str()); - if(err != 0) { - machine().popmessage("Error: %s", fd->error()); - return; - } - if(output_format) - fd->setup_write(output_format); - } -} - -void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist) -{ - if (softlist) - { - machine().popmessage("When loaded from software list, the disk is Read-only.\n"); - image->load(filename.c_str()); - ui_menu::stack_pop(machine()); - return; - } - - input_filename = filename; - input_format = static_cast<floppy_image_device *>(image)->identify(filename); - - if (!input_format) - { - machine().popmessage("Error: %s\n", image->error()); - ui_menu::stack_pop(machine()); - return; - } - - bool can_in_place = input_format->supports_save(); - if(can_in_place) { - osd_file::error filerr; - std::string tmp_path; - util::core_file::ptr tmp_file; - /* attempt to open the file for writing but *without* create */ - filerr = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path); - if(filerr == osd_file::error::NONE) - tmp_file.reset(); - else - can_in_place = false; - } - submenu_result = -1; - ui_menu::stack_push(global_alloc_clear<ui_menu_select_rw>(machine(), container, can_in_place, &submenu_result)); - state = SELECT_RW; -} - -void ui_menu_control_floppy_image::handle() -{ - floppy_image_device *fd = static_cast<floppy_image_device *>(image); - switch (state) { - case DO_CREATE: { - floppy_image_format_t *fif_list = fd->get_formats(); - int ext_match; - int total_usable = 0; - for(floppy_image_format_t *i = fif_list; i; i = i->next) { - if(!i->supports_save()) - continue; - if (i->extension_matches(current_file.c_str())) - format_array[total_usable++] = i; - } - ext_match = total_usable; - for(floppy_image_format_t *i = fif_list; i; i = i->next) { - if(!i->supports_save()) - continue; - if (!i->extension_matches(current_file.c_str())) - format_array[total_usable++] = i; - } - submenu_result = -1; - ui_menu::stack_push(global_alloc_clear<ui_menu_select_format>(machine(), container, format_array, ext_match, total_usable, &submenu_result)); - - state = SELECT_FORMAT; - break; - } - - case SELECT_FORMAT: - if(submenu_result == -1) { - state = START_FILE; - handle(); - } else { - util::zippath_combine(output_filename, current_directory.c_str(), current_file.c_str()); - output_format = format_array[submenu_result]; - do_load_create(); - ui_menu::stack_pop(machine()); - } - break; - - case SELECT_RW: - switch(submenu_result) { - case ui_menu_select_rw::READONLY: - do_load_create(); - ui_menu::stack_pop(machine()); - break; - - case ui_menu_select_rw::READWRITE: - output_format = input_format; - do_load_create(); - ui_menu::stack_pop(machine()); - break; - - case ui_menu_select_rw::WRITE_DIFF: - machine().popmessage("Sorry, diffs are not supported yet\n"); - ui_menu::stack_pop(machine()); - break; - - case ui_menu_select_rw::WRITE_OTHER: - ui_menu::stack_push(global_alloc_clear<ui_menu_file_create>(machine(), container, image, current_directory, current_file, &create_ok)); - state = CHECK_CREATE; - break; - - case -1: - state = START_FILE; - break; - } - break; - - default: - ui_menu_control_device_image::handle(); - } -} - //=================================================================== // Floppy sound // diff --git a/src/devices/imagedev/floppy.h b/src/devices/imagedev/floppy.h index 32ec1382801..a6c1fe6a244 100644 --- a/src/devices/imagedev/floppy.h +++ b/src/devices/imagedev/floppy.h @@ -19,8 +19,6 @@ #include "formats/td0_dsk.h" #include "formats/cqm_dsk.h" #include "formats/dsk_dsk.h" -#include "ui/menu.h" -#include "ui/imgcntrl.h" #include "sound/samples.h" #define MCFG_FLOPPY_DRIVE_ADD(_tag, _slot_intf, _def_slot, _formats) \ @@ -134,8 +132,6 @@ public: UINT32 get_form_factor() const; UINT32 get_variant() const; - virtual ui_menu *get_selection_menu(running_machine &machine, class render_container *container) override; - static const floppy_format_type default_floppy_formats[]; // Enable sound @@ -207,25 +203,6 @@ protected: floppy_sound_device* m_sound_out; }; -class ui_menu_control_floppy_image : public ui_menu_control_device_image { -public: - ui_menu_control_floppy_image(running_machine &machine, render_container *container, device_image_interface *image); - virtual ~ui_menu_control_floppy_image(); - - virtual void handle() override; - -protected: - enum { SELECT_FORMAT = LAST_ID, SELECT_MEDIA, SELECT_RW }; - - floppy_image_format_t **format_array; - floppy_image_format_t *input_format, *output_format; - std::string input_filename, output_filename; - - void do_load_create(); - virtual void hook_load(std::string filename, bool softlist) override; -}; - - #define DECLARE_FLOPPY_IMAGE_DEVICE(_name, _interface) \ class _name : public floppy_image_device { \ public: \ diff --git a/src/devices/machine/hp_taco.cpp b/src/devices/machine/hp_taco.cpp index d6a1fa27805..bde624733a2 100644 --- a/src/devices/machine/hp_taco.cpp +++ b/src/devices/machine/hp_taco.cpp @@ -139,7 +139,7 @@ // #include "emu.h" #include "hp_taco.h" -#include "ui/ui.h" +#include "ui/uimain.h" // Debugging #define VERBOSE 1 @@ -1688,6 +1688,7 @@ void hp_taco_device::call_unload() void hp_taco_device::call_display() { +/* // Mostly lifted from cassette_image_device::call_display ;) // Do not show anything if image not loaded or tape not moving @@ -1720,6 +1721,7 @@ void hp_taco_device::call_display() y *= device().machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; device().machine().ui().draw_text_box(&device().machine().render().ui_container(), buffer, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); + */ } const char *hp_taco_device::file_extensions() const diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index 8aebfd1d979..2ff355f9c27 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -92,7 +92,7 @@ void debug_console_init(running_machine &machine) return; /* print the opening lines */ - debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), build_version); + debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), emulator_info::get_build_version()); debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description); /* request callback upon exiting */ diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 3208c21b854..394fabdbed4 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -19,7 +19,6 @@ #include "uiinput.h" #include "xmlfile.h" #include "coreutil.h" -#include "luaengine.h" #include <ctype.h> @@ -1927,7 +1926,7 @@ void device_debug::instruction_hook(offs_t curpc) // flush any pending updates before waiting again machine.debug_view().flush_osd_updates(); - machine.manager().lua()->periodic_check(); + emulator_info::periodic_check(); // clear the memory modified flag and wait global->memory_modified = false; diff --git a/src/emu/diimage.cpp b/src/emu/diimage.cpp index fdad11a0536..67d7bbf06f5 100644 --- a/src/emu/diimage.cpp +++ b/src/emu/diimage.cpp @@ -11,12 +11,9 @@ #include "emu.h" #include "emuopts.h" #include "drivenum.h" -#include "ui/ui.h" -#include "ui/menu.h" +#include "ui/uimain.h" #include "zippath.h" -#include "ui/imgcntrl.h" #include "softlist.h" -#include "image.h" #include "formats/ioprocs.h" //************************************************************************** @@ -1352,16 +1349,6 @@ std::string device_image_interface::software_get_default_slot(const char *defaul return result; } -/*------------------------------------------------- - get_selection_menu - create the menu stack - for ui-level image selection --------------------------------------------------*/ - -ui_menu *device_image_interface::get_selection_menu(running_machine &machine, render_container *container) -{ - return global_alloc_clear<ui_menu_control_device_image>(machine, container, this); -} - /* ----------------------------------------------------------------------- */ static int image_fseek_thunk(void *file, INT64 offset, int whence) diff --git a/src/emu/diimage.h b/src/emu/diimage.h index 5300392d57a..08001c8da89 100644 --- a/src/emu/diimage.h +++ b/src/emu/diimage.h @@ -100,7 +100,6 @@ class device_image_interface; struct feature_list; class software_part; class software_info; -class ui_menu; // device image interface function types typedef delegate<int (device_image_interface &)> device_image_load_delegate; @@ -166,8 +165,6 @@ public: virtual const char *file_extensions() const = 0; virtual const option_guide *create_option_guide() const = 0; - virtual ui_menu *get_selection_menu(running_machine &machine, class render_container *container); - const image_device_format *device_get_indexed_creatable_format(int index) { return m_formatlist.find(index); } const image_device_format *device_get_named_creatable_format(const char *format_name); const option_guide *device_get_creation_option_guide() { return create_option_guide(); } diff --git a/src/emu/drivers/empty.cpp b/src/emu/drivers/empty.cpp index 9b075c10308..86ba96bf2dc 100644 --- a/src/emu/drivers/empty.cpp +++ b/src/emu/drivers/empty.cpp @@ -11,9 +11,6 @@ #include "emu.h" #include "emuopts.h" #include "render.h" -#include "ui/selgame.h" -#include "ui/simpleselgame.h" - //************************************************************************** // DRIVER STATE @@ -30,12 +27,7 @@ public: virtual void machine_start() override { - // force the UI to show the game select screen - if (strcmp(machine().options().ui(),"simple")==0) { - ui_simple_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); - } else { - ui_menu_select_game::force_game_select(machine(), &machine().render().ui_container()); - } + emulator_info::display_ui_chooser(machine()); } UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) diff --git a/src/emu/emu.h b/src/emu/emu.h index 1411ecda1db..7a506da1fe9 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -90,8 +90,7 @@ typedef device_t * (*machine_config_constructor)(machine_config &config, device_ #include "devcpu.h" // the running machine -#include "mame.h" -#include "language.h" +#include "main.h" #include "machine.h" #include "driver.h" diff --git a/src/emu/image.cpp b/src/emu/image.cpp index 09cd5c1f379..707c36ba0a5 100644 --- a/src/emu/image.cpp +++ b/src/emu/image.cpp @@ -53,7 +53,7 @@ image_manager::image_manager(running_machine &machine) /* unload all images */ unload_all(); - fatalerror_exitcode(machine, MAMERR_DEVICE, "Device %s load (%s) failed: %s", + fatalerror_exitcode(machine, EMU_ERR_DEVICE, "Device %s load (%s) failed: %s", image.device().name(), image_basename.c_str(), image_err.c_str()); @@ -229,7 +229,7 @@ void image_manager::postdevice_init() /* unload all images */ unload_all(); - fatalerror_exitcode(machine(), MAMERR_DEVICE, "Device %s load failed: %s", + fatalerror_exitcode(machine(), EMU_ERR_DEVICE, "Device %s load failed: %s", image.device().name(), image_err.c_str()); } diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 1e732dd3de3..c7c40b139f2 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -95,7 +95,7 @@ #include "config.h" #include "xmlfile.h" #include "profiler.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "uiinput.h" #include "osdepend.h" @@ -3545,7 +3545,7 @@ void ioport_manager::record_init() header.set_basetime(systime.time); header.set_version(); header.set_sysname(machine().system().name); - header.set_appdesc(util::string_format("%s %s", emulator_info::get_appname(), build_version)); + header.set_appdesc(util::string_format("%s %s", emulator_info::get_appname(), emulator_info::get_build_version())); // write it header.write(m_record_file); diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 16d7b1b214b..5eb1e4f3037 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -74,15 +74,11 @@ #include "config.h" #include "debugger.h" #include "render.h" -#include "cheat.h" #include "uiinput.h" #include "crsshair.h" #include "unzip.h" -#include "ui/datfile.h" -#include "ui/inifile.h" #include "debug/debugvw.h" #include "image.h" -#include "luaengine.h" #include "network.h" #include <time.h> @@ -189,18 +185,6 @@ const char *running_machine::describe_context() return m_context.c_str(); } -TIMER_CALLBACK_MEMBER(running_machine::autoboot_callback) -{ - if (strlen(options().autoboot_script())!=0) { - manager().lua()->load_script(options().autoboot_script()); - } - else if (strlen(options().autoboot_command())!=0) { - std::string cmd = std::string(options().autoboot_command()); - strreplace(cmd, "'", "\\'"); - std::string val = std::string("emu.keypost('").append(cmd).append("')"); - manager().lua()->load_string(val.c_str()); - } -} //------------------------------------------------- // start - initialize the emulated machine @@ -226,11 +210,7 @@ void running_machine::start() // create the video manager m_video = std::make_unique<video_manager>(*this); - m_ui = std::make_unique<ui_manager>(*this); - m_ui->init(); - - // start the inifile manager - m_inifile = std::make_unique<inifile_manager>(*this); + m_ui = manager().create_ui(*this); // initialize the base time (needed for doing record/playback) ::time(&m_base_time); @@ -277,10 +257,6 @@ void running_machine::start() m_render->resolve_tags(); - // call the game driver's init function - // this is where decryption is done and memory maps are altered - // so this location in the init order is important - ui().set_startup_text("Initializing...", true); // register callbacks for the devices, then start them add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(running_machine::reset_all_devices), this)); @@ -298,17 +274,6 @@ void running_machine::start() else if (options().autosave() && (m_system.flags & MACHINE_SUPPORTS_SAVE) != 0) schedule_load("auto"); - // set up the cheat engine - m_cheat = std::make_unique<cheat_manager>(*this); - - // allocate autoboot timer - m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this)); - - // start datfile manager - m_datfile = std::make_unique<datfile_manager>(*this); - - // start favorite manager - m_favorite = std::make_unique<favorite_manager>(*this); manager().update_machine(); } @@ -320,7 +285,7 @@ void running_machine::start() int running_machine::run(bool firstrun) { - int error = MAMERR_NONE; + int error = EMU_ERR_NONE; // use try/catch for deep error recovery try @@ -352,10 +317,8 @@ int running_machine::run(bool firstrun) sound().ui_mute(false); // initialize ui lists - ui().initialize(*this); - // display the startup screens - ui().display_startup_screens(firstrun); + manager().ui_initialize(*this, firstrun); // perform a soft reset -- this takes us to the running phase soft_reset(); @@ -379,7 +342,7 @@ int running_machine::run(bool firstrun) if (!m_paused) { m_scheduler.timeslice(); - manager().lua()->periodic_check(); + emulator_info::periodic_check(); } // otherwise, just pump video updates through else @@ -403,34 +366,34 @@ int running_machine::run(bool firstrun) catch (emu_fatalerror &fatal) { osd_printf_error("Fatal error: %s\n", fatal.string()); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; if (fatal.exitcode() != 0) error = fatal.exitcode(); } catch (emu_exception &) { osd_printf_error("Caught unhandled emulator exception\n"); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; } catch (binding_type_exception &btex) { osd_printf_error("Error performing a late bind of type %s to %s\n", btex.m_actual_type.name(), btex.m_target_type.name()); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; } catch (add_exception &aex) { osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag()); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; } catch (std::exception &ex) { osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what()); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; } catch (...) { osd_printf_error("Caught unhandled exception\n"); - error = MAMERR_FATALERROR; + error = EMU_ERR_FATALERROR; } // make sure our phase is set properly before cleaning up, @@ -919,9 +882,6 @@ void running_machine::soft_reset(void *ptr, INT32 param) // call all registered reset callbacks call_notifiers(MACHINE_NOTIFY_RESET); - // setup autoboot if needed - m_autoboot_timer->adjust(attotime(options().autoboot_delay(),0),0); - // now we're running m_current_phase = MACHINE_PHASE_RUNNING; } diff --git a/src/emu/machine.h b/src/emu/machine.h index 6f18ef60001..45001f406bb 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -82,7 +82,6 @@ const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is e //************************************************************************** // forward declarations -class cheat_manager; class render_manager; class sound_manager; class video_manager; @@ -99,10 +98,7 @@ class image_manager; class rom_load_manager; class debugger_manager; class osd_interface; -class datfile_manager; enum class config_type; -class inifile_manager; -class favorite_manager; struct debugcpu_private; @@ -170,10 +166,6 @@ public: memory_manager &memory() { return m_memory; } ioport_manager &ioport() { return m_ioport; } parameters_manager ¶meters() { return m_parameters; } - cheat_manager &cheat() const { assert(m_cheat != nullptr); return *m_cheat; } - datfile_manager &datfile() const { assert(m_datfile != nullptr); return *m_datfile; } - inifile_manager &inifile() const { assert(m_inifile != nullptr); return *m_inifile; } - favorite_manager &favorite() const { assert(m_favorite != nullptr); return *m_favorite; } render_manager &render() const { assert(m_render != nullptr); return *m_render; } input_manager &input() const { assert(m_input != nullptr); return *m_input; } sound_manager &sound() const { assert(m_sound != nullptr); return *m_sound; } @@ -288,19 +280,16 @@ private: void presave_all_devices(); void postload_all_devices(); - TIMER_CALLBACK_MEMBER(autoboot_callback); - // internal state const machine_config & m_config; // reference to the constructed machine_config const game_driver & m_system; // reference to the definition of the game machine machine_manager & m_manager; // reference to machine manager system // managers - std::unique_ptr<cheat_manager> m_cheat; // internal data from cheat.cpp std::unique_ptr<render_manager> m_render; // internal data from render.cpp std::unique_ptr<input_manager> m_input; // internal data from input.cpp std::unique_ptr<sound_manager> m_sound; // internal data from sound.cpp std::unique_ptr<video_manager> m_video; // internal data from video.cpp - std::unique_ptr<ui_manager> m_ui; // internal data from ui.cpp + ui_manager *m_ui; // internal data from ui.cpp std::unique_ptr<ui_input_manager> m_ui_input; // internal data from uiinput.cpp std::unique_ptr<tilemap_manager> m_tilemap; // internal data from tilemap.cpp std::unique_ptr<debug_view_manager> m_debug_view; // internal data from debugvw.cpp @@ -375,11 +364,6 @@ private: ioport_manager m_ioport; // I/O port manager parameters_manager m_parameters; // parameters manager device_scheduler m_scheduler; // scheduler object - emu_timer *m_autoboot_timer; // autoboot timer - - std::unique_ptr<datfile_manager> m_datfile; // internal data from datfile.c - std::unique_ptr<inifile_manager> m_inifile; // internal data from inifile.c for INIs - std::unique_ptr<favorite_manager> m_favorite; // internal data from inifile.c for favorites // string formatting buffer mutable util::ovectorstream m_string_buffer; diff --git a/src/emu/main.h b/src/emu/main.h new file mode 100644 index 00000000000..5b4d0124fa4 --- /dev/null +++ b/src/emu/main.h @@ -0,0 +1,94 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles +/*************************************************************************** + + main.h + + Controls execution of the core emulator system. +***************************************************************************/ + +#pragma once + +#ifndef __EMU_H__ +#error Dont include this file directly; include emu.h instead. +#endif + +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include <time.h> + +//************************************************************************** +// CONSTANTS +//************************************************************************** + +enum +{ + EMU_ERR_NONE = 0, /* no error */ + EMU_ERR_FAILED_VALIDITY = 1, /* failed validity checks */ + EMU_ERR_MISSING_FILES = 2, /* missing files */ + EMU_ERR_FATALERROR = 3, /* some other fatal error */ + EMU_ERR_DEVICE = 4, /* device initialization error (MESS-specific) */ + EMU_ERR_NO_SUCH_GAME = 5, /* game was specified but doesn't exist */ + EMU_ERR_INVALID_CONFIG = 6, /* some sort of error in configuration */ + EMU_ERR_IDENT_NONROMS = 7, /* identified all non-ROM files */ + EMU_ERR_IDENT_PARTIAL = 8, /* identified some files but not all */ + EMU_ERR_IDENT_NONE = 9 /* identified no files */ +}; + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** +class osd_interface; + +class emulator_info +{ +public: + // construction/destruction + emulator_info() {}; + + static const char * get_appname(); + static const char * get_appname_lower(); + static const char * get_configname(); + static const char * get_copyright(); + static const char * get_copyright_info(); + static const char * get_bare_build_version(); + static const char * get_build_version(); + static void display_ui_chooser(running_machine& machine); + static int start_frontend(emu_options &options, osd_interface &osd, int argc, char *argv[]); + static void draw_user_interface(running_machine& machine); + static void periodic_check(); + static bool frame_hook(); +}; + +// ======================> machine_manager +class ui_manager; + +class machine_manager +{ + DISABLE_COPYING(machine_manager); +protected: + // construction/destruction + machine_manager(emu_options &options, osd_interface &osd) : m_osd(osd), m_options(options), m_machine(nullptr) { } +public: + virtual ~machine_manager() { } + + osd_interface &osd() const { return m_osd; } + emu_options &options() const { return m_options; } + + running_machine *machine() { return m_machine; } + + void set_machine(running_machine *machine) { m_machine = machine; } + + virtual ui_manager* create_ui(running_machine& machine) { return nullptr; } + virtual void ui_initialize(running_machine& machine,bool firstrun) { } + + virtual void update_machine() { } +protected: + osd_interface & m_osd; // reference to OSD system + emu_options & m_options; // reference to options + running_machine * m_machine; +}; + + +#endif /* __MAIN_H__ */ diff --git a/src/emu/mame.h b/src/emu/mame.h deleted file mode 100644 index 737356f2499..00000000000 --- a/src/emu/mame.h +++ /dev/null @@ -1,112 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria, Aaron Giles -/*************************************************************************** - - mame.h - - Controls execution of the core MAME system. -***************************************************************************/ - -#pragma once - -#ifndef __EMU_H__ -#error Dont include this file directly; include emu.h instead. -#endif - -#ifndef __MAME_H__ -#define __MAME_H__ - -#include <time.h> -#include "pluginopts.h" - -class osd_interface; - -//************************************************************************** -// CONSTANTS -//************************************************************************** - -// return values from run_game -enum -{ - MAMERR_NONE = 0, /* no error */ - MAMERR_FAILED_VALIDITY = 1, /* failed validity checks */ - MAMERR_MISSING_FILES = 2, /* missing files */ - MAMERR_FATALERROR = 3, /* some other fatal error */ - MAMERR_DEVICE = 4, /* device initialization error (MESS-specific) */ - MAMERR_NO_SUCH_GAME = 5, /* game was specified but doesn't exist */ - MAMERR_INVALID_CONFIG = 6, /* some sort of error in configuration */ - MAMERR_IDENT_NONROMS = 7, /* identified all non-ROM files */ - MAMERR_IDENT_PARTIAL = 8, /* identified some files but not all */ - MAMERR_IDENT_NONE = 9 /* identified no files */ -}; - - - - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -class emulator_info -{ -public: - // construction/destruction - emulator_info() {}; - - static const char * get_appname(); - static const char * get_appname_lower(); - static const char * get_configname(); - static const char * get_copyright(); - static const char * get_copyright_info(); -}; - -class lua_engine; - -// ======================> machine_manager - -class machine_manager -{ - DISABLE_COPYING(machine_manager); -private: - // construction/destruction - machine_manager(emu_options &options, osd_interface &osd); -public: - static machine_manager *instance(emu_options &options, osd_interface &osd); - static machine_manager *instance(); - ~machine_manager(); - - osd_interface &osd() const; - emu_options &options() const { return m_options; } - plugin_options &plugins() const { return *m_plugins; } - lua_engine *lua() { return m_lua; } - - running_machine *machine() { return m_machine; } - - void set_machine(running_machine *machine) { m_machine = machine; } - - void update_machine(); - - /* execute as configured by the OPTION_SYSTEMNAME option on the specified options */ - int execute(); - void start_luaengine(); - void schedule_new_driver(const game_driver &driver); -private: - osd_interface & m_osd; // reference to OSD system - emu_options & m_options; // reference to options - std::unique_ptr<plugin_options> m_plugins; // pointer to plugin options - lua_engine * m_lua; - - const game_driver * m_new_driver_pending; // pointer to the next pending driver - - running_machine *m_machine; - static machine_manager* m_manager; -}; - -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** - -extern const char build_version[]; -extern const char bare_build_version[]; - -#endif /* __MAME_H__ */ diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 27dab8b7189..304e667b82f 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -45,7 +45,7 @@ #include "config.h" #include "drivenum.h" #include "xmlfile.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include <zlib.h> diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 6b96de7ab24..a7f0d74d826 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -11,7 +11,7 @@ #include "emuopts.h" #include "drivenum.h" #include "softlist.h" -#include "ui/ui.h" +#include "ui/uimain.h" #define LOG_LOAD 0 @@ -487,7 +487,7 @@ void rom_load_manager::display_rom_load_results(bool from_list) { /* create the error message and exit fatally */ osd_printf_error("%s", m_errorstring.c_str()); - fatalerror_exitcode(machine(), MAMERR_MISSING_FILES, "Required files are missing, the machine cannot be run."); + fatalerror_exitcode(machine(), EMU_ERR_MISSING_FILES, "Required files are missing, the machine cannot be run."); } /* if we had warnings, output them, but continue */ diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index b417b675d6b..fa53767854d 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -1301,7 +1301,7 @@ void screen_device::finalize_burnin() char text[256]; // add two text entries describing the image - sprintf(text,"%s %s", emulator_info::get_appname(), build_version); + sprintf(text,"%s %s", emulator_info::get_appname(), emulator_info::get_build_version()); png_add_text(&pnginfo, "Software", text); sprintf(text, "%s %s", machine().system().manufacturer, machine().system().description); png_add_text(&pnginfo, "System", text); diff --git a/src/emu/screen.h b/src/emu/screen.h index 182a1505b16..cf55fcb0ec8 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -157,6 +157,7 @@ typedef device_delegate<void (screen_device &, bool)> screen_vblank_delegate; // ======================> screen_device class screen_device_svg_renderer; +class render_container; class screen_device : public device_t { diff --git a/src/emu/ui/uimain.h b/src/emu/ui/uimain.h new file mode 100644 index 00000000000..23db7aae32c --- /dev/null +++ b/src/emu/ui/uimain.h @@ -0,0 +1,130 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods +/*************************************************************************** + + ui/menu.h + + Internal MAME menus for the user interface. + +***************************************************************************/ + +#pragma once + +#ifndef __BASIC_UI_H__ +#define __BASIC_UI_H__ + +#include "emu.h" +/*************************************************************************** + CONSTANTS +***************************************************************************/ + +// flags for menu items +#define MENU_FLAG_LEFT_ARROW (1 << 0) +#define MENU_FLAG_RIGHT_ARROW (1 << 1) +#define MENU_FLAG_INVERT (1 << 2) +#define MENU_FLAG_MULTILINE (1 << 3) +#define MENU_FLAG_REDTEXT (1 << 4) +#define MENU_FLAG_DISABLE (1 << 5) +#define MENU_FLAG_UI (1 << 6) +#define MENU_FLAG_UI_DATS (1 << 7) +#define MENU_FLAG_UI_SWLIST (1 << 8) +#define MENU_FLAG_UI_FAVORITE (1 << 9) +#define MENU_FLAG_UI_PALETTE (1 << 10) +#define MENU_FLAG_UI_HEADING (1 << 11) + +// special menu item for separators +#define MENU_SEPARATOR_ITEM "---" + + +#define SLIDER_NOCHANGE 0x12345678 + + +typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval); + +struct slider_state +{ + slider_state * next; /* pointer to next slider */ + slider_update update; /* callback */ + void * arg; /* argument */ + INT32 minval; /* minimum value */ + INT32 defval; /* default value */ + INT32 maxval; /* maximum value */ + INT32 incval; /* increment value */ + int id; + char description[1]; /* textual description */ +}; + +// types of menu items (TODO: please expand) +enum class ui_menu_item_type +{ + UNKNOWN, + SLIDER, + SEPARATOR +}; + + + +/*************************************************************************** + TYPE DEFINITIONS +***************************************************************************/ + +class ui_menu_item +{ +public: + const char *text; + const char *subtext; + UINT32 flags; + void *ref; + ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*) + + inline bool is_selectable() const; +}; + +class ui_manager +{ +public: + // construction/destruction + ui_manager(running_machine &machine) : m_machine(machine),m_use_natural_keyboard(false),m_show_timecode_counter(false),m_show_timecode_total(false) { } + + virtual void set_startup_text(const char *text, bool force) { } + + virtual bool is_menu_active() { return false; } + + bool use_natural_keyboard() const { return m_use_natural_keyboard; } + + void set_show_timecode_counter(bool value) { m_show_timecode_counter = value; m_show_timecode_total = true; } + + bool show_timecode_counter() { return m_show_timecode_counter; } + bool show_timecode_total() { return m_show_timecode_total; } + + virtual void popup_time_string(int seconds, std::string message) { } + + virtual void image_display(const device_type &type, device_image_interface *image) { } + + template <typename Format, typename... Params> void popup_time(int seconds, Format &&fmt, Params &&... args); + +protected: + // instance variables + running_machine & m_machine; + bool m_use_natural_keyboard; + bool m_show_timecode_counter; + bool m_show_timecode_total; +}; + +/*************************************************************************** + MEMBER TEMPLATES +***************************************************************************/ + +//------------------------------------------------- +// popup_time - popup a message for a specific +// amount of time +//------------------------------------------------- + +template <typename Format, typename... Params> +inline void ui_manager::popup_time(int seconds, Format &&fmt, Params &&... args) +{ + // extract the text + popup_time_string(seconds, string_format(std::forward<Format>(fmt), std::forward<Params>(args)...)); +} + +#endif // __BASIC_UI_H__ diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 90ffa309ac8..8ff9207f99f 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -12,12 +12,11 @@ #include "emuopts.h" #include "png.h" #include "debugger.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "aviio.h" #include "crsshair.h" #include "rendersw.inc" #include "output.h" -#include "luaengine.h" #include "snap.lh" @@ -223,7 +222,7 @@ void video_manager::frame_update(bool debug) } // draw the user interface - machine().ui().update_and_render(&machine().render().ui_container()); + emulator_info::draw_user_interface(machine()); // if we're throttling, synchronize before rendering attotime current_time = machine().time(); @@ -235,7 +234,7 @@ void video_manager::frame_update(bool debug) machine().osd().update(!debug && skipped_it); g_profiler.stop(); - machine().manager().lua()->periodic_check(); + emulator_info::periodic_check(); // perform tasks for this frame if (!debug) @@ -315,7 +314,7 @@ void video_manager::save_snapshot(screen_device *screen, emu_file &file) create_snapshot_bitmap(screen); // add two text entries describing the image - std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine().system().manufacturer).append(" ").append(machine().system().description); png_info pnginfo = { nullptr }; png_add_text(&pnginfo, "Software", text1.c_str()); @@ -708,7 +707,7 @@ bool video_manager::finish_screen_updates() anything_changed = true; // draw HUD from LUA callback (if any) - anything_changed |= machine().manager().lua()->frame_hook(); + anything_changed |= emulator_info::frame_hook(); // update our movie recording and burn-in state if (!machine().paused()) @@ -1312,7 +1311,7 @@ void video_manager::record_frame() png_info pnginfo = { nullptr }; if (m_mng_frame == 0) { - std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine().system().manufacturer).append(" ").append(machine().system().description); png_add_text(&pnginfo, "Software", text1.c_str()); png_add_text(&pnginfo, "System", text2.c_str()); diff --git a/src/emu/audit.cpp b/src/frontend/mame/audit.cpp index 60781ae7710..60781ae7710 100644 --- a/src/emu/audit.cpp +++ b/src/frontend/mame/audit.cpp diff --git a/src/emu/audit.h b/src/frontend/mame/audit.h index 83421f8cc6e..83421f8cc6e 100644 --- a/src/emu/audit.h +++ b/src/frontend/mame/audit.h diff --git a/src/emu/cheat.cpp b/src/frontend/mame/cheat.cpp index d08abacc462..099e6344d59 100644 --- a/src/emu/cheat.cpp +++ b/src/frontend/mame/cheat.cpp @@ -1228,8 +1228,8 @@ void cheat_manager::render_text(render_container &container) if (!m_output[linenum].empty()) { // output the text - machine().ui().draw_text_full(&container, m_output[linenum].c_str(), - 0.0f, (float)linenum * machine().ui().get_line_height(), 1.0f, + mame_machine_manager::instance()->ui().draw_text_full(&container, m_output[linenum].c_str(), + 0.0f, (float)linenum * mame_machine_manager::instance()->ui().get_line_height(), 1.0f, m_justify[linenum], WRAP_NEVER, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } @@ -1351,7 +1351,7 @@ void cheat_manager::frame_update() { // set up for accumulating output m_lastline = 0; - m_numlines = floor(1.0f / machine().ui().get_line_height()); + m_numlines = floor(1.0f / mame_machine_manager::instance()->ui().get_line_height()); m_numlines = MIN(m_numlines, m_output.size()); for (auto & elem : m_output) elem.clear(); diff --git a/src/emu/cheat.h b/src/frontend/mame/cheat.h index dac90e17286..dac90e17286 100644 --- a/src/emu/cheat.h +++ b/src/frontend/mame/cheat.h diff --git a/src/emu/clifront.cpp b/src/frontend/mame/clifront.cpp index bbb5a800b00..9d81306aa60 100644 --- a/src/emu/clifront.cpp +++ b/src/frontend/mame/clifront.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "mame.h" #include "chd.h" #include "emuopts.h" #include "mameopts.h" @@ -147,7 +148,7 @@ private: cli_frontend::cli_frontend(emu_options &options, osd_interface &osd) : m_options(options), m_osd(osd), - m_result(MAMERR_NONE) + m_result(EMU_ERR_NONE) { m_options.add_entries(cli_option_entries); } @@ -171,8 +172,8 @@ cli_frontend::~cli_frontend() int cli_frontend::execute(int argc, char **argv) { // wrap the core execution in a try/catch to field all fatal errors - m_result = MAMERR_NONE; - machine_manager *manager = machine_manager::instance(m_options, m_osd); + m_result = EMU_ERR_NONE; + mame_machine_manager *manager = mame_machine_manager::instance(m_options, m_osd); try { @@ -190,12 +191,12 @@ int cli_frontend::execute(int argc, char **argv) { const game_driver *system = m_options.system(); if (system == nullptr && *(m_options.system_name()) != 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); machine_config config(*system, m_options); software_list_device_iterator iter(config.root_device()); if (iter.count() == 0) - throw emu_fatalerror(MAMERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name()); + throw emu_fatalerror(EMU_ERR_FATALERROR, "Error: unknown option: %s\n", m_options.software_name()); bool found = false; for (software_list_device &swlistdev : iter) @@ -245,7 +246,7 @@ int cli_frontend::execute(int argc, char **argv) if (!found) { software_list_device::display_matches(config, nullptr, m_options.software_name()); - throw emu_fatalerror(MAMERR_FATALERROR, nullptr); + throw emu_fatalerror(EMU_ERR_FATALERROR, nullptr); } } @@ -254,10 +255,10 @@ int cli_frontend::execute(int argc, char **argv) { // if we failed, check for no command and a system name first; in that case error on the name if (*(m_options.command()) == 0 && m_options.system() == nullptr && *(m_options.system_name()) != 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); // otherwise, error on the options - throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", strtrimspace(option_errors).c_str()); + throw emu_fatalerror(EMU_ERR_INVALID_CONFIG, "%s", strtrimspace(option_errors).c_str()); } if (!option_errors.empty()) osd_printf_error("Error in command line:\n%s\n", strtrimspace(option_errors).c_str()); @@ -285,7 +286,7 @@ int cli_frontend::execute(int argc, char **argv) // if we can't find it, give an appropriate error const game_driver *system = m_options.system(); if (system == nullptr && *(m_options.system_name()) != 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name()); // otherwise just run the game m_result = manager->execute(); @@ -298,11 +299,11 @@ int cli_frontend::execute(int argc, char **argv) std::string str(fatal.string()); strtrimspace(str); osd_printf_error("%s\n", str.c_str()); - m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : MAMERR_FATALERROR; + m_result = (fatal.exitcode() != 0) ? fatal.exitcode() : EMU_ERR_FATALERROR; // if a game was specified, wasn't a wildcard, and our error indicates this was the // reason for failure, offer some suggestions - if (m_result == MAMERR_NO_SUCH_GAME && *(m_options.system_name()) != 0 && strchr(m_options.system_name(), '*') == nullptr && m_options.system() == nullptr) + if (m_result == EMU_ERR_NO_SUCH_GAME && *(m_options.system_name()) != 0 && strchr(m_options.system_name(), '*') == nullptr && m_options.system() == nullptr) { // get the top 16 approximate matches driver_enumerator drivlist(m_options); @@ -320,22 +321,22 @@ int cli_frontend::execute(int argc, char **argv) catch (emu_exception &) { osd_printf_error("Caught unhandled emulator exception\n"); - m_result = MAMERR_FATALERROR; + m_result = EMU_ERR_FATALERROR; } catch (add_exception &aex) { osd_printf_error("Tag '%s' already exists in tagged_list\n", aex.tag()); - m_result = MAMERR_FATALERROR; + m_result = EMU_ERR_FATALERROR; } catch (std::exception &ex) { osd_printf_error("Caught unhandled %s exception: %s\n", typeid(ex).name(), ex.what()); - m_result = MAMERR_FATALERROR; + m_result = EMU_ERR_FATALERROR; } catch (...) { osd_printf_error("Caught unhandled exception\n"); - m_result = MAMERR_FATALERROR; + m_result = EMU_ERR_FATALERROR; } util::archive_file::cache_clear(); @@ -355,7 +356,7 @@ void cli_frontend::listxml(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // create the XML and print it to stdout info_xml_creator creator(drivlist); @@ -373,7 +374,7 @@ void cli_frontend::listfull(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // print the header osd_printf_info("Name: Description:\n"); @@ -395,7 +396,7 @@ void cli_frontend::listsource(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate through drivers and output the info while (drivlist.next()) @@ -429,7 +430,7 @@ void cli_frontend::listclones(const char *gamename) { // see if we match but just weren't a clone if (original_count == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); else osd_printf_info("Found %d matches for '%s' but none were clones\n", drivlist.count(), gamename); return; @@ -460,7 +461,7 @@ void cli_frontend::listbrothers(const char *gamename) // start with a filtered list of drivers; return an error if none found driver_enumerator initial_drivlist(m_options, gamename); if (initial_drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // for the final list, start with an empty driver list driver_enumerator drivlist(m_options); @@ -503,7 +504,7 @@ void cli_frontend::listcrc(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate through matches, and then through ROMs while (drivlist.next()) @@ -531,7 +532,7 @@ void cli_frontend::listroms(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate through matches bool first = true; @@ -592,7 +593,7 @@ void cli_frontend::listsamples(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate over drivers, looking for SAMPLES devices bool first = true; @@ -637,7 +638,7 @@ void cli_frontend::listdevices(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // iterate over drivers, looking for SAMPLES devices bool first = true; @@ -710,7 +711,7 @@ void cli_frontend::listslots(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // print header printf(" SYSTEM SLOT NAME SLOT OPTIONS SLOT DEVICE NAME \n"); @@ -770,7 +771,7 @@ void cli_frontend::listmedia(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // print header printf(" SYSTEM MEDIA NAME (brief) IMAGE FILE EXTENSIONS SUPPORTED \n"); @@ -1069,22 +1070,22 @@ void cli_frontend::verifyroms(const char *gamename) // return an error if none found if (matched == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // if we didn't get anything at all, display a generic end message if (matched > 0 && correct == 0 && incorrect == 0) { if (notfound > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "romset \"%s\" not found!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "romset \"%s\" not found!\n", gamename); else - throw emu_fatalerror(MAMERR_MISSING_FILES, "romset \"%s\" has no roms!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "romset \"%s\" has no roms!\n", gamename); } // otherwise, print a summary else { if (incorrect > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "%d romsets found, %d were OK.\n", correct + incorrect, correct); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "%d romsets found, %d were OK.\n", correct + incorrect, correct); osd_printf_info("%d romsets found, %d were OK.\n", correct, correct); } } @@ -1161,22 +1162,22 @@ void cli_frontend::verifysamples(const char *gamename) // return an error if none found if (matched == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // if we didn't get anything at all, display a generic end message if (matched > 0 && correct == 0 && incorrect == 0) { if (notfound > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "sampleset \"%s\" not found!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "sampleset \"%s\" not found!\n", gamename); else - throw emu_fatalerror(MAMERR_MISSING_FILES, "sampleset \"%s\" not required!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "sampleset \"%s\" not required!\n", gamename); } // otherwise, print a summary else { if (incorrect > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "%d samplesets found, %d were OK.\n", correct + incorrect, correct); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "%d samplesets found, %d were OK.\n", correct + incorrect, correct); osd_printf_info("%d samplesets found, %d were OK.\n", correct, correct); } } @@ -1371,7 +1372,7 @@ void cli_frontend::listsoftware(const char *gamename) // determine which drivers to output; return an error if none found driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); while (drivlist.next()) { @@ -1409,7 +1410,7 @@ void cli_frontend::verifysoftware(const char *gamename) driver_enumerator drivlist(m_options, gamename); if (drivlist.count() == 0) { - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); } media_auditor auditor(drivlist); @@ -1474,18 +1475,18 @@ void cli_frontend::verifysoftware(const char *gamename) // return an error if none found if (matched == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching games found for '%s'", gamename); // if we didn't get anything at all, display a generic end message if (matched > 0 && correct == 0 && incorrect == 0) { - throw emu_fatalerror(MAMERR_MISSING_FILES, "romset \"%s\" has no software entries defined!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "romset \"%s\" has no software entries defined!\n", gamename); } // otherwise, print a summary else { if (incorrect > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, nrlists, correct); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, nrlists, correct); osd_printf_info("%d romsets found in %d software lists, %d romsets were OK.\n", correct, nrlists, correct); } @@ -1594,18 +1595,18 @@ void cli_frontend::verifysoftlist(const char *gamename) // return an error if none found if (matched == 0) - throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "No matching software lists found for '%s'", gamename); + throw emu_fatalerror(EMU_ERR_NO_SUCH_GAME, "No matching software lists found for '%s'", gamename); // if we didn't get anything at all, display a generic end message if (matched > 0 && correct == 0 && incorrect == 0) { - throw emu_fatalerror(MAMERR_MISSING_FILES, "no romsets found for software list \"%s\"!\n", gamename); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "no romsets found for software list \"%s\"!\n", gamename); } // otherwise, print a summary else { if (incorrect > 0) - throw emu_fatalerror(MAMERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, matched, correct); + throw emu_fatalerror(EMU_ERR_MISSING_FILES, "%d romsets found in %d software lists, %d were OK.\n", correct + incorrect, matched, correct); osd_printf_info("%d romsets found in %d software lists, %d romsets were OK.\n", correct, matched, correct); } } @@ -1627,11 +1628,11 @@ void cli_frontend::romident(const char *filename) if (ident.matches() == ident.total()) return; else if (ident.matches() == ident.total() - ident.nonroms()) - throw emu_fatalerror(MAMERR_IDENT_NONROMS, "Out of %d files, %d matched, %d are not roms.\n",ident.total(),ident.matches(),ident.nonroms()); + throw emu_fatalerror(EMU_ERR_IDENT_NONROMS, "Out of %d files, %d matched, %d are not roms.\n",ident.total(),ident.matches(),ident.nonroms()); else if (ident.matches() > 0) - throw emu_fatalerror(MAMERR_IDENT_PARTIAL, "Out of %d files, %d matched, %d did not match.\n",ident.total(),ident.matches(),ident.total()-ident.matches()); + throw emu_fatalerror(EMU_ERR_IDENT_PARTIAL, "Out of %d files, %d matched, %d did not match.\n",ident.total(),ident.matches(),ident.total()-ident.matches()); else - throw emu_fatalerror(MAMERR_IDENT_NONE, "No roms matched.\n"); + throw emu_fatalerror(EMU_ERR_IDENT_NONE, "No roms matched.\n"); } @@ -1665,7 +1666,7 @@ void cli_frontend::execute_commands(const char *exename) const char *sysname = m_options.system_name(); bool result = valid.check_all_matching((sysname[0] == 0) ? "*" : sysname); if (!result) - throw emu_fatalerror(MAMERR_FAILED_VALIDITY, "Validity check failed (%d errors, %d warnings in total)\n", valid.errors(), valid.warnings()); + throw emu_fatalerror(EMU_ERR_FAILED_VALIDITY, "Validity check failed (%d errors, %d warnings in total)\n", valid.errors(), valid.warnings()); return; } @@ -1758,7 +1759,7 @@ void cli_frontend::execute_commands(const char *exename) if (!m_osd.execute_command(m_options.command())) // if we get here, we don't know what has been requested - throw emu_fatalerror(MAMERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command()); + throw emu_fatalerror(EMU_ERR_INVALID_CONFIG, "Unknown command '%s' specified", m_options.command()); } diff --git a/src/emu/clifront.h b/src/frontend/mame/clifront.h index 2a7da7fcb78..2a7da7fcb78 100644 --- a/src/emu/clifront.h +++ b/src/frontend/mame/clifront.h diff --git a/src/emu/info.cpp b/src/frontend/mame/info.cpp index 37d0b3f892b..ee77890d63b 100644 --- a/src/emu/info.cpp +++ b/src/frontend/mame/info.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "mameopts.h" #include "machine/ram.h" diff --git a/src/emu/info.h b/src/frontend/mame/info.h index 78082ec033b..78082ec033b 100644 --- a/src/emu/info.h +++ b/src/frontend/mame/info.h diff --git a/src/emu/language.cpp b/src/frontend/mame/language.cpp index 5c9686a646e..5c9686a646e 100644 --- a/src/emu/language.cpp +++ b/src/frontend/mame/language.cpp diff --git a/src/emu/language.h b/src/frontend/mame/language.h index 2a9d934576b..2a9d934576b 100644 --- a/src/emu/language.h +++ b/src/frontend/mame/language.h diff --git a/src/emu/luaengine.cpp b/src/frontend/mame/luaengine.cpp index f452684f997..b8d8644218a 100644 --- a/src/emu/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -14,6 +14,7 @@ #include "luabridge/Source/LuaBridge/LuaBridge.h" #include <signal.h> #include "emu.h" +#include "mame.h" #include "cheat.h" #include "drivenum.h" #include "emuopts.h" @@ -1427,8 +1428,7 @@ int lua_engine::lua_screen::l_draw_box(lua_State *L) // draw the box render_container &rc = sc->container(); - ui_manager &ui = sc->machine().ui(); - ui.draw_outlined_box(&rc, x1, y1, x2, y2, fgcolor, bgcolor); + mame_machine_manager::instance()->ui().draw_outlined_box(&rc, x1, y1, x2, y2, fgcolor, bgcolor); return 0; } @@ -1513,11 +1513,9 @@ int lua_engine::lua_screen::l_draw_text(lua_State *L) // draw the text render_container &rc = sc->container(); - ui_manager &ui = sc->machine().ui(); - ui.draw_text_full(&rc, msg, x, y, (1.0f - x), + mame_machine_manager::instance()->ui().draw_text_full(&rc, msg, x, y, (1.0f - x), justify, WRAP_WORD, DRAW_NORMAL, textcolor, UI_TEXT_BG_COLOR, nullptr, nullptr); - return 0; } @@ -1580,7 +1578,7 @@ int lua_engine::l_emu_start(lua_State *L) int index = driver_list::find(system_name); if (index != -1) { - machine_manager::instance()->schedule_new_driver(driver_list::driver(index)); + mame_machine_manager::instance()->schedule_new_driver(driver_list::driver(index)); luaThis->machine().schedule_hard_reset(); } return 1; @@ -2171,10 +2169,10 @@ void lua_engine::initialize() .addCFunction ("print_error", l_osd_printf_error ) .addCFunction ("print_info", l_osd_printf_info ) .addCFunction ("print_debug", l_osd_printf_debug ) - .beginClass <machine_manager> ("manager") + .beginClass <mame_machine_manager> ("manager") .addFunction ("machine", &machine_manager::machine) .addFunction ("options", &machine_manager::options) - .addFunction ("plugins", &machine_manager::plugins) + .addFunction ("plugins", &mame_machine_manager::plugins) .endClass () .beginClass <lua_machine> ("lua_machine") .addCFunction ("popmessage", &lua_machine::l_popmessage) @@ -2192,7 +2190,7 @@ void lua_engine::initialize() .addFunction ("render", &running_machine::render) .addFunction ("ioport", &running_machine::ioport) .addFunction ("parameters", &running_machine::parameters) - .addFunction ("cheat", &running_machine::cheat) + .addFunction ("cheat", &mame_machine_manager::cheat) .addFunction ("memory", &running_machine::memory) .addFunction ("options", &running_machine::options) .addFunction ("outputs", &running_machine::output) @@ -2400,13 +2398,13 @@ void lua_engine::initialize() .addFunction ("ui_container", &render_manager::ui_container) .addProperty <luabridge::LuaRef, void> ("targets", &lua_engine::l_render_get_targets) .endClass() - .beginClass <ui_manager> ("ui") - .addFunction ("is_menu_active", &ui_manager::is_menu_active) - .addFunction ("options", &ui_manager::options) - .addProperty <bool, bool> ("show_fps", &ui_manager::show_fps, &ui_manager::set_show_fps) - .addProperty <bool, bool> ("show_profiler", &ui_manager::show_profiler, &ui_manager::set_show_profiler) - .addProperty <bool, bool> ("single_step", &ui_manager::single_step, &ui_manager::set_single_step) - .addFunction ("get_line_height", &ui_manager::get_line_height) + .beginClass <mame_ui_manager> ("ui") + .addFunction ("is_menu_active", &mame_ui_manager::is_menu_active) + .addFunction ("options", &mame_ui_manager::options) + .addProperty <bool, bool> ("show_fps", &mame_ui_manager::show_fps, &mame_ui_manager::set_show_fps) + .addProperty <bool, bool> ("show_profiler", &mame_ui_manager::show_profiler, &mame_ui_manager::set_show_profiler) + .addProperty <bool, bool> ("single_step", &mame_ui_manager::single_step, &mame_ui_manager::set_single_step) + .addFunction ("get_line_height", &mame_ui_manager::get_line_height) .endClass() .beginClass <lua_screen> ("lua_screen_dev") .addCFunction ("draw_box", &lua_screen::l_draw_box) @@ -2503,7 +2501,7 @@ void lua_engine::initialize() .endClass() .endNamespace(); - luabridge::push (m_lua_state, machine_manager::instance()); + luabridge::push (m_lua_state, mame_machine_manager::instance()); lua_setglobal(m_lua_state, "manager"); } diff --git a/src/emu/luaengine.h b/src/frontend/mame/luaengine.h index 0f18cb995b1..0f18cb995b1 100644 --- a/src/emu/luaengine.h +++ b/src/frontend/mame/luaengine.h diff --git a/src/emu/mame.cpp b/src/frontend/mame/mame.cpp index d5eacf786b5..2be1ea0f615 100644 --- a/src/emu/mame.cpp +++ b/src/frontend/mame/mame.cpp @@ -71,59 +71,58 @@ ***************************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "mameopts.h" #include "osdepend.h" #include "validity.h" +#include "clifront.h" #include "luaengine.h" #include <time.h> +#include "ui/selgame.h" +#include "ui/simpleselgame.h" +#include "cheat.h" +#include "ui/datfile.h" +#include "ui/inifile.h" //************************************************************************** // MACHINE MANAGER //************************************************************************** -machine_manager* machine_manager::m_manager = nullptr; +mame_machine_manager* mame_machine_manager::m_manager = nullptr; -osd_interface &machine_manager::osd() const -{ - return m_osd; -} - - -machine_manager* machine_manager::instance(emu_options &options,osd_interface &osd) +mame_machine_manager* mame_machine_manager::instance(emu_options &options,osd_interface &osd) { if(!m_manager) { - m_manager = global_alloc(machine_manager(options,osd)); + m_manager = global_alloc(mame_machine_manager(options,osd)); } return m_manager; } -machine_manager* machine_manager::instance() +mame_machine_manager* mame_machine_manager::instance() { return m_manager; } //------------------------------------------------- -// machine_manager - constructor +// mame_machine_manager - constructor //------------------------------------------------- -machine_manager::machine_manager(emu_options &options,osd_interface &osd) - : m_osd(osd), - m_options(options), +mame_machine_manager::mame_machine_manager(emu_options &options,osd_interface &osd) + : machine_manager(options, osd), m_plugins(std::make_unique<plugin_options>()), m_lua(global_alloc(lua_engine)), - m_new_driver_pending(nullptr), - m_machine(nullptr) + m_new_driver_pending(nullptr) { } //------------------------------------------------- -// ~machine_manager - destructor +// ~mame_machine_manager - destructor //------------------------------------------------- -machine_manager::~machine_manager() +mame_machine_manager::~mame_machine_manager() { global_free(m_lua); m_manager = nullptr; @@ -139,7 +138,7 @@ machine_manager::~machine_manager() // be loaded //------------------------------------------------- -void machine_manager::schedule_new_driver(const game_driver &driver) +void mame_machine_manager::schedule_new_driver(const game_driver &driver) { m_new_driver_pending = &driver; } @@ -148,7 +147,7 @@ void machine_manager::schedule_new_driver(const game_driver &driver) /*************************************************************************** CORE IMPLEMENTATION ***************************************************************************/ -void machine_manager::update_machine() +void mame_machine_manager::update_machine() { m_lua->set_machine(m_machine); m_lua->attach_notifiers(); @@ -169,7 +168,7 @@ std::vector<std::string> split(const std::string &text, char sep) return tokens; } -void machine_manager::start_luaengine() +void mame_machine_manager::start_luaengine() { if (options().plugins()) { @@ -226,7 +225,7 @@ void machine_manager::start_luaengine() execute - run the core emulation -------------------------------------------------*/ -int machine_manager::execute() +int mame_machine_manager::execute() { bool started_empty = false; @@ -235,12 +234,12 @@ int machine_manager::execute() // loop across multiple hard resets bool exit_pending = false; - int error = MAMERR_NONE; + int error = EMU_ERR_NONE; if (m_options.console()) { m_lua->start_console(); } - while (error == MAMERR_NONE && !exit_pending) + while (error == EMU_ERR_NONE && !exit_pending) { m_new_driver_pending = nullptr; @@ -304,3 +303,91 @@ int machine_manager::execute() // return an error return error; } + +TIMER_CALLBACK_MEMBER(mame_machine_manager::autoboot_callback) +{ + if (strlen(options().autoboot_script())!=0) { + mame_machine_manager::instance()->lua()->load_script(options().autoboot_script()); + } + else if (strlen(options().autoboot_command())!=0) { + std::string cmd = std::string(options().autoboot_command()); + strreplace(cmd, "'", "\\'"); + std::string val = std::string("emu.keypost('").append(cmd).append("')"); + mame_machine_manager::instance()->lua()->load_string(val.c_str()); + } +} + +void mame_machine_manager::reset() +{ + // setup autoboot if needed + m_autoboot_timer->adjust(attotime(options().autoboot_delay(),0),0); +} + +ui_manager* mame_machine_manager::create_ui(running_machine& machine) +{ + m_ui = std::make_unique<mame_ui_manager>(machine); + m_ui->init(); + + machine.add_notifier(MACHINE_NOTIFY_RESET, machine_notify_delegate(FUNC(mame_machine_manager::reset), this)); + + // start the inifile manager + m_inifile = std::make_unique<inifile_manager>(machine); + + m_ui->set_startup_text("Initializing...", true); + // set up the cheat engine + m_cheat = std::make_unique<cheat_manager>(machine); + + // allocate autoboot timer + m_autoboot_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mame_machine_manager::autoboot_callback), this)); + + // start datfile manager + m_datfile = std::make_unique<datfile_manager>(machine); + + // start favorite manager + m_favorite = std::make_unique<favorite_manager>(machine); + + return m_ui.get(); +} + +void mame_machine_manager::ui_initialize(running_machine& machine,bool firstrun) +{ + m_ui->initialize(machine); + + // display the startup screens + m_ui->display_startup_screens(firstrun); +} + +const char * emulator_info::get_bare_build_version() { return bare_build_version; } +const char * emulator_info::get_build_version() { return build_version; } + +void emulator_info::display_ui_chooser(running_machine& machine) +{ + // force the UI to show the game select screen + if (strcmp(machine.options().ui(), "simple") == 0) { + ui_simple_menu_select_game::force_game_select(machine, &machine.render().ui_container()); + } + else { + ui_menu_select_game::force_game_select(machine, &machine.render().ui_container()); + } +} + +int emulator_info::start_frontend(emu_options &options, osd_interface &osd, int argc, char *argv[]) +{ + cli_frontend frontend(options, osd); + return frontend.execute(argc, argv); +} + +void emulator_info::draw_user_interface(running_machine& machine) +{ + mame_machine_manager::instance()->ui().update_and_render(&machine.render().ui_container()); +} + +void emulator_info::periodic_check() +{ + mame_machine_manager::instance()->lua()->periodic_check(); +} + +bool emulator_info::frame_hook() +{ + return mame_machine_manager::instance()->lua()->frame_hook(); +}
\ No newline at end of file diff --git a/src/frontend/mame/mame.h b/src/frontend/mame/mame.h new file mode 100644 index 00000000000..33ce991e685 --- /dev/null +++ b/src/frontend/mame/mame.h @@ -0,0 +1,92 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles +/*************************************************************************** + + mame.h + + Controls execution of the core MAME system. +***************************************************************************/ + +#pragma once + +#ifndef __EMU_H__ +#error Dont include this file directly; include emu.h instead. +#endif + +#ifndef __MAME_H__ +#define __MAME_H__ + +#include "emu.h" +#include <time.h> +#include "pluginopts.h" +#include "ui/ui.h" + +class osd_interface; + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** +class lua_engine; +class cheat_manager; +class datfile_manager; +class inifile_manager; +class favorite_manager; +class mame_ui_manager; + +// ======================> machine_manager + +class mame_machine_manager : machine_manager +{ + DISABLE_COPYING(mame_machine_manager); +private: + // construction/destruction + mame_machine_manager(emu_options &options, osd_interface &osd); +public: + static mame_machine_manager *instance(emu_options &options, osd_interface &osd); + static mame_machine_manager *instance(); + ~mame_machine_manager(); + + plugin_options &plugins() const { return *m_plugins; } + lua_engine *lua() { return m_lua; } + + virtual void update_machine() override; + + void reset(); + TIMER_CALLBACK_MEMBER(autoboot_callback); + + virtual ui_manager* create_ui(running_machine& machine) override; + virtual void ui_initialize(running_machine& machine,bool firstrun) override; + + /* execute as configured by the OPTION_SYSTEMNAME option on the specified options */ + int execute(); + void start_luaengine(); + void schedule_new_driver(const game_driver &driver); + mame_ui_manager& ui() const { assert(m_ui != nullptr); return *m_ui; } + cheat_manager &cheat() const { assert(m_cheat != nullptr); return *m_cheat; } + datfile_manager &datfile() const { assert(m_datfile != nullptr); return *m_datfile; } + inifile_manager &inifile() const { assert(m_inifile != nullptr); return *m_inifile; } + favorite_manager &favorite() const { assert(m_favorite != nullptr); return *m_favorite; } +private: + std::unique_ptr<plugin_options> m_plugins; // pointer to plugin options + lua_engine * m_lua; + + const game_driver * m_new_driver_pending; // pointer to the next pending driver + + static mame_machine_manager* m_manager; + emu_timer *m_autoboot_timer; // autoboot timer + std::unique_ptr<mame_ui_manager> m_ui; // internal data from ui.cpp + std::unique_ptr<cheat_manager> m_cheat; // internal data from cheat.cpp + std::unique_ptr<datfile_manager> m_datfile; // internal data from datfile.c + std::unique_ptr<inifile_manager> m_inifile; // internal data from inifile.c for INIs + std::unique_ptr<favorite_manager> m_favorite; // internal data from inifile.c for favorites + +}; + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +extern const char build_version[]; +extern const char bare_build_version[]; + +#endif /* __MAME_H__ */ diff --git a/src/emu/mameopts.cpp b/src/frontend/mame/mameopts.cpp index a0754f4cfd5..a0754f4cfd5 100644 --- a/src/emu/mameopts.cpp +++ b/src/frontend/mame/mameopts.cpp diff --git a/src/emu/mameopts.h b/src/frontend/mame/mameopts.h index 50b1ae5b776..50b1ae5b776 100644 --- a/src/emu/mameopts.h +++ b/src/frontend/mame/mameopts.h diff --git a/src/emu/pluginopts.cpp b/src/frontend/mame/pluginopts.cpp index 90b4b138cab..90b4b138cab 100644 --- a/src/emu/pluginopts.cpp +++ b/src/frontend/mame/pluginopts.cpp diff --git a/src/emu/pluginopts.h b/src/frontend/mame/pluginopts.h index 91aa68c2208..91aa68c2208 100644 --- a/src/emu/pluginopts.h +++ b/src/frontend/mame/pluginopts.h diff --git a/src/emu/ui/auditmenu.cpp b/src/frontend/mame/ui/auditmenu.cpp index 70aa5e2f258..3c1ddace6cf 100644 --- a/src/emu/ui/auditmenu.cpp +++ b/src/frontend/mame/ui/auditmenu.cpp @@ -111,7 +111,7 @@ void ui_menu_audit::handle() if (m_first) { - machine().ui().draw_text_box(container, _("Audit in progress..."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); + mame_machine_manager::instance()->ui().draw_text_box(container, _("Audit in progress..."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_GREEN_COLOR); m_first = false; return; } @@ -176,12 +176,12 @@ void ui_menu_audit::populate() void ui_menu_audit::save_available_machines() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(emulator_info::get_configname(), "_avail.ini") == osd_file::error::NONE) { // generate header std::ostringstream buffer; - buffer << "#\n" << UI_VERSION_TAG << bare_build_version << "\n#\n\n"; + buffer << "#\n" << UI_VERSION_TAG << emulator_info::get_bare_build_version() << "\n#\n\n"; util::stream_format(buffer, "%d\n", m_availablesorted.size()); util::stream_format(buffer, "%d\n", m_unavailablesorted.size()); diff --git a/src/emu/ui/auditmenu.h b/src/frontend/mame/ui/auditmenu.h index b63bbb6507b..b63bbb6507b 100644 --- a/src/emu/ui/auditmenu.h +++ b/src/frontend/mame/ui/auditmenu.h diff --git a/src/emu/ui/barcode.cpp b/src/frontend/mame/ui/barcode.cpp index 6478e7db3fc..10dec5bde11 100644 --- a/src/emu/ui/barcode.cpp +++ b/src/frontend/mame/ui/barcode.cpp @@ -75,7 +75,7 @@ void ui_menu_barcode_reader::populate() item_append(ui_menu_item_type::SEPARATOR); item_append(_("Enter Code"), nullptr, 0, ITEMREF_ENTER_BARCODE); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } } @@ -115,7 +115,7 @@ void ui_menu_barcode_reader::handle() std::string tmp_file(m_barcode_buffer); //printf("code %s\n", m_barcode_buffer); if (!current_device()->is_valid(tmp_file.length())) - machine().ui().popup_time(5, "%s", _("Barcode length invalid!")); + mame_machine_manager::instance()->ui().popup_time(5, "%s", _("Barcode length invalid!")); else { current_device()->write_code(tmp_file.c_str(), tmp_file.length()); diff --git a/src/emu/ui/barcode.h b/src/frontend/mame/ui/barcode.h index 5a3dbff634e..5a3dbff634e 100644 --- a/src/emu/ui/barcode.h +++ b/src/frontend/mame/ui/barcode.h diff --git a/src/emu/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp index 55d3d20f6d1..8d84c06d759 100644 --- a/src/emu/ui/cheatopt.cpp +++ b/src/frontend/mame/ui/cheatopt.cpp @@ -36,7 +36,7 @@ void ui_menu_cheat::handle() /* handle reset all + reset all cheats for reload all option */ if ((menu_event->itemref == ITEMREF_CHEATS_RESET_ALL || menu_event->itemref == ITEMREF_CHEATS_RELOAD_ALL) && menu_event->iptkey == IPT_UI_SELECT) { - for (cheat_entry &curcheat : machine().cheat().entries()) + for (cheat_entry &curcheat : mame_machine_manager::instance()->cheat().entries()) if (curcheat.select_default_state()) changed = true; } @@ -83,7 +83,7 @@ void ui_menu_cheat::handle() if (menu_event->itemref == ITEMREF_CHEATS_RELOAD_ALL && menu_event->iptkey == IPT_UI_SELECT) { /* re-init cheat engine and thus reload cheats/cheats have already been turned off by here */ - machine().cheat().reload(); + mame_machine_manager::instance()->cheat().reload(); /* display the reloaded cheats */ reset(UI_MENU_RESET_REMEMBER_REF); @@ -124,8 +124,8 @@ void ui_menu_cheat::populate() item_append(ui_menu_item_type::SEPARATOR); // add other cheats - if (!machine().cheat().entries().empty()) { - for (cheat_entry &curcheat : machine().cheat().entries()) + if (!mame_machine_manager::instance()->cheat().entries().empty()) { + for (cheat_entry &curcheat : mame_machine_manager::instance()->cheat().entries()) { UINT32 flags; curcheat.menu_text(text, subtext, flags); diff --git a/src/emu/ui/cheatopt.h b/src/frontend/mame/ui/cheatopt.h index a9321df7304..a9321df7304 100644 --- a/src/emu/ui/cheatopt.h +++ b/src/frontend/mame/ui/cheatopt.h diff --git a/src/emu/ui/custmenu.cpp b/src/frontend/mame/ui/custmenu.cpp index 25ffdff8bde..e1d6ed470ca 100644 --- a/src/emu/ui/custmenu.cpp +++ b/src/frontend/mame/ui/custmenu.cpp @@ -196,7 +196,7 @@ void ui_menu_custom_filter::populate() item_append(_("Add filter"), nullptr, 0, (void *)(FPTR)ADD_FILTER); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -205,7 +205,7 @@ void ui_menu_custom_filter::populate() void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // get the size of the text mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, @@ -239,7 +239,7 @@ void ui_menu_custom_filter::custom_render(void *selectedref, float top, float bo void ui_menu_custom_filter::save_custom_filters() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == osd_file::error::NONE) { // generate custom filters info @@ -512,7 +512,7 @@ void ui_menu_swcustom_filter::populate() item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -521,7 +521,7 @@ void ui_menu_swcustom_filter::populate() void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // get the size of the text mui.draw_text_full(container, _("Select custom filters:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_NEVER, @@ -555,7 +555,7 @@ void ui_menu_swcustom_filter::custom_render(void *selectedref, float top, float void ui_menu_swcustom_filter::save_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open("custom_", m_driver->name, "_filter.ini") == osd_file::error::NONE) { // generate custom filters info diff --git a/src/emu/ui/custmenu.h b/src/frontend/mame/ui/custmenu.h index 338344dcddd..338344dcddd 100644 --- a/src/emu/ui/custmenu.h +++ b/src/frontend/mame/ui/custmenu.h diff --git a/src/emu/ui/custui.cpp b/src/frontend/mame/ui/custui.cpp index 42ef567ce02..eb0e755d240 100644 --- a/src/emu/ui/custui.cpp +++ b/src/frontend/mame/ui/custui.cpp @@ -54,7 +54,7 @@ ui_menu_custom_ui::ui_menu_custom_ui(running_machine &machine, render_container ui_menu_custom_ui::~ui_menu_custom_ui() { std::string error_string; - machine().ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); + mame_machine_manager::instance()->ui().options().set_value(OPTION_HIDE_PANELS, ui_globals::panels_status, OPTION_PRIORITY_CMDLINE, error_string); if (!m_lang.empty()) { machine().options().set_value(OPTION_LANGUAGE, m_lang[m_currlang].c_str(), OPTION_PRIORITY_CMDLINE, error_string); @@ -150,7 +150,7 @@ void ui_menu_custom_ui::populate() item_append(_("Show side panels"), _(hide_status[ui_globals::panels_status]), arrow_flags, (void *)(FPTR)HIDE_MENU); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -160,7 +160,7 @@ void ui_menu_custom_ui::populate() void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Custom UI Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); @@ -192,7 +192,7 @@ void ui_menu_custom_ui::custom_render(void *selectedref, float top, float bottom ui_menu_font_ui::ui_menu_font_ui(running_machine &machine, render_container *container) : ui_menu(machine, container) { - ui_options &moptions = machine.ui().options(); + ui_options &moptions = mame_machine_manager::instance()->ui().options(); std::string name(machine.options().ui_font()); list(); @@ -250,7 +250,7 @@ void ui_menu_font_ui::list() ui_menu_font_ui::~ui_menu_font_ui() { std::string error_string; - ui_options &moptions = machine().ui().options(); + ui_options &moptions = mame_machine_manager::instance()->ui().options(); std::string name(m_fonts[m_actual].first); #ifdef UI_WINDOWS @@ -364,7 +364,7 @@ void ui_menu_font_ui::populate() item_append(ui_menu_item_type::SEPARATOR); - custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -374,7 +374,7 @@ void ui_menu_font_ui::populate() void ui_menu_font_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // top text std::string topbuf(_("UI Fonts Settings")); @@ -466,7 +466,7 @@ ui_menu_colors_ui::~ui_menu_colors_ui() for (int index = 1; index < MUI_RESTORE; index++) { dec_color = string_format("%x", (UINT32)m_color_table[index].color); - machine().ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + mame_machine_manager::instance()->ui().options().set_value(m_color_table[index].option, dec_color.c_str(), OPTION_PRIORITY_CMDLINE, error_string); } } @@ -522,7 +522,7 @@ void ui_menu_colors_ui::populate() item_append(ui_menu_item_type::SEPARATOR); item_append(_("Restore originals colors"), nullptr, 0, (void *)(FPTR)MUI_RESTORE); - custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -532,7 +532,7 @@ void ui_menu_colors_ui::populate() void ui_menu_colors_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width, maxwidth = origx2 - origx1; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); // top text @@ -866,7 +866,7 @@ void ui_menu_rgb_ui::populate() item_append(_("Choose from palette"), nullptr, 0, (void *)(FPTR)PALETTE_CHOOSE); item_append(ui_menu_item_type::SEPARATOR); - custombottom = customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -876,7 +876,7 @@ void ui_menu_rgb_ui::populate() void ui_menu_rgb_ui::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width, maxwidth = origx2 - origx1; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // top text std::string topbuf = std::string(m_title).append(_(" - ARGB Settings")); diff --git a/src/emu/ui/custui.h b/src/frontend/mame/ui/custui.h index 0aeffca9c5b..0aeffca9c5b 100644 --- a/src/emu/ui/custui.h +++ b/src/frontend/mame/ui/custui.h diff --git a/src/emu/ui/datfile.cpp b/src/frontend/mame/ui/datfile.cpp index 41df0a40d9b..1e2ca1d6938 100644 --- a/src/emu/ui/datfile.cpp +++ b/src/frontend/mame/ui/datfile.cpp @@ -60,7 +60,7 @@ bool datfile_manager::first_run = true; //------------------------------------------------- datfile_manager::datfile_manager(running_machine &machine) : m_machine(machine) { - if (machine.ui().options().enabled_dats() && first_run) + if (mame_machine_manager::instance()->ui().options().enabled_dats() && first_run) { first_run = false; if (parseopen("mameinfo.dat")) @@ -577,7 +577,7 @@ bool datfile_manager::parseopen(const char *filename) // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, // so it's better and faster use standard C fileio functions. - emu_file file(machine().ui().options().history_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().history_path(), OPEN_FLAG_READ); if (file.open(filename) != osd_file::error::NONE) return false; diff --git a/src/emu/ui/datfile.h b/src/frontend/mame/ui/datfile.h index 27bb8094704..27bb8094704 100644 --- a/src/emu/ui/datfile.h +++ b/src/frontend/mame/ui/datfile.h diff --git a/src/emu/ui/datmenu.cpp b/src/frontend/mame/ui/datmenu.cpp index 9da52bfa0f2..7e90e11178d 100644 --- a/src/emu/ui/datmenu.cpp +++ b/src/frontend/mame/ui/datmenu.cpp @@ -59,8 +59,8 @@ ui_menu_dats_view::ui_menu_dats_view(running_machine &machine, render_container , m_issoft(true) { - if (machine.datfile().has_software(m_list, m_short, m_parent)) - m_items_list.emplace_back(_("Software History"), UI_HISTORY_LOAD, machine.datfile().rev_history()); + if (mame_machine_manager::instance()->datfile().has_software(m_list, m_short, m_parent)) + m_items_list.emplace_back(_("Software History"), UI_HISTORY_LOAD, mame_machine_manager::instance()->datfile().rev_history()); if (swinfo != nullptr && !swinfo->usage.empty()) m_items_list.emplace_back(_("Software Usage"), 0, ""); } @@ -109,8 +109,8 @@ void ui_menu_dats_view::populate() (m_issoft == true) ? get_data_sw() : get_data(); item_append(MENU_SEPARATOR_ITEM, nullptr, (MENU_FLAG_UI_DATS | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW), nullptr); - customtop = 2.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; - custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; + custombottom = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; if (!paused) machine().resume(); @@ -122,7 +122,7 @@ void ui_menu_dats_view::populate() void ui_menu_dats_view::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float maxwidth = origx2 - origx1; float width; std::string driver = (m_issoft == true) ? m_swinfo->longname : m_driver->description; @@ -228,14 +228,14 @@ void ui_menu_dats_view::get_data() std::vector<std::string> m_item; if (m_items_list[m_actual].option == UI_COMMAND_LOAD) { - machine().datfile().command_sub_menu(m_driver, m_item); + mame_machine_manager::instance()->datfile().command_sub_menu(m_driver, m_item); if (!m_item.empty()) { for (size_t x = 0; x < m_item.size(); ++x) { std::string t_buffer; buffer.append(m_item[x]).append("\n"); - machine().datfile().load_command_info(t_buffer, m_item[x]); + mame_machine_manager::instance()->datfile().load_command_info(t_buffer, m_item[x]); if (!t_buffer.empty()) buffer.append(t_buffer).append("\n"); } @@ -243,9 +243,9 @@ void ui_menu_dats_view::get_data() } } else - machine().datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option); + mame_machine_manager::instance()->datfile().load_data_info(m_driver, buffer, m_items_list[m_actual].option); - int lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); + int lines = mame_machine_manager::instance()->ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); for (int x = 0; x < lines; ++x) { std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); @@ -263,12 +263,12 @@ void ui_menu_dats_view::get_data_sw() else { if (m_swinfo->startempty == 1) - machine().datfile().load_data_info(m_swinfo->driver, buffer, UI_HISTORY_LOAD); + mame_machine_manager::instance()->datfile().load_data_info(m_swinfo->driver, buffer, UI_HISTORY_LOAD); else - machine().datfile().load_software_info(m_swinfo->listname, buffer, m_swinfo->shortname, m_swinfo->parentname); + mame_machine_manager::instance()->datfile().load_software_info(m_swinfo->listname, buffer, m_swinfo->shortname, m_swinfo->parentname); } - int lines = machine().ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); + int lines = mame_machine_manager::instance()->ui().wrap_text(container, buffer.c_str(), 0.0f, 0.0f, 1.0f - (4.0f * UI_BOX_LR_BORDER), xstart, xend); for (int x = 0; x < lines; ++x) { std::string tempbuf(buffer.substr(xstart[x], xend[x] - xstart[x])); @@ -278,7 +278,7 @@ void ui_menu_dats_view::get_data_sw() void ui_menu_dats_view::init_items() { - datfile_manager &datfile = machine().datfile(); + datfile_manager &datfile = mame_machine_manager::instance()->datfile(); if (datfile.has_history(m_driver)) m_items_list.emplace_back(_("History"), UI_HISTORY_LOAD, datfile.rev_history()); if (datfile.has_mameinfo(m_driver)) diff --git a/src/emu/ui/datmenu.h b/src/frontend/mame/ui/datmenu.h index 10de3894816..10de3894816 100644 --- a/src/emu/ui/datmenu.h +++ b/src/frontend/mame/ui/datmenu.h diff --git a/src/emu/ui/defimg.h b/src/frontend/mame/ui/defimg.h index bce018449d1..bce018449d1 100644 --- a/src/emu/ui/defimg.h +++ b/src/frontend/mame/ui/defimg.h diff --git a/src/emu/ui/devctrl.h b/src/frontend/mame/ui/devctrl.h index 44cdb6d8ede..44cdb6d8ede 100644 --- a/src/emu/ui/devctrl.h +++ b/src/frontend/mame/ui/devctrl.h diff --git a/src/emu/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp index de145a41b4a..de145a41b4a 100644 --- a/src/emu/ui/devopt.cpp +++ b/src/frontend/mame/ui/devopt.cpp diff --git a/src/emu/ui/devopt.h b/src/frontend/mame/ui/devopt.h index 56916aebb54..56916aebb54 100644 --- a/src/emu/ui/devopt.h +++ b/src/frontend/mame/ui/devopt.h diff --git a/src/emu/ui/dirmenu.cpp b/src/frontend/mame/ui/dirmenu.cpp index b84cacc8d62..9ec3205f134 100644 --- a/src/emu/ui/dirmenu.cpp +++ b/src/frontend/mame/ui/dirmenu.cpp @@ -75,7 +75,7 @@ ui_menu_directory::~ui_menu_directory() { save_ui_options(machine()); ui_globals::reset = true; - machine().datfile().reset_run(); + mame_machine_manager::instance()->datfile().reset_run(); } //------------------------------------------------- @@ -101,7 +101,7 @@ void ui_menu_directory::populate() item_append(_(elem.name), nullptr, 0, (void *)(FPTR)elem.action); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -111,7 +111,7 @@ void ui_menu_directory::populate() void ui_menu_directory::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // get the size of the text mui.draw_text_full(container, _("Folders Setup"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, @@ -182,8 +182,8 @@ void ui_menu_display_actual::handle() void ui_menu_display_actual::populate() { m_tempbuf = string_format(_("Current %1$s Folders"), _(s_folders[m_ref].name)); - if (machine().ui().options().exists(s_folders[m_ref].option)) - m_searchpath.assign(machine().ui().options().value(s_folders[m_ref].option)); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + m_searchpath.assign(mame_machine_manager::instance()->ui().options().value(s_folders[m_ref].option)); else m_searchpath.assign(machine().options().value(s_folders[m_ref].option)); @@ -199,7 +199,7 @@ void ui_menu_display_actual::populate() item_append(_("Remove Folder"), nullptr, 0, (void *)REMOVE); item_append(ui_menu_item_type::SEPARATOR); - customtop = (m_folders.size() + 1) * machine().ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; + customtop = (m_folders.size() + 1) * mame_machine_manager::instance()->ui().get_line_height() + 6.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -209,7 +209,7 @@ void ui_menu_display_actual::populate() void ui_menu_display_actual::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width, maxwidth = origx2 - origx1; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float lineh = mui.get_line_height(); for (auto & elem : m_folders) @@ -283,8 +283,8 @@ ui_menu_add_change_folder::ui_menu_add_change_folder(running_machine &machine, r osd_get_full_path(m_current_path, "."); std::string searchpath; - if (machine.ui().options().exists(s_folders[m_ref].option)) - searchpath = machine.ui().options().value(s_folders[m_ref].option); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + searchpath = mame_machine_manager::instance()->ui().options().value(s_folders[m_ref].option); else searchpath = machine.options().value(s_folders[m_ref].option); @@ -365,14 +365,14 @@ void ui_menu_add_change_folder::handle() std::string error_string; if (m_change) { - if (machine().ui().options().exists(s_folders[m_ref].option)) - machine().ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + mame_machine_manager::instance()->ui().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); else if (strcmp(machine().options().value(s_folders[m_ref].option), m_current_path.c_str()) != 0) { machine().options().set_value(s_folders[m_ref].option, m_current_path.c_str(), OPTION_PRIORITY_CMDLINE, error_string); machine().options().mark_changed(s_folders[m_ref].option); } - machine().datfile().reset_run(); + mame_machine_manager::instance()->datfile().reset_run(); } else { @@ -385,8 +385,8 @@ void ui_menu_add_change_folder::handle() tmppath.append(";"); } - if (machine().ui().options().exists(s_folders[m_ref].option)) - machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + mame_machine_manager::instance()->ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); else if (strcmp(machine().options().value(s_folders[m_ref].option), tmppath.c_str()) != 0) { machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); @@ -479,8 +479,8 @@ void ui_menu_add_change_folder::populate() item_append(ui_menu_item_type::SEPARATOR); // configure the custom rendering - customtop = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; - custombottom = 1.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = 1.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -490,7 +490,7 @@ void ui_menu_add_change_folder::populate() void ui_menu_add_change_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width, maxwidth = origx2 - origx1; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); std::string tempbuf[2]; tempbuf[0] = string_format( (m_change) @@ -569,8 +569,8 @@ void ui_menu_add_change_folder::custom_render(void *selectedref, float top, floa ui_menu_remove_folder::ui_menu_remove_folder(running_machine &machine, render_container *container, int ref) : ui_menu(machine, container) { m_ref = ref; - if (machine.ui().options().exists(s_folders[m_ref].option)) - m_searchpath.assign(machine.ui().options().value(s_folders[m_ref].option)); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + m_searchpath.assign(mame_machine_manager::instance()->ui().options().value(s_folders[m_ref].option)); else m_searchpath.assign(machine.options().value(s_folders[m_ref].option)); @@ -603,8 +603,8 @@ void ui_menu_remove_folder::handle() tmppath.append(";"); } - if (machine().ui().options().exists(s_folders[m_ref].option)) - machine().ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); + if (mame_machine_manager::instance()->ui().options().exists(s_folders[m_ref].option)) + mame_machine_manager::instance()->ui().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); else if (strcmp(machine().options().value(s_folders[m_ref].option),tmppath.c_str())!=0) { machine().options().set_value(s_folders[m_ref].option, tmppath.c_str(), OPTION_PRIORITY_CMDLINE, error_string); @@ -627,7 +627,7 @@ void ui_menu_remove_folder::populate() item_append(elem.c_str(), nullptr, 0, (void *)(FPTR)++folders_count); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -637,7 +637,7 @@ void ui_menu_remove_folder::populate() void ui_menu_remove_folder::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); std::string tempbuf = string_format(_("Remove %1$s Folder"), _(s_folders[m_ref].name)); // get the size of the text diff --git a/src/emu/ui/dirmenu.h b/src/frontend/mame/ui/dirmenu.h index 6b68764b258..6b68764b258 100644 --- a/src/emu/ui/dirmenu.h +++ b/src/frontend/mame/ui/dirmenu.h diff --git a/src/emu/ui/filemngr.cpp b/src/frontend/mame/ui/filemngr.cpp index cac30f4f525..a0400e234bb 100644 --- a/src/emu/ui/filemngr.cpp +++ b/src/frontend/mame/ui/filemngr.cpp @@ -17,6 +17,8 @@ #include "ui/filemngr.h" #include "ui/filesel.h" #include "ui/miscmenu.h" +#include "ui/imgcntrl.h" +#include "ui/floppycntrl.h" #include "softlist.h" @@ -154,7 +156,7 @@ void ui_menu_file_manager::populate() item_append(ui_menu_item_type::SEPARATOR); item_append("Reset", nullptr, 0, (void *)1); - custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -178,9 +180,17 @@ void ui_menu_file_manager::handle() selected_device = (device_image_interface *) event->itemref; if (selected_device != nullptr) { - m_curr_selected = TRUE; - ui_menu::stack_push(selected_device->get_selection_menu(machine(), container)); + m_curr_selected = TRUE; + floppy_image_device *floppy_device = dynamic_cast<floppy_image_device *>(selected_device); + if (floppy_device != nullptr) + { + ui_menu::stack_push(global_alloc_clear<ui_menu_control_floppy_image>(machine(), container, floppy_device)); + } + else + { + ui_menu::stack_push(global_alloc_clear<ui_menu_control_device_image>(machine(), container, selected_device)); + } // reset the existing menu reset(UI_MENU_RESET_REMEMBER_POSITION); } @@ -201,7 +211,7 @@ void ui_menu_file_manager::force_file_manager(running_machine &machine, render_c ui_menu::stack_push(global_alloc_clear<ui_menu_file_manager>(machine, container, warnings)); // force the menus on - machine.ui().show_menu(); + mame_machine_manager::instance()->ui().show_menu(); // make sure MAME is paused machine.pause(); diff --git a/src/emu/ui/filemngr.h b/src/frontend/mame/ui/filemngr.h index 38c4e068281..38c4e068281 100644 --- a/src/emu/ui/filemngr.h +++ b/src/frontend/mame/ui/filemngr.h diff --git a/src/emu/ui/filesel.cpp b/src/frontend/mame/ui/filesel.cpp index 73edf1d6483..24d65757a10 100644 --- a/src/emu/ui/filesel.cpp +++ b/src/frontend/mame/ui/filesel.cpp @@ -77,7 +77,7 @@ static void extra_text_draw_box(render_container *container, float origx1, float float x1, y1, x2, y2, temp; // get the size of the text - container->manager().machine().ui().draw_text_full(container,text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, + mame_machine_manager::instance()->ui().draw_text_full(container,text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height); width = text_width + (2 * UI_BOX_LR_BORDER); maxwidth = MAX(width, origx2 - origx1); @@ -96,14 +96,14 @@ static void extra_text_draw_box(render_container *container, float origx1, float } // draw a box - container->manager().machine().ui().draw_outlined_box(container,x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container,x1, y1, x2, y2, UI_BACKGROUND_COLOR); // take off the borders x1 += UI_BOX_LR_BORDER; y1 += UI_BOX_TB_BORDER; // draw the text within it - container->manager().machine().ui().draw_text_full(container,text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD, + mame_machine_manager::instance()->ui().draw_text_full(container,text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } @@ -286,7 +286,7 @@ void ui_menu_file_create::populate() item_append(ui_menu_item_type::SEPARATOR); item_append(_("Create"), nullptr, 0, ITEMREF_CREATE); - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -315,7 +315,7 @@ void ui_menu_file_create::handle() ui_menu::stack_pop(machine()); } else - machine().ui().popup_time(1, "%s", _("Please enter a file extension too")); + mame_machine_manager::instance()->ui().popup_time(1, "%s", _("Please enter a file extension too")); } break; @@ -612,7 +612,7 @@ void ui_menu_file_selector::populate() set_selection((void *) selected_entry); // set up custom render proc - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; if (directory != nullptr) util::zippath_closedir(directory); @@ -664,7 +664,7 @@ void ui_menu_file_selector::handle() if (err != osd_file::error::NONE) { // this path is problematic; present the user with an error and bail - machine().ui().popup_time(1, "Error accessing %s", entry->fullpath); + mame_machine_manager::instance()->ui().popup_time(1, "Error accessing %s", entry->fullpath); break; } m_current_directory.assign(entry->fullpath); @@ -695,7 +695,7 @@ void ui_menu_file_selector::handle() update_selected = TRUE; if (ARRAY_LENGTH(m_filename_buffer) > 0) - machine().ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); + mame_machine_manager::instance()->ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); } // if it's any other key and we're not maxed out, update else if (event->unichar >= ' ' && event->unichar < 0x7f) @@ -705,7 +705,7 @@ void ui_menu_file_selector::handle() update_selected = TRUE; if (ARRAY_LENGTH(m_filename_buffer) > 0) - machine().ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); + mame_machine_manager::instance()->ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); } if (update_selected) diff --git a/src/emu/ui/filesel.h b/src/frontend/mame/ui/filesel.h index c7e113e463b..c7e113e463b 100644 --- a/src/emu/ui/filesel.h +++ b/src/frontend/mame/ui/filesel.h diff --git a/src/frontend/mame/ui/floppycntrl.cpp b/src/frontend/mame/ui/floppycntrl.cpp new file mode 100644 index 00000000000..05a4e03c825 --- /dev/null +++ b/src/frontend/mame/ui/floppycntrl.cpp @@ -0,0 +1,170 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + ui/floppycntrl.cpp + +***************************************************************************/ + +#include "emu.h" +#include "zippath.h" +#include "ui/menu.h" +#include "ui/imgcntrl.h" +#include "ui/filesel.h" +#include "ui/floppycntrl.h" + +/*************************************************************************** + IMPLEMENTATION +***************************************************************************/ + +ui_menu_control_floppy_image::ui_menu_control_floppy_image(running_machine &machine, render_container *container, device_image_interface *_image) : ui_menu_control_device_image(machine, container, _image) +{ + floppy_image_device *fd = static_cast<floppy_image_device *>(image); + const floppy_image_format_t *fif_list = fd->get_formats(); + int fcnt = 0; + for(const floppy_image_format_t *i = fif_list; i; i = i->next) + fcnt++; + + format_array = global_alloc_array(floppy_image_format_t *, fcnt); + input_format = output_format = nullptr; + input_filename = output_filename = ""; +} + +ui_menu_control_floppy_image::~ui_menu_control_floppy_image() +{ + global_free_array(format_array); +} + +void ui_menu_control_floppy_image::do_load_create() +{ + floppy_image_device *fd = static_cast<floppy_image_device *>(image); + if(input_filename.compare("")==0) { + int err = fd->create(output_filename.c_str(), nullptr, nullptr); + if (err != 0) { + machine().popmessage("Error: %s", fd->error()); + return; + } + fd->setup_write(output_format); + } else { + int err = fd->load(input_filename.c_str()); + if (!err && output_filename.compare("") != 0) + err = fd->reopen_for_write(output_filename.c_str()); + if(err != 0) { + machine().popmessage("Error: %s", fd->error()); + return; + } + if(output_format) + fd->setup_write(output_format); + } +} + +void ui_menu_control_floppy_image::hook_load(std::string filename, bool softlist) +{ + if (softlist) + { + machine().popmessage("When loaded from software list, the disk is Read-only.\n"); + image->load(filename.c_str()); + ui_menu::stack_pop(machine()); + return; + } + + input_filename = filename; + input_format = static_cast<floppy_image_device *>(image)->identify(filename); + + if (!input_format) + { + machine().popmessage("Error: %s\n", image->error()); + ui_menu::stack_pop(machine()); + return; + } + + bool can_in_place = input_format->supports_save(); + if(can_in_place) { + osd_file::error filerr; + std::string tmp_path; + util::core_file::ptr tmp_file; + // attempt to open the file for writing but *without* create + filerr = util::zippath_fopen(filename.c_str(), OPEN_FLAG_READ | OPEN_FLAG_WRITE, tmp_file, tmp_path); + if(filerr == osd_file::error::NONE) + tmp_file.reset(); + else + can_in_place = false; + } + submenu_result = -1; + ui_menu::stack_push(global_alloc_clear<ui_menu_select_rw>(machine(), container, can_in_place, &submenu_result)); + state = SELECT_RW; +} + +void ui_menu_control_floppy_image::handle() +{ + floppy_image_device *fd = static_cast<floppy_image_device *>(image); + switch (state) { + case DO_CREATE: { + floppy_image_format_t *fif_list = fd->get_formats(); + int ext_match; + int total_usable = 0; + for(floppy_image_format_t *i = fif_list; i; i = i->next) { + if(!i->supports_save()) + continue; + if (i->extension_matches(current_file.c_str())) + format_array[total_usable++] = i; + } + ext_match = total_usable; + for(floppy_image_format_t *i = fif_list; i; i = i->next) { + if(!i->supports_save()) + continue; + if (!i->extension_matches(current_file.c_str())) + format_array[total_usable++] = i; + } + submenu_result = -1; + ui_menu::stack_push(global_alloc_clear<ui_menu_select_format>(machine(), container, format_array, ext_match, total_usable, &submenu_result)); + + state = SELECT_FORMAT; + break; + } + + case SELECT_FORMAT: + if(submenu_result == -1) { + state = START_FILE; + handle(); + } else { + util::zippath_combine(output_filename, current_directory.c_str(), current_file.c_str()); + output_format = format_array[submenu_result]; + do_load_create(); + ui_menu::stack_pop(machine()); + } + break; + + case SELECT_RW: + switch(submenu_result) { + case ui_menu_select_rw::READONLY: + do_load_create(); + ui_menu::stack_pop(machine()); + break; + + case ui_menu_select_rw::READWRITE: + output_format = input_format; + do_load_create(); + ui_menu::stack_pop(machine()); + break; + + case ui_menu_select_rw::WRITE_DIFF: + machine().popmessage("Sorry, diffs are not supported yet\n"); + ui_menu::stack_pop(machine()); + break; + + case ui_menu_select_rw::WRITE_OTHER: + ui_menu::stack_push(global_alloc_clear<ui_menu_file_create>(machine(), container, image, current_directory, current_file, &create_ok)); + state = CHECK_CREATE; + break; + + case -1: + state = START_FILE; + break; + } + break; + + default: + ui_menu_control_device_image::handle(); + } +}
\ No newline at end of file diff --git a/src/frontend/mame/ui/floppycntrl.h b/src/frontend/mame/ui/floppycntrl.h new file mode 100644 index 00000000000..08ac1e85d68 --- /dev/null +++ b/src/frontend/mame/ui/floppycntrl.h @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert +/*************************************************************************** + + ui/floppycntrl.h + +***************************************************************************/ + +#pragma once + +#ifndef __UI_FLOPPY_IMAGE_H__ +#define __UI_FLOPPY_IMAGE_H__ + +#include "imagedev/floppy.h" +#include "formats/flopimg.h" + +class ui_menu_control_floppy_image : public ui_menu_control_device_image { +public: + ui_menu_control_floppy_image(running_machine &machine, render_container *container, device_image_interface *image); + virtual ~ui_menu_control_floppy_image(); + + virtual void handle() override; + +protected: + enum { SELECT_FORMAT = LAST_ID, SELECT_MEDIA, SELECT_RW }; + + floppy_image_format_t **format_array; + floppy_image_format_t *input_format, *output_format; + std::string input_filename, output_filename; + + void do_load_create(); + virtual void hook_load(std::string filename, bool softlist) override; +}; + + +#endif /* __UI_FLOPPY_IMAGE_H__ */
\ No newline at end of file diff --git a/src/emu/ui/icorender.h b/src/frontend/mame/ui/icorender.h index ac942ac922e..ac942ac922e 100644 --- a/src/emu/ui/icorender.h +++ b/src/frontend/mame/ui/icorender.h diff --git a/src/emu/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index 5497d953f99..78bbf1825a2 100644 --- a/src/emu/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -109,7 +109,7 @@ void ui_menu_control_device_image::test_create(bool &can_create, bool &need_conf case ENTTYPE_DIR: /* a directory exists here - we can't save over it */ - machine().ui().popup_time(5, "%s", _("Cannot save over directory")); + mame_machine_manager::instance()->ui().popup_time(5, "%s", _("Cannot save over directory")); can_create = false; need_confirm = false; break; diff --git a/src/emu/ui/imgcntrl.h b/src/frontend/mame/ui/imgcntrl.h index 3d978ed617c..3d978ed617c 100644 --- a/src/emu/ui/imgcntrl.h +++ b/src/frontend/mame/ui/imgcntrl.h diff --git a/src/emu/ui/info.cpp b/src/frontend/mame/ui/info.cpp index 32fe064f484..966d0ca0a33 100644 --- a/src/emu/ui/info.cpp +++ b/src/frontend/mame/ui/info.cpp @@ -30,7 +30,7 @@ ui_menu_game_info::~ui_menu_game_info() void ui_menu_game_info::populate() { std::string tempstring; - item_append(machine().ui().game_info_astring(tempstring).c_str(), nullptr, MENU_FLAG_MULTILINE, nullptr); + item_append(mame_machine_manager::instance()->ui().game_info_astring(tempstring).c_str(), nullptr, MENU_FLAG_MULTILINE, nullptr); } void ui_menu_game_info::handle() diff --git a/src/emu/ui/info.h b/src/frontend/mame/ui/info.h index a9459b25340..a9459b25340 100644 --- a/src/emu/ui/info.h +++ b/src/frontend/mame/ui/info.h diff --git a/src/emu/ui/info_pty.cpp b/src/frontend/mame/ui/info_pty.cpp index 267f8b1c5b9..267f8b1c5b9 100644 --- a/src/emu/ui/info_pty.cpp +++ b/src/frontend/mame/ui/info_pty.cpp diff --git a/src/emu/ui/info_pty.h b/src/frontend/mame/ui/info_pty.h index 584652211a6..584652211a6 100644 --- a/src/emu/ui/info_pty.h +++ b/src/frontend/mame/ui/info_pty.h diff --git a/src/emu/ui/inifile.cpp b/src/frontend/mame/ui/inifile.cpp index 1a2b894a5fb..5e3871a0137 100644 --- a/src/emu/ui/inifile.cpp +++ b/src/frontend/mame/ui/inifile.cpp @@ -38,7 +38,7 @@ inifile_manager::inifile_manager(running_machine &machine) void inifile_manager::directory_scan() { // open extra INIs folder - file_enumerator path(machine().ui().options().extraini_path()); + file_enumerator path(mame_machine_manager::instance()->ui().options().extraini_path()); const osd_directory_entry *dir; // loop into folder's file @@ -151,7 +151,7 @@ bool inifile_manager::parseopen(const char *filename) // MAME core file parsing functions fail in recognizing UNICODE chars in UTF-8 without BOM, // so it's better and faster use standard C fileio functions. - emu_file file(machine().ui().options().extraini_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().extraini_path(), OPEN_FLAG_READ); if (file.open(filename) != osd_file::error::NONE) return false; @@ -357,7 +357,7 @@ bool favorite_manager::isgame_favorite(ui_software_info &swinfo) void favorite_manager::parse_favorite() { - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (file.open(favorite_filename) == osd_file::error::NONE) { char readbuf[1024]; @@ -416,7 +416,7 @@ void favorite_manager::parse_favorite() void favorite_manager::save_favorite_games() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(favorite_filename) == osd_file::error::NONE) { if (m_list.empty()) diff --git a/src/emu/ui/inifile.h b/src/frontend/mame/ui/inifile.h index f9e5c096539..ecc755290a6 100644 --- a/src/emu/ui/inifile.h +++ b/src/frontend/mame/ui/inifile.h @@ -13,7 +13,7 @@ #ifndef __UI_INIFILE_H__ #define __UI_INIFILE_H__ -#include "ui/utils.h" +#include "../frontend/mame/ui/utils.h" //------------------------------------------------- // INIFILE MANAGER diff --git a/src/emu/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index c78ef8da7b0..d43725b8eb6 100644 --- a/src/emu/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -642,7 +642,7 @@ void ui_menu_settings_dip_switches::custom_render(void *selectedref, float top, y2 = y1 + bottom; // draw extra menu area - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); y1 += (float)DIP_SWITCH_SPACING; // iterate over DIP switches @@ -688,11 +688,11 @@ void ui_menu_settings_dip_switches::custom_render_one(float x1, float y1, float x1 += (x2 - x1 - numtoggles * switch_field_width) / 2; /* draw the dip switch name */ - machine().ui().draw_text_full( container, + mame_machine_manager::instance()->ui().draw_text_full( container, dip->name, 0, y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2, - x1 - machine().ui().get_string_width(" "), + x1 - mame_machine_manager::instance()->ui().get_string_width(" "), JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NORMAL, @@ -712,7 +712,7 @@ void ui_menu_settings_dip_switches::custom_render_one(float x1, float y1, float float innerx1; /* first outline the switch */ - machine().ui().draw_outlined_box(container, x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x1 + switch_field_width, y2, UI_BACKGROUND_COLOR); /* compute x1/x2 for the inner filled in switch */ innerx1 = x1 + (switch_field_width - switch_width) / 2; diff --git a/src/emu/ui/inputmap.h b/src/frontend/mame/ui/inputmap.h index 32ad48092ea..32ad48092ea 100644 --- a/src/emu/ui/inputmap.h +++ b/src/frontend/mame/ui/inputmap.h diff --git a/src/emu/ui/mainmenu.cpp b/src/frontend/mame/ui/mainmenu.cpp index 339ecd134ab..1202bd136f2 100644 --- a/src/emu/ui/mainmenu.cpp +++ b/src/frontend/mame/ui/mainmenu.cpp @@ -129,13 +129,13 @@ void ui_menu_main::populate() item_append(_("Plugin Options"), nullptr, 0, (void *)PLUGINS); // add dats menu - if (machine().ui().options().enabled_dats() && machine().datfile().has_data()) + if (mame_machine_manager::instance()->ui().options().enabled_dats() && mame_machine_manager::instance()->datfile().has_data()) item_append(_("External DAT View"), nullptr, 0, (void *)EXTERNAL_DATS); item_append(ui_menu_item_type::SEPARATOR); /* add favorite menu */ - if (!machine().favorite().isgame_favorite()) + if (!mame_machine_manager::instance()->favorite().isgame_favorite()) item_append(_("Add To Favorites"), nullptr, 0, (void *)ADD_FAVORITE); else item_append(_("Remove From Favorites"), nullptr, 0, (void *)REMOVE_FAVORITE); @@ -263,18 +263,18 @@ void ui_menu_main::handle() break; case ADD_FAVORITE: - machine().favorite().add_favorite_game(); + mame_machine_manager::instance()->favorite().add_favorite_game(); reset(UI_MENU_RESET_REMEMBER_POSITION); break; case REMOVE_FAVORITE: - machine().favorite().remove_favorite_game(); + mame_machine_manager::instance()->favorite().remove_favorite_game(); reset(UI_MENU_RESET_REMEMBER_POSITION); break; case QUIT_GAME: ui_menu::stack_pop(machine()); - machine().ui().request_quit(); + mame_machine_manager::instance()->ui().request_quit(); break; default: diff --git a/src/emu/ui/mainmenu.h b/src/frontend/mame/ui/mainmenu.h index cb12e6e1d1a..cb12e6e1d1a 100644 --- a/src/emu/ui/mainmenu.h +++ b/src/frontend/mame/ui/mainmenu.h diff --git a/src/emu/ui/menu.cpp b/src/frontend/mame/ui/menu.cpp index 08cb46a703e..3c144228d7a 100644 --- a/src/emu/ui/menu.cpp +++ b/src/frontend/mame/ui/menu.cpp @@ -492,16 +492,16 @@ void ui_menu::set_selection(void *selected_itemref) void ui_menu::draw(UINT32 flags, float origx0, float origy0) { // first draw the FPS counter - if (machine().ui().show_fps_counter()) + if (mame_machine_manager::instance()->ui().show_fps_counter()) { - machine().ui().draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, + mame_machine_manager::instance()->ui().draw_text_full(container, machine().video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } bool customonly = (flags & UI_MENU_PROCESS_CUSTOM_ONLY); bool noimage = (flags & UI_MENU_PROCESS_NOIMAGE); bool noinput = (flags & UI_MENU_PROCESS_NOINPUT); - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; @@ -511,7 +511,7 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) bool mouse_hit, mouse_button; float mouse_x = -1, mouse_y = -1; - if (machine().ui().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) + if (mame_machine_manager::instance()->ui().options().use_background_image() && &machine().system() == &GAME_NAME(___empty) && bgrnd_bitmap->valid() && !noimage) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // compute the width and height of the full menu @@ -523,11 +523,11 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) float total_width; // compute width of left hand side - total_width = gutter_width + machine().ui().get_string_width(pitem.text) + gutter_width; + total_width = gutter_width + mame_machine_manager::instance()->ui().get_string_width(pitem.text) + gutter_width; // add in width of right hand side if (pitem.subtext) - total_width += 2.0f * gutter_width + machine().ui().get_string_width(pitem.subtext); + total_width += 2.0f * gutter_width + mame_machine_manager::instance()->ui().get_string_width(pitem.subtext); // track the maximum if (total_width > visible_width) @@ -601,7 +601,7 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) float x2 = visible_left + visible_width + UI_BOX_LR_BORDER; float y2 = visible_top + visible_main_menu_height + UI_BOX_TB_BORDER; if (!customonly) - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); if (top_line < 0 || selected == 0) top_line = 0; @@ -721,11 +721,11 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) { if (pitem.flags & MENU_FLAG_UI_HEADING) { - float heading_width = machine().ui().get_string_width(itemtext); + float heading_width = mame_machine_manager::instance()->ui().get_string_width(itemtext); container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + ((visible_width - heading_width) / 2) - UI_BOX_LR_BORDER, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(visible_left + visible_width - ((visible_width - heading_width) / 2) + UI_BOX_LR_BORDER, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } - machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, + mame_machine_manager::instance()->ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, nullptr, nullptr); } @@ -737,14 +737,14 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) float item_width, subitem_width; // draw the left-side text - machine().ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, + mame_machine_manager::instance()->ui().draw_text_full(container, itemtext, effective_left, line_y, effective_width, JUSTIFY_LEFT, WRAP_TRUNCATE, DRAW_NORMAL, fgcolor, bgcolor, &item_width, nullptr); // give 2 spaces worth of padding item_width += 2.0f * gutter_width; // if the subitem doesn't fit here, display dots - if (machine().ui().get_string_width(subitem_text) > effective_width - item_width) + if (mame_machine_manager::instance()->ui().get_string_width(subitem_text) > effective_width - item_width) { subitem_text = "..."; if (itemnum == selected) @@ -762,7 +762,7 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) fgcolor2 = rgb_t(0xff,0xff,0xff,0x00); // draw the subitem right-justified - machine().ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width, + mame_machine_manager::instance()->ui().draw_text_full(container, subitem_text, effective_left + item_width, line_y, effective_width - item_width, JUSTIFY_RIGHT, WRAP_TRUNCATE, DRAW_NORMAL, subitem_invert ? fgcolor3 : fgcolor2, bgcolor, &subitem_width, nullptr); // apply arrows @@ -801,7 +801,7 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) float target_x, target_y; // compute the multi-line target width/height - machine().ui().draw_text_full(container, pitem.subtext, 0, 0, visible_width * 0.75f, + mame_machine_manager::instance()->ui().draw_text_full(container, pitem.subtext, 0, 0, visible_width * 0.75f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); // determine the target location @@ -811,12 +811,12 @@ void ui_menu::draw(UINT32 flags, float origx0, float origy0) target_y = line_y - target_height - UI_BOX_TB_BORDER; // add a box around that - machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER, + mame_machine_manager::instance()->ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER, target_y - UI_BOX_TB_BORDER, target_x + target_width + UI_BOX_LR_BORDER, target_y + target_height + UI_BOX_TB_BORDER, subitem_invert ? UI_SELECTED_BG_COLOR : UI_BACKGROUND_COLOR); - machine().ui().draw_text_full(container, pitem.subtext, target_x, target_y, target_width, + mame_machine_manager::instance()->ui().draw_text_full(container, pitem.subtext, target_x, target_y, target_width, JUSTIFY_RIGHT, WRAP_WORD, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); } @@ -838,21 +838,21 @@ void ui_menu::draw_text_box() { const char *text = item[0].text; const char *backtext = item[1].text; - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width; float target_width, target_height, prior_width; float target_x, target_y; // compute the multi-line target width/height - machine().ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width, + mame_machine_manager::instance()->ui().draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER - 2.0f * gutter_width, JUSTIFY_LEFT, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); target_height += 2.0f * line_height; if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) target_height = floorf((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; // maximum against "return to prior menu" text - prior_width = machine().ui().get_string_width(backtext) + 2.0f * gutter_width; + prior_width = mame_machine_manager::instance()->ui().get_string_width(backtext) + 2.0f * gutter_width; target_width = MAX(target_width, prior_width); // determine the target location @@ -870,12 +870,12 @@ void ui_menu::draw_text_box() target_y = 1.0f - UI_BOX_TB_BORDER - target_height; // add a box around that - machine().ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER - gutter_width, + mame_machine_manager::instance()->ui().draw_outlined_box(container, target_x - UI_BOX_LR_BORDER - gutter_width, target_y - UI_BOX_TB_BORDER, target_x + target_width + gutter_width + UI_BOX_LR_BORDER, target_y + target_height + UI_BOX_TB_BORDER, (item[0].flags & MENU_FLAG_REDTEXT) ? UI_RED_COLOR : UI_BACKGROUND_COLOR); - machine().ui().draw_text_full(container, text, target_x, target_y, target_width, + mame_machine_manager::instance()->ui().draw_text_full(container, text, target_x, target_y, target_width, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // draw the "return to prior menu" text with a hilight behind it @@ -885,7 +885,7 @@ void ui_menu::draw_text_box() target_x + target_width - 0.5f * UI_LINE_WIDTH, target_y + target_height, UI_SELECTED_BG_COLOR); - machine().ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width, + mame_machine_manager::instance()->ui().draw_text_full(container, backtext, target_x, target_y + target_height - line_height, target_width, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_SELECTED_COLOR, UI_SELECTED_BG_COLOR, nullptr, nullptr); // artificially set the hover to the last item so a double-click exits @@ -1133,7 +1133,7 @@ void ui_menu::handle_keys(UINT32 flags) // handle a toggle cheats request if (machine().ui_input().pressed_repeat(IPT_UI_TOGGLE_CHEAT, 0)) - machine().cheat().set_enable(!machine().cheat().enabled()); + mame_machine_manager::instance()->cheat().set_enable(!mame_machine_manager::instance()->cheat().enabled()); // see if any other UI keys are pressed if (menu_event.iptkey == IPT_INVALID) @@ -1278,7 +1278,7 @@ UINT32 ui_menu::ui_handler(running_machine &machine, render_container *container clear_free_list(machine); // if the menus are to be hidden, return a cancel here - if (machine.ui().is_menu_active() && ((machine.ui_input().pressed(IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == nullptr)) + if (mame_machine_manager::instance()->ui().is_menu_active() && ((machine.ui_input().pressed(IPT_UI_CONFIGURE) && !stack_has_special_main_menu()) || menu_stack == nullptr)) return UI_HANDLER_CANCEL; return 0; @@ -1411,7 +1411,7 @@ void ui_menu::init_ui(running_machine &machine) bgrnd_bitmap = std::make_unique<bitmap_argb32>(0, 0); bgrnd_texture = mrender.texture_alloc(render_texture::hq_scale); - ui_options &mopt = machine.ui().options(); + ui_options &mopt = mame_machine_manager::instance()->ui().options(); if (mopt.use_background_image() && &machine.system() == &GAME_NAME(___empty)) { emu_file backgroundfile(".", OPEN_FLAG_READ); @@ -1465,7 +1465,7 @@ void ui_menu::init_ui(running_machine &machine) void ui_menu::draw_select_game(UINT32 flags) { bool noinput = (flags & UI_MENU_PROCESS_NOINPUT); - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = 0.52f * ud_arrow_width; mouse_x = -1, mouse_y = -1; @@ -1475,10 +1475,10 @@ void ui_menu::draw_select_game(UINT32 flags) float primary_width = visible_width; bool is_swlist = ((item[0].flags & MENU_FLAG_UI_SWLIST) != 0); bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // draw background image if available - if (machine().ui().options().use_background_image() && bgrnd_bitmap->valid()) + if (mame_machine_manager::instance()->ui().options().use_background_image() && bgrnd_bitmap->valid()) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); hover = item.size() + 1; @@ -1638,7 +1638,7 @@ void ui_menu::draw_select_game(UINT32 flags) float item_width, subitem_width; // compute right space for subitem - mui.draw_text_full(container, subitem_text, effective_left, line_y, machine().ui().get_string_width(pitem.subtext), + mui.draw_text_full(container, subitem_text, effective_left, line_y, mame_machine_manager::instance()->ui().get_string_width(pitem.subtext), JUSTIFY_RIGHT, WRAP_NEVER, DRAW_NONE, item_invert ? fgcolor3 : fgcolor, bgcolor, &subitem_width, nullptr); subitem_width += gutter_width; @@ -1740,7 +1740,7 @@ void ui_menu::get_title_search(std::string &snaptext, std::string &searchstr) else { ui_options moptions; - searchstr = machine().ui().options().value(arts_info[ui_globals::curimage_view].path); + searchstr = mame_machine_manager::instance()->ui().options().value(arts_info[ui_globals::curimage_view].path); addpath = moptions.value(arts_info[ui_globals::curimage_view].path); } @@ -1957,7 +1957,7 @@ void ui_menu::handle_main_keys(UINT32 flags) // handle a toggle cheats request if (!ui_error && machine().ui_input().pressed_repeat(IPT_UI_TOGGLE_CHEAT, 0)) - machine().cheat().set_enable(!machine().cheat().enabled()); + mame_machine_manager::instance()->cheat().set_enable(!mame_machine_manager::instance()->cheat().enabled()); // see if any other UI keys are pressed if (menu_event.iptkey == IPT_INVALID) @@ -2181,7 +2181,7 @@ void ui_menu::handle_main_events(UINT32 flags) float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); float midl = (x2 - x1) * 0.5f; @@ -2252,7 +2252,7 @@ float ui_menu::draw_right_box_title(float x1, float y1, float x2, float y2) std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); std::string snaptext, searchstr; float title_size = 0.0f; @@ -2297,8 +2297,8 @@ std::string ui_menu::arts_render_common(float origx1, float origy1, float origx2 void ui_menu::draw_star(float x0, float y0) { - float y1 = y0 + machine().ui().get_line_height(); - float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(); + float y1 = y0 + mame_machine_manager::instance()->ui().get_line_height(); + float x1 = x0 + mame_machine_manager::instance()->ui().get_line_height() * container->manager().ui_aspect(); container->add_quad(x0, y0, x1, y1, ARGB_WHITE, star_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_PACKABLE); } @@ -2308,7 +2308,7 @@ void ui_menu::draw_star(float x0, float y0) void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // draw a box mui.draw_outlined_box(container, x1, y1, x2, y2, rgb_t(0xEF, 0x12, 0x47, 0x7B)); @@ -2344,7 +2344,7 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software { hover = HOVER_B_FAV + z; color = ARGB_WHITE; - float ypos = y2 + machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; + float ypos = y2 + mame_machine_manager::instance()->ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; mui.draw_text_box(container, _(hover_msg[z]), JUSTIFY_CENTER, 0.5f, ypos, UI_BACKGROUND_COLOR); } @@ -2363,7 +2363,7 @@ void ui_menu::draw_toolbar(float x1, float y1, float x2, float y2, bool software void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float origy1, float origx2, float origy2, bool software) { bool no_available = false; - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); // if it fails, use the default image if (!tmp_bitmap->valid()) @@ -2396,7 +2396,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float int dest_yPixel = tmp_bitmap->height(); // force 4:3 ratio min - if (machine().ui().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) + if (mame_machine_manager::instance()->ui().options().forced_4x3_snapshot() && ratioI < 0.75f && ui_globals::curimage_view == SNAPSHOT_VIEW) { // smaller ratio will ensure that the image fits in the view dest_yPixel = tmp_bitmap->width() * 0.75f; @@ -2406,7 +2406,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float dest_yPixel *= ratio; } // resize the bitmap if necessary - else if (ratioW < 1 || ratioH < 1 || (machine().ui().options().enlarge_snaps() && !no_available)) + else if (ratioW < 1 || ratioH < 1 || (mame_machine_manager::instance()->ui().options().enlarge_snaps() && !no_available)) { // smaller ratio will ensure that the image fits in the view float ratio = MIN(ratioW, ratioH); @@ -2450,7 +2450,7 @@ void ui_menu::arts_render_images(bitmap_argb32 *tmp_bitmap, float origx1, float void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float origy2, int current, int dmin, int dmax, float title_size) { - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; @@ -2471,14 +2471,14 @@ void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float // set hover if (mouse_hit && ar_x0 <= mouse_x && ar_x1 > mouse_x && ar_y0 <= mouse_y && ar_y1 > mouse_y && current != dmax) { - machine().ui().draw_textured_box(container, ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), + mame_machine_manager::instance()->ui().draw_textured_box(container, ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); hover = HOVER_UI_RIGHT; fgcolor_right = UI_MOUSEOVER_COLOR; } else if (mouse_hit && al_x0 <= mouse_x && al_x1 > mouse_x && al_y0 <= mouse_y && al_y1 > mouse_y && current != dmin) { - machine().ui().draw_textured_box(container, al_x0 + 0.01f, al_y0, al_x1 - 0.01f, al_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), + mame_machine_manager::instance()->ui().draw_textured_box(container, al_x0 + 0.01f, al_y0, al_x1 - 0.01f, al_y1, UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); hover = HOVER_UI_LEFT; fgcolor_left = UI_MOUSEOVER_COLOR; @@ -2503,8 +2503,8 @@ void ui_menu::draw_common_arrow(float origx1, float origy1, float origx2, float void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) { static const game_driver *olddriver[MAX_ICONS_RENDER] = { nullptr }; - float x1 = x0 + machine().ui().get_line_height() * container->manager().ui_aspect(container); - float y1 = y0 + machine().ui().get_line_height(); + float x1 = x0 + mame_machine_manager::instance()->ui().get_line_height() * container->manager().ui_aspect(container); + float y1 = y0 + mame_machine_manager::instance()->ui().get_line_height(); const game_driver *driver = (const game_driver *)selectedref; if (olddriver[linenum] != driver || ui_globals::redraw_icon) @@ -2521,9 +2521,9 @@ void ui_menu::draw_icon(int linenum, void *selectedref, float x0, float y0) } // get search path - path_iterator path(machine().ui().options().icons_directory()); + path_iterator path(mame_machine_manager::instance()->ui().options().icons_directory()); std::string curpath; - std::string searchstr(machine().ui().options().icons_directory()); + std::string searchstr(mame_machine_manager::instance()->ui().options().icons_directory()); // iterate over path and add path for zipped formats while (path.next(curpath)) @@ -2612,7 +2612,7 @@ void ui_menu::info_arrow(int ub, float origx1, float origx2, float oy1, float li if (mouse_hit && origx1 <= mouse_x && origx2 > mouse_x && oy1 <= mouse_y && oy1 + (line_height * text_size) > mouse_y) { - machine().ui().draw_textured_box(container, origx1 + 0.01f, oy1, origx2 - 0.01f, oy1 + (line_height * text_size), UI_MOUSEOVER_BG_COLOR, + mame_machine_manager::instance()->ui().draw_textured_box(container, origx1 + 0.01f, oy1, origx2 - 0.01f, oy1 + (line_height * text_size), UI_MOUSEOVER_BG_COLOR, rgb_t(255, 43, 43, 43), hilight_main_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); hover = (!ub) ? HOVER_DAT_UP : HOVER_DAT_DOWN; fgcolor = UI_MOUSEOVER_COLOR; @@ -2628,14 +2628,14 @@ void ui_menu::info_arrow(int ub, float origx1, float origx2, float oy1, float li void ui_menu::draw_palette_menu() { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); float lr_arrow_width = 0.4f * line_height * machine().render().ui_aspect(); float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = lr_arrow_width * 1.3f; int itemnum, linenum; - if (machine().ui().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) + if (mame_machine_manager::instance()->ui().options().use_background_image() && machine().options().system() == nullptr && bgrnd_bitmap->valid()) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); // compute the width and height of the full menu @@ -2817,16 +2817,16 @@ void ui_menu::draw_palette_menu() void ui_menu::draw_dats_menu() { - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float ud_arrow_width = line_height * machine().render().ui_aspect(); float gutter_width = 0.52f * line_height * machine().render().ui_aspect(); mouse_x = -1, mouse_y = -1; float visible_width = 1.0f - 2.0f * UI_BOX_LR_BORDER; float visible_left = (1.0f - visible_width) * 0.5f; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); // draw background image if available - if (machine().ui().options().use_background_image() && bgrnd_bitmap->valid()) + if (mame_machine_manager::instance()->ui().options().use_background_image() && bgrnd_bitmap->valid()) container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, ARGB_WHITE, bgrnd_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); hover = item.size() + 1; diff --git a/src/emu/ui/menu.h b/src/frontend/mame/ui/menu.h index 2b79990f2b8..af2badd3305 100644 --- a/src/emu/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -14,29 +14,14 @@ #define __UI_MENU_H__ #include "render.h" +#include "language.h" +#include "ui/uimain.h" /*************************************************************************** CONSTANTS ***************************************************************************/ -// flags for menu items -#define MENU_FLAG_LEFT_ARROW (1 << 0) -#define MENU_FLAG_RIGHT_ARROW (1 << 1) -#define MENU_FLAG_INVERT (1 << 2) -#define MENU_FLAG_MULTILINE (1 << 3) -#define MENU_FLAG_REDTEXT (1 << 4) -#define MENU_FLAG_DISABLE (1 << 5) -#define MENU_FLAG_UI (1 << 6) -#define MENU_FLAG_UI_DATS (1 << 7) -#define MENU_FLAG_UI_SWLIST (1 << 8) -#define MENU_FLAG_UI_FAVORITE (1 << 9) -#define MENU_FLAG_UI_PALETTE (1 << 10) -#define MENU_FLAG_UI_HEADING (1 << 11) - -// special menu item for separators -#define MENU_SEPARATOR_ITEM "---" - // flags to pass to ui_menu_process #define UI_MENU_PROCESS_NOKEYS 1 #define UI_MENU_PROCESS_LR_REPEAT 2 @@ -53,14 +38,6 @@ enum ui_menu_reset_options UI_MENU_RESET_REMEMBER_REF }; -// types of menu items (TODO: please expand) -enum class ui_menu_item_type -{ - UNKNOWN, - SLIDER, - SEPARATOR -}; - /*************************************************************************** TYPE DEFINITIONS @@ -84,18 +61,6 @@ struct ui_menu_pool }; -class ui_menu_item -{ -public: - const char *text; - const char *subtext; - UINT32 flags; - void *ref; - ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*) - - inline bool is_selectable() const; -}; - class ui_menu { public: diff --git a/src/emu/ui/miscmenu.cpp b/src/frontend/mame/ui/miscmenu.cpp index 24064f57e63..8ec09c4dc17 100644 --- a/src/emu/ui/miscmenu.cpp +++ b/src/frontend/mame/ui/miscmenu.cpp @@ -9,6 +9,7 @@ *********************************************************************/ #include "emu.h" +#include "mame.h" #include "osdnet.h" #include "mameopts.h" @@ -35,7 +36,7 @@ ui_menu_keyboard_mode::ui_menu_keyboard_mode(running_machine &machine, render_co void ui_menu_keyboard_mode::populate() { - bool natural = machine().ui().use_natural_keyboard(); + bool natural = mame_machine_manager::instance()->ui().use_natural_keyboard(); item_append(_("Keyboard Mode:"), natural ? _("Natural") : _("Emulated"), natural ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, nullptr); } @@ -45,7 +46,7 @@ ui_menu_keyboard_mode::~ui_menu_keyboard_mode() void ui_menu_keyboard_mode::handle() { - bool natural = machine().ui().use_natural_keyboard(); + bool natural = mame_machine_manager::instance()->ui().use_natural_keyboard(); /* process the menu */ const ui_menu_event *menu_event = process(0); @@ -54,7 +55,7 @@ void ui_menu_keyboard_mode::handle() { if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) { - machine().ui().set_use_natural_keyboard(natural ^ true); + mame_machine_manager::instance()->ui().set_use_natural_keyboard(natural ^ true); reset(UI_MENU_RESET_REMEMBER_REF); } } @@ -586,7 +587,7 @@ void ui_menu_export::handle() if (m_event->iptkey == IPT_UI_SELECT) { std::string filename("exported"); - emu_file infile(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file infile(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (infile.open(filename.c_str(), ".xml") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { @@ -599,7 +600,7 @@ void ui_menu_export::handle() } // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(filename.c_str(), ".xml") == osd_file::error::NONE) { FILE *pfile; @@ -626,7 +627,7 @@ void ui_menu_export::handle() if (m_event->iptkey == IPT_UI_SELECT) { std::string filename("exported"); - emu_file infile(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file infile(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (infile.open(filename.c_str(), ".txt") == osd_file::error::NONE) for (int seq = 0; ; ++seq) { @@ -639,7 +640,7 @@ void ui_menu_export::handle() } // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS); if (file.open(filename.c_str(), ".txt") == osd_file::error::NONE) { // print the header @@ -726,17 +727,17 @@ void ui_menu_machine_configure::handle() { std::string inistring = m_opts.output_ini(); file.puts(inistring.c_str()); - machine().ui().popup_time(2, "%s", _("\n Configuration saved \n\n")); + mame_machine_manager::instance()->ui().popup_time(2, "%s", _("\n Configuration saved \n\n")); } break; } case ADDFAV: - machine().favorite().add_favorite_game(m_drv); + mame_machine_manager::instance()->favorite().add_favorite_game(m_drv); reset(UI_MENU_RESET_REMEMBER_POSITION); break; case DELFAV: - machine().favorite().remove_favorite_game(); + mame_machine_manager::instance()->favorite().remove_favorite_game(); reset(UI_MENU_RESET_REMEMBER_POSITION); break; case CONTROLLER: @@ -788,7 +789,7 @@ void ui_menu_machine_configure::populate() item_append(_(control_submenu_options[0].description), nullptr, 0, (void *)(FPTR)CONTROLLER); item_append(ui_menu_item_type::SEPARATOR); - if (!machine().favorite().isgame_favorite(m_drv)) + if (!mame_machine_manager::instance()->favorite().isgame_favorite(m_drv)) item_append(_("Add To Favorites"), nullptr, 0, (void *)ADDFAV); else item_append(_("Remove From Favorites"), nullptr, 0, (void *)DELFAV); @@ -796,7 +797,7 @@ void ui_menu_machine_configure::populate() item_append(ui_menu_item_type::SEPARATOR); item_append(_("Save machine configuration"), nullptr, 0, (void *)(FPTR)SAVE); item_append(ui_menu_item_type::SEPARATOR); - customtop = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -806,7 +807,7 @@ void ui_menu_machine_configure::populate() void ui_menu_machine_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); std::string text[2]; float maxwidth = origx2 - origx1; @@ -899,7 +900,7 @@ ui_menu_plugins_configure::~ui_menu_plugins_configure() if (file_plugin.open("plugin.ini") != osd_file::error::NONE) throw emu_fatalerror("Unable to create file plugin.ini\n"); // generate the updated INI - file_plugin.puts(machine().manager().plugins().output_ini().c_str()); + file_plugin.puts(mame_machine_manager::instance()->plugins().output_ini().c_str()); } //------------------------------------------------- @@ -910,7 +911,7 @@ void ui_menu_plugins_configure::handle() { // process the menu bool changed = false; - plugin_options& plugins = machine().manager().plugins(); + plugin_options& plugins = mame_machine_manager::instance()->plugins(); ui_menu::menu_stack->parent->process(UI_MENU_PROCESS_NOINPUT); const ui_menu_event *m_event = process(UI_MENU_PROCESS_NOIMAGE); if (m_event != nullptr && m_event->itemref != nullptr) @@ -933,7 +934,7 @@ void ui_menu_plugins_configure::handle() void ui_menu_plugins_configure::populate() { - plugin_options& plugins = machine().manager().plugins(); + plugin_options& plugins = mame_machine_manager::instance()->plugins(); for (auto &curentry : plugins) { @@ -945,7 +946,7 @@ void ui_menu_plugins_configure::populate() } } item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); + customtop = mame_machine_manager::instance()->ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); } //------------------------------------------------- @@ -955,7 +956,7 @@ void ui_menu_plugins_configure::populate() void ui_menu_plugins_configure::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Plugins"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); diff --git a/src/emu/ui/miscmenu.h b/src/frontend/mame/ui/miscmenu.h index 18f22c49d54..18f22c49d54 100644 --- a/src/emu/ui/miscmenu.h +++ b/src/frontend/mame/ui/miscmenu.h diff --git a/src/emu/ui/moptions.cpp b/src/frontend/mame/ui/moptions.cpp index 3c8d37fec12..3c8d37fec12 100644 --- a/src/emu/ui/moptions.cpp +++ b/src/frontend/mame/ui/moptions.cpp diff --git a/src/emu/ui/moptions.h b/src/frontend/mame/ui/moptions.h index 9a657d69d0e..55d800651f4 100644 --- a/src/emu/ui/moptions.h +++ b/src/frontend/mame/ui/moptions.h @@ -13,6 +13,8 @@ #ifndef __UI_OPTS_H__ #define __UI_OPTS_H__ +#include "options.h" + // core directory options #define OPTION_HISTORY_PATH "historypath" #define OPTION_EXTRAINI_PATH "extrainipath" diff --git a/src/emu/ui/optsmenu.cpp b/src/frontend/mame/ui/optsmenu.cpp index d11cfe37143..b08b82b1268 100644 --- a/src/emu/ui/optsmenu.cpp +++ b/src/frontend/mame/ui/optsmenu.cpp @@ -91,20 +91,20 @@ void ui_menu_game_options::handle() { if (m_event->iptkey == IPT_UI_LEFT) { - machine().inifile().move_file(-1); + mame_machine_manager::instance()->inifile().move_file(-1); changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT) { - machine().inifile().move_file(1); + mame_machine_manager::instance()->inifile().move_file(1); changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) { - inifile_manager &ifile = machine().inifile(); + inifile_manager &ifile = mame_machine_manager::instance()->inifile(); int total = ifile.total(); std::vector<std::string> s_sel(total); - machine().inifile().set_cat(0); + mame_machine_manager::instance()->inifile().set_cat(0); for (size_t index = 0; index < total; ++index) s_sel[index] = ifile.get_file(index); @@ -116,17 +116,17 @@ void ui_menu_game_options::handle() { if (m_event->iptkey == IPT_UI_LEFT) { - machine().inifile().move_cat(-1); + mame_machine_manager::instance()->inifile().move_cat(-1); changed = true; } else if (m_event->iptkey == IPT_UI_RIGHT) { - machine().inifile().move_cat(1); + mame_machine_manager::instance()->inifile().move_cat(1); changed = true; } else if (m_event->iptkey == IPT_UI_SELECT) { - inifile_manager &ifile = machine().inifile(); + inifile_manager &ifile = mame_machine_manager::instance()->inifile(); int total = ifile.cat_total(); std::vector<std::string> s_sel(total); for (int index = 0; index < total; ++index) @@ -230,9 +230,9 @@ void ui_menu_game_options::populate() item_append(_("Filter"), main_filters::text[m_main], arrow_flags, (void *)(FPTR)FILTER_MENU); // add category subitem - if (m_main == FILTER_CATEGORY && machine().inifile().total() > 0) + if (m_main == FILTER_CATEGORY && mame_machine_manager::instance()->inifile().total() > 0) { - inifile_manager &inif = machine().inifile(); + inifile_manager &inif = mame_machine_manager::instance()->inifile(); arrow_flags = get_arrow_flags(0, inif.total() - 1, inif.cur_file()); fbuff = _(" ^!File"); @@ -283,8 +283,8 @@ void ui_menu_game_options::populate() item_append(ui_menu_item_type::SEPARATOR); item_append(_("Save Configuration"), nullptr, 0, (void *)(FPTR)SAVE_CONFIG); - custombottom = 2.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } //------------------------------------------------- @@ -294,7 +294,7 @@ void ui_menu_game_options::populate() void ui_menu_game_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Settings"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; @@ -330,7 +330,7 @@ void save_ui_options(running_machine &machine) if (file.open("ui.ini") == osd_file::error::NONE) { // generate the updated INI - std::string initext = machine.ui().options().output_ini(); + std::string initext = mame_machine_manager::instance()->ui().options().output_ini(); file.puts(initext.c_str()); file.close(); } @@ -386,5 +386,5 @@ void save_main_option(running_machine &machine) return; } } - machine.ui().popup_time(3, "%s", _("\n Configuration saved \n\n")); + mame_machine_manager::instance()->ui().popup_time(3, "%s", _("\n Configuration saved \n\n")); } diff --git a/src/emu/ui/optsmenu.h b/src/frontend/mame/ui/optsmenu.h index f6b4243afa0..f6b4243afa0 100644 --- a/src/emu/ui/optsmenu.h +++ b/src/frontend/mame/ui/optsmenu.h diff --git a/src/emu/ui/pluginopt.cpp b/src/frontend/mame/ui/pluginopt.cpp index b2f1d81579a..6d026c8fabe 100644 --- a/src/emu/ui/pluginopt.cpp +++ b/src/frontend/mame/ui/pluginopt.cpp @@ -9,6 +9,7 @@ *********************************************************************/ #include "emu.h" +#include "mame.h" #include "luaengine.h" #include "ui/pluginopt.h" @@ -26,7 +27,7 @@ void ui_menu_plugin::handle() ui_menu_plugin::ui_menu_plugin(running_machine &machine, render_container *container) : ui_menu(machine, container), - m_plugins(machine.manager().lua()->get_menu()) + m_plugins(mame_machine_manager::instance()->lua()->get_menu()) { } @@ -80,7 +81,7 @@ void ui_menu_plugin_opt::handle() default: return; } - if(machine().manager().lua()->menu_callback(m_menu, (FPTR)menu_event->itemref, key)) + if(mame_machine_manager::instance()->lua()->menu_callback(m_menu, (FPTR)menu_event->itemref, key)) reset(UI_MENU_RESET_REMEMBER_REF); } } @@ -88,7 +89,7 @@ void ui_menu_plugin_opt::handle() void ui_menu_plugin_opt::populate() { std::vector<lua_engine::menu_item> menu_list; - machine().manager().lua()->menu_populate(m_menu, menu_list); + mame_machine_manager::instance()->lua()->menu_populate(m_menu, menu_list); FPTR i = 1; for(auto &item : menu_list) { diff --git a/src/emu/ui/pluginopt.h b/src/frontend/mame/ui/pluginopt.h index 9d529e93749..9d529e93749 100644 --- a/src/emu/ui/pluginopt.h +++ b/src/frontend/mame/ui/pluginopt.h diff --git a/src/emu/ui/selector.cpp b/src/frontend/mame/ui/selector.cpp index 7ef7545c685..4f06bd961f4 100644 --- a/src/emu/ui/selector.cpp +++ b/src/frontend/mame/ui/selector.cpp @@ -66,13 +66,13 @@ void ui_menu_selector::handle() switch (m_category) { case SELECTOR_INIFILE: - machine().inifile().set_file(m_selector); - machine().inifile().set_cat(0); + mame_machine_manager::instance()->inifile().set_file(m_selector); + mame_machine_manager::instance()->inifile().set_cat(0); ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); break; case SELECTOR_CATEGORY: - machine().inifile().set_cat(m_selector); + mame_machine_manager::instance()->inifile().set_cat(m_selector); ui_menu::menu_stack->parent->reset(UI_MENU_RESET_REMEMBER_REF); break; @@ -150,7 +150,7 @@ void ui_menu_selector::populate() } item_append(ui_menu_item_type::SEPARATOR); - customtop = custombottom = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = custombottom = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; m_first_pass = false; } @@ -161,7 +161,7 @@ void ui_menu_selector::populate() void ui_menu_selector::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); std::string tempbuf = std::string(_("Selection List - Search: ")).append(m_search).append("_"); // get the size of the text diff --git a/src/emu/ui/selector.h b/src/frontend/mame/ui/selector.h index 6809729396d..6809729396d 100644 --- a/src/emu/ui/selector.h +++ b/src/frontend/mame/ui/selector.h diff --git a/src/emu/ui/selgame.cpp b/src/frontend/mame/ui/selgame.cpp index 2df9cd35012..00fbd75108e 100644 --- a/src/emu/ui/selgame.cpp +++ b/src/frontend/mame/ui/selgame.cpp @@ -9,6 +9,7 @@ *********************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "ui/ui.h" #include "uiinput.h" @@ -54,7 +55,7 @@ ui_menu_select_game::ui_menu_select_game(running_machine &machine, render_contai m_focus = focused_menu::main; highlight = 0; std::string error_string, last_filter, sub_filter; - ui_options &moptions = machine.ui().options(); + ui_options &moptions = mame_machine_manager::instance()->ui().options(); // load drivers cache init_sorted_list(); @@ -141,7 +142,7 @@ ui_menu_select_game::~ui_menu_select_game() std::string error_string, last_driver; const game_driver *driver = nullptr; ui_software_info *swinfo = nullptr; - ui_options &mopt = machine().ui().options(); + ui_options &mopt = mame_machine_manager::instance()->ui().options(); if (isfavorite()) swinfo = (selected >= 0 && selected < item.size()) ? (ui_software_info *)item[selected].ref : nullptr; else @@ -175,7 +176,7 @@ void ui_menu_select_game::handle() m_prev_selected = item[0].ref; bool check_filter = false; - bool enabled_dats = machine().ui().options().enabled_dats(); + bool enabled_dats = mame_machine_manager::instance()->ui().options().enabled_dats(); // if i have to load datfile, performe an hard reset if (ui_globals::reset) @@ -346,13 +347,13 @@ void ui_menu_select_game::handle() if (!isfavorite()) { const game_driver *driver = (const game_driver *)m_event->itemref; - if ((FPTR)driver > skip_main_items && machine().datfile().has_data(driver)) + if ((FPTR)driver > skip_main_items && mame_machine_manager::instance()->datfile().has_data(driver)) ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, driver)); } else { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - datfile_manager &mdat = machine().datfile(); + datfile_manager &mdat = mame_machine_manager::instance()->datfile(); if ((FPTR)ui_swinfo > skip_main_items) { @@ -372,15 +373,15 @@ void ui_menu_select_game::handle() const game_driver *driver = (const game_driver *)m_event->itemref; if ((FPTR)driver > skip_main_items) { - if (!machine().favorite().isgame_favorite(driver)) + if (!mame_machine_manager::instance()->favorite().isgame_favorite(driver)) { - machine().favorite().add_favorite_game(driver); + mame_machine_manager::instance()->favorite().add_favorite_game(driver); machine().popmessage(_("%s\n added to favorites list."), driver->description); } else { - machine().favorite().remove_favorite_game(); + mame_machine_manager::instance()->favorite().remove_favorite_game(); machine().popmessage(_("%s\n removed from favorites list."), driver->description); } } @@ -391,7 +392,7 @@ void ui_menu_select_game::handle() if ((FPTR)swinfo > skip_main_items) { machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str()); - machine().favorite().remove_favorite_game(*swinfo); + mame_machine_manager::instance()->favorite().remove_favorite_game(*swinfo); reset(UI_MENU_RESET_SELECT_FIRST); } } @@ -452,7 +453,7 @@ void ui_menu_select_game::handle() // if we're in an error state, overlay an error message if (ui_error) - machine().ui().draw_text_box(container, _("The selected machine is missing one or more required ROM or CHD images. " + mame_machine_manager::instance()->ui().draw_text_box(container, _("The selected machine is missing one or more required ROM or CHD images. " "Please select a different machine.\n\nPress any key to continue."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); // handle filters selection from key shortcuts @@ -553,7 +554,7 @@ void ui_menu_select_game::populate() m_search[0] = '\0'; int curitem = 0; // iterate over entries - for (auto & mfavorite : machine().favorite().m_list) + for (auto & mfavorite : mame_machine_manager::instance()->favorite().m_list) { UINT32 flags_ui = MENU_FLAG_UI | MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW | MENU_FLAG_UI_FAVORITE; if (mfavorite.startempty == 1) @@ -603,8 +604,8 @@ void ui_menu_select_game::populate() skip_main_items = 0; // configure the custom rendering - customtop = 3.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; - custombottom = 5.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = 3.0f * mame_machine_manager::instance()->ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; + custombottom = 5.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; // reselect prior game launched, if any if (old_item_selected != -1) @@ -749,7 +750,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott std::string tempbuf[5]; rgb_t color = UI_BACKGROUND_COLOR; bool isstar = false; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float tbarspace = mui.get_line_height(); float text_size = 1.0f; @@ -761,12 +762,12 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott m_isabios); std::string filtered; - if (main_filters::actual == FILTER_CATEGORY && machine().inifile().total() > 0) + if (main_filters::actual == FILTER_CATEGORY && mame_machine_manager::instance()->inifile().total() > 0) { filtered = string_format(_("%1$s (%2$s - %3$s) - "), main_filters::text[main_filters::actual], - machine().inifile().get_file(), - machine().inifile().get_category()); + mame_machine_manager::instance()->inifile().get_file(), + mame_machine_manager::instance()->inifile().get_category()); } else if (main_filters::actual == FILTER_MANUFACTURER) { @@ -836,7 +837,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott if (driver != nullptr) { - isstar = machine().favorite().isgame_favorite(driver); + isstar = mame_machine_manager::instance()->favorite().isgame_favorite(driver); // first line is game name tempbuf[0] = string_format(_("Romset: %1$-.100s"), driver->name); @@ -885,7 +886,7 @@ void ui_menu_select_game::custom_render(void *selectedref, float top, float bott else if (swinfo != nullptr) { - isstar = machine().favorite().isgame_favorite(*swinfo); + isstar = mame_machine_manager::instance()->favorite().isgame_favorite(*swinfo); // first line is system tempbuf[0] = string_format(_("System: %1$-.100s"), swinfo->driver->description); @@ -1000,7 +1001,7 @@ void ui_menu_select_game::force_game_select(running_machine &machine, render_con ui_menu::stack_push(global_alloc_clear<ui_menu_select_game>(machine, container, nullptr)); // force the menus on - machine.ui().show_menu(); + mame_machine_manager::instance()->ui().show_menu(); // make sure MAME is paused machine.pause(); @@ -1055,14 +1056,14 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) } s_bios biosname; - if (!machine().ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) + if (!mame_machine_manager::instance()->ui().options().skip_bios_menu() && has_multiple_bios(driver, biosname)) ui_menu::stack_push(global_alloc_clear<ui_bios_selection>(machine(), container, biosname, (void *)driver, false, false)); else { reselect_last::driver = driver->name; reselect_last::software.clear(); reselect_last::swlist.clear(); - machine().manager().schedule_new_driver(*driver); + mame_machine_manager::instance()->schedule_new_driver(*driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -1083,7 +1084,7 @@ void ui_menu_select_game::inkey_select(const ui_menu_event *m_event) void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - ui_options &mopt = machine().ui().options(); + ui_options &mopt = mame_machine_manager::instance()->ui().options(); // special case for configure options if ((FPTR)ui_swinfo == CONF_OPTS) @@ -1125,7 +1126,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) reselect_last::software.clear(); reselect_last::swlist.clear(); reselect_last::set(true); - machine().manager().schedule_new_driver(*ui_swinfo->driver); + mame_machine_manager::instance()->schedule_new_driver(*ui_swinfo->driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -1180,7 +1181,7 @@ void ui_menu_select_game::inkey_select_favorite(const ui_menu_event *m_event) reselect_last::driver = drv.driver().name; reselect_last::software = ui_swinfo->shortname; reselect_last::swlist = ui_swinfo->listname; - machine().manager().schedule_new_driver(drv.driver()); + mame_machine_manager::instance()->schedule_new_driver(drv.driver()); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -1470,7 +1471,7 @@ void ui_menu_select_game::build_category() { m_displaylist.clear(); std::vector<int> temp_filter; - machine().inifile().load_ini_category(temp_filter); + mame_machine_manager::instance()->inifile().load_ini_category(temp_filter); for (auto actual : temp_filter) m_displaylist.push_back(&driver_list::driver(actual)); @@ -1588,7 +1589,7 @@ void ui_menu_select_game::general_info(const game_driver *driver, std::string &b util::stream_format(str, _("Requires CHD: %1$s\n"), found ? _("Yes") : _("No")); // audit the game first to see if we're going to work - if (machine().ui().options().info_audit()) + if (mame_machine_manager::instance()->ui().options().info_audit()) { driver_enumerator enumerator(machine().options(), *driver); enumerator.next(); @@ -1668,7 +1669,7 @@ void ui_menu_select_game::init_sorted_list() bool ui_menu_select_game::load_available_machines() { // try to load available drivers from file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (file.open(emulator_info::get_configname(), "_avail.ini") != osd_file::error::NONE) return false; @@ -1720,7 +1721,7 @@ bool ui_menu_select_game::load_available_machines() void ui_menu_select_game::load_custom_filters() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", emulator_info::get_configname(), "_filter.ini") == osd_file::error::NONE) { char buffer[MAX_CHAR_INFO]; @@ -1779,14 +1780,14 @@ void ui_menu_select_game::load_custom_filters() float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); if (ui_globals::panels_status == SHOW_PANELS || ui_globals::panels_status == HIDE_RIGHT_PANEL) { float origy1 = y1; float origy2 = y2; - float text_size = machine().ui().options().infos_size(); + float text_size = mame_machine_manager::instance()->ui().options().infos_size(); float line_height_max = line_height * text_size; float left_width = 0.0f; int text_lenght = main_filters::length; @@ -1938,12 +1939,12 @@ float ui_menu_select_game::draw_left_panel(float x1, float y1, float x2, float y void ui_menu_select_game::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); static std::string buffer; std::vector<int> xstart; std::vector<int> xend; - float text_size = machine().ui().options().infos_size(); + float text_size = mame_machine_manager::instance()->ui().options().infos_size(); const game_driver *driver = nullptr; ui_software_info *soft = nullptr; bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); @@ -2029,9 +2030,9 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or if (ui_globals::curdats_view == UI_GENERAL_LOAD) general_info(driver, buffer); else if (ui_globals::curdats_view != UI_COMMAND_LOAD) - machine().datfile().load_data_info(driver, buffer, ui_globals::curdats_view); + mame_machine_manager::instance()->datfile().load_data_info(driver, buffer, ui_globals::curdats_view); else - machine().datfile().command_sub_menu(driver, m_item); + mame_machine_manager::instance()->datfile().command_sub_menu(driver, m_item); if (!m_item.empty() && ui_globals::curdats_view == UI_COMMAND_LOAD) { @@ -2039,7 +2040,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or { std::string t_buffer; buffer.append(m_item[x]).append("\n"); - machine().datfile().load_command_info(t_buffer, m_item[x]); + mame_machine_manager::instance()->datfile().load_command_info(t_buffer, m_item[x]); if (!t_buffer.empty()) buffer.append(t_buffer).append("\n"); } @@ -2200,9 +2201,9 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) - machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); + mame_machine_manager::instance()->datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); else - machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); + mame_machine_manager::instance()->datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); } else buffer = soft->usage; @@ -2253,7 +2254,7 @@ void ui_menu_select_game::infos_render(void *selectedref, float origx1, float or void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); rgb_t fgcolor = UI_TEXT_COLOR; bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH); float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; @@ -2296,7 +2297,7 @@ void ui_menu_select_game::draw_right_panel(void *selectedref, float origx1, floa void ui_menu_select_game::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); bool is_favorites = ((item[0].flags & MENU_FLAG_UI_FAVORITE) != 0); static ui_software_info *oldsoft = nullptr; diff --git a/src/emu/ui/selgame.h b/src/frontend/mame/ui/selgame.h index 225e9c2cf3a..225e9c2cf3a 100644 --- a/src/emu/ui/selgame.h +++ b/src/frontend/mame/ui/selgame.h diff --git a/src/emu/ui/selsoft.cpp b/src/frontend/mame/ui/selsoft.cpp index 16808d2a963..b9aae4170f3 100644 --- a/src/emu/ui/selsoft.cpp +++ b/src/frontend/mame/ui/selsoft.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "ui/ui.h" #include "ui/menu.h" @@ -241,10 +242,10 @@ void ui_menu_select_software::handle() } // handle UI_DATS - else if (m_event->iptkey == IPT_UI_DATS && machine().ui().options().enabled_dats()) + else if (m_event->iptkey == IPT_UI_DATS && mame_machine_manager::instance()->ui().options().enabled_dats()) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - datfile_manager &mdat = machine().datfile(); + datfile_manager &mdat = mame_machine_manager::instance()->datfile(); if (ui_swinfo->startempty == 1 && mdat.has_history(ui_swinfo->driver)) ui_menu::stack_push(global_alloc_clear<ui_menu_dats_view>(machine(), container, ui_swinfo->driver)); @@ -274,16 +275,16 @@ void ui_menu_select_software::handle() if ((FPTR)swinfo > 2) { - if (!machine().favorite().isgame_favorite(*swinfo)) + if (!mame_machine_manager::instance()->favorite().isgame_favorite(*swinfo)) { - machine().favorite().add_favorite_game(*swinfo); + mame_machine_manager::instance()->favorite().add_favorite_game(*swinfo); machine().popmessage(_("%s\n added to favorites list."), swinfo->longname.c_str()); } else { machine().popmessage(_("%s\n removed from favorites list."), swinfo->longname.c_str()); - machine().favorite().remove_favorite_game(); + mame_machine_manager::instance()->favorite().remove_favorite_game(); } } } @@ -376,7 +377,7 @@ void ui_menu_select_software::handle() // if we're in an error state, overlay an error message if (ui_error) - machine().ui().draw_text_box(container, _("The selected software is missing one or more required files. " + mame_machine_manager::instance()->ui().draw_text_box(container, _("The selected software is missing one or more required files. " "Please select a different software.\n\nPress any key to continue."), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); @@ -504,8 +505,8 @@ void ui_menu_select_software::populate() item_append(MENU_SEPARATOR_ITEM, nullptr, flags_ui, nullptr); // configure the custom rendering - customtop = 4.0f * machine().ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; - custombottom = 5.0f * machine().ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; + customtop = 4.0f * mame_machine_manager::instance()->ui().get_line_height() + 5.0f * UI_BOX_TB_BORDER; + custombottom = 5.0f * mame_machine_manager::instance()->ui().get_line_height() + 4.0f * UI_BOX_TB_BORDER; if (old_software != -1) { @@ -666,7 +667,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float { ui_software_info *swinfo = (selectedref != nullptr) ? (ui_software_info *)selectedref : ((m_prev_selected != nullptr) ? (ui_software_info *)m_prev_selected : nullptr); const game_driver *driver = nullptr; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float width; std::string tempbuf[5], filtered; rgb_t color = UI_BACKGROUND_COLOR; @@ -737,7 +738,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float if (driver != nullptr) { - isstar = machine().favorite().isgame_favorite(driver); + isstar = mame_machine_manager::instance()->favorite().isgame_favorite(driver); // first line is game description tempbuf[0] = string_format(_("%1$-.100s"), driver->description); @@ -787,7 +788,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float else if (swinfo != nullptr) { - isstar = machine().favorite().isgame_favorite(*swinfo); + isstar = mame_machine_manager::instance()->favorite().isgame_favorite(*swinfo); // first line is long name tempbuf[0] = string_format(_("%1$-.100s"), swinfo->longname.c_str()); @@ -883,7 +884,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float { mui.draw_text_full(container, elem.c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_NEVER, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr, text_size); - y1 += machine().ui().get_line_height(); + y1 += mame_machine_manager::instance()->ui().get_line_height(); } } @@ -894,7 +895,7 @@ void ui_menu_select_software::custom_render(void *selectedref, float top, float void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) { ui_software_info *ui_swinfo = (ui_software_info *)m_event->itemref; - ui_options &mopt = machine().ui().options(); + ui_options &mopt = mame_machine_manager::instance()->ui().options(); if (ui_swinfo->startempty == 1) { @@ -907,7 +908,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) reselect_last::software = "[Start empty]"; reselect_last::swlist.clear(); reselect_last::set(true); - machine().manager().schedule_new_driver(*ui_swinfo->driver); + mame_machine_manager::instance()->schedule_new_driver(*ui_swinfo->driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -957,7 +958,7 @@ void ui_menu_select_software::inkey_select(const ui_menu_event *m_event) reselect_last::software = ui_swinfo->shortname; reselect_last::swlist = ui_swinfo->listname; reselect_last::set(true); - machine().manager().schedule_new_driver(drivlist.driver()); + mame_machine_manager::instance()->schedule_new_driver(drivlist.driver()); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -1058,7 +1059,7 @@ void ui_menu_select_software::inkey_configure(const ui_menu_event *m_event) void ui_menu_select_software::load_sw_custom_filters() { // attempt to open the output file - emu_file file(machine().ui().options().ui_path(), OPEN_FLAG_READ); + emu_file file(mame_machine_manager::instance()->ui().options().ui_path(), OPEN_FLAG_READ); if (file.open("custom_", m_driver->name, "_filter.ini") == osd_file::error::NONE) { char buffer[MAX_CHAR_INFO]; @@ -1388,7 +1389,7 @@ void ui_menu_select_software::build_custom() float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, float y2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); if (ui_globals::panels_status == SHOW_PANELS || ui_globals::panels_status == HIDE_RIGHT_PANEL) { @@ -1548,12 +1549,12 @@ float ui_menu_select_software::draw_left_panel(float x1, float y1, float x2, flo void ui_menu_select_software::infos_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); static std::string buffer; std::vector<int> xstart; std::vector<int> xend; - float text_size = machine().ui().options().infos_size(); + float text_size = mame_machine_manager::instance()->ui().options().infos_size(); ui_software_info *soft = (selectedref != nullptr) ? (ui_software_info *)selectedref : ((m_prev_selected != nullptr) ? (ui_software_info *)m_prev_selected : nullptr); static ui_software_info *oldsoft = nullptr; static int old_sw_view = -1; @@ -1638,9 +1639,9 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa if (ui_globals::cur_sw_dats_view == 0) { if (soft->startempty == 1) - machine().datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); + mame_machine_manager::instance()->datfile().load_data_info(soft->driver, buffer, UI_HISTORY_LOAD); else - machine().datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); + mame_machine_manager::instance()->datfile().load_software_info(soft->listname, buffer, soft->shortname, soft->parentname); } else buffer = soft->usage; @@ -1692,7 +1693,7 @@ void ui_menu_select_software::infos_render(void *selectedref, float origx1, floa void ui_menu_select_software::arts_render(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); float line_height = mui.get_line_height(); static ui_software_info *oldsoft = nullptr; static const game_driver *olddriver = nullptr; @@ -1878,7 +1879,7 @@ void ui_menu_select_software::arts_render(void *selectedref, float origx1, float void ui_menu_select_software::draw_right_panel(void *selectedref, float origx1, float origy1, float origx2, float origy2) { - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); rgb_t fgcolor = UI_TEXT_COLOR; bool hide = (ui_globals::panels_status == HIDE_RIGHT_PANEL || ui_globals::panels_status == HIDE_BOTH); float x2 = (hide) ? origx2 : origx1 + 2.0f * UI_BOX_LR_BORDER; @@ -1943,7 +1944,7 @@ void ui_software_parts::populate() item_append(elem.first.c_str(), elem.second.c_str(), 0, (void *)&elem); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); + customtop = mame_machine_manager::instance()->ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); } //------------------------------------------------- @@ -1970,7 +1971,7 @@ void ui_software_parts::handle() std::string snap_list = std::string(m_uiinfo->listname).append("/").append(m_uiinfo->shortname); machine().options().set_value(OPTION_SNAPNAME, snap_list.c_str(), OPTION_PRIORITY_CMDLINE, error_string); - machine().manager().schedule_new_driver(*m_uiinfo->driver); + mame_machine_manager::instance()->schedule_new_driver(*m_uiinfo->driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -1983,7 +1984,7 @@ void ui_software_parts::handle() void ui_software_parts::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Software part selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; @@ -2038,7 +2039,7 @@ void ui_bios_selection::populate() item_append(elem.first.c_str(), nullptr, 0, (void *)&elem.first); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); + customtop = mame_machine_manager::instance()->ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); } //------------------------------------------------- @@ -2069,7 +2070,7 @@ void ui_bios_selection::handle() std::string error; moptions.set_value(OPTION_BIOS, elem.second, OPTION_PRIORITY_CMDLINE, error); - machine().manager().schedule_new_driver(*s_driver); + mame_machine_manager::instance()->schedule_new_driver(*s_driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -2082,7 +2083,7 @@ void ui_bios_selection::handle() drivlist.next(); software_list_device *swlist = software_list_device::find_by_name(drivlist.config(), ui_swinfo->listname.c_str()); software_info *swinfo = swlist->find(ui_swinfo->shortname.c_str()); - if (!machine().ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) + if (!mame_machine_manager::instance()->ui().options().skip_parts_menu() && swinfo->has_multiple_parts(ui_swinfo->interface.c_str())) { s_parts parts; for (const software_part &swpart : swinfo->parts()) @@ -2107,7 +2108,7 @@ void ui_bios_selection::handle() reselect_last::software = ui_swinfo->shortname; reselect_last::swlist = ui_swinfo->listname; reselect_last::set(true); - machine().manager().schedule_new_driver(drivlist.driver()); + mame_machine_manager::instance()->schedule_new_driver(drivlist.driver()); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -2121,7 +2122,7 @@ void ui_bios_selection::handle() void ui_bios_selection::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Bios selection:"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; diff --git a/src/emu/ui/selsoft.h b/src/frontend/mame/ui/selsoft.h index 64ce0ac4cdb..64ce0ac4cdb 100644 --- a/src/emu/ui/selsoft.h +++ b/src/frontend/mame/ui/selsoft.h diff --git a/src/emu/ui/simpleselgame.cpp b/src/frontend/mame/ui/simpleselgame.cpp index 73575a21026..16818ea2c8c 100644 --- a/src/emu/ui/simpleselgame.cpp +++ b/src/frontend/mame/ui/simpleselgame.cpp @@ -9,6 +9,7 @@ ***************************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "ui/ui.h" #include "ui/menu.h" @@ -128,7 +129,7 @@ void ui_simple_menu_select_game::handle() // if we're in an error state, overlay an error message if (m_error) - machine().ui().draw_text_box(container, + mame_machine_manager::instance()->ui().draw_text_box(container, "The selected game is missing one or more required ROM or CHD images. " "Please select a different game.\n\nPress any key to continue.", JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); @@ -158,7 +159,7 @@ void ui_simple_menu_select_game::inkey_select(const ui_menu_event *menu_event) // if everything looks good, schedule the new driver if (summary == media_auditor::CORRECT || summary == media_auditor::BEST_AVAILABLE || summary == media_auditor::NONE_NEEDED) { - machine().manager().schedule_new_driver(*driver); + mame_machine_manager::instance()->schedule_new_driver(*driver); machine().schedule_hard_reset(); ui_menu::stack_reset(machine()); } @@ -267,8 +268,8 @@ void ui_simple_menu_select_game::populate() } // configure the custom rendering - customtop = machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; - custombottom = 4.0f * machine().ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + customtop = mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; + custombottom = 4.0f * mame_machine_manager::instance()->ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER; } @@ -292,7 +293,7 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo tempbuf[0] = _("Type name or select: (random)"); // get the size of the text - machine().ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + mame_machine_manager::instance()->ui().draw_text_full(container, tempbuf[0].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(width, origx2 - origx1); @@ -304,7 +305,7 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo y2 = origy1 - UI_BOX_TB_BORDER; // draw a box - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); // take off the borders x1 += UI_BOX_LR_BORDER; @@ -312,7 +313,7 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo y1 += UI_BOX_TB_BORDER; // draw the text within it - machine().ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + mame_machine_manager::instance()->ui().draw_text_full(container, tempbuf[0].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); // determine the text to render below @@ -382,7 +383,7 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo maxwidth = origx2 - origx1; for (line = 0; line < 4; line++) { - machine().ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, + mame_machine_manager::instance()->ui().draw_text_full(container, tempbuf[line].c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; maxwidth = MAX(maxwidth, width); @@ -402,7 +403,7 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo color = UI_YELLOW_COLOR; if (driver != nullptr && (driver->flags & (MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION)) != 0) color = UI_RED_COLOR; - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, color); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x2, y2, color); // take off the borders x1 += UI_BOX_LR_BORDER; @@ -412,9 +413,9 @@ void ui_simple_menu_select_game::custom_render(void *selectedref, float top, flo // draw all lines for (line = 0; line < 4; line++) { - machine().ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, + mame_machine_manager::instance()->ui().draw_text_full(container, tempbuf[line].c_str(), x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); - y1 += machine().ui().get_line_height(); + y1 += mame_machine_manager::instance()->ui().get_line_height(); } } @@ -438,7 +439,7 @@ void ui_simple_menu_select_game::force_game_select(running_machine &machine, ren ui_menu::stack_push(global_alloc_clear<ui_simple_menu_select_game>(machine, container, gamename)); // force the menus on - machine.ui().show_menu(); + mame_machine_manager::instance()->ui().show_menu(); // make sure MAME is paused machine.pause(); diff --git a/src/emu/ui/simpleselgame.h b/src/frontend/mame/ui/simpleselgame.h index 316e3747b2f..316e3747b2f 100644 --- a/src/emu/ui/simpleselgame.h +++ b/src/frontend/mame/ui/simpleselgame.h diff --git a/src/emu/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp index 53869500eb0..8ec21b8894c 100644 --- a/src/emu/ui/sliders.cpp +++ b/src/frontend/mame/ui/sliders.cpp @@ -140,7 +140,7 @@ void ui_menu_sliders::populate() std::string tempstring; /* add UI sliders */ - std::vector<ui_menu_item> ui_sliders = machine().ui().get_slider_list(); + std::vector<ui_menu_item> ui_sliders = mame_machine_manager::instance()->ui().get_slider_list(); for (ui_menu_item item : ui_sliders) { if (item.type == ui_menu_item_type::SLIDER) @@ -183,7 +183,7 @@ void ui_menu_sliders::populate() } } - custombottom = 2.0f * machine().ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; + custombottom = 2.0f * mame_machine_manager::instance()->ui().get_line_height() + 2.0f * UI_BOX_TB_BORDER; } /*------------------------------------------------- @@ -197,7 +197,7 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, if (curslider != nullptr) { float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x; - float line_height = machine().ui().get_line_height(); + float line_height = mame_machine_manager::instance()->ui().get_line_height(); float percentage, default_percentage; std::string tempstring; float text_height; @@ -220,11 +220,11 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, x2 = 1.0f - UI_BOX_LR_BORDER; /* draw extra menu area */ - machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR); y1 += UI_BOX_TB_BORDER; /* determine the text height */ - machine().ui().draw_text_full(container, tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, + mame_machine_manager::instance()->ui().draw_text_full(container, tempstring.c_str(), 0, 0, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, nullptr, &text_height); /* draw the thermometer */ @@ -251,7 +251,7 @@ void ui_menu_sliders::custom_render(void *selectedref, float top, float bottom, container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); /* draw the actual text */ - machine().ui().draw_text_full(container, tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, + mame_machine_manager::instance()->ui().draw_text_full(container, tempstring.c_str(), x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, JUSTIFY_CENTER, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, &text_height); } } diff --git a/src/emu/ui/sliders.h b/src/frontend/mame/ui/sliders.h index f420b094cbe..f420b094cbe 100644 --- a/src/emu/ui/sliders.h +++ b/src/frontend/mame/ui/sliders.h diff --git a/src/emu/ui/slotopt.cpp b/src/frontend/mame/ui/slotopt.cpp index 9b6afa92132..9b6afa92132 100644 --- a/src/emu/ui/slotopt.cpp +++ b/src/frontend/mame/ui/slotopt.cpp diff --git a/src/emu/ui/slotopt.h b/src/frontend/mame/ui/slotopt.h index 8d7c4ab6b18..8d7c4ab6b18 100644 --- a/src/emu/ui/slotopt.h +++ b/src/frontend/mame/ui/slotopt.h diff --git a/src/emu/ui/sndmenu.cpp b/src/frontend/mame/ui/sndmenu.cpp index 2bdb835f09b..58362585dc2 100644 --- a/src/emu/ui/sndmenu.cpp +++ b/src/frontend/mame/ui/sndmenu.cpp @@ -135,7 +135,7 @@ void ui_menu_sound_options::populate() item_append(_("Use External Samples"), m_samples ? _("On") : _("Off"), m_samples ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)(FPTR)ENABLE_SAMPLES); item_append(ui_menu_item_type::SEPARATOR); - customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); + customtop = mame_machine_manager::instance()->ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); } //------------------------------------------------- @@ -145,7 +145,7 @@ void ui_menu_sound_options::populate() void ui_menu_sound_options::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _("Sound Options"), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); width += 2 * UI_BOX_LR_BORDER; diff --git a/src/emu/ui/sndmenu.h b/src/frontend/mame/ui/sndmenu.h index 24bb0a79277..24bb0a79277 100644 --- a/src/emu/ui/sndmenu.h +++ b/src/frontend/mame/ui/sndmenu.h diff --git a/src/emu/ui/starimg.h b/src/frontend/mame/ui/starimg.h index f57ebb8797f..f57ebb8797f 100644 --- a/src/emu/ui/starimg.h +++ b/src/frontend/mame/ui/starimg.h diff --git a/src/emu/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index ae85db7d7a8..68b8d85d36a 100644 --- a/src/emu/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -85,8 +85,8 @@ ui_submenu::ui_submenu(running_machine &machine, render_container *container, st } break; case ui_submenu::UI: - sm_option.entry = machine.ui().options().get_entry(sm_option.name); - sm_option.options = dynamic_cast<core_options*>(&machine.ui().options()); + sm_option.entry = mame_machine_manager::instance()->ui().options().get_entry(sm_option.name); + sm_option.options = dynamic_cast<core_options*>(&mame_machine_manager::instance()->ui().options()); break; default: continue; @@ -300,7 +300,7 @@ void ui_submenu::populate() } item_append(ui_menu_item_type::SEPARATOR); - custombottom = customtop = machine().ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); + custombottom = customtop = mame_machine_manager::instance()->ui().get_line_height() + (3.0f * UI_BOX_TB_BORDER); } //------------------------------------------------- @@ -310,7 +310,7 @@ void ui_submenu::populate() void ui_submenu::custom_render(void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) { float width; - ui_manager &mui = machine().ui(); + mame_ui_manager &mui = mame_machine_manager::instance()->ui(); mui.draw_text_full(container, _(m_options[0].description), 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, nullptr); diff --git a/src/emu/ui/submenu.h b/src/frontend/mame/ui/submenu.h index 8168ab4bb7a..8168ab4bb7a 100644 --- a/src/emu/ui/submenu.h +++ b/src/frontend/mame/ui/submenu.h diff --git a/src/emu/ui/swlist.cpp b/src/frontend/mame/ui/swlist.cpp index c8100b44b86..915c11239b9 100644 --- a/src/emu/ui/swlist.cpp +++ b/src/frontend/mame/ui/swlist.cpp @@ -286,7 +286,7 @@ void ui_menu_software_list::handle() update_selected = true; if (ARRAY_LENGTH(m_filename_buffer) > 0) - machine().ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); + mame_machine_manager::instance()->ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); } // if it's any other key and we're not maxed out, update else if (event->unichar >= ' ' && event->unichar < 0x7f) @@ -296,7 +296,7 @@ void ui_menu_software_list::handle() update_selected = true; if (ARRAY_LENGTH(m_filename_buffer) > 0) - machine().ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); + mame_machine_manager::instance()->ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer); } if (update_selected) diff --git a/src/emu/ui/swlist.h b/src/frontend/mame/ui/swlist.h index 253eeb6e7c8..253eeb6e7c8 100644 --- a/src/emu/ui/swlist.h +++ b/src/frontend/mame/ui/swlist.h diff --git a/src/emu/ui/tapectrl.cpp b/src/frontend/mame/ui/tapectrl.cpp index 510d0eb3fb3..510d0eb3fb3 100644 --- a/src/emu/ui/tapectrl.cpp +++ b/src/frontend/mame/ui/tapectrl.cpp diff --git a/src/emu/ui/tapectrl.h b/src/frontend/mame/ui/tapectrl.h index 9cfa1316a99..9cfa1316a99 100644 --- a/src/emu/ui/tapectrl.h +++ b/src/frontend/mame/ui/tapectrl.h diff --git a/src/emu/ui/toolbar.h b/src/frontend/mame/ui/toolbar.h index 93ee1e3467b..93ee1e3467b 100644 --- a/src/emu/ui/toolbar.h +++ b/src/frontend/mame/ui/toolbar.h diff --git a/src/emu/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 65d1711a4e0..173eff6ad9c 100644 --- a/src/emu/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -9,6 +9,7 @@ *********************************************************************/ #include "emu.h" +#include "mame.h" #include "emuopts.h" #include "mameopts.h" #include "video/vector.h" @@ -114,13 +115,13 @@ static const char *s_color_list[] = { ***************************************************************************/ // messagebox buffer -std::string ui_manager::messagebox_text; -std::string ui_manager::messagebox_poptext; -rgb_t ui_manager::messagebox_backcolor; +std::string mame_ui_manager::messagebox_text; +std::string mame_ui_manager::messagebox_poptext; +rgb_t mame_ui_manager::messagebox_backcolor; // slider info -std::vector<ui_menu_item> ui_manager::slider_list; -slider_state *ui_manager::slider_current; +std::vector<ui_menu_item> mame_ui_manager::slider_list; +slider_state *mame_ui_manager::slider_current; /*************************************************************************** @@ -172,7 +173,7 @@ static void load_ui_options(running_machine &machine) emu_file file(machine.options().ini_path(), OPEN_FLAG_READ); if (file.open("ui.ini") == osd_file::error::NONE) { - bool result = machine.ui().options().parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); + bool result = mame_machine_manager::instance()->ui().options().parse_ini_file((util::core_file&)file, OPTION_PRIORITY_MAME_INI, OPTION_PRIORITY_DRIVER_INI, error); if (!result) osd_printf_error("**Error loading ui.ini**"); } @@ -264,12 +265,12 @@ static const UINT32 mouse_bitmap[32*32] = // ctor - set up the user interface //------------------------------------------------- -ui_manager::ui_manager(running_machine &machine) - : m_machine(machine) +mame_ui_manager::mame_ui_manager(running_machine &machine) + : ui_manager(machine) { } -void ui_manager::init() +void mame_ui_manager::init() { load_ui_options(machine()); // initialize the other UI bits @@ -285,10 +286,7 @@ void ui_manager::init() m_showfps_end = 0; m_show_profiler = false; m_popup_text_end = 0; - m_use_natural_keyboard = false; m_mouse_arrow_texture = nullptr; - m_show_timecode_counter = false; - m_show_timecode_total = false; m_load_save_hold = false; get_font_rows(&machine()); @@ -300,7 +298,7 @@ void ui_manager::init() m_mouse_show = machine().system().flags & MACHINE_CLICKABLE_ARTWORK ? true : false; // request a callback upon exiting - machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_manager::exit), this)); + machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(mame_ui_manager::exit), this)); // retrieve options m_use_natural_keyboard = machine().options().natural_keyboard(); @@ -316,7 +314,7 @@ void ui_manager::init() // exit - clean up ourselves on exit //------------------------------------------------- -void ui_manager::exit() +void mame_ui_manager::exit() { // free the mouse texture machine().render().texture_free(m_mouse_arrow_texture); @@ -335,7 +333,7 @@ void ui_manager::exit() // initialize - initialize ui lists //------------------------------------------------- -void ui_manager::initialize(running_machine &machine) +void mame_ui_manager::initialize(running_machine &machine) { // initialize the on-screen display system slider_list = slider_init(machine); @@ -355,7 +353,7 @@ void ui_manager::initialize(running_machine &machine) // pair for the current UI handler //------------------------------------------------- -UINT32 ui_manager::set_handler(ui_callback callback, UINT32 param) +UINT32 mame_ui_manager::set_handler(ui_callback callback, UINT32 param) { m_handler_callback = callback; m_handler_param = param; @@ -368,7 +366,7 @@ UINT32 ui_manager::set_handler(ui_callback callback, UINT32 param) // various startup screens //------------------------------------------------- -void ui_manager::display_startup_screens(bool first_time) +void mame_ui_manager::display_startup_screens(bool first_time) { const int maxstate = 3; int str = machine().options().seconds_to_run(); @@ -448,7 +446,7 @@ void ui_manager::display_startup_screens(bool first_time) // at startup //------------------------------------------------- -void ui_manager::set_startup_text(const char *text, bool force) +void mame_ui_manager::set_startup_text(const char *text, bool force) { static osd_ticks_t lastupdatetime = 0; osd_ticks_t curtime = osd_ticks(); @@ -471,7 +469,7 @@ void ui_manager::set_startup_text(const char *text, bool force) // render it; called by video.c //------------------------------------------------- -void ui_manager::update_and_render(render_container *container) +void mame_ui_manager::update_and_render(render_container *container) { // always start clean container->empty(); @@ -491,8 +489,8 @@ void ui_manager::update_and_render(render_container *container) // render any cheat stuff at the bottom if (machine().phase() >= MACHINE_PHASE_RESET) { - machine().manager().lua()->on_frame_done(); - machine().cheat().render_text(*container); + mame_machine_manager::instance()->lua()->on_frame_done(); + mame_machine_manager::instance()->cheat().render_text(*container); } // call the current UI handler @@ -517,7 +515,7 @@ void ui_manager::update_and_render(render_container *container) float mouse_y=-1,mouse_x=-1; if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *container, mouse_x, mouse_y)) { - const float cursor_size = 0.6 * machine().ui().get_line_height(); + const float cursor_size = 0.6 * mame_machine_manager::instance()->ui().get_line_height(); container->add_quad(mouse_x, mouse_y, mouse_x + cursor_size*container->manager().ui_aspect(container), mouse_y + cursor_size, UI_TEXT_COLOR, m_mouse_arrow_texture, PRIMFLAG_ANTIALIAS(1) | PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } } @@ -533,7 +531,7 @@ void ui_manager::update_and_render(render_container *container) // get_font - return the UI font //------------------------------------------------- -render_font *ui_manager::get_font() +render_font *mame_ui_manager::get_font() { // allocate the font and messagebox string if (m_font == nullptr) @@ -547,7 +545,7 @@ render_font *ui_manager::get_font() // of a line //------------------------------------------------- -float ui_manager::get_line_height() +float mame_ui_manager::get_line_height() { INT32 raw_font_pixel_height = get_font()->pixel_height(); render_target &ui_target = machine().render().ui_target(); @@ -592,7 +590,7 @@ float ui_manager::get_line_height() // single character //------------------------------------------------- -float ui_manager::get_char_width(unicode_char ch) +float mame_ui_manager::get_char_width(unicode_char ch) { return get_font()->char_width(get_line_height(), machine().render().ui_aspect(), ch); } @@ -603,7 +601,7 @@ float ui_manager::get_char_width(unicode_char ch) // character string //------------------------------------------------- -float ui_manager::get_string_width(const char *s, float text_size) +float mame_ui_manager::get_string_width(const char *s, float text_size) { return get_font()->utf8string_width(get_line_height() * text_size, machine().render().ui_aspect(), s); } @@ -615,7 +613,7 @@ float ui_manager::get_string_width(const char *s, float text_size) // color //------------------------------------------------- -void ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor) +void mame_ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor) { draw_outlined_box(container, x0, y0, x1, y1, UI_BORDER_COLOR, backcolor); } @@ -627,7 +625,7 @@ void ui_manager::draw_outlined_box(render_container *container, float x0, float // color //------------------------------------------------- -void ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor) +void mame_ui_manager::draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t fgcolor, rgb_t bgcolor) { container->add_rect(x0, y0, x1, y1, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, fgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -641,7 +639,7 @@ void ui_manager::draw_outlined_box(render_container *container, float x0, float // draw_text - simple text renderer //------------------------------------------------- -void ui_manager::draw_text(render_container *container, const char *buf, float x, float y) +void mame_ui_manager::draw_text(render_container *container, const char *buf, float x, float y) { draw_text_full(container, buf, x, y, 1.0f - x, JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, nullptr, nullptr); } @@ -653,7 +651,7 @@ void ui_manager::draw_text(render_container *container, const char *buf, float x // and full size computation //------------------------------------------------- -void ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size) +void mame_ui_manager::draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight, float text_size) { float lineheight = get_line_height() * text_size; const char *ends = origs + strlen(origs); @@ -861,7 +859,7 @@ void ui_manager::draw_text_full(render_container *container, const char *origs, // message with a box around it //------------------------------------------------- -void ui_manager::draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor) +void mame_ui_manager::draw_text_box(render_container *container, const char *text, int justify, float xpos, float ypos, rgb_t backcolor) { float line_height = get_line_height(); float max_width = 2.0f * ((xpos <= 0.5f) ? xpos : 1.0f - xpos) - 2.0f * UI_BOX_LR_BORDER; @@ -914,7 +912,7 @@ void ui_manager::draw_text_box(render_container *container, const char *text, in // message with a box around it //------------------------------------------------- -void ui_manager::draw_message_window(render_container *container, const char *text) +void mame_ui_manager::draw_message_window(render_container *container, const char *text) { draw_text_box(container, text, JUSTIFY_LEFT, 0.5f, 0.5f, UI_BACKGROUND_COLOR); } @@ -925,7 +923,7 @@ void ui_manager::draw_message_window(render_container *container, const char *te // a specific period of time //------------------------------------------------- -void ui_manager::show_fps_temp(double seconds) +void mame_ui_manager::show_fps_temp(double seconds) { if (!m_showfps) m_showfps_end = osd_ticks() + seconds * osd_ticks_per_second(); @@ -936,7 +934,7 @@ void ui_manager::show_fps_temp(double seconds) // set_show_fps - show/hide the FPS counter //------------------------------------------------- -void ui_manager::set_show_fps(bool show) +void mame_ui_manager::set_show_fps(bool show) { m_showfps = show; if (!show) @@ -952,7 +950,7 @@ void ui_manager::set_show_fps(bool show) // counter visibility state //------------------------------------------------- -bool ui_manager::show_fps() const +bool mame_ui_manager::show_fps() const { return m_showfps || (m_showfps_end != 0); } @@ -962,7 +960,7 @@ bool ui_manager::show_fps() const // show_fps_counter //------------------------------------------------- -bool ui_manager::show_fps_counter() +bool mame_ui_manager::show_fps_counter() { bool result = m_showfps || osd_ticks() < m_showfps_end; if (!result) @@ -975,7 +973,7 @@ bool ui_manager::show_fps_counter() // set_show_profiler - show/hide the profiler //------------------------------------------------- -void ui_manager::set_show_profiler(bool show) +void mame_ui_manager::set_show_profiler(bool show) { m_show_profiler = show; g_profiler.enable(show); @@ -987,7 +985,7 @@ void ui_manager::set_show_profiler(bool show) // profiler visibility state //------------------------------------------------- -bool ui_manager::show_profiler() const +bool mame_ui_manager::show_profiler() const { return m_show_profiler; } @@ -997,7 +995,7 @@ bool ui_manager::show_profiler() const // show_menu - show the menus //------------------------------------------------- -void ui_manager::show_menu() +void mame_ui_manager::show_menu() { set_handler(ui_menu::ui_handler, 0); } @@ -1007,7 +1005,7 @@ void ui_manager::show_menu() // show_mouse - change mouse status //------------------------------------------------- -void ui_manager::show_mouse(bool status) +void mame_ui_manager::show_mouse(bool status) { m_mouse_show = status; } @@ -1018,23 +1016,12 @@ void ui_manager::show_mouse(bool status) // UI handler is active //------------------------------------------------- -bool ui_manager::is_menu_active(void) +bool mame_ui_manager::is_menu_active(void) { return (m_handler_callback == ui_menu::ui_handler); } -bool ui_manager::show_timecode_counter() -{ - return m_show_timecode_counter; -} -bool ui_manager::show_timecode_total() -{ - return m_show_timecode_total; -} - - - /*************************************************************************** TEXT GENERATORS ***************************************************************************/ @@ -1044,7 +1031,7 @@ bool ui_manager::show_timecode_total() // text to the given buffer //------------------------------------------------- -std::string &ui_manager::warnings_string(std::string &str) +std::string &mame_ui_manager::warnings_string(std::string &str) { #define WARNING_FLAGS ( MACHINE_NOT_WORKING | \ MACHINE_UNEMULATED_PROTECTION | \ @@ -1175,7 +1162,7 @@ std::string &ui_manager::warnings_string(std::string &str) // string with the game info text //------------------------------------------------- -std::string &ui_manager::game_info_astring(std::string &str) +std::string &mame_ui_manager::game_info_astring(std::string &str) { std::ostringstream buf; @@ -1298,9 +1285,9 @@ std::string &ui_manager::game_info_astring(std::string &str) // messagebox_text string but handles no input //------------------------------------------------- -UINT32 ui_manager::handler_messagebox(running_machine &machine, render_container *container, UINT32 state) +UINT32 mame_ui_manager::handler_messagebox(running_machine &machine, render_container *container, UINT32 state) { - machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); + mame_machine_manager::instance()->ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); return 0; } @@ -1311,10 +1298,10 @@ UINT32 ui_manager::handler_messagebox(running_machine &machine, render_container // any keypress //------------------------------------------------- -UINT32 ui_manager::handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state) +UINT32 mame_ui_manager::handler_messagebox_anykey(running_machine &machine, render_container *container, UINT32 state) { // draw a standard message window - machine.ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); + mame_machine_manager::instance()->ui().draw_text_box(container, messagebox_text.c_str(), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor); // if the user cancels, exit out completely if (machine.ui_input().pressed(IPT_UI_CANCEL)) @@ -1336,7 +1323,7 @@ UINT32 ui_manager::handler_messagebox_anykey(running_machine &machine, render_co // natural keyboard input //------------------------------------------------- -void ui_manager::process_natural_keyboard() +void mame_ui_manager::process_natural_keyboard() { ui_event event; int i, pressed; @@ -1388,7 +1375,7 @@ void ui_manager::process_natural_keyboard() // increase_frameskip //------------------------------------------------- -void ui_manager::increase_frameskip() +void mame_ui_manager::increase_frameskip() { // get the current value and increment it int newframeskip = machine().video().frameskip() + 1; @@ -1397,7 +1384,7 @@ void ui_manager::increase_frameskip() machine().video().set_frameskip(newframeskip); // display the FPS counter for 2 seconds - machine().ui().show_fps_temp(2.0); + mame_machine_manager::instance()->ui().show_fps_temp(2.0); } @@ -1405,7 +1392,7 @@ void ui_manager::increase_frameskip() // decrease_frameskip //------------------------------------------------- -void ui_manager::decrease_frameskip() +void mame_ui_manager::decrease_frameskip() { // get the current value and decrement it int newframeskip = machine().video().frameskip() - 1; @@ -1414,7 +1401,7 @@ void ui_manager::decrease_frameskip() machine().video().set_frameskip(newframeskip); // display the FPS counter for 2 seconds - machine().ui().show_fps_temp(2.0); + mame_machine_manager::instance()->ui().show_fps_temp(2.0); } @@ -1422,7 +1409,7 @@ void ui_manager::decrease_frameskip() // can_paste //------------------------------------------------- -bool ui_manager::can_paste() +bool mame_ui_manager::can_paste() { // retrieve the clipboard text char *text = osd_get_clipboard_text(); @@ -1440,7 +1427,7 @@ bool ui_manager::can_paste() // paste - does a paste from the keyboard //------------------------------------------------- -void ui_manager::paste() +void mame_ui_manager::paste() { // retrieve the clipboard text char *text = osd_get_clipboard_text(); @@ -1462,7 +1449,7 @@ void ui_manager::paste() // callback function for each image device //------------------------------------------------- -void ui_manager::image_handler_ingame() +void mame_ui_manager::image_handler_ingame() { // run display routine for devices if (machine().phase() == MACHINE_PHASE_RUNNING) @@ -1471,48 +1458,97 @@ void ui_manager::image_handler_ingame() } +#define ANIMATION_FPS 1 +#define ANIMATION_FRAMES 4 + +void mame_ui_manager::image_display(const device_type &type, device_image_interface *image) +{ + if (type == CASSETTE) + { + cassette_image_device *cass = dynamic_cast<cassette_image_device *>(image); + if (cass != nullptr) + { + char buf[65]; + float x, y; + int n; + double position, length; + cassette_state uistate; + static const UINT8 shapes[8] = { 0x2d, 0x5c, 0x7c, 0x2f, 0x2d, 0x20, 0x20, 0x20 }; + + /* figure out where we are in the cassette */ + position = cass->get_position(); + length = cass->get_length(); + uistate = (cassette_state)(cass->get_state() & CASSETTE_MASK_UISTATE); + + /* choose a location on the screen */ + x = 0.2f; + y = 0.5f; + + y += cassette_device_iterator(machine().root_device()).indexof(*cass); + + y *= get_line_height() + 2.0f * UI_BOX_TB_BORDER; + /* choose which frame of the animation we are at */ + n = ((int)position / ANIMATION_FPS) % ANIMATION_FRAMES; + /* Since you can have anything in a BDF file, we will use crude ascii characters instead */ + snprintf(buf, ARRAY_LENGTH(buf), "%c%c %c %02d:%02d (%04d) [%02d:%02d (%04d)]", + shapes[n], /* cassette icon left */ + shapes[n | 4], /* cassette icon right */ + (uistate == CASSETTE_PLAY) ? 0x50 : 0x52, /* play (P) or record (R) */ + ((int)position / 60), + ((int)position % 60), + (int)position, + ((int)length / 60), + ((int)length % 60), + (int)length); + + // draw the cassette + draw_text_box(&machine().render().ui_container(), buf, JUSTIFY_LEFT, x, y, UI_BACKGROUND_COLOR); + } + } +} + //------------------------------------------------- // handler_ingame - in-game handler takes care // of the standard keypresses //------------------------------------------------- -UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *container, UINT32 state) +UINT32 mame_ui_manager::handler_ingame(running_machine &machine, render_container *container, UINT32 state) { bool is_paused = machine.paused(); // first draw the FPS counter - if (machine.ui().show_fps_counter()) + if (mame_machine_manager::instance()->ui().show_fps_counter()) { - machine.ui().draw_text_full(container, machine.video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, + mame_machine_manager::instance()->ui().draw_text_full(container, machine.video().speed_text().c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } // Show the duration of current part (intro or gameplay or extra) - if (machine.ui().show_timecode_counter()) { + if (mame_machine_manager::instance()->ui().show_timecode_counter()) { std::string tempstring; - machine.ui().draw_text_full(container, machine.video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + mame_machine_manager::instance()->ui().draw_text_full(container, machine.video().timecode_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_RIGHT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0xf0,0x10,0x10), ARGB_BLACK, NULL, NULL); } // Show the total time elapsed for the video preview (all parts intro, gameplay, extras) - if (machine.ui().show_timecode_total()) { + if (mame_machine_manager::instance()->ui().show_timecode_total()) { std::string tempstring; - machine.ui().draw_text_full(container, machine.video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, + mame_machine_manager::instance()->ui().draw_text_full(container, machine.video().timecode_total_text(tempstring).c_str(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, rgb_t(0xf0,0x10,0xf0,0x10), ARGB_BLACK, NULL, NULL); } // draw the profiler if visible - if (machine.ui().show_profiler()) + if (mame_machine_manager::instance()->ui().show_profiler()) { const char *text = g_profiler.text(machine); - machine.ui().draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); + mame_machine_manager::instance()->ui().draw_text_full(container, text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, nullptr, nullptr); } // if we're single-stepping, pause now - if (machine.ui().single_step()) + if (mame_machine_manager::instance()->ui().single_step()) { machine.pause(); - machine.ui().set_single_step(false); + mame_machine_manager::instance()->ui().set_single_step(false); } // determine if we should disable the rest of the UI @@ -1530,7 +1566,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // display a popup indicating the new status if (machine.ui_active()) { - machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", + mame_machine_manager::instance()->ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", _("Keyboard Emulation Status"), "-------------------------", _("Mode: PARTIAL Emulation"), @@ -1540,7 +1576,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co } else { - machine.ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", + mame_machine_manager::instance()->ui().popup_time(2, "%s\n%s\n%s\n%s\n%s\n%s\n", _("Keyboard Emulation Status"), "-------------------------", _("Mode: FULL Emulation"), @@ -1552,17 +1588,17 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co } // is the natural keyboard enabled? - if (machine.ui().use_natural_keyboard() && (machine.phase() == MACHINE_PHASE_RUNNING)) - machine.ui().process_natural_keyboard(); + if (mame_machine_manager::instance()->ui().use_natural_keyboard() && (machine.phase() == MACHINE_PHASE_RUNNING)) + mame_machine_manager::instance()->ui().process_natural_keyboard(); if (!ui_disabled) { // paste command if (machine.ui_input().pressed(IPT_UI_PASTE)) - machine.ui().paste(); + mame_machine_manager::instance()->ui().paste(); } - machine.ui().image_handler_ingame(); + mame_machine_manager::instance()->ui().image_handler_ingame(); // handle a save input timecode request if (machine.ui_input().pressed(IPT_UI_TIMECODE)) @@ -1572,17 +1608,17 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_CANCEL)) { - machine.ui().request_quit(); + mame_machine_manager::instance()->ui().request_quit(); return 0; } // turn on menus if requested if (machine.ui_input().pressed(IPT_UI_CONFIGURE)) - return machine.ui().set_handler(ui_menu::ui_handler, 0); + return mame_machine_manager::instance()->ui().set_handler(ui_menu::ui_handler, 0); // if the on-screen display isn't up and the user has toggled it, turn it on if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0 && machine.ui_input().pressed(IPT_UI_ON_SCREEN_DISPLAY)) - return machine.ui().set_handler(ui_menu_sliders::ui_handler, 1); + return mame_machine_manager::instance()->ui().set_handler(ui_menu_sliders::ui_handler, 1); // handle a reset request if (machine.ui_input().pressed(IPT_UI_RESET_MACHINE)) @@ -1595,7 +1631,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co { if (!is_paused) machine.pause(); - return machine.ui().set_handler(ui_gfx_ui_handler, is_paused); + return mame_machine_manager::instance()->ui().set_handler(ui_gfx_ui_handler, is_paused); } // handle a tape control key @@ -1620,16 +1656,16 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ui_input().pressed(IPT_UI_SAVE_STATE)) { machine.pause(); - machine.ui().m_load_save_hold = true; - return machine.ui().set_handler(handler_load_save, LOADSAVE_SAVE); + mame_machine_manager::instance()->ui().m_load_save_hold = true; + return mame_machine_manager::instance()->ui().set_handler(handler_load_save, LOADSAVE_SAVE); } // handle a load state request if (machine.ui_input().pressed(IPT_UI_LOAD_STATE)) { machine.pause(); - machine.ui().m_load_save_hold = true; - return machine.ui().set_handler(handler_load_save, LOADSAVE_LOAD); + mame_machine_manager::instance()->ui().m_load_save_hold = true; + return mame_machine_manager::instance()->ui().set_handler(handler_load_save, LOADSAVE_LOAD); } // handle a save snapshot request @@ -1643,13 +1679,13 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // pause single step if (machine.ui_input().pressed(IPT_UI_PAUSE_SINGLE)) { - machine.ui().set_single_step(true); + mame_machine_manager::instance()->ui().set_single_step(true); machine.resume(); } // handle a toggle cheats request if (machine.ui_input().pressed(IPT_UI_TOGGLE_CHEAT)) - machine.cheat().set_enable(!machine.cheat().enabled()); + mame_machine_manager::instance()->cheat().set_enable(!mame_machine_manager::instance()->cheat().enabled()); // toggle movie recording if (machine.ui_input().pressed(IPT_UI_RECORD_MOVIE)) @@ -1657,19 +1693,19 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // toggle profiler display if (machine.ui_input().pressed(IPT_UI_SHOW_PROFILER)) - machine.ui().set_show_profiler(!machine.ui().show_profiler()); + mame_machine_manager::instance()->ui().set_show_profiler(!mame_machine_manager::instance()->ui().show_profiler()); // toggle FPS display if (machine.ui_input().pressed(IPT_UI_SHOW_FPS)) - machine.ui().set_show_fps(!machine.ui().show_fps()); + mame_machine_manager::instance()->ui().set_show_fps(!mame_machine_manager::instance()->ui().show_fps()); // increment frameskip? if (machine.ui_input().pressed(IPT_UI_FRAMESKIP_INC)) - machine.ui().increase_frameskip(); + mame_machine_manager::instance()->ui().increase_frameskip(); // decrement frameskip? if (machine.ui_input().pressed(IPT_UI_FRAMESKIP_DEC)) - machine.ui().decrease_frameskip(); + mame_machine_manager::instance()->ui().decrease_frameskip(); // toggle throttle? if (machine.ui_input().pressed(IPT_UI_THROTTLE)) @@ -1694,7 +1730,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co if (machine.ioport().type_pressed(IPT_UI_FAST_FORWARD)) { machine.video().set_fastforward(true); - machine.ui().show_fps_temp(0.5); + mame_machine_manager::instance()->ui().show_fps_temp(0.5); } else machine.video().set_fastforward(false); @@ -1708,7 +1744,7 @@ UINT32 ui_manager::handler_ingame(running_machine &machine, render_container *co // specifying a game to save or load //------------------------------------------------- -UINT32 ui_manager::handler_load_save(running_machine &machine, render_container *container, UINT32 state) +UINT32 mame_ui_manager::handler_load_save(running_machine &machine, render_container *container, UINT32 state) { char filename[20]; char file = 0; @@ -1719,12 +1755,12 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container // okay, we're waiting for a key to select a slot; display a message if (state == LOADSAVE_SAVE) - machine.ui().draw_message_window(container, _("Select position to save to")); + mame_machine_manager::instance()->ui().draw_message_window(container, _("Select position to save to")); else - machine.ui().draw_message_window(container, _("Select position to load from")); + mame_machine_manager::instance()->ui().draw_message_window(container, _("Select position to load from")); // if load/save state sequence is still being pressed, do not read the filename yet - if (machine.ui().m_load_save_hold) { + if (mame_machine_manager::instance()->ui().m_load_save_hold) { bool seq_in_progress = false; const input_seq &load_save_seq = state == LOADSAVE_SAVE ? machine.ioport().type_seq(IPT_UI_SAVE_STATE) : @@ -1737,7 +1773,7 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container if (seq_in_progress) return state; else - machine.ui().m_load_save_hold = false; + mame_machine_manager::instance()->ui().m_load_save_hold = false; } // check for cancel key @@ -1812,7 +1848,7 @@ UINT32 ui_manager::handler_load_save(running_machine &machine, render_container // request_quit //------------------------------------------------- -void ui_manager::request_quit() +void mame_ui_manager::request_quit() { if (!machine().options().confirm_quit()) machine().schedule_exit(); @@ -1826,7 +1862,7 @@ void ui_manager::request_quit() // confirming quit emulation //------------------------------------------------- -UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state) +UINT32 mame_ui_manager::handler_confirm_quit(running_machine &machine, render_container *container, UINT32 state) { // get the text for 'UI Select' std::string ui_select_text = machine.input().seq_name(machine.ioport().type_seq(IPT_UI_SELECT, 0, SEQ_TYPE_STANDARD)); @@ -1841,7 +1877,7 @@ UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_contain ui_select_text, ui_cancel_text); - machine.ui().draw_text_box(container, quit_message.c_str(), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); + mame_machine_manager::instance()->ui().draw_text_box(container, quit_message.c_str(), JUSTIFY_CENTER, 0.5f, 0.5f, UI_RED_COLOR); machine.pause(); // if the user press ENTER, quit the game @@ -1867,7 +1903,7 @@ UINT32 ui_manager::handler_confirm_quit(running_machine &machine, render_contain // ui_get_slider_list - get the list of sliders //------------------------------------------------- -std::vector<ui_menu_item>& ui_manager::get_slider_list(void) +std::vector<ui_menu_item>& mame_ui_manager::get_slider_list(void) { return slider_list; } @@ -1896,11 +1932,11 @@ static slider_state *slider_alloc(running_machine &machine, const char *title, I //---------------------------------------------------------- -// ui_manager::slider_init - initialize the list of slider +// mame_ui_manager::slider_init - initialize the list of slider // controls //---------------------------------------------------------- -std::vector<ui_menu_item> ui_manager::slider_init(running_machine &machine) +std::vector<ui_menu_item> mame_ui_manager::slider_init(running_machine &machine) { std::vector<slider_state *> sliders; @@ -2497,24 +2533,12 @@ static INT32 slider_crossoffset(running_machine &machine, void *arg, int id, std } #endif - -//------------------------------------------------- -// use_natural_keyboard - returns -// whether the natural keyboard is active -//------------------------------------------------- - -bool ui_manager::use_natural_keyboard() const -{ - return m_use_natural_keyboard; -} - - //------------------------------------------------- // set_use_natural_keyboard - specifies // whether the natural keyboard is active //------------------------------------------------- -void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) +void mame_ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) { m_use_natural_keyboard = use_natural_keyboard; std::string error; @@ -2526,7 +2550,7 @@ void ui_manager::set_use_natural_keyboard(bool use_natural_keyboard) // wrap_text //------------------------------------------------- -int ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size) +int mame_ui_manager::wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size) { float lineheight = get_line_height() * text_size; const char *ends = origs + strlen(origs); @@ -2660,7 +2684,7 @@ int ui_manager::wrap_text(render_container *container, const char *origs, float // textured background and line color //------------------------------------------------- -void ui_manager::draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture, UINT32 flags) +void mame_ui_manager::draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture, UINT32 flags) { container->add_quad(x0, y0, x1, y1, backcolor, texture, flags); container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, linecolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); @@ -2681,7 +2705,7 @@ rgb_t decode_ui_color(int id, running_machine *machine) ui_options option; for (int x = 0; x < ARRAY_LENGTH(s_color_list); ++x) { const char *o_default = option.value(s_color_list[x]); - const char *s_option = machine->ui().options().value(s_color_list[x]); + const char *s_option = mame_machine_manager::instance()->ui().options().value(s_color_list[x]); int len = strlen(s_option); if (len != 8) color[x] = rgb_t((UINT32)strtoul(o_default, nullptr, 16)); @@ -2700,5 +2724,15 @@ int get_font_rows(running_machine *machine) { static int value; - return ((machine != nullptr) ? value = machine->ui().options().font_rows() : value); + return ((machine != nullptr) ? value = mame_machine_manager::instance()->ui().options().font_rows() : value); +} + +void mame_ui_manager::popup_time_string(int seconds, std::string message) +{ + // extract the text + messagebox_poptext = message; + messagebox_backcolor = UI_BACKGROUND_COLOR; + + // set a timer + m_popup_text_end = osd_ticks() + osd_ticks_per_second() * seconds; } diff --git a/src/emu/ui/ui.h b/src/frontend/mame/ui/ui.h index ad6c3d11ae1..b45d20c6e63 100644 --- a/src/emu/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -17,6 +17,9 @@ #include "render.h" #include "moptions.h" +#include "mame.h" +#include "language.h" +#include "ui/uimain.h" class ui_menu_item; @@ -87,8 +90,6 @@ enum DRAW_OPAQUE }; -#define SLIDER_NOCHANGE 0x12345678 - /*************************************************************************** TYPE DEFINITIONS @@ -96,29 +97,13 @@ enum typedef UINT32 (*ui_callback)(running_machine &, render_container *, UINT32); -typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval); +// ======================> mame_ui_manager -struct slider_state -{ - slider_state * next; /* pointer to next slider */ - slider_update update; /* callback */ - void * arg; /* argument */ - INT32 minval; /* minimum value */ - INT32 defval; /* default value */ - INT32 maxval; /* maximum value */ - INT32 incval; /* increment value */ - int id; - char description[1]; /* textual description */ -}; - - -// ======================> ui_manager - -class ui_manager +class mame_ui_manager : public ui_manager { public: // construction/destruction - ui_manager(running_machine &machine); + mame_ui_manager(running_machine &machine); void init(); @@ -135,7 +120,7 @@ public: std::vector<ui_menu_item> slider_init(running_machine &machine); UINT32 set_handler(ui_callback callback, UINT32 param); void display_startup_screens(bool first_time); - void set_startup_text(const char *text, bool force); + virtual void set_startup_text(const char *text, bool force) override; void update_and_render(render_container *container); render_font *get_font(); float get_line_height(); @@ -157,10 +142,9 @@ public: bool show_profiler() const; void show_menu(); void show_mouse(bool status); - bool is_menu_active(); + virtual bool is_menu_active() override; bool can_paste(); void paste(); - bool use_natural_keyboard() const; void set_use_natural_keyboard(bool use_natural_keyboard); void image_handler_ingame(); void increase_frameskip(); @@ -176,19 +160,16 @@ public: // other void process_natural_keyboard(); - void set_show_timecode_counter(bool value) { m_show_timecode_counter = value; m_show_timecode_total = true; } - bool show_timecode_counter(); - bool show_timecode_total(); - // word wrap int wrap_text(render_container *container, const char *origs, float x, float y, float origwrapwidth, std::vector<int> &xstart, std::vector<int> &xend, float text_size = 1.0f); // draw an outlined box with given line color and filled with a texture void draw_textured_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor, rgb_t linecolor, render_texture *texture = nullptr, UINT32 flags = PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); - + virtual void popup_time_string(int seconds, std::string message) override; + + virtual void image_display(const device_type &type, device_image_interface *image) override; private: // instance variables - running_machine & m_machine; render_font * m_font; ui_callback m_handler_callback; UINT32 m_handler_param; @@ -197,12 +178,9 @@ private: osd_ticks_t m_showfps_end; bool m_show_profiler; osd_ticks_t m_popup_text_end; - bool m_use_natural_keyboard; std::unique_ptr<UINT8[]> m_non_char_keys_down; render_texture * m_mouse_arrow_texture; bool m_mouse_show; - bool m_show_timecode_counter; - bool m_show_timecode_total; bool m_load_save_hold; ui_options m_ui_options; @@ -235,25 +213,11 @@ private: rgb_t decode_ui_color(int id, running_machine *machine = nullptr); int get_font_rows(running_machine *machine = nullptr); - -/*************************************************************************** - MEMBER TEMPLATES -***************************************************************************/ - -//------------------------------------------------- -// popup_time - popup a message for a specific -// amount of time -//------------------------------------------------- - template <typename Format, typename... Params> -inline void ui_manager::popup_time(int seconds, Format &&fmt, Params &&... args) +inline void mame_ui_manager::popup_time(int seconds, Format &&fmt, Params &&... args) { // extract the text - messagebox_poptext = string_format(std::forward<Format>(fmt), std::forward<Params>(args)...); - messagebox_backcolor = UI_BACKGROUND_COLOR; - - // set a timer - m_popup_text_end = osd_ticks() + osd_ticks_per_second() * seconds; + popup_time_string(seconds, string_format(std::forward<Format>(fmt), std::forward<Params>(args)...)); } #endif /* __USRINTRF_H__ */ diff --git a/src/emu/ui/uicmd14.png b/src/frontend/mame/ui/uicmd14.png Binary files differindex d3cae952cac..d3cae952cac 100644 --- a/src/emu/ui/uicmd14.png +++ b/src/frontend/mame/ui/uicmd14.png diff --git a/src/emu/ui/utils.cpp b/src/frontend/mame/ui/utils.cpp index d65bbc52ef7..d65bbc52ef7 100644 --- a/src/emu/ui/utils.cpp +++ b/src/frontend/mame/ui/utils.cpp diff --git a/src/emu/ui/utils.h b/src/frontend/mame/ui/utils.h index d31b3746e77..d31b3746e77 100644 --- a/src/emu/ui/utils.h +++ b/src/frontend/mame/ui/utils.h diff --git a/src/emu/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp index f0f54a20702..f0f54a20702 100644 --- a/src/emu/ui/videoopt.cpp +++ b/src/frontend/mame/ui/videoopt.cpp diff --git a/src/emu/ui/videoopt.h b/src/frontend/mame/ui/videoopt.h index 802f1295c08..802f1295c08 100644 --- a/src/emu/ui/videoopt.h +++ b/src/frontend/mame/ui/videoopt.h diff --git a/src/emu/ui/viewgfx.cpp b/src/frontend/mame/ui/viewgfx.cpp index a23d8a997d9..2a49b00983d 100644 --- a/src/emu/ui/viewgfx.cpp +++ b/src/frontend/mame/ui/viewgfx.cpp @@ -346,7 +346,7 @@ static void palette_handler(running_machine &machine, render_container *containe int total = state.palette.which ? palette->indirect_entries() : palette->entries(); const rgb_t *raw_color = palette->palette()->entry_list_raw(); - render_font *ui_font = machine.ui().get_font(); + render_font *ui_font = mame_machine_manager::instance()->ui().get_font(); float cellwidth, cellheight; float chwidth, chheight; float titlewidth; @@ -357,7 +357,7 @@ static void palette_handler(running_machine &machine, render_container *containe char title[100]; // add a half character padding for the box - chheight = machine.ui().get_line_height(); + chheight = mame_machine_manager::instance()->ui().get_line_height(); chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; @@ -386,7 +386,7 @@ static void palette_handler(running_machine &machine, render_container *containe x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); // go ahead and draw the outer box now - machine.ui().draw_outlined_box(container, boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); // draw the title x0 = 0.5f - 0.5f * titlewidth; @@ -549,7 +549,7 @@ static void palette_handle_keys(running_machine &machine, ui_gfx_state &state) static void gfxset_handler(running_machine &machine, render_container *container, ui_gfx_state &state) { - render_font *ui_font = machine.ui().get_font(); + render_font *ui_font = mame_machine_manager::instance()->ui().get_font(); int dev = state.gfxset.devindex; int set = state.gfxset.set; ui_gfx_info &info = state.gfxdev[dev]; @@ -573,7 +573,7 @@ static void gfxset_handler(running_machine &machine, render_container *container char title[100]; // add a half character padding for the box - chheight = machine.ui().get_line_height(); + chheight = mame_machine_manager::instance()->ui().get_line_height(); chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; @@ -649,7 +649,7 @@ static void gfxset_handler(running_machine &machine, render_container *container x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); // go ahead and draw the outer box now - machine.ui().draw_outlined_box(container, boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, boxbounds.x0 - x0, boxbounds.y0, boxbounds.x1 + x0, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); // draw the title x0 = 0.5f - 0.5f * titlewidth; @@ -949,7 +949,7 @@ static void gfxset_draw_item(running_machine &machine, gfx_element &gfx, int ind static void tilemap_handler(running_machine &machine, render_container *container, ui_gfx_state &state) { - render_font *ui_font = machine.ui().get_font(); + render_font *ui_font = mame_machine_manager::instance()->ui().get_font(); float chwidth, chheight; render_bounds mapboxbounds; render_bounds boxbounds; @@ -971,7 +971,7 @@ static void tilemap_handler(running_machine &machine, render_container *containe { UINT32 temp = mapwidth; mapwidth = mapheight; mapheight = temp; } // add a half character padding for the box - chheight = machine.ui().get_line_height(); + chheight = mame_machine_manager::instance()->ui().get_line_height(); chwidth = ui_font->char_width(chheight, machine.render().ui_aspect(), '0'); boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth; @@ -1027,7 +1027,7 @@ static void tilemap_handler(running_machine &machine, render_container *containe } // go ahead and draw the outer box now - machine.ui().draw_outlined_box(container, boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); + mame_machine_manager::instance()->ui().draw_outlined_box(container, boxbounds.x0, boxbounds.y0, boxbounds.x1, boxbounds.y1, UI_GFXVIEWER_BG_COLOR); // draw the title x0 = 0.5f - 0.5f * titlewidth; diff --git a/src/emu/ui/viewgfx.h b/src/frontend/mame/ui/viewgfx.h index 16c257476f0..16c257476f0 100644 --- a/src/emu/ui/viewgfx.h +++ b/src/frontend/mame/ui/viewgfx.h diff --git a/src/mame/audio/gamate.cpp b/src/mame/audio/gamate.cpp index 79913845058..0d040e6e7ec 100644 --- a/src/mame/audio/gamate.cpp +++ b/src/mame/audio/gamate.cpp @@ -8,7 +8,6 @@ #include "emu.h" #include "includes/gamate.h" -#include "ui/ui.h" enum { ClockDelay=32 }; diff --git a/src/mame/drivers/gamate.cpp b/src/mame/drivers/gamate.cpp index 66959b13008..ebdcd5890a3 100644 --- a/src/mame/drivers/gamate.cpp +++ b/src/mame/drivers/gamate.cpp @@ -12,7 +12,7 @@ #include "emu.h" #include "includes/gamate.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "rendlay.h" #include "softlist.h" diff --git a/src/mame/machine/cps2crpt.cpp b/src/mame/machine/cps2crpt.cpp index b80135acaca..f7973b95270 100644 --- a/src/mame/machine/cps2crpt.cpp +++ b/src/mame/machine/cps2crpt.cpp @@ -114,7 +114,7 @@ the decryption keys. #include "emu.h" #include "cpu/m68000/m68000.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "includes/cps1.h" diff --git a/src/mame/machine/spec_snqk.cpp b/src/mame/machine/spec_snqk.cpp index 543619099d6..b02203e7f55 100644 --- a/src/mame/machine/spec_snqk.cpp +++ b/src/mame/machine/spec_snqk.cpp @@ -28,7 +28,7 @@ ***************************************************************************/ #include "emu.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "cpu/z80/z80.h" #include "includes/spectrum.h" #include "sound/ay8910.h" diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index df16e96bfc0..97ece12b825 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -172,7 +172,6 @@ Rowscroll style: #include "emu.h" #include "video/deco16ic.h" -#include "ui/ui.h" #include "render.h" const device_type DECO16IC = &device_creator<deco16ic_device>; @@ -866,7 +865,7 @@ void deco16ic_device::pf_update( const UINT16 *rowscroll_1_ptr, const UINT16 *ro void deco16ic_device::print_debug_info(bitmap_ind16 &bitmap) { - char buf[64*5]; +/* char buf[64*5]; if (machine().input().code_pressed(KEYCODE_O)) return; @@ -879,7 +878,7 @@ void deco16ic_device::print_debug_info(bitmap_ind16 &bitmap) else sprintf(buf, "\n\n"); - machine().ui().draw_text(&machine().render().ui_container(), buf, 60, 40); + machine().ui().draw_text(&machine().render().ui_container(), buf, 60, 40);*/ } /*****************************************************************************************/ diff --git a/src/mame/video/ssv.cpp b/src/mame/video/ssv.cpp index d9ceb4a71c9..0eaf75a120d 100644 --- a/src/mame/video/ssv.cpp +++ b/src/mame/video/ssv.cpp @@ -138,9 +138,6 @@ Note: press Z to show some info on each sprite (debug builds only) #include "emu.h" #include "includes/ssv.h" -#ifdef MAME_DEBUG -#include "ui/ui.h" -#endif #include "render.h" @@ -931,13 +928,13 @@ void ssv_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) } } - #ifdef MAME_DEBUG - if (machine().input().code_pressed(KEYCODE_Z)) /* Display some info on each sprite */ - { char buf[30]; - sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8); - machine().ui().draw_text(&machine().render().ui_container(), buf, sx, sy); - } - #endif +// #ifdef MAME_DEBUG +// if (machine().input().code_pressed(KEYCODE_Z)) /* Display some info on each sprite */ +// { char buf[30]; +// sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8); +// machine().ui().draw_text(&machine().render().ui_container(), buf, sx, sy); +// } +// #endif } /* sprite type */ diff --git a/src/mame/video/taito_f3.cpp b/src/mame/video/taito_f3.cpp index 97b93fafdab..9e354dfdd07 100644 --- a/src/mame/video/taito_f3.cpp +++ b/src/mame/video/taito_f3.cpp @@ -208,7 +208,6 @@ Playfield tile info: #include "emu.h" #include "includes/taito_f3.h" -#include "ui/ui.h" #include "render.h" #define VERBOSE 0 @@ -327,7 +326,7 @@ pri_alp_bitmap void taito_f3_state::print_debug_info(bitmap_rgb32 &bitmap) { - UINT16 *f3_line_ram = m_f3_line_ram.get(); +/* UINT16 *f3_line_ram = m_f3_line_ram.get(); int l[16]; char buf[64*16]; char *bufptr = buf; @@ -395,7 +394,7 @@ void taito_f3_state::print_debug_info(bitmap_rgb32 &bitmap) l[3]=f3_line_ram[0x15e0*2]&0xffff; bufptr += sprintf(bufptr,"5000: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); - machine().ui().draw_text(&machine().render().ui_container(), buf, 60, 40); + machine().ui().draw_text(&machine().render().ui_container(), buf, 60, 40);*/ } /******************************************************************************/ diff --git a/src/osd/modules/debugger/debugint.cpp b/src/osd/modules/debugger/debugint.cpp index d35a931c33e..03f7998e460 100644 --- a/src/osd/modules/debugger/debugint.cpp +++ b/src/osd/modules/debugger/debugint.cpp @@ -9,7 +9,7 @@ *********************************************************************/ #include "emu.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "ui/menu.h" #include "rendfont.h" #include "uiinput.h" diff --git a/src/osd/modules/input/input_sdl.cpp b/src/osd/modules/input/input_sdl.cpp index 996221f57e6..eb9dbae1100 100644 --- a/src/osd/modules/input/input_sdl.cpp +++ b/src/osd/modules/input/input_sdl.cpp @@ -27,7 +27,7 @@ // MAME headers #include "emu.h" #include "osdepend.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "uiinput.h" #include "strconv.h" diff --git a/src/osd/modules/input/input_sdlcommon.cpp b/src/osd/modules/input/input_sdlcommon.cpp index 6f2794e3ac5..ebc20ddd319 100644 --- a/src/osd/modules/input/input_sdlcommon.cpp +++ b/src/osd/modules/input/input_sdlcommon.cpp @@ -23,7 +23,7 @@ // MAME headers #include "emu.h" #include "osdepend.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "uiinput.h" #include "window.h" #include "strconv.h" diff --git a/src/osd/modules/lib/osdobj_common.cpp b/src/osd/modules/lib/osdobj_common.cpp index 099c5fefb77..68af56245bf 100644 --- a/src/osd/modules/lib/osdobj_common.cpp +++ b/src/osd/modules/lib/osdobj_common.cpp @@ -217,7 +217,7 @@ void osd_common_t::register_options() #ifndef OSD_MINI REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS); REGISTER_MODULE(m_mod_man, DEBUG_QT); - REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL); +// REGISTER_MODULE(m_mod_man, DEBUG_INTERNAL); REGISTER_MODULE(m_mod_man, DEBUG_IMGUI); REGISTER_MODULE(m_mod_man, DEBUG_NONE); #endif diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index 4996cce002d..05b1020d9ab 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -10,8 +10,8 @@ #define __OSDWINDOW__ #include "emu.h" -#include "ui/ui.h" -#include "ui/menu.h" +#include "ui/uimain.h" +#include "render.h" #include "osdhelper.h" // standard windows headers diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 80934ed073a..1d5c162c61f 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -10,8 +10,7 @@ //============================================================ #include "emu.h" -#include "ui/ui.h" -#include "ui/menu.h" +#include "ui/uimain.h" #include "osdcore.h" #include "modules/osdwindow.h" diff --git a/src/osd/modules/render/bgfx/slider.cpp b/src/osd/modules/render/bgfx/slider.cpp index a4424c8600f..77ac69e08dc 100644 --- a/src/osd/modules/render/bgfx/slider.cpp +++ b/src/osd/modules/render/bgfx/slider.cpp @@ -9,7 +9,7 @@ #include "emu.h" #include "slider.h" -#include "ui/ui.h" +#include "ui/uimain.h" bgfx_slider::bgfx_slider(running_machine &machine, std::string name, float min, float def, float max, float step, slider_type type, screen_type screen, std::string format, std::string description, std::vector<std::string>& strings) : m_name(name) diff --git a/src/osd/modules/render/bgfx/slider.h b/src/osd/modules/render/bgfx/slider.h index 8ab9129c434..c1d1865218d 100644 --- a/src/osd/modules/render/bgfx/slider.h +++ b/src/osd/modules/render/bgfx/slider.h @@ -17,7 +17,7 @@ #include <vector> #include "emu.h" -#include "ui/ui.h" +#include "ui/uimain.h" class bgfx_slider { diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 4ce87b3e29c..859914d741c 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -17,13 +17,12 @@ // MAME headers #include "emu.h" #include "render.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "rendutil.h" #include "emuopts.h" #include "aviio.h" #include "png.h" #include "screen.h" -#include "ui/ui.h" // MAMEOS headers #include "winmain.h" @@ -275,7 +274,7 @@ void shaders::render_snapshot(surface *surface) } // add two text entries describing the image - std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(build_version); + std::string text1 = std::string(emulator_info::get_appname()).append(" ").append(emulator_info::get_build_version()); std::string text2 = std::string(machine->system().manufacturer).append(" ").append(machine->system().description); png_info pnginfo = { 0 }; png_add_text(&pnginfo, "Software", text1.c_str()); diff --git a/src/osd/modules/render/drawsdl.cpp b/src/osd/modules/render/drawsdl.cpp index 72d2f4c4c91..38d18f42aa8 100644 --- a/src/osd/modules/render/drawsdl.cpp +++ b/src/osd/modules/render/drawsdl.cpp @@ -16,7 +16,7 @@ // MAME headers #include "emu.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "rendersw.inc" // standard SDL headers diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index 0b96cbb1fcc..b6235f7570c 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -16,7 +16,7 @@ #include "emucore.h" #include "osdcore.h" #include "unicode.h" -#include "ui/menu.h" +#include "ui/uimain.h" #include <memory> #include <string> diff --git a/src/osd/sdl/sdlmain.cpp b/src/osd/sdl/sdlmain.cpp index 218c4bd89d4..a465e64655a 100644 --- a/src/osd/sdl/sdlmain.cpp +++ b/src/osd/sdl/sdlmain.cpp @@ -36,7 +36,6 @@ // MAME headers #include "osdepend.h" #include "emu.h" -#include "clifront.h" #include "emuopts.h" #include "strconv.h" @@ -218,8 +217,7 @@ int main(int argc, char *argv[]) sdl_options options; sdl_osd_interface osd(options); osd.register_options(); - cli_frontend frontend(options, osd); - res = frontend.execute(argc, argv); + res = emulator_info::start_frontend(options, osd, argc, argv); } #ifdef SDLMAME_UNIX @@ -292,7 +290,7 @@ void sdl_osd_interface::osd_exit() static void defines_verbose(void) { - osd_printf_verbose("Build version: %s\n", build_version); + osd_printf_verbose("Build version: %s\n", emulator_info::get_build_version()); osd_printf_verbose("Build architecure: "); MACRO_VERBOSE(SDLMAME_ARCH); osd_printf_verbose("\n"); diff --git a/src/osd/sdl/video.cpp b/src/osd/sdl/video.cpp index 3aafee31dcc..61b118e8e1b 100644 --- a/src/osd/sdl/video.cpp +++ b/src/osd/sdl/video.cpp @@ -12,7 +12,7 @@ // MAME headers #include "emu.h" #include "rendutil.h" -#include "ui/ui.h" +#include "ui/uimain.h" #include "emuopts.h" #include "uiinput.h" diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 0f6b94abaaf..8c36ede4d36 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -30,7 +30,7 @@ #include "emu.h" #include "emuopts.h" -#include "ui/ui.h" +#include "ui/uimain.h" // OSD headers diff --git a/src/osd/windows/video.cpp b/src/osd/windows/video.cpp index d394a3e1821..82a756d7dd6 100644 --- a/src/osd/windows/video.cpp +++ b/src/osd/windows/video.cpp @@ -12,7 +12,6 @@ // MAME headers #include "emu.h" -#include "ui/ui.h" #include "emuopts.h" #include "render.h" #include "uiinput.h" diff --git a/src/osd/windows/winmain.cpp b/src/osd/windows/winmain.cpp index 14243c67fd7..4047d9d7fee 100644 --- a/src/osd/windows/winmain.cpp +++ b/src/osd/windows/winmain.cpp @@ -20,7 +20,6 @@ // MAME headers #include "emu.h" -#include "clifront.h" #include "emuopts.h" // MAMEOS headers @@ -294,8 +293,7 @@ int main(int argc, char *argv[]) FreeConsole(); } osd.register_options(); - cli_frontend frontend(options, osd); - result = frontend.execute(argc, argv); + result = emulator_info::start_frontend(options, osd, argc, argv); osd_output::pop(&winerror); } @@ -324,7 +322,7 @@ static BOOL WINAPI control_handler(DWORD type) if (g_current_machine == nullptr || type == CTRL_C_EVENT || type == CTRL_BREAK_EVENT) { fprintf(stderr, ", exiting\n"); - TerminateProcess(GetCurrentProcess(), MAMERR_FATALERROR); + TerminateProcess(GetCurrentProcess(), EMU_ERR_FATALERROR); } // all other situations attempt to do a clean exit |