From 6726493ee7aa4ac2f66260349947efb229f17adf Mon Sep 17 00:00:00 2001
From: Jonas Kulla <Nyocurio@gmail.com>
Date: Wed, 23 Jul 2014 23:05:24 +0200
Subject: [PATCH] RGSSAD: Add RGSS2 archive reader

Exactly the same as RGSS1 but different file extension.
Also remove some redundant strings.
---
 src/filesystem.cpp |  4 +++-
 src/rgssad.cpp     | 27 ++++++++++++++++++++++++---
 src/rgssad.h       |  3 ++-
 3 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/filesystem.cpp b/src/filesystem.cpp
index e78805f..67b87fc 100644
--- a/src/filesystem.cpp
+++ b/src/filesystem.cpp
@@ -337,7 +337,9 @@ FileSystem::FileSystem(const char *argv0,
 	p->extensions[Font].push_back("otf");
 
 	PHYSFS_init(argv0);
-	PHYSFS_registerArchiver(&RGSS_Archiver);
+
+	PHYSFS_registerArchiver(&RGSS1_Archiver);
+	PHYSFS_registerArchiver(&RGSS2_Archiver);
 
 	if (allowSymlinks)
 		PHYSFS_permitSymbolicLinks(1);
diff --git a/src/rgssad.cpp b/src/rgssad.cpp
index dd94f51..c047a8c 100644
--- a/src/rgssad.cpp
+++ b/src/rgssad.cpp
@@ -466,14 +466,35 @@ RGSS_noop2(void*, const char*)
 	return 0;
 }
 
-const PHYSFS_Archiver RGSS_Archiver =
+const PHYSFS_Archiver RGSS1_Archiver =
 {
 	0,
 	{
 		"RGSSAD",
 		"RGSS encrypted archive format",
-		"Jonas Kulla <Nyocurio@gmail.com>",
-		"http://k-du.de/rgss/rgss.html",
+		"", /* Author */
+		"", /* Website */
+		0 /* symlinks not supported */
+	},
+	RGSS_openArchive,
+	RGSS_enumerateFiles,
+	RGSS_openRead,
+	RGSS_noop1, /* openWrite */
+	RGSS_noop1, /* openAppend */
+	RGSS_noop2, /* remove */
+	RGSS_noop2, /* mkdir */
+	RGSS_stat,
+	RGSS_closeArchive
+};
+
+const PHYSFS_Archiver RGSS2_Archiver =
+{
+	0,
+	{
+		"RGSS2A",
+		"RGSS2 encrypted archive format",
+		"", /* Author */
+		"", /* Website */
 		0 /* symlinks not supported */
 	},
 	RGSS_openArchive,
diff --git a/src/rgssad.h b/src/rgssad.h
index b93eba6..9e809d0 100644
--- a/src/rgssad.h
+++ b/src/rgssad.h
@@ -24,6 +24,7 @@
 
 #include <physfs.h>
 
-extern const PHYSFS_Archiver RGSS_Archiver;
+extern const PHYSFS_Archiver RGSS1_Archiver;
+extern const PHYSFS_Archiver RGSS2_Archiver;
 
 #endif // RGSSAD_H