[Scummvm-cvs-logs] SF.net SVN: scummvm: [25844] tools/trunk
kirben at users.sourceforge.net
kirben at users.sourceforge.net
Sun Feb 25 07:21:19 CET 2007
Revision: 25844
http://scummvm.svn.sourceforge.net/scummvm/?rev=25844&view=rev
Author: kirben
Date: 2007-02-24 22:21:19 -0800 (Sat, 24 Feb 2007)
Log Message:
-----------
Add extractor for Applie II version of Maniac Mansion.
Modified Paths:
--------------
tools/trunk/Makefile
tools/trunk/Makefile.mingw
tools/trunk/README
Added Paths:
-----------
tools/trunk/extract_mm_apple.c
Modified: tools/trunk/Makefile
===================================================================
--- tools/trunk/Makefile 2007-02-25 00:12:11 UTC (rev 25843)
+++ tools/trunk/Makefile 2007-02-25 06:21:19 UTC (rev 25844)
@@ -33,6 +33,7 @@
extract_agos$(EXEEXT) \
extract_kyra$(EXEEXT) \
extract_loom_tg16$(EXEEXT) \
+ extract_mm_apple$(EXEEXT) \
extract_mm_c64$(EXEEXT) \
extract_mm_nes$(EXEEXT) \
extract_scumm_mac$(EXEEXT) \
@@ -99,6 +100,9 @@
extract_loom_tg16$(EXEEXT): extract_loom_tg16.o util.o
$(CC) $(LDFLAGS) -o $@ $+
+extract_mm_apple$(EXEEXT): extract_mm_apple.o util.o
+ $(CC) $(LDFLAGS) -o $@ $+
+
extract_mm_c64$(EXEEXT): extract_mm_c64.o util.o
$(CC) $(LDFLAGS) -o $@ $+
@@ -132,6 +136,7 @@
encode_dxa.o \
extract_kyra.o \
extract_loom_tg16.o \
+extract_mm_apple.o \
extract_mm_c64.o \
extract_mm_nes.o \
extract_scumm_mac.o \
Modified: tools/trunk/Makefile.mingw
===================================================================
--- tools/trunk/Makefile.mingw 2007-02-25 00:12:11 UTC (rev 25843)
+++ tools/trunk/Makefile.mingw 2007-02-25 06:21:19 UTC (rev 25844)
@@ -28,6 +28,7 @@
strip extract_agos.exe -o $(SCUMMVMPATH)/tools/extract_agos.exe
strip extract_kyra.exe -o $(SCUMMVMPATH)/tools/extract_kyra.exe
strip extract_loom_tg16.exe -o $(SCUMMVMPATH)/tools/extract_loom_tg16.exe
+ strip extract_mm_apple.exe -o $(SCUMMVMPATH)/tools/extract_mm_apple.exe
strip extract_mm_c64.exe -o $(SCUMMVMPATH)/tools/extract_mm_c64.exe
strip extract_mm_nes.exe -o $(SCUMMVMPATH)/tools/extract_mm_nes.exe
strip extract_scumm_mac.exe -o $(SCUMMVMPATH)/tools/extract_scumm_mac.exe
Modified: tools/trunk/README
===================================================================
--- tools/trunk/README 2007-02-25 00:12:11 UTC (rev 25843)
+++ tools/trunk/README 2007-02-25 06:21:19 UTC (rev 25844)
@@ -27,6 +27,10 @@
to dump the code tracks on the CD.
There is currently no support for this game in ScummVM!
+ extract_mm_apple
+ Extracts data files from the Apple II version of Maniac
+ Mansion.
+
extract_mm_c64
Extracts data files from the Commodore 64 version of Maniac
Mansion.
Added: tools/trunk/extract_mm_apple.c
===================================================================
--- tools/trunk/extract_mm_apple.c (rev 0)
+++ tools/trunk/extract_mm_apple.c 2007-02-25 06:21:19 UTC (rev 25844)
@@ -0,0 +1,166 @@
+/* extract_mm_apple - Extract data files from Apple II version of Maniac Mansion
+ * Copyright (C) 2004-2006 The ScummVM Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "util.h"
+#include <stdarg.h>
+
+typedef int BOOL;
+#define TRUE 1
+#define FALSE 0
+
+#ifdef _MSC_VER
+ #define vsnprintf _vsnprintf
+#endif
+
+void writeByteAlt(FILE *fp, uint8 b)
+{
+ writeByte(fp, (uint8)(b ^ 0xFF));
+}
+void writeUint16LEAlt(FILE *fp, uint16 value)
+{
+ writeUint16LE(fp, (uint16)(value ^ 0xFFFF));
+}
+#define writeByte writeByteAlt
+#define writeUint16LE writeUint16LEAlt
+
+void notice(const char *s, ...) {
+ char buf[1024];
+ va_list va;
+
+ va_start(va, s);
+ vsnprintf(buf, 1024, s, va);
+ va_end(va);
+
+ fprintf(stdout, "%s\n", buf);
+}
+
+unsigned char room_disks[55], room_tracks[55], room_sectors[55];
+
+int main (int argc, char **argv)
+{
+ FILE *input1, *input2, *output;
+ char fname[256];
+ int i, j;
+ unsigned short signature;
+
+ if (argc < 3)
+ {
+ printf("Syntax: %s <disk1.dsk> <disk2.dsk>\n",argv[0]);
+ return 1;
+ }
+ if (!(input1 = fopen(argv[1],"rb")))
+ error("Error: unable to open file %s for input!",argv[1]);
+ if (!(input2 = fopen(argv[2],"rb")))
+ error("Error: unable to open file %s for input!",argv[2]);
+
+ fseek(input1, 142080, SEEK_SET);
+ fseek(input2, 143104, SEEK_SET);
+
+ /* check signature */
+ signature = readUint16LE(input1);
+ if (signature != 0x0A31)
+ error("Signature not found in disk 1!");
+ signature = readUint16LE(input2);
+ if (signature != 0x0032)
+ error("Signature not found in disk 2!");
+
+ if (!(output = fopen("00.LFL","wb")))
+ error("Unable to create index file!");
+ notice("Creating 00.LFL...");
+
+ /* write signature */
+ writeUint16LE(output, signature);
+
+ /* copy object flags */
+ for (i = 0; i < 256; i++)
+ writeByte(output, readByte(input1));
+
+ /* copy room offsets */
+ for (i = 0; i < 55; i++) {
+ room_disks[i] = readByte(input1);
+ writeByte(output, room_disks[i]);
+ }
+ for (i = 0; i < 55; i++) {
+ room_sectors[i] = readByte(input1);
+ writeByte(output, room_sectors[i]);
+ room_tracks[i] = readByte(input1);
+ writeByte(output, room_tracks[i]);
+ }
+
+ /* TODO: Double check values, as index is slightly longer */
+
+ for (i = 0; i < 25; i++)
+ writeByte(output, readByte(input1));
+ for (i = 0; i < 25; i++)
+ writeUint16LE(output, readUint16LE(input1));
+
+ for (i = 0; i < 160; i++)
+ writeByte(output, readByte(input1));
+ for (i = 0; i < 160; i++)
+ writeUint16LE(output, readUint16LE(input1));
+
+ for (i = 0; i < 70; i++)
+ writeByte(output, readByte(input1));
+ for (i = 0; i < 70; i++)
+ writeUint16LE(output, readUint16LE(input1));
+ fclose(output);
+
+ for (i = 0; i < 55; i++) {
+ const int SectorOffset[36] = {
+ 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 256,
+ 272, 288, 304, 320, 336, 352, 368,
+ 384, 400, 416, 432, 448, 464,
+ 480, 496, 512, 528, 544, 560
+ };
+ const int ResourcesPerFile[55] = {
+ 0, 11, 1, 3, 9, 12, 1, 13, 10, 6,
+ 4, 1, 7, 1, 1, 2, 7, 8, 19, 9,
+ 6, 9, 2, 6, 8, 4, 16, 8, 3, 3,
+ 12, 12, 2, 8, 1, 1, 2, 1, 9, 1,
+ 3, 7, 3, 3, 13, 5, 4, 3, 1, 1,
+ 3, 10, 1, 0, 0
+ };
+ FILE *input;
+ if (room_disks[i] == '1')
+ input = input1;
+ else if (room_disks[i] == '2')
+ input = input2;
+ else continue;
+
+ sprintf(fname,"%02i.LFL", i);
+ output = fopen(fname, "wb");
+ if (output == NULL)
+ error("Unable to create %s!",fname);
+ notice("Creating %s...",fname);
+ fseek(input, (SectorOffset[room_tracks[i]] + room_sectors[i]) * 256, SEEK_SET);
+ for (j = 0; j < ResourcesPerFile[i]; j++) {
+ unsigned short len = readUint16LE(input);
+ writeUint16LE(output, len);
+ for (len -= 2; len > 0; len--)
+ writeByte(output, readByte(input));
+ }
+ rewind(input);
+ }
+
+ notice("All done!");
+ return 0;
+}
Property changes on: tools/trunk/extract_mm_apple.c
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Date Rev Author URL Id
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list