diff --git a/.github/workflows/build_mame.yml b/.github/workflows/build_mame.yml index 0da223d..6477bdf 100644 --- a/.github/workflows/build_mame.yml +++ b/.github/workflows/build_mame.yml @@ -25,11 +25,8 @@ jobs: - name: "Install dependencies" run: "automation_tools/install_dependencies.sh" - - name: "Creating MAME manifest" - run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/update_mame_manifest.sh" - - name: "[DEBUG] Outputting manifest" - run: cat net.retrodeck.mame.yml + run: cat org.mamedev.MAME.yaml - name: "Build flatpak" id: "flatpak-download" @@ -39,7 +36,7 @@ jobs: --install-deps-from=flathub-beta \ --repo=${GITHUB_WORKSPACE}/mame-repo \ "${GITHUB_WORKSPACE}"/mame-build-dir \ - net.retrodeck.mame.yml + org.mamedev.MAME.yaml - name: Create Artifact for RetroDECK run: | diff --git a/floppy.patch b/floppy.patch new file mode 100644 index 0000000..b80d0a2 --- /dev/null +++ b/floppy.patch @@ -0,0 +1,41 @@ +diff --git a/src/devices/imagedev/floppy.cpp b/src/devices/imagedev/floppy.cpp +index 3c00336d..cda94d92 100644 +--- a/src/devices/imagedev/floppy.cpp ++++ b/src/devices/imagedev/floppy.cpp +@@ -1707,9 +1707,10 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector< + { + idx = m_spin_playback_sample; + sampleend = m_sample[idx].data.size(); +- out = m_sample[idx].data[m_spin_samplepos++]; +- +- if (m_spin_samplepos >= sampleend) ++ m_spin_samplepos++; ++ if (m_spin_samplepos < sampleend) ++ out = m_sample[idx].data[m_spin_samplepos]; ++ else + { + // Motor sample has completed + switch (m_spin_playback_sample) +@@ -1763,7 +1764,8 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector< + idx = m_step_base + m_seek_playback_sample; + sampleend = m_sample[idx].data.size(); + // Mix it into the stream value +- out += m_sample[idx].data[(int)m_seek_samplepos]; ++ if (m_seek_samplepos < sampleend) ++ out += m_sample[idx].data[(int)m_seek_samplepos]; + // By adding different values than 1, we can change the playback speed + // This will be used to adjust the seek sound + m_seek_samplepos += m_seek_pitch; +@@ -1781,8 +1783,10 @@ void floppy_sound_device::sound_stream_update(sound_stream &stream, std::vector< + sampleend = m_sample[idx].data.size(); + + // Mix it into the stream value +- out += m_sample[idx].data[m_step_samplepos++]; +- if (m_step_samplepos >= sampleend) ++ m_step_samplepos++; ++ if (m_step_samplepos < sampleend) ++ out += m_sample[idx].data[m_step_samplepos]; ++ else + { + // Step sample done + m_step_samplepos = 0; diff --git a/mame.ini b/mame.ini new file mode 100644 index 0000000..354f5e8 --- /dev/null +++ b/mame.ini @@ -0,0 +1,38 @@ +# +# CORE SEARCH PATH OPTIONS +# +homepath $HOME/.mame +rompath /app/share/mame/roms +hashpath /app/share/mame/hash +samplepath /app/share/mame/samples +artpath /app/share/mame/artwork +ctrlrpath /app/share/mame/ctrlr +inipath $HOME/.mame;/app/share/mame/ini +fontpath /app/bin/ +cheatpath /app/share/mame/cheat +crosshairpath /app/share/mame/crosshair +pluginspath /app/share/mame/plugins +languagepath /app/share/mame/language +swpath /app/share/mame/software + +# +# CORE OUTPUT DIRECTORY OPTIONS +# +cfg_directory $HOME/.mame/cfg +nvram_directory $HOME/.mame/nvram +input_directory $HOME/.mame/inp +state_directory $HOME/.mame/sta +snapshot_directory $HOME/.mame/snap +diff_directory $HOME/.mame/diff +comment_directory $HOME/.mame/comments +share_directory $HOME/.mame/share + +# +# OSD VIDEO OPTIONS +# +video opengl + +# +# BGFX POST-PROCESSING OPTIONS +# +bgfx_path /app/share/mame/bgfx diff --git a/mame128x128.png b/mame128x128.png new file mode 100644 index 0000000..38d6e00 Binary files /dev/null and b/mame128x128.png differ diff --git a/mame16x16.png b/mame16x16.png new file mode 100644 index 0000000..d3b62b7 Binary files /dev/null and b/mame16x16.png differ diff --git a/mame24x24.png b/mame24x24.png new file mode 100644 index 0000000..3c998e2 Binary files /dev/null and b/mame24x24.png differ diff --git a/mame256x256.png b/mame256x256.png new file mode 100644 index 0000000..09e4a26 Binary files /dev/null and b/mame256x256.png differ diff --git a/mame32x32.png b/mame32x32.png new file mode 100644 index 0000000..aeaab3b Binary files /dev/null and b/mame32x32.png differ diff --git a/mame48x48.png b/mame48x48.png new file mode 100644 index 0000000..c802dcd Binary files /dev/null and b/mame48x48.png differ diff --git a/mame64x64.png b/mame64x64.png new file mode 100644 index 0000000..8a2aaa5 Binary files /dev/null and b/mame64x64.png differ diff --git a/org.mamedev.MAME.desktop b/org.mamedev.MAME.desktop new file mode 100644 index 0000000..a42eaab --- /dev/null +++ b/org.mamedev.MAME.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=MAME +GenericName=Emulator +Comment=A multi-purpose emulation framework +Exec=mame +Type=Application +Icon=org.mamedev.MAME +Categories=Game;ArcadeGame;Emulator diff --git a/org.mamedev.MAME.metainfo.xml b/org.mamedev.MAME.metainfo.xml new file mode 100644 index 0000000..85ddac0 --- /dev/null +++ b/org.mamedev.MAME.metainfo.xml @@ -0,0 +1,57 @@ + + + org.mamedev.MAME + CC0-1.0 + GPL-2.0-or-later + MAME + + MAME is a multi-purpose emulation framework. + + +

