summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Grapentin <andreas@grapentin.org>2019-02-09 18:48:46 +0100
committerAndreas Grapentin <andreas@grapentin.org>2019-02-09 18:48:46 +0100
commit6231995e0cd6245e34a8da5e54c7d282e7534073 (patch)
treedd679eb1afbbbb95aff625e221070689c53febbf
parent8fac28f1f23b8c69be3ceec4919322a0a41ed0af (diff)
downloadabslibre-6231995e0cd6245e34a8da5e54c7d282e7534073.tar.gz
abslibre-6231995e0cd6245e34a8da5e54c7d282e7534073.tar.bz2
abslibre-6231995e0cd6245e34a8da5e54c7d282e7534073.zip
pcr/reicast-git: ancient and unmaintained. removed
-rw-r--r--pcr/reicast-git/PKGBUILD166
-rw-r--r--pcr/reicast-git/fix-dyna-constprop.patch63
-rw-r--r--pcr/reicast-git/fix-x11-keyboard-support.patch166
-rw-r--r--pcr/reicast-git/futuristic-memops.patch31
-rw-r--r--pcr/reicast-git/multiplayer-config.patch16
-rw-r--r--pcr/reicast-git/no-buffer-overflows.patch587
-rw-r--r--pcr/reicast-git/sh-block-graphs.patch296
7 files changed, 0 insertions, 1325 deletions
diff --git a/pcr/reicast-git/PKGBUILD b/pcr/reicast-git/PKGBUILD
deleted file mode 100644
index 404a6c768..000000000
--- a/pcr/reicast-git/PKGBUILD
+++ /dev/null
@@ -1,166 +0,0 @@
-# Maintainer (Arch): carstene1ns <arch carsten-teibes de> - http://git.io/ctPKG
-# Maintainer: André Silva <emulatorman@hyperbola.info>
-# Maintainer: Márcio Silva <coadde@hyperbola.info>
-
-_pkgname=reicast
-pkgname=${_pkgname}-git
-pkgver=r1752.ca837e19
-pkgrel=1
-pkgdesc="A multiplatform Sega Dreamcast/NAOMI emulator"
-arch=('i686' 'x86_64' 'armv7h')
-url="http://${_pkgname}.com/"
-license=('GPL2')
-provides=("${_pkgname}")
-conflicts=("${_pkgname}")
-makedepends=('git')
-depends=('libgl' 'alsa-plugins' 'libpulse' 'opengl-driver' 'python-evdev') # 'sdl2'
-source=(${_pkgname}-${pkgver}::"git+https://github.com/${_pkgname}/${_pkgname}-emulator.git"
- 'fix-dyna-constprop.patch'
- 'futuristic-memops.patch'
- 'sh-block-graphs.patch'
- 'multiplayer-config.patch'
- 'no-buffer-overflows.patch'
- 'fix-x11-keyboard-support.patch')
-sha256sums=('SKIP'
- 'c14287cf2b2289b9de28cedeee06fcb89ca40da50e34607780dce55d7d8e5fd6'
- 'ce3fe9f10555c473cafbf4e85724ebe7a8535a1fa3bfae3c9bc0fe518024f71e'
- '94694d1b615facb39b5ee92ed90c6cefc77fab23fb97f2fcc82e0aa6e1cb14c5'
- '9ad37cfed1de29a754388f8655dd58d98a3459d5f65475c8d000d92cabb96e43'
- 'd673ba39c1f203f6127ac78f0c5cad35bde48ab4eb59d46ed6d1536f27f39be6'
- '188b32f462f8cdb3b4b31b505ca2cbbd8049bb0457689455f281aea4f9c562c0')
-
-pkgver() {
- cd "${srcdir}/${_pkgname}-${pkgver}"
- printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
-}
-
-prepare() {
- cd "${srcdir}/${_pkgname}-${pkgver}"
-
- # Fix GCC 6.1 errors
- sed -i 's|g++|g++ -std=gnu++98|
- ' shell/linux/Makefile
-# sed -i 's|[#]include[ ][<]stdint[.]h[>]|#include <stdint.h>\n#include <iostream>|
-# ' core/deps/libelf/elf32.cpp
-# sed -i 's|||
-# ' core/linux-dist/evdev.cpp
-
- # Remove nonfree fp.h header
- rm -v core/deps/libpng/fp.h
-
- # Add extra patches
- patch -Np1 -i "$srcdir"/fix-dyna-constprop.patch
- patch -Np1 -i "$srcdir"/futuristic-memops.patch
- patch -Np1 -i "$srcdir"/sh-block-graphs.patch
-# patch -Np1 -i "$srcdir"/no-buffer-overflows.patch # Experimental patch
- patch -Np1 -i "$srcdir"/fix-x11-keyboard-support.patch
-
- # Enable Multiplayer config support
- patch -Np1 -i "$srcdir"/multiplayer-config.patch
-
- # Remove unused libraries and headers files
- rm -rv shell/linux-deps
-
- # Add experimental shadow support: http://github.com/reicast-emulator/issues/94
- sed -i 's|//DrawModVols|DrawModVols|' core/rend/gles/gldraw.cpp
-
- # Fix Xbox Input Axis
- sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/linux-dist/joystick.cpp
- sed -i 's|DC_AXIS_LT, 0, 0, DC_AXIS_RT|0, 0, DC_AXIS_RT, DC_AXIS_LT|' core/sdl/sdl.cpp
-
- # Enable Pulseaudio
- sed -i 's|#USE_PULSEAUDIO|USE_PULSEAUDIO|' shell/linux/Makefile
-
- # Enable SDL
-# sed -i 's|USE_JOYSTICK[ ][:][=][ ]1|USE_JOYSTICK := 1\nUSE_SDL := 1|' shell/linux/Makefile
-}
-
-build() {
- mkdir -vm 0755 "$srcdir"/pkgbuild-dir
- mkdir -vm 0755 "$srcdir"/purupuru-dir
- mkdir -vm 0755 "$srcdir"/microphone-dir
- if [ $CARCH == x86_64 ]; then
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
- # Enable Puru Puru Pack (rumble support)
- sed -i 's|SegaVMU[,]i[,]1|PurupuruPack,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/purupuru-dir install
- # Enable Microphone support
- sed -i 's|PurupuruPack[,]i[,]1|Microphone,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/microphone-dir install
- # Disabled, due is unsupported code with gnu++11 or gnu++98
- # mkdir -vm 0755 "$srcdir"/pkgbuild-cpp-dir
- # make -C ${_pkgname}-${pkgver}/shell/linux platform=lincpp PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-cpp-dir install
- # Enable Naomi support
- sed -i 's|USE_JOYSTICK[ ][:][=][ ]1|USE_JOYSTICK := 1\nNAOMI := 1|' ${_pkgname}-${pkgver}/shell/linux/Makefile
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x64 PREFIX=/usr DESTDIR="$srcdir"/naomi-dir install
- # Disabled, due is unsupported code with gnu++11 or gnu++98
- # mkdir -vm 0755 "$srcdir"/naomi-cpp-dir
- # make -C ${_pkgname}-${pkgver}/shell/linux platform=lincpp PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-cpp-dir install
- elif [ $CARCH == i686 ]; then
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
- # Enable Puru Puru Pack (rumble support)
- sed -i 's|SegaVMU[,]i[,]1|PurupuruPack,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/purupuru-dir install
- # Enable Microphone support
- sed -i 's|PurupuruPack[,]i[,]1|Microphone,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/microphone-dir install
- # Enable Naomi support
- sed -i 's|USE_JOYSTICK[ ][:][=][ ]1|USE_JOYSTICK := 1\nNAOMI := 1|' ${_pkgname}-${pkgver}/shell/linux/Makefile
- make -C ${_pkgname}-${pkgver}/shell/linux platform=x86 PREFIX=/usr DESTDIR="$srcdir"/naomi-dir install
- elif [ $CARCH == armv7h ]; then
- make -C ${_pkgname}-${pkgver}/shell/linux platform=armv7h PREFIX=/usr DESTDIR="$srcdir"/pkgbuild-dir install
- # Enable Puru Puru Pack (rumble support)
- sed -i 's|SegaVMU[,]i[,]1|PurupuruPack,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=armv7h PREFIX=/usr DESTDIR="$srcdir"/purupuru-dir install
- # Enable Microphone support
- sed -i 's|PurupuruPack[,]i[,]1|Microphone,i,1|' ${_pkgname}-${pkgver}/core/hw/maple/maple_cfg.cpp
- make -C ${_pkgname}-${pkgver}/shell/linux platform=armv7h PREFIX=/usr DESTDIR="$srcdir"/microphone-dir install
- # Enable Naomi support
- sed -i 's|USE_JOYSTICK[ ][:][=][ ]1|USE_JOYSTICK := 1\nNAOMI := 1|' ${_pkgname}-${pkgver}/shell/linux/Makefile
- make -C ${_pkgname}-${pkgver}/shell/linux platform=armv7h PREFIX=/usr DESTDIR="$srcdir"/naomi-dir install
- fi
-}
-
-package() {
- cp -va "$srcdir"/pkgbuild-dir/* "$pkgdir"
- cp -va "$srcdir"/purupuru-dir/usr/bin/${_pkgname} "$pkgdir"/usr/bin/${_pkgname}-purupuru
- cp -va "$srcdir"/microphone-dir/usr/bin/${_pkgname} "$pkgdir"/usr/bin/${_pkgname}-microphone
- cp -va "$srcdir"/naomi-dir/usr/bin/${_pkgname}-naomi "$pkgdir"/usr/bin/${_pkgname}-naomi
- cp -va "$srcdir"/purupuru-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-purupuru.desktop
- cp -va "$srcdir"/microphone-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-microphone.desktop
- cp -va "$srcdir"/naomi-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-naomi.desktop
- cp -va "$srcdir"/purupuru-dir/usr/share/man/man1/${_pkgname}.1 "$pkgdir"/usr/share/man/man1/${_pkgname}-purupuru.1
- cp -va "$srcdir"/microphone-dir/usr/share/man/man1/${_pkgname}.1 "$pkgdir"/usr/share/man/man1/${_pkgname}-microphone.1
- cp -va "$srcdir"/naomi-dir/usr/share/man/man1/${_pkgname}.1 "$pkgdir"/usr/share/man/man1/${_pkgname}-naomi.1
- sed -i '\|Name| s|Reicast|Reicast with Puru Puru Pack support|
- \|Exec| s|reicast|reicast-purupuru|
- ' "$pkgdir"/usr/share/applications/${_pkgname}-purupuru.desktop
- sed -i '\|Name| s|Reicast|Reicast with Microphone support|
- \|Exec| s|reicast|reicast-microphone|
- ' "$pkgdir"/usr/share/applications/${_pkgname}-microphone.desktop
- sed -i '\|Name| s|Reicast|Reicast NAOMI|
- \|Exec| s|reicast|reicast-naomi|
- s|Dreamcast|Naomi|
- s|dreamcast|naomi|
- ' "$pkgdir"/usr/share/applications/${_pkgname}-naomi.desktop \
- "$pkgdir"/usr/share/man/man1/${_pkgname}-naomi.1
- if [ -d "$srcdir"/pkgbuild-cpp-dir ]; then
- cp -va "$srcdir"/pkgbuild-cpp-dir/usr/bin/${_pkgname} "$pkgdir"/usr/bin/${_pkgname}-c++
- cp -va "$srcdir"/pkgbuild-cpp-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-c++.desktop
- cp -va "$srcdir"/pkgbuild-cpp-dir/usr/share/man/man1/${_pkgname}.1 "$pkgdir"/usr/share/man/man1/${_pkgname}-c++.1
- sed -i '\|Name| s|Reicast|Reicast C++|
- \|Exec| s|reicast|reicast-c++|
- ' "$pkgdir"/usr/share/applications/${_pkgname}-c++.desktop
- elif [ -d "$srcdir"/naomi-cpp-dir ]; then
- cp -va "$srcdir"/naomi-cpp-dir/usr/bin/${_pkgname} "$pkgdir"/usr/bin/${_pkgname}-naomi-c++
- cp -va "$srcdir"/naomi-cpp-dir/usr/share/applications/${_pkgname}.desktop "$pkgdir"/usr/share/applications/${_pkgname}-naomi-c++.desktop
- cp -va "$srcdir"/naomi-cpp-dir/usr/share/man/man1/${_pkgname}.1 "$pkgdir"/usr/share/man/man1/${_pkgname}-naomi-c++.1
- sed -i '\|Name| s|Reicast|Reicast NAOMI C++|
- \|Exec| s|reicast|reicast-naomi-c++|
- s|Dreamcast|Naomi|
- s|dreamcast|naomi|
- ' "$pkgdir"/usr/share/applications/${_pkgname}-naomi-c++.desktop \
- "$pkgdir"/usr/share/man/man1/${_pkgname}-naomi-c++.1
- fi
- install -Dm 644 ${_pkgname}-${pkgver}/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
-}
diff --git a/pcr/reicast-git/fix-dyna-constprop.patch b/pcr/reicast-git/fix-dyna-constprop.patch
deleted file mode 100644
index c7c89b5e2..000000000
--- a/pcr/reicast-git/fix-dyna-constprop.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-diff -Nur a/core/hw/sh4/dyna/shil.cpp b/core/hw/sh4/dyna/shil.cpp
---- a/core/hw/sh4/dyna/shil.cpp 2015-10-06 21:43:53.031336322 -0300
-+++ b/core/hw/sh4/dyna/shil.cpp 2015-10-06 21:45:06.558863627 -0300
-@@ -521,20 +521,39 @@
- rv[op->rd._reg]=op->rs1._imm;
- }
-
-- //NOT WORKING
-- //WE NEED PROPER PAGELOCKS
-- if (op->op==shop_readm && op->rs1.is_imm() && op->rd.is_r32i() && op->rd._reg<16 && op->flags==0x4 && op->rs3.is_null())
-- {
-- u32 baddr=blk->addr&0x0FFFFFFF;
-+ if (0) {
-+ //a more minimalistic but still broken approach for this.
-+ //this is clearly a hack
-+ if (op->op == shop_readm && op->rs1.is_imm() && IsOnRam(op->rs1.imm_value()))
-+ {
-+ u32 round = op->rs1.imm_value() & ~PAGE_MASK;
-+ bool optmize_away = round == (blk->addr & ~PAGE_MASK) && (blk->addr & 0x007FFFFF) > 0x200000;
-+
-+ if (optmize_away && op->flags == 4) {
-+ u32 data = _vmem_ReadMem32(op->rs1.imm_value());
-+ op->op = shop_mov32;
-+ op->rs1.type = FMT_IMM;
-+ op->rs1._imm = data;
-+ }
-+ }
-+ }
-
-- if (/*baddr==0xC158400 &&*/ blk->addr/PAGE_SIZE == op->rs1._imm/PAGE_SIZE)
-+ if (0) {
-+ //NOT WORKING
-+ //WE NEED PROPER PAGELOCKS
-+ if (op->op == shop_readm && op->rs1.is_imm() && op->rd.is_r32i() && op->rd._reg<16 && op->flags == 0x4 && op->rs3.is_null())
- {
-- isi[op->rd._reg]=true;
-- rv[op->rd._reg]= ReadMem32(op->rs1._imm);
-- printf("IMM MOVE: %08X -> %08X\n",op->rs1._imm,rv[op->rd._reg]);
-+ u32 baddr = blk->addr & 0x0FFFFFFF;
-
-- op->op=shop_mov32;
-- op->rs1._imm=rv[op->rd._reg];
-+ if (/*baddr==0xC158400 &&*/ blk->addr / PAGE_SIZE == op->rs1._imm / PAGE_SIZE)
-+ {
-+ isi[op->rd._reg] = true;
-+ rv[op->rd._reg] = ReadMem32(op->rs1._imm);
-+ printf("IMM MOVE: %08X -> %08X\n", op->rs1._imm, rv[op->rd._reg]);
-+
-+ op->op = shop_mov32;
-+ op->rs1._imm = rv[op->rd._reg];
-+ }
- }
- }
- }
-@@ -925,7 +944,7 @@
- */
- if (settings.dynarec.unstable_opt)
- sq_pref(blk);
-- //constprop(blk); // crashes on ip
-+ constprop(blk); // maybe it works w/o the readm parts?
- #if HOST_CPU==CPU_X86
- // rdgrp(blk);
- // wtgrp(blk);
diff --git a/pcr/reicast-git/fix-x11-keyboard-support.patch b/pcr/reicast-git/fix-x11-keyboard-support.patch
deleted file mode 100644
index 1c147c5e2..000000000
--- a/pcr/reicast-git/fix-x11-keyboard-support.patch
+++ /dev/null
@@ -1,166 +0,0 @@
-diff -Nur a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp
---- a/core/linux-dist/x11.cpp 2016-05-18 07:26:32.038142723 -0300
-+++ b/core/linux-dist/x11.cpp 2016-05-18 11:50:02.625273688 -0300
-@@ -3,6 +3,7 @@
- #include <X11/Xlib.h>
- #include <X11/Xatom.h>
- #include <X11/Xutil.h>
-+#include <X11/XKBlib.h>
-
- #if !defined(GLES)
- #include <GL/gl.h>
-@@ -99,6 +100,114 @@
- else
- {
- int dc_key = x11_keymap[e.xkey.keycode];
-+ static bool ana_up = false;
-+ static bool ana_down = false;
-+ static bool ana_left = false;
-+ static bool ana_right = false;
-+ //Detect up press
-+ if(e.xkey.keycode == 25)
-+ {
-+ if(e.type == KeyPress)
-+ {
-+ ana_up = true;
-+ }
-+ else if(e.type == KeyRelease)
-+ {
-+ ana_up = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ //Detect down press
-+ if(e.xkey.keycode == 39)
-+ {
-+ if(e.type == KeyPress)
-+ {
-+ ana_down = true;
-+ }
-+ else if(e.type == KeyRelease)
-+ {
-+ ana_down = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ //Detect left press
-+ if(e.xkey.keycode == 38)
-+ {
-+ if(e.type == KeyPress)
-+ {
-+ ana_left = true;
-+ }
-+ else if(e.type == KeyRelease)
-+ {
-+ ana_left = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ //Detect right press
-+ if(e.xkey.keycode == 40)
-+ {
-+ if(e.type == KeyPress)
-+ {
-+ ana_right = true;
-+ }
-+ else if(e.type == KeyRelease)
-+ {
-+ ana_right = false;
-+ }
-+ else
-+ {
-+ }
-+ }
-+ /* Check analogue control states (up/down) */
-+ if((ana_up == true) && (ana_down == false))
-+ {
-+ joyy[0] = -127;
-+ }
-+ else if((ana_up == false) && (ana_down == true))
-+ {
-+ joyy[0] = 127;
-+ }
-+ else
-+ {
-+ /* Either both pressed simultaniously or neither pressed */
-+ joyy[0] = 0;
-+ }
-+ /* Check analogue control states (left/right) */
-+ if((ana_left == true) && (ana_right == false))
-+ {
-+ joyx[0] = -127;
-+ }
-+ else if((ana_left == false) && (ana_right == true))
-+ {
-+ joyx[0] = 127;
-+ }
-+ else
-+ {
-+ /* Either both pressed simultaniously or neither pressed */
-+ joyx[0] = 0;
-+ }
-+ if (e.xkey.keycode == 24)
-+ {
-+ // Left shoulder button pressed (lt)
-+ if (e.type == KeyPress)
-+ lt[0] = 255;
-+ else
-+ lt[0] = 0;
-+ }
-+ else if (e.xkey.keycode == 26)
-+ {
-+ // Right shoulder button pressed (rt)
-+ if (e.type == KeyPress)
-+ rt[0] = 255;
-+ else
-+ rt[0] = 0;
-+ }
- if (e.type == KeyPress)
- {
- kcode[0] &= ~dc_key;
-@@ -123,15 +232,14 @@
- x11_keymap[111] = DC_DPAD_UP;
- x11_keymap[116] = DC_DPAD_DOWN;
-
-+ x11_keymap[52] = DC_BTN_Y;
- x11_keymap[53] = DC_BTN_X;
- x11_keymap[54] = DC_BTN_B;
- x11_keymap[55] = DC_BTN_A;
-
-- /*
-- //TODO: Fix sliders
-- x11_keymap[38] = DPad_Down;
-- x11_keymap[39] = DPad_Down;
-- */
-+ x11_keymap[10] = DC_BTN_Z;
-+ x11_keymap[11] = DC_BTN_C;
-+ x11_keymap[12] = DC_BTN_D;
-
- x11_keymap[36] = DC_BTN_START;
-
-@@ -140,6 +248,9 @@
-
- void x11_window_create()
- {
-+
-+ Bool ar_set, ar_supp = false;
-+
- if (cfgLoadInt("pvr", "nox11", 0) == 0)
- {
- XInitThreads();
-@@ -302,6 +413,9 @@
- x11_disp = (void*)x11Display;
- x11_win = (void*)x11Window;
- x11_vis = (void*)x11Visual->visual;
-+
-+ ar_set = XkbSetDetectableAutoRepeat(x11Display, True, &ar_supp);
-+ printf("XkbSetDetectableAutoRepeat returns %u, supported = %u\n", ar_set, ar_supp);
- }
- else
- {
diff --git a/pcr/reicast-git/futuristic-memops.patch b/pcr/reicast-git/futuristic-memops.patch
deleted file mode 100644
index 517670402..000000000
--- a/pcr/reicast-git/futuristic-memops.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff -Nur a/core/hw/sh4/dyna/shil_canonical.h b/core/hw/sh4/dyna/shil_canonical.h
---- a/core/hw/sh4/dyna/shil_canonical.h 2015-10-06 21:43:53.031336322 -0300
-+++ b/core/hw/sh4/dyna/shil_canonical.h 2015-10-06 21:48:30.009328396 -0300
-@@ -206,6 +206,27 @@
- shil_recimp()
- shil_opc_end()
-
-+//mem io v2
-+
-+//vref = vrans<mode|size>(ptr, nil)
-+//vref = vrans<mode|size>(base, offset)
-+shil_opc(vtrans)
-+shil_recimp()
-+shil_opc_end()
-+
-+//dst = readpvr<size>(vref)
-+//dst = readpvr<size>(vref, nil, offs) w/ offs < 1024
-+shil_opc(readvptr)
-+shil_recimp()
-+shil_opc_end()
-+
-+//writevptr<size>(vref, src)
-+//writevptr<size>(vref, src, offs) w/ offs < 1024
-+shil_opc(writevptr)
-+shil_recimp()
-+shil_opc_end()
-+
-+
- //Canonical impl. opcodes !
- shil_opc(sync_sr)
- shil_canonical
diff --git a/pcr/reicast-git/multiplayer-config.patch b/pcr/reicast-git/multiplayer-config.patch
deleted file mode 100644
index bf0273e2b..000000000
--- a/pcr/reicast-git/multiplayer-config.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-diff -Nur a/core/hw/maple/maple_cfg.cpp b/core/hw/maple/maple_cfg.cpp
---- a/core/hw/maple/maple_cfg.cpp 2016-05-16 10:10:44.233725925 -0300
-+++ b/core/hw/maple/maple_cfg.cpp 2016-05-16 12:33:19.695805628 -0300
-@@ -78,10 +78,9 @@
-
- for (int i = 0; i < numberOfControl; i++){
- mcfg_Create(MDT_SegaController, i, 5);
-+ mcfg_Create(MDT_SegaVMU,i,0);
-+ mcfg_Create(MDT_SegaVMU,i,1);
- }
--
-- mcfg_Create(MDT_SegaVMU,0,0);
-- mcfg_Create(MDT_SegaVMU,0,1);
- #else
- mcfg_Create(MDT_NaomiJamma, 0, 5);
- #endif
diff --git a/pcr/reicast-git/no-buffer-overflows.patch b/pcr/reicast-git/no-buffer-overflows.patch
deleted file mode 100644
index 401013231..000000000
--- a/pcr/reicast-git/no-buffer-overflows.patch
+++ /dev/null
@@ -1,587 +0,0 @@
-diff -Nur a/core/cfg/cfg.cpp b/core/cfg/cfg.cpp
---- a/core/cfg/cfg.cpp 2016-05-18 07:26:31.884806485 -0300
-+++ b/core/cfg/cfg.cpp 2016-05-18 08:14:04.874168496 -0300
-@@ -128,7 +128,8 @@
- void cfgLoadStr(const wchar * Section, const wchar * Key, wchar * Return,const wchar* Default)
- {
- string value = cfgdb.get(Section, Key, Default);
-- strcpy(Return, value.c_str());
-+ strncpy(Return, value.c_str(), sizeof(Return));
-+ Return[sizeof(Return) - 1] = '\0';
- }
-
- string cfgLoadStr(const wchar * Section, const wchar * Key, const wchar* Default)
-diff -Nur a/core/cfg/ini.cpp b/core/cfg/ini.cpp
---- a/core/cfg/ini.cpp 2016-05-18 07:26:31.884806485 -0300
-+++ b/core/cfg/ini.cpp 2016-05-18 08:12:22.452503951 -0300
-@@ -221,7 +221,8 @@
- if (tl[0] == '[' && tl[strlen(tl)-1] == ']')
- {
- tl[strlen(tl)-1] = '\0';
-- strcpy(current_section, tl+1);
-+ strncpy(current_section, tl+1, sizeof(current_section));
-+ current_section[sizeof(current_section) - 1] = '\0';
- trim_ws(current_section);
- }
- else
-diff -Nur a/core/deps/libwebsocket/client.c b/core/deps/libwebsocket/client.c
---- a/core/deps/libwebsocket/client.c 2016-05-18 07:26:31.928140639 -0300
-+++ b/core/deps/libwebsocket/client.c 2016-05-18 08:29:26.276930099 -0300
-@@ -871,7 +871,8 @@
- lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_HOST));
- p += sprintf(p,
- "Upgrade: websocket\x0d\x0a""Connection: Upgrade\x0d\x0a""Sec-WebSocket-Key: ");
-- strcpy(p, key_b64);
-+ strncpy(p, key_b64, sizeof(p));
-+ p[sizeof(p) - 1] = '\0';
- p += strlen(key_b64);
- p += sprintf(p, "\x0d\x0a");
- if (lws_hdr_simple_ptr(wsi, _WSI_TOKEN_CLIENT_ORIGIN))
-diff -Nur a/core/deps/libwebsocket/context.c b/core/deps/libwebsocket/context.c
---- a/core/deps/libwebsocket/context.c 2016-05-18 07:26:31.928140639 -0300
-+++ b/core/deps/libwebsocket/context.c 2016-05-18 08:23:42.720827986 -0300
-@@ -167,7 +167,8 @@
-
- context->user_space = info->user;
-
-- strcpy(context->canonical_hostname, "unknown");
-+ strncpy(context->canonical_hostname, "unknown", sizeof(context->canonical_hostname));
-+ context->canonical_hostname[sizeof(context->canonical_hostname) - 1] = '\0';
-
- lws_server_get_canonical_hostname(context, info);
-
-diff -Nur a/core/deps/libwebsocket/libwebsockets.c b/core/deps/libwebsocket/libwebsockets.c
---- a/core/deps/libwebsocket/libwebsockets.c 2016-05-18 07:26:31.928140639 -0300
-+++ b/core/deps/libwebsocket/libwebsockets.c 2016-05-18 08:25:22.529251490 -0300
-@@ -526,7 +526,8 @@
-
- if (u - wsi->latency_start > context->worst_latency) {
- context->worst_latency = u - wsi->latency_start;
-- strcpy(context->worst_latency_info, buf);
-+ strncpy(context->worst_latency_info, buf, sizeof(context->worst_latency_info));
-+ context->worst_latency_info[sizeof(context->worst_latency_info) - 1] = '\0';
- }
- lwsl_latency("%s", buf);
- }
-diff -Nur a/core/deps/libwebsocket/parsers.c b/core/deps/libwebsocket/parsers.c
---- a/core/deps/libwebsocket/parsers.c 2016-05-18 07:26:31.931474036 -0300
-+++ b/core/deps/libwebsocket/parsers.c 2016-05-18 08:27:14.004563720 -0300
-@@ -99,8 +99,9 @@
- return 0;
-
- do {
-- strcpy(dest,
-- &wsi->u.hdr.ah->data[wsi->u.hdr.ah->frags[n].offset]);
-+ strncpy(dest,
-+ &wsi->u.hdr.ah->data[wsi->u.hdr.ah->frags[n].offset], sizeof(dest));
-+ dest[sizeof(dest) - 1] = '\0';
- dest += wsi->u.hdr.ah->frags[n].len;
- n = wsi->u.hdr.ah->frags[n].next_frag_index;
- } while (n);
-diff -Nur a/core/deps/libwebsocket/server-handshake.c b/core/deps/libwebsocket/server-handshake.c
---- a/core/deps/libwebsocket/server-handshake.c 2016-05-18 07:26:31.934807432 -0300
-+++ b/core/deps/libwebsocket/server-handshake.c 2016-05-18 09:05:43.379609693 -0300
-@@ -21,7 +21,7 @@
-
- #include "private-libwebsockets.h"
-
--#define LWS_CPYAPP(ptr, str) { strcpy(ptr, str); ptr += strlen(str); }
-+#define LWS_CPYAPP(ptr, str) { strncpy(ptr, str, sizeof(ptr)); ptr[sizeof(ptr) - 1] = '\0'; ptr += strlen(str); }
- #ifndef LWS_NO_EXTENSIONS
- LWS_VISIBLE int
- lws_extension_server_handshake(struct libwebsocket_context *context,
-@@ -212,7 +212,8 @@
- "Upgrade: WebSocket\x0d\x0a"
- "Connection: Upgrade\x0d\x0a"
- "Sec-WebSocket-Accept: ");
-- strcpy(p, (char *)context->service_buffer);
-+ strncpy(p, (char *)context->service_buffer, sizeof(p));
-+ p[sizeof(p) - 1] = '\0';
- p += accept_len;
-
- if (lws_hdr_total_length(wsi, WSI_TOKEN_PROTOCOL)) {
-diff -Nur a/core/deps/libzip/zip_add_dir.c b/core/deps/libzip/zip_add_dir.c
---- a/core/deps/libzip/zip_add_dir.c 2016-05-18 07:26:31.938140829 -0300
-+++ b/core/deps/libzip/zip_add_dir.c 2016-05-18 08:21:20.351686144 -0300
-@@ -60,7 +60,8 @@
- _zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
-- strcpy(s, name);
-+ strncpy(s, name, sizeof(s));
-+ s[sizeof(s) - 1] = '\0';
- s[len] = '/';
- s[len+1] = '\0';
- }
-diff -Nur a/core/deps/zlib/gzlib.c b/core/deps/zlib/gzlib.c
---- a/core/deps/zlib/gzlib.c 2016-05-18 07:26:31.958141208 -0300
-+++ b/core/deps/zlib/gzlib.c 2016-05-18 08:10:37.647202679 -0300
-@@ -213,7 +213,8 @@
- #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
- snprintf(state->path, len + 1, "%s", (const char *)path);
- #else
-- strcpy(state->path, path);
-+ strncpy(state->path, path, sizeof(state->path));
-+ state->path[sizeof(state->path) - 1] = '\0';
- #endif
-
- /* compute the flags for open() */
-@@ -607,7 +608,8 @@
- snprintf(state->msg, strlen(state->path) + strlen(msg) + 3,
- "%s%s%s", state->path, ": ", msg);
- #else
-- strcpy(state->msg, state->path);
-+ strncpy(state->msg, state->path, sizeof(state->msg));
-+ state->msg[sizeof(state->msg) - 1] = '\0';
- strcat(state->msg, ": ");
- strcat(state->msg, msg);
- #endif
-diff -Nur a/core/hw/flashrom/flashrom.h b/core/hw/flashrom/flashrom.h
---- a/core/hw/flashrom/flashrom.h 2016-05-18 07:26:31.978141586 -0300
-+++ b/core/hw/flashrom/flashrom.h 2016-05-18 07:40:53.826766511 -0300
-@@ -63,7 +63,8 @@
- wchar base[512];
- wchar temp[512];
- wchar names[512];
-- strcpy(names,names_ro.c_str());
-+ strncpy(names,names_ro.c_str(),sizeof(names));
-+ names[sizeof(names) - 1] = '\0';
- sprintf(base,"%s",root.c_str());
-
- wchar* curr=names;
-diff -Nur a/core/hw/naomi/naomi_cart.cpp b/core/hw/naomi/naomi_cart.cpp
---- a/core/hw/naomi/naomi_cart.cpp 2016-05-18 07:26:31.988141776 -0300
-+++ b/core/hw/naomi/naomi_cart.cpp 2016-05-18 07:38:20.557239856 -0300
-@@ -33,7 +33,8 @@
- folder_pos++;
-
- char t[512];
-- strcpy(t, file);
-+ strncpy(t, file, sizeof(t));
-+ t[sizeof(t) - 1] = '\0';
- FILE* fl = fopen(t, "r");
- if (!fl)
- return false;
-@@ -92,7 +93,8 @@
- RomCacheMapCount = (u32)files.size();
- RomCacheMap = new fd_t[files.size()];
-
-- strcpy(t, file);
-+ strncpy(t, file, sizeof(t));
-+ t[sizeof(t) - 1] = '\0';
- t[folder_pos] = 0;
- strcat(t, "ndcn-composed.cache");
-
-@@ -106,7 +108,8 @@
- verify(RomPtr != 0);
- verify(RomPtr != (void*)-1);
-
-- strcpy(t, file);
-+ strncpy(t, file, sizeof(t));
-+ t[sizeof(t) - 1] = '\0';
-
- //Create File Mapping Objects
- for (size_t i = 0; i<files.size(); i++)
-diff -Nur a/core/imgread/common.cpp b/core/imgread/common.cpp
---- a/core/imgread/common.cpp 2016-05-18 07:26:32.018142344 -0300
-+++ b/core/imgread/common.cpp 2016-05-18 08:01:47.097240088 -0300
-@@ -179,7 +179,8 @@
- }
-
- wchar fn[512];
-- strcpy(fn,settings.imgread.LastImage);
-+ strncpy(fn,settings.imgread.LastImage,sizeof(fn));
-+ fn[sizeof(fn) - 1] = '\0';
- #ifdef BUILD_DREAMCAST
- int gfrv=GetFile(fn,0,fileflags);
- #else
-@@ -199,7 +200,8 @@
- return false;
- }
-
-- strcpy(settings.imgread.LastImage,fn);
-+ strncpy(settings.imgread.LastImage,fn,sizeof(settings.imgread.LastImage));
-+ settings.imgread.LastImage[sizeof(settings.imgread.LastImage) - 1] = '\0';
- SaveSettings();
-
- if (!InitDrive_(fn))
-@@ -233,7 +235,8 @@
- }
-
- wchar fn[512];
-- strcpy(fn,settings.imgread.LastImage);
-+ strncpy(fn,settings.imgread.LastImage,sizeof(fn));
-+ fn[sizeof(fn) - 1] = '\0';
- #ifdef BUILD_DREAMCAST
- int gfrv=GetFile(fn,0,fileflags);
- #else
-@@ -256,7 +259,8 @@
- return false;
- }
-
-- strcpy(settings.imgread.LastImage,fn);
-+ strncpy(settings.imgread.LastImage,fn,sizeof(settings.imgread.LastImage));
-+ settings.imgread.LastImage[sizeof(settings.imgread.LastImage) - 1] = '\0';
- SaveSettings();
-
- if (!InitDrive_(fn))
-diff -Nur a/core/imgread/gdi.cpp b/core/imgread/gdi.cpp
---- a/core/imgread/gdi.cpp 2016-05-18 07:26:32.021475740 -0300
-+++ b/core/imgread/gdi.cpp 2016-05-18 08:04:36.580422753 -0300
-@@ -32,7 +32,8 @@
- printf("\nGDI : %d tracks\n",iso_tc);
-
- char path[512];
-- strcpy(path,file);
-+ strncpy(path,file,sizeof(path));
-+ path[sizeof(path) - 1] = '\0';
- size_t len=strlen(file);
- while (len>2)
- {
-@@ -87,7 +88,8 @@
-
- if (SSIZE!=0)
- {
-- strcpy(pathptr, track_filename.c_str());
-+ strncpy(pathptr, track_filename.c_str(),sizeof(pathptr));
-+ pathptr[sizeof(pathptr) - 1] = '\0';
- t.file = new RawTrackFile(core_fopen(path),OFFSET,t.StartFAD,SSIZE);
- }
- disc->tracks.push_back(t);
-diff -Nur a/core/nullDC.cpp b/core/nullDC.cpp
---- a/core/nullDC.cpp 2016-05-18 07:26:32.041476119 -0300
-+++ b/core/nullDC.cpp 2016-05-18 08:06:38.942720450 -0300
-@@ -62,7 +62,8 @@
- if (GetOpenFileNameA(&ofn))
- {
- //already there
-- //strcpy(szFileName,ofn.lpstrFile);
-+ //strncpy(szFileName,ofn.lpstrFile,sizeof(szFileName));
-+ //szFileName[sizeof(szFileName) - 1] = '\0';
- }
- #endif
- }
-diff -Nur a/core/webui/server.cpp b/core/webui/server.cpp
---- a/core/webui/server.cpp 2016-05-18 07:26:32.061476498 -0300
-+++ b/core/webui/server.cpp 2016-05-18 07:46:18.756291583 -0300
-@@ -288,7 +288,8 @@
- }
-
- /* if not, send a file the easy way */
-- strcpy(buf, resource_path);
-+ strncpy(buf, resource_path, sizeof(buf));
-+ buf[sizeof(buf) - 1] = '\0';
- if (strcmp((const char*)in, "/")) {
- if (*((const char *)in) != '/')
- strcat(buf, "/");
-diff -Nur a/shell/android/jni/src/Android.cpp b/shell/android/jni/src/Android.cpp
---- a/shell/android/jni/src/Android.cpp 2016-05-18 07:26:32.144811409 -0300
-+++ b/shell/android/jni/src/Android.cpp 2016-05-18 08:20:01.230329866 -0300
-@@ -206,7 +206,8 @@
-
- if(Args[2])
- {
-- strcpy(Args[2],"config:image=");
-+ strncpy(Args[2],"config:image=",sizeof(Args[2]));
-+ Args[2][sizeof(Args[2]) - 1] = '\0';
- strcat(Args[2],P);
- }
-
-diff -Nur a/shell/linux-deps/include/X11/Xos_r.h b/shell/linux-deps/include/X11/Xos_r.h
---- a/shell/linux-deps/include/X11/Xos_r.h 2016-05-18 07:26:32.328148215 -0300
-+++ b/shell/linux-deps/include/X11/Xos_r.h 2016-05-18 09:04:54.728728985 -0300
-@@ -255,27 +255,33 @@
-
- (p).pws.pw_name = (p).pwbuf;
- (p).len = strlen((p).pwp->pw_name);
-- strcpy((p).pws.pw_name, (p).pwp->pw_name);
-+ strncpy((p).pws.pw_name, (p).pwp->pw_name, sizeof((p).pws.pw_name));
-+ (p).pws.pw_name[sizeof((p).pws.pw_name) - 1] = '\0';
-
- (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1;
- (p).len = strlen((p).pwp->pw_passwd);
-- strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd);
-+ strncpy((p).pws.pw_passwd,(p).pwp->pw_passwd, sizeof((p).pws.pw_passwd));
-+ (p).pws.pw_passwd[sizeof((p).pws.pw_passwd) - 1] = '\0';
-
- (p).pws.pw_class = (p).pws.pw_passwd + (p).len + 1;
- (p).len = strlen((p).pwp->pw_class);
-- strcpy((p).pws.pw_class, (p).pwp->pw_class);
-+ strncpy((p).pws.pw_class, (p).pwp->pw_class, sizeof((p).pws.pw_class));
-+ (p).pws.pw_class[sizeof((p).pws.pw_class) - 1] = '\0';
-
- (p).pws.pw_gecos = (p).pws.pw_class + (p).len + 1;
- (p).len = strlen((p).pwp->pw_gecos);
-- strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos);
-+ strncpy((p).pws.pw_gecos, (p).pwp->pw_gecos, sizeof((p).pws.pw_gecos));
-+ (p).pws.pw_gecos[sizeof((p).pws.pw_gecos) - 1] = '\0';
-
- (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1;
- (p).len = strlen((p).pwp->pw_dir);
-- strcpy((p).pws.pw_dir, (p).pwp->pw_dir);
-+ strncpy((p).pws.pw_dir, (p).pwp->pw_dir, sizeof((p).pws.pw_dir));
-+ (p).pws.pw_dir[sizeof((p).pws.pw_dir) - 1] = '\0';
-
- (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1;
- (p).len = strlen((p).pwp->pw_shell);
-- strcpy((p).pws.pw_shell, (p).pwp->pw_shell);
-+ strncpy((p).pws.pw_shell, (p).pwp->pw_shell, sizeof((p).pws.pw_shell));
-+ (p).pws.pw_shell[sizeof((p).pws.pw_shell) - 1] = '\0';
-
- (p).pwp = &(p).pws;
- }
-@@ -285,25 +291,32 @@
- (memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \
- ((p).pws.pw_name = (p).pwbuf), \
- ((p).len = strlen((p).pwp->pw_name)), \
-- strcpy((p).pws.pw_name, (p).pwp->pw_name), \
-+ strncpy((p).pws.pw_name, (p).pwp->pw_name, sizeof((p).pws.pw_name)), \
-+ (p).pws.pw_name[sizeof((p).pws.pw_name) - 1] = '\0', \
- ((p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1), \
- ((p).len = strlen((p).pwp->pw_passwd)), \
-- strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd), \
-+ strncpy((p).pws.pw_passwd,(p).pwp->pw_passwd, sizeof((p).pws.pw_passwd)), \
-+ (p).pws.pw_passwd[sizeof((p).pws.pw_passwd) - 1] = '\0', \
- ((p).pws.pw_age = (p).pws.pw_passwd + (p).len + 1), \
- ((p).len = strlen((p).pwp->pw_age)), \
-- strcpy((p).pws.pw_age, (p).pwp->pw_age), \
-+ strncpy((p).pws.pw_age, (p).pwp->pw_age, sizeof((p).pws.pw_age)), \
-+ (p).pws.pw_age[sizeof((p).pws.pw_age) - 1] = '\0', \
- ((p).pws.pw_comment = (p).pws.pw_age + (p).len + 1), \
- ((p).len = strlen((p).pwp->pw_comment)), \
-- strcpy((p).pws.pw_comment, (p).pwp->pw_comment), \
-+ strncpy((p).pws.pw_comment, (p).pwp->pw_comment, sizeof((p).pws.pw_comment)), \
-+ (p).pws.pw_comment[sizeof((p).pws.pw_comment) - 1] = '\0', \
- ((p).pws.pw_gecos = (p).pws.pw_comment + (p).len + 1), \
- ((p).len = strlen((p).pwp->pw_gecos)), \
-- strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos), \
-+ strncpy((p).pws.pw_gecos, (p).pwp->pw_gecos, sizeof((p).pws.pw_gecos)), \
-+ (p).pws.pw_gecos[sizeof((p).pws.pw_gecos) - 1] = '\0', \
- ((p).pws.pw_dir = (p).pws.pw_comment + (p).len + 1), \
- ((p).len = strlen((p).pwp->pw_dir)), \
-- strcpy((p).pws.pw_dir, (p).pwp->pw_dir), \
-+ strncpy((p).pws.pw_dir, (p).pwp->pw_dir, sizeof((p).pws.pw_dir)), \
-+ (p).pws.pw_dir[sizeof((p).pws.pw_dir) - 1] = '\0', \
- ((p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1), \
-- ((p).len = strlen((p).pwp->pw_shell)), \
-- strcpy((p).pws.pw_shell, (p).pwp->pw_shell), \
-+ ((p).len = strlen((p).pwp->pw_shell), \
-+ strncpy((p).pws.pw_shell, (p).pwp->pw_shell, sizeof((p).pws.pw_shell)), \
-+ (p).pws.pw_shell[sizeof((p).pws.pw_shell) - 1] = '\0', \
- ((p).pwp = &(p).pws), \
- 0 )
- #endif
-@@ -423,15 +436,18 @@
-
- # define _Xg_copyHostent(hp) \
- (memcpy(&(hp).hent, (hp).hptr, sizeof(struct hostent)), \
-- strcpy((hp).h_name, (hp).hptr->h_name), \
-+ strncpy((hp).h_name, (hp).hptr->h_name, sizeof((hp).h_name)), \
-+ (hp).h_name[sizeof((hp).h_name) - 1] = '\0', \
- ((hp).hent.h_name = (hp).h_name), \
- ((hp).hptr = &(hp).hent), \
- 0 )
- # define _Xg_copyServent(sp) \
- (memcpy(&(sp).sent, (sp).sptr, sizeof(struct servent)), \
-- strcpy((sp).s_name, (sp).sptr->s_name), \
-+ strncpy((sp).s_name, (sp).sptr->s_name, sizeof((sp).s_name)), \
-+ (sp).s_name[sizeof((sp).s_name) - 1] = '\0', \
- ((sp).sent.s_name = (sp).s_name), \
-- strcpy((sp).s_proto, (sp).sptr->s_proto), \
-+ strncpy((sp).s_proto, (sp).sptr->s_proto, sizeof((sp).s_proto)), \
-+ (sp).s_proto[sizeof((sp).s_proto) - 1] = '\0', \
- ((sp).sent.s_proto = (sp).s_proto), \
- ((sp).sptr = &(sp).sent), \
- 0 )
-@@ -1015,7 +1031,8 @@
- ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
- ((p).grp.gr_name = (p).buf), \
- ((p).len = strlen((p).pgrp->gr_name)), \
-- strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
-+ strncpy((p).grp.gr_name, (p).pgrp->gr_name, sizeof((p).grp.gr_name)), \
-+ (p).grp.gr_name[sizeof((p).grp.gr_name) - 1] = '\0', \
- ((p).grp.gr_passwd = (p).grp.gr_name + (p).len + 1), \
- ((p).pgrp = &(p).grp), \
- 0 )
-@@ -1023,7 +1040,8 @@
- # define _Xgrp_copyGroup(p) \
- ( memcpy(&(p).grp, (p).pgrp, sizeof(struct group)), \
- ((p).grp.gr_name = (p).buf), \
-- strcpy((p).grp.gr_name, (p).pgrp->gr_name), \
-+ strncpy((p).grp.gr_name, (p).pgrp->gr_name, sizeof((p).grp.gr_name)), \
-+ (p).grp.gr_name[sizeof((p).grp.gr_name) - 1] = '\0', \
- ((p).pgrp = &(p).grp), \
- 0 )
- #endif
-diff -Nur a/shell/linux-deps/include/X11/Xtrans/Xtrans.c b/shell/linux-deps/include/X11/Xtrans/Xtrans.c
---- a/shell/linux-deps/include/X11/Xtrans/Xtrans.c 2016-05-18 07:26:32.331481611 -0300
-+++ b/shell/linux-deps/include/X11/Xtrans/Xtrans.c 2016-05-18 08:46:03.538321741 -0300
-@@ -212,7 +212,8 @@
- /* Copy the string so it can be changed */
-
- tmpptr = mybuf = (char *) xalloc (strlen (address) + 1);
-- strcpy (mybuf, address);
-+ strncpy (mybuf, address, sizeof(mybuf));
-+ mybuf[sizeof(mybuf) - 1] = '\0';
-
- /* Parse the string to get each component */
-
-@@ -371,7 +372,8 @@
- return 0;
- }
- else
-- strcpy (*protocol, _protocol);
-+ strncpy (*protocol, _protocol, sizeof(*protocol));
-+ *protocol[sizeof(*protocol) - 1] = '\0';
-
- if ((*host = (char *) xalloc (strlen (_host) + 1)) == NULL)
- {
-@@ -384,7 +386,8 @@
- return 0;
- }
- else
-- strcpy (*host, _host);
-+ strncpy (*host, _host, sizeof(*host));
-+ *host[sizeof(*host) - 1] = '\0';
-
- if ((*port = (char *) xalloc (strlen (_port) + 1)) == NULL)
- {
-@@ -398,7 +401,8 @@
- return 0;
- }
- else
-- strcpy (*port, _port);
-+ strncpy (*port, _port, sizeof(*port));
-+ *port[sizeof(*port) - 1] = '\0';
-
- xfree (tmpptr);
-
-@@ -545,7 +549,8 @@
- return NULL;
- }
-
-- strcpy (save_port, port);
-+ strncpy (save_port, port, sizeof(save_port));
-+ save_port[sizeof(save_port) - 1] = '\0';
-
- /* Get a new XtransConnInfo object */
-
-@@ -671,7 +676,8 @@
- return 0;
- else
- {
-- strcpy (*port, ciptr->port);
-+ strncpy (*port, ciptr->port, sizeof(*port));
-+ *port[sizeof(*port) - 1] = '\0';
- return 1;
- }
- }
-diff -Nur a/shell/linux-deps/include/X11/Xtrans/Xtranslcl.c b/shell/linux-deps/include/X11/Xtrans/Xtranslcl.c
---- a/shell/linux-deps/include/X11/Xtrans/Xtranslcl.c 2016-05-18 07:26:32.334815008 -0300
-+++ b/shell/linux-deps/include/X11/Xtrans/Xtranslcl.c 2016-05-18 08:37:44.809264973 -0300
-@@ -165,7 +165,8 @@
- xfree((char *) sunaddr);
- return 0;
- }
-- strcpy (sunaddr->sun_path, sun_path);
-+ strncpy (sunaddr->sun_path, sun_path, sizeof(sunaddr->sun_path));
-+ sunaddr->sun_path[sizeof(sunaddr->sun_path) - 1] = '\0';
- #if defined(BSD44SOCKETS)
- sunaddr->sun_len = strlen (sunaddr->sun_path);
- #endif
-@@ -193,7 +194,8 @@
- xfree((char *) p_sunaddr);
- return 0;
- }
-- strcpy (p_sunaddr->sun_path, peer_sun_path);
-+ strncpy (p_sunaddr->sun_path, peer_sun_path, sizeof(p_sunaddr->sun_path));
-+ p_sunaddr->sun_path[sizeof(p_sunaddr->sun_path) - 1] = '\0';
- #if defined(BSD44SOCKETS)
- p_sunaddr->sun_len = strlen (p_sunaddr->sun_path);
- #endif
-@@ -633,7 +635,8 @@
- }
-
- sunaddr->sun_family=AF_UNIX;
-- strcpy(sunaddr->sun_path,buf);
-+ strncpy(sunaddr->sun_path,buf,sizeof(sunaddr->sun_path));
-+ sunaddr->sun_path[sizeof(sunaddr->sun_path) - 1] = '\0';
- #if defined(BSD44SOCKETS)
- sunaddr->sun_len=strlen(sunaddr->sun_path);
- #endif
-@@ -1682,7 +1685,8 @@
- {
- workingXLOCAL=freeXLOCAL=(char *)xalloc (strlen (protocol) + 1);
- if (workingXLOCAL)
-- strcpy (workingXLOCAL, protocol);
-+ strncpy (workingXLOCAL, protocol, sizeof(workingXLOCAL));
-+ workingXLOCAL[sizeof(workingXLOCAL) - 1] = '\0';
- }
- else {
- XLOCAL=(char *)getenv("XLOCAL");
-@@ -1690,7 +1694,8 @@
- XLOCAL=DEF_XLOCAL;
- workingXLOCAL=freeXLOCAL=(char *)xalloc (strlen (XLOCAL) + 1);
- if (workingXLOCAL)
-- strcpy (workingXLOCAL, XLOCAL);
-+ strncpy (workingXLOCAL, XLOCAL, sizeof(workingXLOCAL));
-+ workingXLOCAL[sizeof(workingXLOCAL) - 1] = '\0';
- }
- }
-
-diff -Nur a/shell/linux-deps/include/X11/Xtrans/Xtranstli.c b/shell/linux-deps/include/X11/Xtrans/Xtranstli.c
---- a/shell/linux-deps/include/X11/Xtrans/Xtranstli.c 2016-05-18 07:26:32.334815008 -0300
-+++ b/shell/linux-deps/include/X11/Xtrans/Xtranstli.c 2016-05-18 08:49:18.868553403 -0300
-@@ -277,7 +277,8 @@
-
- #ifdef nuke
- if( *port == '/' ) { /* A full pathname */
-- (void) strcpy(sunaddr->sun_path, port);
-+ (void) strncpy(sunaddr->sun_path, port, sizeof(sunaddr->sun_path));
-+ (void) sunaddr->sun_path[sizeof(sunaddr->sun_path) - 1] = '\0';
- } else {
- (void) sprintf(sunaddr->sun_path,"%s%s", TLINODENAME, port );
- }
-@@ -840,7 +841,8 @@
- sunaddr->sun_family=AF_UNIX;
- if( port && *port ) {
- if( *port == '/' ) { /* A full pathname */
-- (void) strcpy(sunaddr->sun_path, port);
-+ (void) strncpy(sunaddr->sun_path, port, sizeof(sunaddr->sun_path));
-+ (void) sunaddr->sun_path[sizeof(sunaddr->sun_path) - 1] = '\0';
- } else {
- (void) sprintf(sunaddr->sun_path,"%s%s", TLINODENAME, port );
- }
-@@ -1144,7 +1146,8 @@
- if( *port == '/' ||
- strncmp (port, TLINODENAME, strlen (TLINODENAME)) == 0) {
- /* Use the port as is */
-- (void) strcpy(sunaddr->sun_path, port);
-+ (void) strncpy(sunaddr->sun_path, port, sizeof(sunaddr->sun_path));
-+ (void) sunaddr->sun_path[sizeof(sunaddr->sun_path) - 1] = '\0';
- } else {
- (void) sprintf(sunaddr->sun_path,"%s%s", TLINODENAME, port );
- }
-diff -Nur a/shell/linux-deps/include/X11/Xtrans/Xtransutil.c b/shell/linux-deps/include/X11/Xtrans/Xtransutil.c
---- a/shell/linux-deps/include/X11/Xtrans/Xtransutil.c 2016-05-18 07:26:32.338148404 -0300
-+++ b/shell/linux-deps/include/X11/Xtrans/Xtransutil.c 2016-05-18 08:40:26.572188461 -0300
-@@ -203,7 +203,8 @@
- if (!*addrp)
- *addrp = (Xtransaddr *) xalloc (len + 1);
- if (*addrp) {
-- strcpy ((char *) *addrp, hostnamebuf);
-+ strncpy ((char *) *addrp, hostnamebuf, sizeof((char *) *addrp));
-+ (char *) *addrp[sizeof((char *) *addrp) - 1] = '\0';
- *addrlenp = len;
- } else {
- *addrlenp = 0;
-@@ -420,7 +421,8 @@
-
- hostname = (char *) xalloc (
- strlen (ciptr->transptr->TransName) + strlen (addr) + 2);
-- strcpy (hostname, ciptr->transptr->TransName);
-+ strncpy (hostname, ciptr->transptr->TransName, sizeof(hostname));
-+ hostname[sizeof(hostname) - 1] = '\0';
- strcat (hostname, "/");
- if (addr)
- strcat (hostname, addr);
diff --git a/pcr/reicast-git/sh-block-graphs.patch b/pcr/reicast-git/sh-block-graphs.patch
deleted file mode 100644
index c8e1bcf15..000000000
--- a/pcr/reicast-git/sh-block-graphs.patch
+++ /dev/null
@@ -1,296 +0,0 @@
-diff -Nur a/core/hw/sh4/dyna/blockmanager.cpp b/core/hw/sh4/dyna/blockmanager.cpp
---- a/core/hw/sh4/dyna/blockmanager.cpp 2015-10-06 21:43:53.030336315 -0300
-+++ b/core/hw/sh4/dyna/blockmanager.cpp 2015-10-06 21:58:25.685653822 -0300
-@@ -122,7 +122,11 @@
- }
- else
- {
-- printf("bm_GetBlock(%08X) failed ..\n",dynarec_code);
-+ for (iter = blkmap.begin(); iter != blkmap.end(); iter++) {
-+ if ((*iter)->contains_code((u8*)dynarec_code))
-+ return *iter;
-+ }
-+ //printf("bm_GetBlock(%p, %p) failed ..\n",dynarec_code, ngen_FailedToFindBlock);
- return 0;
- }
- }
-@@ -158,6 +162,8 @@
- verify((void*)bm_GetCode(blk->addr)==(void*)ngen_FailedToFindBlock);
- FPCA(blk->addr)=blk->code;
-
-+ verify(bm_GetBlock(blk->addr) == blk);
-+
- #ifdef DYNA_OPROF
- if (oprofHandle)
- {
-diff -Nur a/core/hw/sh4/dyna/blockmanager.h b/core/hw/sh4/dyna/blockmanager.h
---- a/core/hw/sh4/dyna/blockmanager.h 2015-10-06 21:43:53.030336315 -0300
-+++ b/core/hw/sh4/dyna/blockmanager.h 2015-10-06 21:58:25.685653822 -0300
-@@ -71,6 +71,7 @@
-
- u32 memops;
- u32 linkedmemops;
-+ bool entry_block;
- };
-
- struct CachedBlockInfo: RuntimeBlockInfo_Core
-diff -Nur a/core/hw/sh4/dyna/decoder.cpp b/core/hw/sh4/dyna/decoder.cpp
---- a/core/hw/sh4/dyna/decoder.cpp 2015-10-06 21:43:53.030336315 -0300
-+++ b/core/hw/sh4/dyna/decoder.cpp 2015-10-06 21:58:25.685653822 -0300
-@@ -14,6 +14,7 @@
- #include "hw/sh4/sh4_core.h"
- #include "hw/sh4/sh4_mem.h"
- #include "decoder_opcodes.h"
-+#include "../interpr/sh4_opcodes.h"
-
- #define BLOCK_MAX_SH_OPS_SOFT 500
- #define BLOCK_MAX_SH_OPS_HARD 511
-@@ -1098,6 +1099,13 @@
- else
- blk->guest_cycles+=CPU_RATIO;
-
-+ if ((state.cpu.is_delayslot && OpDesc[op]->SetPC()) ||
-+ OpDesc[op]->oph == iNotImplemented) {
-+ blk->addr = -1;
-+ return;
-+ }
-+
-+
- verify(!(state.cpu.is_delayslot && OpDesc[op]->SetPC()));
- if (state.ngen.OnlyDynamicEnds || !OpDesc[op]->rec_oph)
- {
-@@ -1168,6 +1176,8 @@
- if (settings.dynarec.idleskip)
- {
- //Experimental hash-id based idle skip
-+ if (blk->addr == 0x8C0B926A)
-+ blk->guest_cycles *= 100;
- if (strstr(idle_hash,blk->hash(false,true)))
- {
- //printf("IDLESKIP: %08X reloc match %s\n",blk->addr,blk->hash(false,true));
-diff -Nur a/core/hw/sh4/dyna/driver.cpp b/core/hw/sh4/dyna/driver.cpp
---- a/core/hw/sh4/dyna/driver.cpp 2015-10-06 21:43:53.030336315 -0300
-+++ b/core/hw/sh4/dyna/driver.cpp 2015-10-06 21:58:25.685653822 -0300
-@@ -72,11 +72,24 @@
- LastAddr=LastAddr_min;
- memset(emit_GetCCPtr(),0xCC,emit_FreeSpace());
- }
-+
-+#include <map>
-+#include <algorithm>
-+#include <set>
-+
-+typedef map<u32, RuntimeBlockInfo*> BlockGraph;
-+
-+vector<BlockGraph*> graphs;
-+map<u32, BlockGraph*> blockgraphs;
-+
- void recSh4_ClearCache()
- {
- LastAddr=LastAddr_min;
- bm_Reset();
-
-+ graphs.clear();
-+ blockgraphs.clear();
-+
- printf("recSh4:Dynarec Cache clear at %08X\n",curr_pc);
- }
-
-@@ -212,9 +225,145 @@
- AnalyseBlock(this);
- }
-
-+void merge_graphs(BlockGraph* one, BlockGraph* two) {
-+ for (BlockGraph::iterator it = two->begin(); it != two->end(); it++) {
-+ blockgraphs[it->second->addr] = one;
-+ (*one)[it->second->addr] = it->second;
-+ }
-+ graphs.erase(find(graphs.begin(), graphs.end(), two));
-+}
-+
-+void discover_graph(u32 bootstrap) {
-+ BlockGraph* graph;
-+ set<u32> resolved;
-+ vector<u32> unresolved;
-+
-+ if (blockgraphs.count(bootstrap)) {
-+ graph = blockgraphs[bootstrap];
-+ (*graph)[bootstrap]->entry_block = true;
-+ return;
-+ } else {
-+ graph = new BlockGraph();
-+
-+ graphs.push_back(graph);
-+ }
-+
-+ unresolved.push_back(bootstrap);
-+
-+ while (unresolved.size()) {
-+ u32 pc = unresolved[unresolved.size()-1];
-+ unresolved.pop_back();
-+
-+ if (resolved.count(pc))
-+ continue;
-+
-+ if (graph->count(pc))
-+ continue;
-+
-+ if (blockgraphs.count(pc)) {
-+ verify(blockgraphs[pc] != graph);
-+ merge_graphs(blockgraphs[pc], graph);
-+ graph = blockgraphs[pc];
-+ resolved.clear();
-+ continue;
-+ }
-+
-+ resolved.insert(pc);
-+ //printf("resolving %08X\n", pc);
-+
-+ RuntimeBlockInfo* rbi = ngen_AllocateBlock();
-+ rbi->Setup(pc,fpscr);
-+ rbi->entry_block = pc == bootstrap;
-+
-+ if (rbi->addr == -1)
-+ continue;
-+
-+ (*graph)[pc] = rbi;
-+ blockgraphs[pc] = graph;
-+
-+ if (rbi->BranchBlock !=-1 && rbi->BlockType != BET_StaticCall)
-+ unresolved.push_back(rbi->BranchBlock);
-+
-+ if (rbi->NextBlock != -1)
-+ unresolved.push_back(rbi->NextBlock);
-+ }
-+
-+ int entrypoints = 0;
-+
-+ for (BlockGraph::iterator it = graph->begin(); it != graph->end(); it++) {
-+ entrypoints += it->second->entry_block;
-+ }
-+
-+ //printf("Graph: %d blocks w/ %d entrypoints, %d graphs\n", graph->size(), entrypoints, graphs.size());
-+}
-+
-+void print_graphs() {
-+ int top_runs = 0;
-+ int total_runs = 0;
-+ map<BlockGraph*, u32> graph_runs;
-+
-+ for (size_t i = 0; i < graphs.size(); i++) {
-+ BlockGraph* graph = graphs[i];
-+ for (BlockGraph::iterator it = graphs[i]->begin(); it != graphs[i]->end(); it++) {
-+
-+ RuntimeBlockInfo* natblock = bm_GetBlock(it->first);
-+ if (!natblock || natblock->runs == 0)
-+ continue;
-+
-+ if (natblock->runs > top_runs)
-+ top_runs = natblock->runs;
-+
-+ total_runs += natblock->runs;
-+
-+ graph_runs[graph] += natblock->runs;
-+ }
-+ }
-+
-+ int baseline = top_runs / 100;
-+
-+ printf("<Graphdump\n");
-+ for (size_t i = 0; i < graphs.size(); i++) {
-+ BlockGraph* graph = graphs[i];
-+ if (graph_runs[graph] < baseline)
-+ continue;
-+ printf("\tGraph: %p\n", graphs[i]);
-+
-+ int cnt = 0;
-+ int cnt2 = 0;
-+ for (BlockGraph::iterator it = graphs[i]->begin(); it != graphs[i]->end(); it++) {
-+
-+ RuntimeBlockInfo* natblock = bm_GetBlock(it->first);
-+ if (!natblock || natblock->runs == 0 || natblock->runs < baseline) {
-+ if (natblock) {
-+ cnt2++;
-+ natblock->runs = 0;
-+ } else {
-+ cnt++;
-+ }
-+ continue;
-+ }
-+ printf("\t\tBlock %08X, compiled: %d, entrypoint: %d, type: %d, len: %d, cycles: %d, runs %d, loop %d\n",
-+ it->first, natblock != 0, it->second->entry_block, it->second->BlockType, it->second->oplist.size(),
-+ it->second->guest_cycles, natblock ? natblock->runs : 0,
-+ (it->second->BlockType == BET_Cond_0 || it->second->BlockType == BET_Cond_1) && graph->count(it->second->BranchBlock) );
-+
-+ if (natblock)
-+ natblock->runs = 0;
-+ }
-+ if (cnt2) {
-+ printf("\t\t and %d more not worth mentioning\n", cnt2);
-+ }
-+ if (cnt) {
-+ printf("\t\t and %d more that never run\n", cnt);
-+ }
-+ }
-+ printf("Graphdump>\n");
-+}
-+
- DynarecCodeEntryPtr rdv_CompilePC()
- {
- u32 pc=next_pc;
-+ discover_graph(pc);
-
- if (emit_FreeSpace()<16*1024 || pc==0x8c0000e0 || pc==0xac010000 || pc==0xac008300)
- recSh4_ClearCache();
-@@ -232,6 +381,7 @@
- rbi->staging_runs=do_opts?100:-100;
- ngen_Compile(rbi,DoCheck(rbi->addr),(pc&0xFFFFFF)==0x08300 || (pc&0xFFFFFF)==0x10000,false,do_opts);
- verify(rbi->code!=0);
-+ verify(rbi->host_code_size!=0);
-
- bm_AddBlock(rbi);
-
-diff -Nur a/core/linux-dist/main.cpp b/core/linux-dist/main.cpp
---- a/core/linux-dist/main.cpp 2015-10-06 21:43:53.042336401 -0300
-+++ b/core/linux-dist/main.cpp 2015-10-06 21:58:25.685653822 -0300
-@@ -189,6 +189,18 @@
- #if defined(USE_SDL)
- input_sdl_handle(port);
- #endif
-+
-+ //Whatever happened to these?
-+#if FEAT_SHREC != DYNAREC_NONE
-+ /*
-+ void print_graphs();
-+ if ('b' == key) emit_WriteCodeCache();
-+ if ('n' == key) bm_Reset();
-+ if ('m' == key) bm_Sort();
-+ if (',' == key) { emit_WriteCodeCache(); bm_Sort(); }
-+ if ('q' == key) print_graphs();
-+ */
-+#endif
- }
-
- void os_DoEvents()
-diff -Nur a/core/rec-x64/rec_x64.cpp b/core/rec-x64/rec_x64.cpp
---- a/core/rec-x64/rec_x64.cpp 2015-10-06 21:43:53.045336422 -0300
-+++ b/core/rec-x64/rec_x64.cpp 2015-10-06 21:58:25.685653822 -0300
-@@ -162,6 +162,10 @@
-
- sub(dword[rax], block->guest_cycles);
-
-+ mov(rax, (size_t)&block->runs);
-+ add(dword[rax], 1);
-+
-+
- sub(rsp, 0x28);
-
- for (size_t i = 0; i < block->oplist.size(); i++) {
-@@ -355,6 +359,7 @@
-
- block->code = (DynarecCodeEntryPtr)getCode();
-
-+ block->host_code_size = getSize();
- emit_Skip(getSize());
- }
-