diff options
Diffstat (limited to 'games-emulation/zsnes')
-rw-r--r-- | games-emulation/zsnes/Manifest | 1 | ||||
-rw-r--r-- | games-emulation/zsnes/files/zsnes-2.0.12-initc.patch | 28 | ||||
-rw-r--r-- | games-emulation/zsnes/zsnes-2.0.12.ebuild | 66 |
3 files changed, 95 insertions, 0 deletions
diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest index 721d02267537..a10397ee99a5 100644 --- a/games-emulation/zsnes/Manifest +++ b/games-emulation/zsnes/Manifest @@ -1 +1,2 @@ DIST zsnes-2.0.10.tar.gz 926347 BLAKE2B b9ab4701290ae802cb35045e0a3d4ff5268f96f7dc84614f39e950a6273a8477d5e2dca0598e3448744486de31caf692d44d36fe284f6f20697a5b4e92c908f8 SHA512 513e350198a944af47accedc6d3c14405898c753bb8168871d323c11f8c1253d8d7e247759a13e40a3b5eda195824e4862bb1fc093a3db9a75c8bb2e0bef728e +DIST zsnes-2.0.12.tar.gz 963569 BLAKE2B c11496cb5f08930dac23598ade337d9ab5d41f484b8f0ad68b1f01832d3d5ef078d65b3d639719b23eaaaf4406248eb47959b582ab7b96b142993ff532c1f3d2 SHA512 f321582a32a334cb32d9276c88c03db7d99c7ccce67a73a777bea6d66f3551a3013d1cfd38fda37867fb2424cde79ca4220894b27615f0f5c5a6de8ffaef037a diff --git a/games-emulation/zsnes/files/zsnes-2.0.12-initc.patch b/games-emulation/zsnes/files/zsnes-2.0.12-initc.patch new file mode 100644 index 000000000000..d6ce00b93db0 --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-2.0.12-initc.patch @@ -0,0 +1,28 @@ +# https://github.com/xyproto/zsnes/issues/19#issuecomment-1710906677 +# https://github.com/TrashRaccoonSnuffy/zsnes/commit/f77ec1a0 + +Author: Sneed <127693805+TrashRaccoonSnuffy@users.noreply.github.com> +Date: Thu, 7 Sep 2023 21:06:10 -0300 + + Fix a buffer overflow + +--- a/initc.c ++++ b/initc.c +@@ -1364,7 +1364,7 @@ void clearmem(void) + } + + extern uint8_t BRRBuffer[]; +-extern uint8_t echoon0; ++extern uint8_t echoon0[]; + extern uint32_t PHdspsave; + extern uint32_t PHdspsave2; + s4 echobuf[22500]; +@@ -1373,7 +1373,7 @@ extern uint8_t DSPMem[256]; + void clearvidsound() + { + memset(BRRBuffer, 0, PHdspsave); +- memset(&echoon0, 0, PHdspsave2); ++ memset(echoon0, 0, PHdspsave2); + memset(&echobuf, 0, sizeof(echobuf)); + memset(spcBuffera, 0, 65536 * 4 + 4096); + memset(DSPMem, 0, 256); diff --git a/games-emulation/zsnes/zsnes-2.0.12.ebuild b/games-emulation/zsnes/zsnes-2.0.12.ebuild new file mode 100644 index 000000000000..db3d40f511b3 --- /dev/null +++ b/games-emulation/zsnes/zsnes-2.0.12.ebuild @@ -0,0 +1,66 @@ +# Copyright 2021-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop flag-o-matic multilib toolchain-funcs xdg + +DESCRIPTION="Fork of the classic Super Nintendo emulator" +HOMEPAGE="https://github.com/xyproto/zsnes/ https://www.zsnes.com/" +SRC_URI="https://github.com/xyproto/zsnes/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86 ~amd64-linux ~x86-linux" +IUSE="custom-cflags" + +RDEPEND=" + media-libs/libglvnd[X,abi_x86_32(-)] + media-libs/libpng:=[abi_x86_32(-)] + media-libs/libsdl[abi_x86_32(-),joystick,opengl,sound,video] + sys-libs/zlib:=[abi_x86_32(-)] + x11-libs/libX11[abi_x86_32(-)]" +DEPEND=" + ${RDEPEND} + x11-base/xorg-proto" +BDEPEND=" + dev-lang/nasm + sys-libs/zlib + virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/${PN}-2.0.9-cc-quotes.patch + "${FILESDIR}"/${PN}-2.0.9-gentoo-zlib.patch + "${FILESDIR}"/${P}-initc.patch +) + +src_compile() { + # Makefile forces many CFLAGS that are questionable, but zsnes' ancient x86 + # asm is fragile, not pic safe (bug #427104), broken by F_S=3 (formerly + # broken with =2 as well), and can be affected by -march=* and similar. + # Stick to upstream's choices, this is non-portable either way. + if use !custom-cflags; then + strip-flags + append-cppflags -U_FORTIFY_SOURCE # to disable =3, Makefile enables =2 + fi + + # used to build and run parsegen at build time (uses zlib wrt BDEPEND) + tc-export_build_env BUILD_CXX + local buildcxx="${BUILD_CXX} ${BUILD_CXXFLAGS} ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS}" + + use amd64 && multilib_toolchain_setup x86 + tc-export CC CXX + append-cflags "${CPPFLAGS}" + append-cxxflags "${CPPFLAGS}" + + emake CXX_HOST="${buildcxx}" +} + +src_install() { + emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install + + dodoc README.md TODO.md + + newicon icons/64x64x32.png ${PN}.png + make_desktop_entry ${PN} ${PN^^} +} |