Adding two NES emulators.

Because of them, I made allegro build the allegrogl library.
I also added the HawkNL library.


svn path=/nixpkgs/trunk/; revision=26517
This commit is contained in:
Lluís Batlle i Rossell 2011-03-25 22:15:48 +00:00
parent 9eb80e4f94
commit ef57b57b92
7 changed files with 188 additions and 1 deletions

View File

@ -1,7 +1,7 @@
x@{builderDefsPackage
, texinfo, libXext, xextproto, libX11, xproto, libXpm, libXt, libXcursor
, alsaLib, cmake, zlib, libpng, libvorbis, libXxf86dga, libXxf86misc
, xf86dgaproto, xf86miscproto, xf86vidmodeproto, libXxf86vm, openal
, xf86dgaproto, xf86miscproto, xf86vidmodeproto, libXxf86vm, openal, mesa
, ...}:
builderDefsPackage
(a :

View File

@ -0,0 +1,28 @@
{stdenv, fetchurl, unzip}:
stdenv.mkDerivation {
name = "hawknl-1.34";
src = fetchurl {
url = http://hawksoft.com/download/files/HawkNL168src.zip;
sha256 = "11shn2fbxj3w0j77w0234pqyj1368x686kkgv09q5yqhi1cdp028";
};
buildInputs = [ unzip ];
makefile = "makefile.linux";
patchPhase = ''
sed -i s/soname,NL/soname,libNL/ src/makefile.linux
'';
preInstall = ''
sed -i s,/usr/local,$out, src/makefile.linux
ensureDir $out/lib $out/include
'';
meta = {
homepage = http://hawksoft.com/hawknl/;
description = "Free, open source, game oriented network API";
license = "LGPLv2+";
};
}

View File

@ -0,0 +1,28 @@
{stdenv, fetchurl, libX11, libXt, libXext, libXaw }:
assert stdenv.system == "i686-linux";
stdenv.mkDerivation {
name = "darnes-9b0401";
src = fetchurl {
url = http://www.dridus.com/~nyef/darcnes/download/dn9b0401.tgz;
sha256 = "05a7mh51rg7ydb414m3p5mm05p4nz2bgvspqzwm3bhbj7zz543k3";
};
buildInputs = [ libX11 libXt libXext libXaw ];
installPhase = ''
ensureDir $out/bin
cp darcnes $out/bin
'';
patches = [ ./label.patch ];
meta = {
homepage = http://www.dridus.com/~nyef/darcnes/;
description = "Multi-System emulator, specially for NES";
/* Prohibited commercial use, credit required. */
license = "free";
};
}

View File

@ -0,0 +1,13 @@
http://gentoo-overlays.zugaina.org/funtoo/portage/games-emulation/darcnes/files/darcnes-0401-exec-stack.patch
diff -Naur old/video_x.c new/video_x.c
--- old/video_x.c 2004-09-04 01:26:41.102187277 +0200
+++ new/video_x.c 2004-09-04 01:27:51.586427427 +0200
@@ -366,6 +366,7 @@
}
default:
+ break;
}
}

View File

