pkgsrc/emulators/gens/patches/patch-ah
dillo 0271939835 Add support for playing back gmv movies (recording of previously
played game), based on
	http://bisqwit.iki.fi/src/Gens212a-moviepatch-jyzero,bisqwit.gz
adapted to rc3 and cleaned up by me.

More information and movies can be found at
	http://bisqwit.iki.fi/jutut/nesvideos/FrontPage.html

Bump PKGREVISION.
2004-08-15 12:13:53 +00:00

65 lines
1.3 KiB
Text

$NetBSD: patch-ah,v 1.2 2004/08/15 12:13:53 dillo Exp $
--- src/gens/util/rom.c.orig 2004-05-18 22:33:59.000000000 +0200
+++ src/gens/util/rom.c
@@ -17,6 +17,7 @@
#include "ccnet.h"
#include "misc.h"
#include "unzip.h"
+#include "chd.h"
#include "wave.h"
#include "gym.h"
#include <assert.h>
@@ -168,6 +169,7 @@ Detect_Format (char *Name)
FILE *f;
unzFile zf;
unz_file_info zinf;
+ struct chd *cf;
int i;
char buf[1024], zname[256];
@@ -225,6 +227,19 @@ Detect_Format (char *Name)
gzread (f, buf, 1024);
gzclose (f);
}
+ else if (!stricmp (".chd", &Name[strlen (Name) -4]))
+ {
+ char *p;
+ int n;
+
+ cf = chd_open(Name, NULL);
+ if (cf == NULL)
+ return -1;
+
+ chd_read_range(cf, buf, 0, 1024);
+
+ chd_close(cf);
+ }
else
{
strcpy (zname, Name);
@@ -389,7 +404,7 @@ Get_Rom ()
GtkWidget *widget;
gint res;
char Name[2048];
- gchar *filename;
+ gchar *filename = NULL;
int sys;
widget =
@@ -403,9 +418,12 @@ Get_Rom ()
}
gtk_widget_destroy (widget);
- strncpy (Name, filename, 2048);
- g_free (filename);
- Free_Rom (Game);
+ if (filename)
+ {
+ strncpy (Name, filename, 2048);
+ g_free (filename);
+ Free_Rom (Game);
+ }
sys = Detect_Format (Name);