From 57553045649e72f86f3931a03ceeb2fff71fedfe Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Sat, 13 Dec 2014 18:15:11 -0500 Subject: [PATCH] Add Mupen64 v0.5. --- games-emulation/mupen64/mupen64-0.5.recipe | 69 +++++++ .../mupen64/patches/mupen64-0.5.patch | 188 ++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 games-emulation/mupen64/mupen64-0.5.recipe create mode 100644 games-emulation/mupen64/patches/mupen64-0.5.patch diff --git a/games-emulation/mupen64/mupen64-0.5.recipe b/games-emulation/mupen64/mupen64-0.5.recipe new file mode 100644 index 000000000..312f38858 --- /dev/null +++ b/games-emulation/mupen64/mupen64-0.5.recipe @@ -0,0 +1,69 @@ +SUMMARY="A portable Nintendo 64 emulator" +DESCRIPTION="Mupen64 is a portable Nintendo 64 emulator. It emulates most Nintendo \ +64 games perfectly enough that they are playable." +HOMEPAGE="http://mupen64.emulation64.com/" +COPYRIGHT="2005 Hacktarux & Azimer" +SRC_URI="http://mupen64.emulation64.com/files/0.5/mupen64_src-0.5.tar.bz2" +CHECKSUM_SHA256="1b8e4188ab7a94d8125b77aed8725ee348c24818622b881adfe16be510487dfd" +SOURCE_DIR="mupen64_src-$portVersion" +PATCHES="mupen64-$portVersion.patch" +REVISION="1" +LICENSE="GNU GPL v2" + +DISABLE_SOURCE_PACKAGE="YES" # bug in HaikuPorter that makes this fail + +ARCHITECTURES="x86 ?x86_64" +if [ $effectiveTargetArchitecture != x86_gcc2 ]; then + # x86_gcc2 is fine as primary target architecture as long as we're building + # for a different secondary architecture. + ARCHITECTURES="$ARCHITECTURES x86_gcc2" +else + ARCHITECTURES="$ARCHITECTURES !x86_gcc2" +fi +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + mupen64$secondaryArchSuffix = $portVersion + cmd:mupen64_nogui = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libgl$secondaryArchSuffix + lib:libsdl_1.2$secondaryArchSuffix >= 0.11.4 + lib:libz$secondaryArchSuffix + " +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + devel:libgl$secondaryArchSuffix + devel:libsdl_1.2$secondaryArchSuffix >= 0.11.4 + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:pkg_config$secondaryArchSuffix + cmd:make + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + " + +BUILD() +{ + export WITH_HOME="$prefix/" + make -e $jobArgs \ + mupen64_nogui \ + plugins/mupen64_input.so \ + plugins/mupen64_hle_rsp_azimer.so \ + plugins/dummyaudio.so \ + plugins/jttl_audio.so \ + plugins/mupen64_soft_gfx.so +} + +INSTALL() +{ + mkdir -p $prefix $prefix/bin $prefix/data/mupen64 + + cp mupen64_nogui $prefix/bin + cp mupen64.ini $prefix/data/mupen64 + cp -rv lang $prefix/data/mupen64 + cp -rv plugins $prefix/data/mupen64 + cp -rv doc $prefix/data/mupen64 +} diff --git a/games-emulation/mupen64/patches/mupen64-0.5.patch b/games-emulation/mupen64/patches/mupen64-0.5.patch new file mode 100644 index 000000000..0fd780c64 --- /dev/null +++ b/games-emulation/mupen64/patches/mupen64-0.5.patch @@ -0,0 +1,188 @@ +From 480f35785b23c25194d5b6c00df041597e6547ac Mon Sep 17 00:00:00 2001 +From: Augustin Cavalier +Date: Sat, 13 Dec 2014 18:01:23 -0500 +Subject: [PATCH] Fix build on Haiku. + +--- + Makefile | 16 ++++++++-------- + config.h | 1 - + main/main.c | 11 ++++++----- + rsp_hle/wintypes.h | 12 ++++-------- + 4 files changed, 18 insertions(+), 22 deletions(-) + +diff --git a/Makefile b/Makefile +index e1370e5..ffdc78d 100644 +--- a/Makefile ++++ b/Makefile +@@ -4,7 +4,7 @@ CC =gcc + CXX =g++ + + #CFLAGS =-DX86 -O3 -mpentium -Wall -DEMU64_DEBUG +-CFLAGS =-DX86 -O3 -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -ffast-math -fno-strict-aliasing -mcpu=athlon -Wall -pipe ++CFLAGS =-DX86 -O3 -fexpensive-optimizations -fomit-frame-pointer -funroll-loops -ffast-math -fno-strict-aliasing -Wall -pipe -DWITH_HOME=\"$(WITH_HOME)\" -DNOGUI_VERSION + #CFLAGS =-DX86 -O3 -mcpu=pentium -Wall -g -pg + #CFLAGS =-DX86 -Wall -pipe -g3 -DEMU64_DEBUG + #CFLAGS =-DX86 -Wall -pipe -g -DEMU64_DEBUG -DCOMPARE_CORE +@@ -153,7 +153,7 @@ HEADER =main/rom.h \ + r4300/recomp.h \ + memory/pif.h + +-LIB =-lz -lm ++LIB =-lz + + ifneq ("$(shell grep GTK2 config.h)","\#define GTK2_SUPPORT 1") + GTK_FLAGS =`gtk-config --cflags` +@@ -206,7 +206,7 @@ main/gui_gtk/romproperties.o: main/gui_gtk/romproperties.c + $(CC) $(CFLAGS) -c -o $@ $< $(GTK_FLAGS) + + main/gui_gtk/config.o: main/gui_gtk/config.c +- $(CC) $(CFLAGS) -c -o $@ $< $(GTK_FLAGS) ++ $(CC) $(CFLAGS) -c -o $@ $< + + main/gui_gtk/dirbrowser.o: main/gui_gtk/dirbrowser.c + $(CC) $(CFLAGS) -c -o $@ $< $(GTK_FLAGS) +@@ -218,7 +218,7 @@ main/vcr_compress.o: main/vcr_compress.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< `avifile-config --cflags` + + mupen64_input/main.o: mupen64_input/main.c +- $(CC) $(CFLAGS) -DUSE_GTK -c -o $@ $< $(GTK_FLAGS) `sdl-config --cflags` ++ $(CC) $(CFLAGS) -c -o $@ $< `sdl-config --cflags` + + blight_input/plugin.o: blight_input/plugin.c + $(CC) $(CFLAGS) "-DPACKAGE=\"$(shell grep PACKAGE blight_input/package | cut -d "=" -f 2)\"" "-DVERSION=\"$(shell grep VERSION blight_input/package | cut -d "=" -f 2)\"" `sdl-config --cflags` -DGUI_SDL -c -o $@ $< +@@ -243,13 +243,13 @@ blight_input/pad.o: blight_input/pad.c + $(CC) $(CFLAGS) -DGUI_SDL -c -o $@ $< + + rsp_hle/main.o: rsp_hle/main.c +- $(CC) $(CFLAGS) $(GTK_FLAGS) -DUSE_GTK -c -o $@ $< ++ $(CC) $(CFLAGS) -c -o $@ $< + + mupen64_audio/main.o: mupen64_audio/main.c + $(CC) $(CFLAGS) $(GTK_FLAGS) -DUSE_GTK -c -o $@ $< + + jttl_audio/main.o: jttl_audio/main.c +- $(CC) $(CFLAGS) $(GTK_FLAGS) -DUSE_GTK `sdl-config --cflags` -c -o $@ $< ++ $(CC) $(CFLAGS) `sdl-config --cflags` -c -o $@ $< + + mupen64_soft_gfx/main.o: mupen64_soft_gfx/main.cpp + $(CXX) $(CFLAGS) `sdl-config --cflags` -c -o $@ $< +@@ -342,7 +342,7 @@ glN64/F3DWRUS.o: glN64/F3DWRUS.cpp + $(CXX) $(CFLAGS) -D__LINUX__ -DX86_ASM `sdl-config --cflags` -c -o $@ $< + + mupen64_nogui: $(OBJ) $(OBJ_X86) main/main.o main/gui_gtk/config.o +- $(CC) $^ $(LIB) -Wl,-export-dynamic -L/usr/X11R6/lib `sdl-config --libs` -lGL -lpthread -ldl -o $@ ++ $(CC) $^ $(LIB) -Wl,-export-dynamic -L/usr/X11R6/lib `sdl-config --libs` -lGL -o $@ + strip --strip-all $@ + + ifneq ("$(shell grep VCR config.h)","\#define VCR_SUPPORT 1") +@@ -363,7 +363,7 @@ mupen64_oldgui: $(OBJ) $(OBJ_X86) main/main_gtk.o + strip --strip-all $@ + + plugins/mupen64_input.so: $(OBJ_INPUT) +- $(CC) $^ -Wl,-Bsymbolic -shared $(GTK_LIBS) -o $@ ++ $(CC) $^ -Wl,-Bsymbolic -shared -o $@ + strip --strip-all $@ + + plugins/blight_input.so: $(OBJ_BLIGHT) +diff --git a/config.h b/config.h +index f2ef9b7..303d655 100644 +--- a/config.h ++++ b/config.h +@@ -1,7 +1,6 @@ + #ifndef CONFIG_H + #define CONFIG_H + +-#undef WITH_HOME + #undef VCR_SUPPORT + #define GTK2_SUPPORT 1 + +diff --git a/main/main.c b/main/main.c +index 00a12a0..78ed1c9 100644 +--- a/main/main.c ++++ b/main/main.c +@@ -37,6 +37,7 @@ + + #include + #include ++#include + + #include "main.h" + #include "guifuncs.h" +@@ -263,7 +264,7 @@ int main (int argc, char *argv[]) + unsigned char byte; + dest = fopen(temp, "wb"); + strcpy(orig, WITH_HOME); +- strcat(orig, "share/mupen64/mupen64.ini"); ++ strcat(orig, "data/mupen64/mupen64.ini"); + src = fopen(orig, "rb"); + while(fread(&byte, 1, 1, src)) + fwrite(&byte, 1, 1, dest); +@@ -275,7 +276,7 @@ int main (int argc, char *argv[]) + strcpy(temp, g_WorkingDir); + strcat(temp, "lang"); + strcpy(orig, WITH_HOME); +- strcat(orig, "share/mupen64/lang"); ++ strcat(orig, "data/mupen64/lang"); + symlink(orig, temp); + + /*strcpy(temp, g_WorkingDir); +@@ -288,14 +289,14 @@ int main (int argc, char *argv[]) + strcat(temp, "plugins"); + mkdir(temp, 0700); + strcpy(orig, WITH_HOME); +- strcat(orig, "share/mupen64/plugins"); ++ strcat(orig, "data/mupen64/plugins"); + dir = opendir(orig); + while((entry = readdir(dir)) != NULL) + { + if(strcmp(entry->d_name + strlen(entry->d_name) - 3, ".so")) + { + strcpy(orig, WITH_HOME); +- strcat(orig, "share/mupen64/plugins/"); ++ strcat(orig, "data/mupen64/plugins/"); + strcat(orig, entry->d_name); + src = fopen(orig, "rb"); + if(src == NULL) continue; +@@ -321,7 +322,7 @@ int main (int argc, char *argv[]) + strcat(temp, "plugins/"); + strcat(temp, entry->d_name); + strcpy(orig, WITH_HOME); +- strcat(orig, "share/mupen64/plugins/"); ++ strcat(orig, "data/mupen64/plugins/"); + strcat(orig, entry->d_name); + symlink(orig, temp); + } +diff --git a/rsp_hle/wintypes.h b/rsp_hle/wintypes.h +index 7e01c9d..0d820b2 100644 +--- a/rsp_hle/wintypes.h ++++ b/rsp_hle/wintypes.h +@@ -1,7 +1,7 @@ + #ifndef __WINTYPES_H__ + #define __WINTYPES_H__ + +-#include ++#include + + typedef int HWND; + typedef int HINSTANCE; +@@ -12,14 +12,10 @@ typedef void* LPVOID; + #define _cdecl + #define WINAPI + +-typedef u_int32_t DWORD; +-typedef u_int16_t WORD; +-typedef u_int8_t BYTE, byte; ++typedef uint32 DWORD; ++typedef uint16 WORD; ++typedef uint8 BYTE, byte; + typedef int BOOL, BOOLEAN; +-#define __int8 char +-#define __int16 short +-#define __int32 int +-#define __int64 long long + + /** HRESULT stuff **/ + typedef long HRESULT; +-- +1.8.3.4 +