@ -0,0 +1,84 @@
diff --git a/build/openal.cbd b/build/openal.cbd
index d18e62d..74af061 100644
--- a/build/openal.cbd
+++ b/build/openal.cbd
@@ -23,7 +23,7 @@ CFLAGS += ' -DUSE_OPENAL'
# --
do ifplat unix
- LDFLAGS += ' `openal-config --libs`'
+ LDFLAGS += ' -lopenal'
else
LDFLAGS += ' -lOpenAL32'
done
diff --git a/build/alleggl.cbd b/build/alleggl.cbd
index e2708ff..e826371 100644
--- a/build/alleggl.cbd
+++ b/build/alleggl.cbd
@@ -22,7 +22,7 @@ CFLAGS += ' -DUSE_ALLEGROGL'
# --
-LIBAGL = agl
+LIBAGL = alleggl
ifopt debug LIBAGL = 'agld'
diff --git a/src/apu.cpp b/src/apu.cpp
index af59f1c..893a798 100644
--- a/src/apu.cpp
+++ b/src/apu.cpp
@@ -1930,7 +1930,7 @@ static void amplify(real& sample)
gain -= releaseRate;
}
- real output = (1.0 / max(gain, EPSILON));
+ real output = (1.0 / MAX(gain, EPSILON));
output = fixf(output, apu_agc_gain_floor, apu_agc_gain_ceiling);
sample *= output;
}
diff --git a/src/audio.cpp b/src/audio.cpp
index b9650dc..c21c05e 100644
--- a/src/audio.cpp
+++ b/src/audio.cpp
@@ -7,6 +7,7 @@
You must read and accept the license prior to use. */
#include <allegro.h>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
@@ -234,7 +235,7 @@ void audio_update(void)
const unsigned queuedFrames = (audioQueue.size() / audio_channels);
if(queuedFrames > 0) {
// Determine how many frames we want to make room for.
- const unsigned framesToAdd = min(queuedFrames, audio_buffer_size_frames);
+ const unsigned framesToAdd = MIN(queuedFrames, audio_buffer_size_frames);
// Make room for the frames in the buffer.
const unsigned framesToMove = (audioBufferedFrames - framesToAdd);
if(framesToMove > 0) {
@@ -258,7 +259,7 @@ void audio_update(void)
// Determine how many frames are available in the buffer.
const unsigned bufferableFrames = (audio_buffer_size_frames - audioBufferedFrames);
// Determine the number of frames to copy to the buffer.
- const unsigned framesToCopy = min(queuedFrames, bufferableFrames);
+ const unsigned framesToCopy = MIN(queuedFrames, bufferableFrames);
// Copy frames to the buffer.
for(unsigned frame = 0; frame < framesToCopy; frame++) {
diff --git a/src/include/common.h b/src/include/common.h
index be28795..e2d21d1 100644
--- a/src/include/common.h
+++ b/src/include/common.h
@@ -41,8 +41,10 @@ extern "C" {
#define true TRUE
#define false FALSE
+/*
#define min(x,y) MIN((x),(y))
#define max(x,y) MAX((x),(y))
+*/
#define true_or_false(x) ((x) ? true : false)

View File

@ -0,0 +1,28 @@
{stdenv, fetchurl, allegro, openal, mesa, zlib, hawknl, freeglut, libX11,
libXxf86vm, libXcursor, libXpm }:
stdenv.mkDerivation {
name = "fakenes-0.5.9b3";
src = fetchurl {
url = mirror://sourceforge/fakenes/fakenes-0.5.9-beta3.tar.gz;
sha256 = "026h67s4pzc1vma59pmzk02iy379255qbai2q74wln9bxqcpniy4";
};
buildInputs = [ allegro openal mesa zlib hawknl freeglut libX11
libXxf86vm libXcursor libXpm ];
installPhase = ''
ensureDir $out/bin
cp fakenes $out/bin
'';
NIX_LDFLAGS = "-lX11 -lXxf86vm -lXcursor -lXpm";
patches = [ ./build.patch ];
meta = {
homepage = http://fakenes.sourceforge.net/;
license = "GPLv2+";
description = "Portable Open Source NES Emulator";
};
}

View File

@ -3278,6 +3278,8 @@ let
# TODO : Add MIT Kerberos and let admin choose.
kerberos = heimdal;
hawknl = callPackage ../development/libraries/hawknl { };
heimdal = callPackage ../development/libraries/kerberos/heimdal.nix { };
herqqSvn = callPackage ../development/libraries/herqq/svn.nix { };
@ -7474,6 +7476,8 @@ let
cupsBjnp = callPackage ../misc/cups/drivers/cups-bjnp { };
darcnes = callPackage ../misc/emulators/darcnes { };
dblatex = callPackage ../misc/tex/dblatex { };
dosbox = callPackage ../misc/emulators/dosbox { };
@ -7484,6 +7488,8 @@ let
electricsheep = callPackage ../misc/screensavers/electricsheep { };
fakenes = callPackage ../misc/emulators/fakenes { };
foldingathome = callPackage ../misc/foldingathome { };
foo2zjs = callPackage ../misc/drivers/foo2zjs {};