+ MAME's purpose is to preserve decades of software history. As electronic technology continues to rush + forward, MAME prevents this important "vintage" software from being lost and forgotten. This is + achieved by documenting the hardware and how it functions. The source code to MAME serves as this documentation. + The fact that the software is usable serves primarily to validate the accuracy of the documentation (how else + can you prove that you have recreated the hardware faithfully?). Over time, MAME (originally stood for Multiple + Arcade Machine Emulator) absorbed the sister-project MESS (Multi Emulator Super System), so MAME now documents a + wide variety of (mostly vintage) computers, video game consoles and calculators, in addition to the arcade video + games that were its initial focus. +

+
+ + Game + ArcadeGame + Emulator + + https://www.mamedev.org + org.mamedev.MAME.desktop + + + + + + + + + + + + + + + + + + + + + mame + + + + + https://upload.wikimedia.org/wikipedia/commons/6/6f/NewMAME.png + + +
diff --git a/org.mamedev.MAME.yaml b/org.mamedev.MAME.yaml new file mode 100644 index 0000000..4a922a7 --- /dev/null +++ b/org.mamedev.MAME.yaml @@ -0,0 +1,89 @@ +id: org.mamedev.MAME +runtime: org.kde.Platform +runtime-version: 5.15-23.08 +sdk: org.kde.Sdk +command: mame +separate-locales: false +finish-args: + - --device=all + - --persist=.mame + - --filesystem=home + - --filesystem=host:ro + - --share=network + - --share=ipc + - --socket=x11 + - --socket=fallback-x11 + - --socket=pulseaudio + - --socket=wayland + - --allow=bluetooth +modules: + - name: mame + buildsystem: simple + build-options: + no-debuginfo: true + strip: true + build-commands: + - make + -j ${FLATPAK_BUILDER_N_JOBS} + CFLAGS+=-Wno-error=restrict + USE_WAYLAND=1 + USE_SYSTEM_LIB_FLAC=1 + SDL_INI_PATH='$$HOME/.APP_NAME;/app/share/APP_NAME/ini' + LDOPTS=-Wl,-s + - install -Dm 0755 mame ${FLATPAK_DEST}/bin/mame + - install -Dm 0644 ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop + - install -Dm 0644 ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml + - install -Dm 0644 mame16x16.png ${FLATPAK_DEST}/share/icons/hicolor/16x16/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame24x24.png ${FLATPAK_DEST}/share/icons/hicolor/24x24/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame32x32.png ${FLATPAK_DEST}/share/icons/hicolor/32x32/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame48x48.png ${FLATPAK_DEST}/share/icons/hicolor/48x48/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame64x64.png ${FLATPAK_DEST}/share/icons/hicolor/64x64/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame128x128.png ${FLATPAK_DEST}/share/icons/hicolor/128x128/apps/${FLATPAK_ID}.png + - install -Dm 0644 mame256x256.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png + - cp COPYING ${FLATPAK_DEST}/bin/ + - cp uismall.bdf ${FLATPAK_DEST}/bin/ + - mkdir -p ${FLATPAK_DEST}/share/mame/ + - cp -r artwork/ ${FLATPAK_DEST}/share/mame/ + - cp -r bgfx/ ${FLATPAK_DEST}/share/mame/ + - cp -r ctrlr/ ${FLATPAK_DEST}/share/mame/ + - mkdir -p ${FLATPAK_DEST}/share/mame/docs/ + - cp -r docs/legal/ ${FLATPAK_DEST}/share/mame/docs/ + - cp -r docs/man/ ${FLATPAK_DEST}/share/mame/docs + - cp -r hash/ ${FLATPAK_DEST}/share/mame/ + - cp -r hlsl/ ${FLATPAK_DEST}/share/mame/ + - cp -r ini/ ${FLATPAK_DEST}/share/mame/ + - install -Dm 0644 mame.ini ${FLATPAK_DEST}/share/mame/ini/mame.ini + - cp -r language/ ${FLATPAK_DEST}/share/mame/ + - cp -r plugins/ ${FLATPAK_DEST}/share/mame/ + - cp -r roms/ ${FLATPAK_DEST}/share/mame/ + - cp -r samples/ ${FLATPAK_DEST}/share/mame/ + sources: + - type: archive + url: https://github.com/mamedev/mame/archive/refs/tags/mame0261.tar.gz + sha256: 51d5ce1563897709ceb7a924c31a70cc5ff2bec466aab8d0cc9ff3cc72b38899 + - type: file + path: mame16x16.png + - type: file + path: mame24x24.png + - type: file + path: mame32x32.png + - type: file + path: mame48x48.png + - type: file + path: mame64x64.png + - type: file + path: mame128x128.png + - type: file + path: mame256x256.png + - type: file + path: org.mamedev.MAME.desktop + - type: file + path: org.mamedev.MAME.metainfo.xml + - type: file + path: mame.ini + - type: patch + path: floppy.patch + - type: patch + path: sound.patch + - type: patch + path: ym3802.patch diff --git a/sound.patch b/sound.patch new file mode 100644 index 0000000..066c35c --- /dev/null +++ b/sound.patch @@ -0,0 +1,28 @@ +diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp +index a0293063..c4989abb 100644 +--- a/src/emu/sound.cpp ++++ b/src/emu/sound.cpp +@@ -761,6 +761,9 @@ read_stream_view sound_stream::update_view(attotime start, attotime end, u32 out + } + g_profiler.stop(); + ++ if (!m_output_view[outputnum].valid()) ++ m_output_view[outputnum] = empty_view(start, end); ++ + // return the requested view + return read_stream_view(m_output_view[outputnum], start); + } +diff --git a/src/emu/sound.h b/src/emu/sound.h +index 15f6a574..bfa45c45 100644 +--- a/src/emu/sound.h ++++ b/src/emu/sound.h +@@ -284,6 +284,9 @@ public: + return *this; + } + ++ // check basic constraints ++ bool valid() const { return m_buffer != nullptr; } ++ + // return the local gain + sample_t gain() const { return m_gain; } + diff --git a/ym3802.patch b/ym3802.patch new file mode 100644 index 0000000..265bee3 --- /dev/null +++ b/ym3802.patch @@ -0,0 +1,13 @@ +diff --git a/src/devices/machine/ym3802.cpp b/src/devices/machine/ym3802.cpp +index 4a8f6a7ffae..d1bf2b961f6 100644 +--- a/src/devices/machine/ym3802.cpp ++++ b/src/devices/machine/ym3802.cpp +@@ -45,7 +45,7 @@ void ym3802_device::device_start() + + void ym3802_device::device_reset() + { +- m_reg.clear(); ++ m_reg.assign(REG_MAX, 0); + reset_irq(0xff); + transmit_register_reset(); + receive_register_reset();