[Scummvm-cvs-logs] SF.net SVN: scummvm:[46625] tools/branches/gsoc2009-gui

sev at users.sourceforge.net sev at users.sourceforge.net
Sun Dec 27 13:02:20 CET 2009


Revision: 46625
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46625&view=rev
Author:   sev
Date:     2009-12-27 12:02:20 +0000 (Sun, 27 Dec 2009)

Log Message:
-----------
Sync with trunk tools. Part 1/2

Modified Paths:
--------------
    tools/branches/gsoc2009-gui/create_sjisfnt.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.cpp
    tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.h

Modified: tools/branches/gsoc2009-gui/create_sjisfnt.cpp
===================================================================
--- tools/branches/gsoc2009-gui/create_sjisfnt.cpp	2009-12-27 11:56:51 UTC (rev 46624)
+++ tools/branches/gsoc2009-gui/create_sjisfnt.cpp	2009-12-27 12:02:20 UTC (rev 46625)
@@ -26,7 +26,7 @@
 #include <cstdio>
 #include <cstdlib>
 #include <iconv.h>
-#include <vector>
+#include <list>
 
 #include "common/endian.h"
 #include "common/file.h"
@@ -37,6 +37,9 @@
 
 namespace {
 
+bool isASCII(uint8 fB);
+
+int mapASCIItoChunk(uint8 fB);
 int mapSJIStoChunk(uint8 fB, uint8 sB);
 
 bool initSJIStoUTF32Conversion();
@@ -58,8 +61,22 @@
 	uint8 *plainData;
 };
 
-bool drawGlyph16x16(uint32 unicode, Glyph &glyph);
+bool setGlyphSize(int width, int height);
+bool checkGlyphSize(const Glyph &g, const int baseLine, const int maxW, const int maxH);
 
+bool drawGlyph(uint8 fB, uint8 sB, Glyph &glyph);
+bool drawGlyph(uint32 unicode, Glyph &glyph);
+
+void convertChar8x16(uint8 *dst, const Glyph &g);
+void convertChar16x16(uint8 *dst, const Glyph &g);
+
+typedef std::list<Glyph> GlyphList;
+void freeGlyphlist(GlyphList &list) {
+	for (GlyphList::iterator i = list.begin(); i != list.end(); ++i)
+		delete[] i->plainData;
+	list.clear();
+}
+
 } // end of anonymous namespace
 
 int main(int argc, char *argv[]) {
@@ -80,121 +97,139 @@
 		return -1;
 	}
 
-	atexit(deinitSJIStoUTF32Conversion);
+	std::atexit(deinitSJIStoUTF32Conversion);
 
 	if (!initFreeType(font)) {
 		error("Could not initialize FreeType library.");
 		return -1;
 	}
 
-	atexit(deinitFreeType);
+	std::atexit(deinitFreeType);
 
-	std::vector<Glyph> glyphs;
-	int chars = 0;
+	GlyphList glyphs;
+	int chars8x16 = 0;
+	int chars16x16 = 0;
 
+	// FIXME: It seems some ttf fonts will only render invalid data,
+	// when FreeType2 is asked to provide 8x16 glyphs. "sazanami-mincho.ttf"
+	// is such a case. When we will render them in the default 16x16 setting
+	// all ASCII chars will be rendered correctly and still fit within 8x16.
+	// Some fonts might require special setup as 8x16 though.
+	// We should try to find some proper way of detecting and handling this.
+
+	// ASCII chars will be rendererd as 8x16
+	if (!setGlyphSize(8, 16))
+		return -1;
+
+	for (uint8 fB = 0x00; fB <= 0xDF; ++fB) {
+		if (mapASCIItoChunk(fB) == -1)
+			continue;
+
+		++chars8x16;
+
+		Glyph data;
+		if (drawGlyph(fB, 0, data))
+			glyphs.push_back(data);
+	}
+
+	// The two byte SJIS chars will be rendered as 16x16
+	if (!setGlyphSize(16, 16)) {
+		freeGlyphlist(glyphs);
+		return -1;
+	}
+
 	for (uint8 fB = 0x81; fB <= 0xEF; ++fB) {
-		if (fB >= 0xA0 && fB <= 0xDF)
+		if (mapSJIStoChunk(fB, 0x40) == -1)
 			continue;
 
 		for (uint8 sB = 0x40; sB <= 0xFC; ++sB) {
-			if (sB == 0x7F)
+			if (mapSJIStoChunk(fB, sB) == -1)
 				continue;
 
-			++chars;
+			++chars16x16;
 
-			uint32 utf32 = convertSJIStoUTF32(fB, sB);
-			if (utf32 == (uint32)-1) {
-				// For now we disable that warning, since iconv will fail for all reserved,
-				// that means unused, valid SJIS character codes.
-				//
-				// It might be useful to enable that warning again to detect problems with
-				// iconv though. An example for such an iconv problem is the 
-				// "FULLWIDTH APOSTROPHE", which iconv refuses to convert to UTF-32.
-				//warning("Conversion error on: %.2X %.02X", fB, sB);
-				continue;
-			}
-
 			Glyph data;
-			data.fB = fB;
-			data.sB = sB;
-			if (!drawGlyph16x16(utf32, data)) {
-				warning("Could not render glyph: %.2X %.2X", fB, sB);
-				continue;
-			}
-
-			glyphs.push_back(data);
+			if (drawGlyph(fB, sB, data))
+				glyphs.push_back(data);
 		}
 	}
 
-	// Calculate the base line for the font. The possible range is [0, 15].
-	int baseLine = 15;
-	for (std::vector<Glyph>::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
-		int bL = 16 + (i->yOffset - i->height);
+	// Post process all chars, so that xOffset is at least 0
+	int minXOffset = 0;
+	for (GlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i)
+		minXOffset = std::min(minXOffset, i->xOffset);
 
-		if (bL < baseLine)
-			baseLine = bL;
-	}
-	
-	// Check whether we have an character which does not fit in 16x16
-	for (std::vector<Glyph>::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
-		if (baseLine - i->yOffset < 0 || baseLine - i->yOffset + i->height > 16 ||
-			i->xOffset > 15 || i->xOffset + i->width > 16) {
+	minXOffset = std::abs(minXOffset);
 
-			for (std::vector<Glyph>::iterator j = glyphs.begin(); j != glyphs.end(); ++j)
-				delete[] i->plainData;
+	for (GlyphList::iterator i = glyphs.begin(); i != glyphs.end(); ++i)
+		i->xOffset += minXOffset;
 
-			error("Could not fit glyph for %.2X %.2X top: %d bottom: %d, left: %d right: %d", i->fB, i->sB, 
-			      baseLine - i->yOffset, baseLine - i->yOffset + i->height, i->xOffset, i->xOffset + i->width);
-		}
-	}
+	// Calculate the base line for the font. The possible range is [0, 15].
+	// TODO: This logic might need some more tinkering, it's pretty hacky right now.
+	int baseLine = 0;
+	for (GlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
+		int bL = 0;
 
-	const int sjisDataSize = chars * 32;
-	uint8 *sjisFontData = new uint8[sjisDataSize];
+		// Try to center the glyph vertically
+		if (i->height + i->yOffset <= 16)
+			bL = i->yOffset + (16 - (i->height + i->yOffset)) / 2;
 
-	if (!sjisFontData) {
-		for (std::vector<Glyph>::iterator i = glyphs.begin(); i != glyphs.end(); ++i)
-			delete[] i->plainData;
-		error("Out of memory");
+		bL = std::min(bL, 15);
+
+		baseLine = std::max(baseLine, bL);
 	}
 
-	memset(sjisFontData, 0, sjisDataSize);
+	// Check whether we have an character which does not fit within the boundaries6
+	for (GlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
+		if (i->pitch == 0)
+			continue;
 
-	for (std::vector<Glyph>::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
-		int chunk = mapSJIStoChunk(i->fB, i->sB);
+		if ((isASCII(i->fB) && !checkGlyphSize(*i, baseLine, 8, 16)) ||
+			(!isASCII(i->fB) && !checkGlyphSize(*i, baseLine, 16, 16))) {
+			for (GlyphList::iterator j = glyphs.begin(); j != glyphs.end(); ++j)
+				delete[] j->plainData;
 
-		if (chunk != -1) {
-			uint8 *dst = sjisFontData + chunk * 32;
-			const uint8 *src = i->plainData;
+			error("Could not fit glyph for %.2X %.2X top: %d bottom: %d, left: %d right: %d, xOffset: %d, yOffset: %d, width: %d, height: %d, baseLine: %d",
+				   i->fB, i->sB, baseLine - i->yOffset, baseLine - i->yOffset + i->height, i->xOffset, i->xOffset + i->width,
+				   i->xOffset, i->yOffset, i->width, i->height, baseLine);
+		}
+	}
 
-			dst += (baseLine - i->yOffset) * 2;
+	const int sjis8x16DataSize = chars8x16 * 16;
+	uint8 *sjis8x16FontData = new uint8[sjis8x16DataSize];
 
-			for (int y = 0; y < i->height; ++y) {
-				uint16 mask = 1 << (15 - i->xOffset);
+	const int sjis16x16DataSize = chars16x16 * 32;
+	uint8 *sjis16x16FontData = new uint8[sjis16x16DataSize];
 
-				const uint8 *curSrc = src;
+	if (!sjis16x16FontData) {
+		freeGlyphlist(glyphs);
+		error("Out of memory");
+	}
 
-				uint16 line = 0;
-				uint8 d = 0;
-				for (int x = 0; x < i->width; ++x) {
-					if (x == 0 || x == 8)
-						d = *curSrc++;
+	memset(sjis8x16FontData, 0, sjis8x16DataSize);
+	memset(sjis16x16FontData, 0, sjis16x16DataSize);
 
-					if (d & 0x80)
-						line |= mask;
+	for (GlyphList::const_iterator i = glyphs.begin(); i != glyphs.end(); ++i) {
+		if (isASCII(i->fB)) {
+			int chunk = mapASCIItoChunk(i->fB);
 
-					d <<= 1;
-					mask >>= 1;
-				}
+			if (chunk != -1) {
+				uint8 *dst = sjis8x16FontData + chunk * 16;
+				dst += (baseLine - i->yOffset);
+				convertChar8x16(dst, *i);
+			}
+		} else {
+			int chunk = mapSJIStoChunk(i->fB, i->sB);
 
-				WRITE_BE_UINT16(dst, line); dst += 2;
-				src += i->pitch;
+			if (chunk != -1) {
+				uint8 *dst = sjis16x16FontData + chunk * 32;
+				dst += (baseLine - i->yOffset) * 2;
+				convertChar16x16(dst, *i);
 			}
 		}
 	}
 
-	for (std::vector<Glyph>::iterator i = glyphs.begin(); i != glyphs.end(); ++i)
-		delete[] i->plainData;
-	glyphs.clear();
+	freeGlyphlist(glyphs);
 
 	Common::File sjisFont(out, "wb");
 	if (sjisFont.isOpen()) {
@@ -203,23 +238,28 @@
 		sjisFont.writeUint32BE(MKID_BE('SJIS'));
 
 		// Write version
-		sjisFont.writeUint32BE(0x00000001);
+		sjisFont.writeUint32BE(0x00000002);
 
 		// Write character count
-		sjisFont.writeUint16BE(chars);
+		sjisFont.writeUint16BE(chars16x16);
+		sjisFont.writeUint16BE(chars8x16);
 
-		sjisFont.write(sjisFontData, sjisDataSize);
+		sjisFont.write(sjis16x16FontData, sjis16x16DataSize);
+		sjisFont.write(sjis8x16FontData, sjis8x16DataSize);
 
 		if (sjisFont.err()) {
-			delete[] sjisFontData;
+			delete[] sjis8x16FontData;
+			delete[] sjis16x16FontData;
 			error("Error while writing to font file: '%s'", out);
 		}
 	} else {
-		delete[] sjisFontData;
+		delete[] sjis8x16FontData;
+		delete[] sjis16x16FontData;
 		error("Could not open file '%s' for writing", out);
 	}
 
-	delete[] sjisFontData;
+	delete[] sjis8x16FontData;
+	delete[] sjis16x16FontData;
 	return 0;
 }
 
@@ -263,6 +303,12 @@
 	// here.
 	if (fB == 0x81 && sB == 0xAD)
 		return 0x0000FF07;
+	// SJIS uses "YEN SIGN" instead of "REVERSE SOLIDUS"
+	else if (fB == 0x5C && sB == 0x00)
+		return 0x000000A5;
+	// SJIS uses "OVERLINE" instead of "TILDE"
+	else if (fB == 0x7E && sB == 0x00)
+		return 0x0000203E;
 
 	char inBuf[3];
 
@@ -307,11 +353,8 @@
 		return false;
 	}
 
-	err = FT_Set_Pixel_Sizes(sjisFont, 16, 16);
-	if (err) {
-		warning("Could not initialize font for 16x16 outout.");
+	if (!setGlyphSize(16, 16))
 		return false;
-	}
 
 	err = FT_Select_Charmap(sjisFont, FT_ENCODING_UNICODE);
 	if (err) {
@@ -327,12 +370,52 @@
 	FT_Done_FreeType(ft);
 }
 
-bool drawGlyph16x16(uint32 unicode, Glyph &glyph) {
+bool setGlyphSize(int width, int height) {
+	FT_Error err = FT_Set_Pixel_Sizes(sjisFont, width, height);
+	if (err) {
+		warning("Could not initialize font for %dx%d outout.", width, height);
+		return false;
+	}
+
+	return true;
+}
+
+bool checkGlyphSize(const Glyph &g, const int baseLine, const int maxW, const int maxH) {
+	if (baseLine - g.yOffset < 0 || baseLine - g.yOffset + g.height > (maxH + 1) ||
+		g.xOffset > (maxW - 1) || g.xOffset + g.width > (maxW + 1))
+		return false;
+	return true;
+}
+
+bool drawGlyph(uint8 fB, uint8 sB, Glyph &glyph) {
+	uint32 utf32 = convertSJIStoUTF32(fB, sB);
+	if (utf32 == (uint32)-1) {
+		// For now we disable that warning, since iconv will fail for all reserved,
+		// that means unused, valid SJIS character codes.
+		//
+		// It might be useful to enable that warning again to detect problems with
+		// iconv though. An example for such an iconv problem is the 
+		// "FULLWIDTH APOSTROPHE", which iconv refuses to convert to UTF-32.
+		//warning("Conversion error on: %.2X %.02X", fB, sB);
+		return false;
+	}
+
+	glyph.fB = fB;
+	glyph.sB = sB;
+	if (!drawGlyph(utf32, glyph)) {
+		warning("Could not render glyph: %.2X %.2X", fB, sB);
+		return false;
+	}
+
+	return true;
+}
+
+bool drawGlyph(uint32 unicode, Glyph &glyph) {
 	uint32 index = FT_Get_Char_Index(sjisFont, unicode);
 	if (!index)
 		return false;
 
-	FT_Error err = FT_Load_Glyph(sjisFont, index, FT_LOAD_MONOCHROME);
+	FT_Error err = FT_Load_Glyph(sjisFont, index, FT_LOAD_MONOCHROME | FT_LOAD_NO_HINTING);
 	if (err)
 		return false;
 
@@ -350,7 +433,7 @@
 	glyph.plainData = 0;
 
 	if (glyph.height) {
-		glyph.plainData = new uint8[glyph.height * abs(glyph.pitch)];
+		glyph.plainData = new uint8[glyph.height * std::abs(glyph.pitch)];
 		if (!glyph.plainData)
 			return false;
 
@@ -361,14 +444,72 @@
 			dst += (glyph.height - 1) * (-glyph.pitch);
 
 		for (int i = 0; i < bitmap.rows; ++i) {
-			memcpy(dst, src, glyph.pitch);
+			memcpy(dst, src, std::abs(glyph.pitch));
 			src += bitmap.pitch;
 			dst += glyph.pitch;
 		}
 	}
 
+	glyph.pitch = std::abs(glyph.pitch);
+
 	return true;
 }
 
+// TODO: merge these two
+
+void convertChar8x16(uint8 *dst, const Glyph &g) {
+	const uint8 *src = g.plainData;
+
+	assert(g.width + g.xOffset <= 8);
+
+	for (int y = 0; y < g.height; ++y) {
+		uint8 mask = 1 << (7 - g.xOffset);
+
+		const uint8 *curSrc = src;
+
+		uint8 line = 0;
+		uint8 d = 0;
+		for (int x = 0; x < g.width; ++x) {
+			if (x == 0)
+				d = *curSrc++;
+
+			if (d & 0x80)
+				line |= mask;
+
+			d <<= 1;
+			mask >>= 1;
+		}
+
+		*dst++ = line;
+		src += g.pitch;
+	}
+}
+
+void convertChar16x16(uint8 *dst, const Glyph &g) {
+	const uint8 *src = g.plainData;
+
+	for (int y = 0; y < g.height; ++y) {
+		uint16 mask = 1 << (15 - g.xOffset);
+
+		const uint8 *curSrc = src;
+
+		uint16 line = 0;
+		uint8 d = 0;
+		for (int x = 0; x < g.width; ++x) {
+			if (x == 0 || x == 8)
+				d = *curSrc++;
+
+			if (d & 0x80)
+				line |= mask;
+
+			d <<= 1;
+			mask >>= 1;
+		}
+
+		WRITE_BE_UINT16(dst, line); dst += 2;
+		src += g.pitch;
+	}
+}
+
 } // end of anonymous namespace
 

Modified: tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.cpp
===================================================================
--- tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.cpp	2009-12-27 11:56:51 UTC (rev 46624)
+++ tools/branches/gsoc2009-gui/engines/scumm/extract_loom_tg16.cpp	2009-12-27 12:02:20 UTC (rev 46625)
@@ -735,7 +735,7 @@
 			error("extract_resource(globdata) - length mismatch while extracting resource (was %04X, expected %04X)",rlen,r_length(res));
 		if (rtype != 0x11)
 			error("extract_resource(globdata) - resource tag is incorrect");
-		output.writeUint32LE((uint16)(rlen + 1));
+		output.writeUint32LE(rlen + 1);
 		output.writeUint16LE('O0');	// 0O - Object Index
 		for (i = 5; i < rlen; i++)
 			output.writeByte(input.readByte());
@@ -948,7 +948,7 @@
 			error("extract_resource(costume) - length mismatch while extracting resource (was %04X, expected %04X)",rlen,r_length(res));
 		if (rtype != 0x03)
 			error("extract_resource(costume) - resource tag is incorrect");
-		output.writeUint32LE((uint16)(rlen + 1));
+		output.writeUint32LE(rlen + 1);
 		output.writeUint16LE('OC');	// CO - Costume
 		for (i = 5; i < rlen; i++)
 			output.writeByte(input.readByte());
@@ -962,7 +962,7 @@
 			error("extract_resource(script) - length mismatch while extracting resource (was %04X, expected %04X)", rlen, r_length(res));
 		if (rtype != 0x02)
 			error("extract_resource(script) - resource tag is incorrect");
-		output.writeUint32LE((uint16)(rlen + 1));
+		output.writeUint32LE(rlen + 1);
 		output.writeUint16LE('CS');	// SC - Script
 		for (i = 5; i < rlen; i++)
 			output.writeByte(input.readByte());

Modified: tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.cpp
===================================================================
--- tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.cpp	2009-12-27 11:56:51 UTC (rev 46624)
+++ tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.cpp	2009-12-27 12:02:20 UTC (rev 46625)
@@ -96,6 +96,17 @@
 	{ 0x117AD, 0x0437 }, { 0x11BE4, 0x086E }, { 0x12452, 0x0199 }, { 0x125EB, 0x0947 }, { 0x12F32, 0x037A }
 };
 
+const struct t_resource res_roomgfx_ita[40] = {
+	{ 0x04001, 0x03EF }, { 0x043F0, 0x069E }, { 0x04A8E, 0x0327 }, { 0x04DB5, 0x053B }, { 0x052F0, 0x06BE },
+	{ 0x059AE, 0x0682 }, { 0x06030, 0x0778 }, { 0x067A8, 0x0517 }, { 0x06CBF, 0x07FB }, { 0x074BA, 0x07BE },
+	{ 0x08001, 0x07A5 }, { 0x087A6, 0x06DD }, { 0x08E83, 0x04EA }, { 0x0936D, 0x07E2 }, { 0x09B4F, 0x0791 },
+	{ 0x0A2E0, 0x07B5 }, { 0x0AA95, 0x0515 }, { 0x0AFAA, 0x0799 }, { 0x0B743, 0x04BB }, { 0x0BBFE, 0x0319 },
+	{ 0x0C001, 0x0464 }, { 0x0C465, 0x072C }, { 0x0CB91, 0x0827 }, { 0x0D3B8, 0x0515 }, { 0x0D8CD, 0x064E },
+	{ 0x0DF1B, 0x0775 }, { 0x0E690, 0x06DD }, { 0x0ED6D, 0x0376 }, { 0x0F0E3, 0x05F7 }, { 0x0F6DA, 0x0787 },
+	{ 0x07C78, 0x02D6 }, { 0x10001, 0x06A3 }, { 0x106A4, 0x0921 }, { 0x10FC5, 0x0361 }, { 0x11326, 0x0489 },
+	{ 0x117AF, 0x0437 }, { 0x11BE6, 0x0863 }, { 0x12449, 0x0199 }, { 0x125E2, 0x0947 }, { 0x12F29, 0x037A }
+};
+
 const struct t_resgroup res_roomgfx = {
 	NES_ROOMGFX,
 	{
@@ -105,6 +116,7 @@
 	res_roomgfx_fra,
 	res_roomgfx_ger,
 	res_roomgfx_esp,
+	res_roomgfx_ita,
 	}
 };
 
@@ -114,6 +126,7 @@
 const struct t_resource res_costumegfx_fra[2] = { { 0x30001, 0x0EB8 }, { 0x2F608, 0x0340 } };
 const struct t_resource res_costumegfx_ger[2] = { { 0x30001, 0x0EB8 }, { 0x2F4CE, 0x0340 } };
 const struct t_resource res_costumegfx_esp[2] = { { 0x30001, 0x0EB8 }, { 0x2F0F6, 0x0340 } };
+const struct t_resource res_costumegfx_ita[2] = { { 0x30001, 0x0EB8 }, { 0x2F4A0, 0x0340 } };
 
 const struct t_resgroup res_costumegfx = {
 	NES_COSTUMEGFX,
@@ -124,6 +137,7 @@
 	res_costumegfx_fra,
 	res_costumegfx_ger,
 	res_costumegfx_esp,
+	res_costumegfx_ita,
 	}
 };
 
@@ -211,6 +225,20 @@
 	{ 0x2AEEF, 0x02C9 }, { 0x2B2C0, 0x03D2 }, { 0x27D12, 0x0207 }, { 0x2B7FC, 0x0168 }, { 0x2BD06, 0x0169 }
 };
 
+const struct t_resource res_rooms_ita[55] = {
+	{ 0x00000, 0x0000 }, { 0x14001, 0x0D70 }, { 0x132A3, 0x04EA }, { 0x15423, 0x086E }, { 0x1378D, 0x06B1 },
+	{ 0x15D16, 0x070F }, { 0x16658, 0x04DB }, { 0x16B33, 0x0AEF }, { 0x18001, 0x06DF }, { 0x17991, 0x03E1 },
+	{ 0x18C5C, 0x065E }, { 0x19316, 0x04AF }, { 0x199EA, 0x0448 }, { 0x1A09D, 0x0479 }, { 0x1A516, 0x0445 },
+	{ 0x1A95B, 0x03A7 }, { 0x1AD02, 0x0826 }, { 0x1B588, 0x0693 }, { 0x1C001, 0x0B92 }, { 0x1CD70, 0x0484 },
+	{ 0x1D4E3, 0x0598 }, { 0x1DFCB, 0x0538 }, { 0x1E9C9, 0x05D1 }, { 0x1F052, 0x0394 }, { 0x1F70D, 0x0741 },
+	{ 0x20001, 0x04C2 }, { 0x2053F, 0x0528 }, { 0x21718, 0x05F6 }, { 0x21EB5, 0x0486 }, { 0x223E8, 0x048C },
+	{ 0x228DA, 0x093A }, { 0x24001, 0x037A }, { 0x247EE, 0x03CA }, { 0x24BB8, 0x050D }, { 0x25289, 0x0346 },
+	{ 0x1BCAC, 0x01CA }, { 0x255CF, 0x045F }, { 0x25A2E, 0x0552 }, { 0x25F80, 0x0651 }, { 0x26B93, 0x024B },
+	{ 0x26DDE, 0x01FA }, { 0x270D6, 0x0217 }, { 0x275E4, 0x02F4 }, { 0x28001, 0x045C }, { 0x284CE, 0x08BD },
+	{ 0x28DDF, 0x05DF }, { 0x27AC9, 0x0201 }, { 0x2A8A3, 0x0325 }, { 0x27D6F, 0x01FC }, { 0x2AE66, 0x02A9 },
+	{ 0x2B10F, 0x02E7 }, { 0x2B4F9, 0x03DE }, { 0x2BA31, 0x0206 }, { 0x2C001, 0x0168 }, { 0x17DC0, 0x0169 }
+};
+
 const struct t_resgroup res_rooms = {
 	NES_ROOM,
 	{
@@ -220,6 +248,7 @@
 	res_rooms_fra,
 	res_rooms_ger,
 	res_rooms_esp,
+	res_rooms_ita,
 	}
 };
 
@@ -457,6 +486,45 @@
 	{ 0x2A2DB, 0x0005 }, { 0x00000, 0x0000 }, { 0x2A2E0, 0x009C }, { 0x2A37C, 0x009C }
 };
 
+const struct t_resource res_scripts_ita[179] = {
+	{ 0x00000, 0x0000 }, { 0x293BE, 0x046B }, { 0x29829, 0x020C }, { 0x29A35, 0x00AA }, { 0x29ADF, 0x03FD },
+	{ 0x29EDC, 0x01A1 }, { 0x00000, 0x0000 }, { 0x2A07D, 0x005C }, { 0x00000, 0x0000 }, { 0x2A0D9, 0x0005 },
+	{ 0x2C169, 0x000D }, { 0x2C176, 0x000D }, { 0x186E0, 0x0040 }, { 0x18720, 0x0016 }, { 0x1B528, 0x0046 },
+	{ 0x1EF9A, 0x00B8 }, { 0x21D0E, 0x0056 }, { 0x17622, 0x0027 }, { 0x1FE4E, 0x0027 }, { 0x1FE75, 0x0027 },
+	{ 0x1BC1B, 0x0022 }, { 0x15C91, 0x0085 }, { 0x2233B, 0x001E }, { 0x22359, 0x008F }, { 0x192BA, 0x002B },
+	{ 0x1CB93, 0x0065 }, { 0x1CBF8, 0x003F }, { 0x1CC37, 0x004E }, { 0x1CC85, 0x0055 }, { 0x204C3, 0x007C },
+	{ 0x16425, 0x0035 }, { 0x1645A, 0x001C }, { 0x16476, 0x0014 }, { 0x1648A, 0x001C }, { 0x164A6, 0x0027 },
+	{ 0x164CD, 0x018B }, { 0x1D1F4, 0x009B }, { 0x1D28F, 0x010A }, { 0x1D399, 0x001C }, { 0x1D3B5, 0x0056 },
+	{ 0x1D40B, 0x0072 }, { 0x1E503, 0x0028 }, { 0x1E52B, 0x01AA }, { 0x1E6D5, 0x0233 }, { 0x2845D, 0x0071 },
+	{ 0x17D72, 0x004E }, { 0x13E3E, 0x0039 }, { 0x18736, 0x02C8 }, { 0x189FE, 0x00BB }, { 0x18AB9, 0x019E },
+	{ 0x00000, 0x0000 }, { 0x19E32, 0x00F8 }, { 0x21D64, 0x00F7 }, { 0x1E908, 0x00B0 }, { 0x21E5B, 0x0047 },
+	{ 0x2C183, 0x004D }, { 0x13E77, 0x0024 }, { 0x14D71, 0x0014 }, { 0x17649, 0x0058 }, { 0x176A1, 0x010A },
+	{ 0x177AB, 0x0009 }, { 0x14D85, 0x01B7 }, { 0x2ABC8, 0x029E }, { 0x23214, 0x070B }, { 0x2C1D0, 0x001A },
+	{ 0x2C1EA, 0x0021 }, { 0x2C20B, 0x0022 }, { 0x2C22D, 0x0023 }, { 0x2C250, 0x0016 }, { 0x2C266, 0x001E },
+	{ 0x2C284, 0x0016 }, { 0x2C29A, 0x0027 }, { 0x00000, 0x0000 }, { 0x2C2C1, 0x000E }, { 0x177B4, 0x00AA },
+	{ 0x22874, 0x0066 }, { 0x14F3C, 0x007B }, { 0x1F3E6, 0x0126 }, { 0x1FE9C, 0x001D }, { 0x1F50C, 0x00B4 },
+	{ 0x1F5C0, 0x00AA }, { 0x1785E, 0x006D }, { 0x178CB, 0x003F }, { 0x1F66A, 0x00A3 }, { 0x2C2CF, 0x00AF },
+	{ 0x2C37E, 0x00BD }, { 0x2C43B, 0x0085 }, { 0x20A67, 0x01AA }, { 0x20C11, 0x016A }, { 0x20D7B, 0x0073 },
+	{ 0x20DEE, 0x003B }, { 0x20E29, 0x00F0 }, { 0x20F19, 0x0047 }, { 0x20F60, 0x00FD }, { 0x2105D, 0x00FF },
+	{ 0x2115C, 0x0157 }, { 0x212B3, 0x0195 }, { 0x21448, 0x002E }, { 0x21476, 0x00A9 }, { 0x2437B, 0x011F },
+	{ 0x1BC3D, 0x006F }, { 0x1CCDA, 0x0096 }, { 0x28D8B, 0x0054 }, { 0x19F2A, 0x00B8 }, { 0x19FE2, 0x0071 },
+	{ 0x14FB7, 0x0057 }, { 0x272ED, 0x02F7 }, { 0x1DA7B, 0x021C }, { 0x1DC97, 0x00FA }, { 0x1DD91, 0x0053 },
+	{ 0x1DDE4, 0x01CF }, { 0x1500E, 0x004D }, { 0x26FD8, 0x00FE }, { 0x21EA2, 0x0013 }, { 0x2A0DE, 0x00F0 },
+	{ 0x2449A, 0x00DC }, { 0x2151F, 0x00E7 }, { 0x24576, 0x0022 }, { 0x2B8D7, 0x00FE }, { 0x24598, 0x00BB },
+	{ 0x250C5, 0x0188 }, { 0x1B56E, 0x000D }, { 0x1B57B, 0x000D }, { 0x2391F, 0x0182 }, { 0x278D8, 0x01F1 },
+	{ 0x23AA1, 0x0150 }, { 0x23BF1, 0x01C2 }, { 0x23DB3, 0x0016 }, { 0x2B9D5, 0x005C }, { 0x23DC9, 0x0020 },
+	{ 0x27CCA, 0x00A5 }, { 0x2A1CE, 0x0384 }, { 0x1505B, 0x00FA }, { 0x2B3F6, 0x005E }, { 0x00000, 0x0000 },
+	{ 0x2524D, 0x003C }, { 0x1E9B8, 0x0011 }, { 0x13E9B, 0x0018 }, { 0x265D1, 0x001F }, { 0x265F0, 0x0054 },
+	{ 0x26644, 0x0155 }, { 0x26799, 0x004B }, { 0x267E4, 0x017C }, { 0x26960, 0x0027 }, { 0x26987, 0x0041 },
+	{ 0x269C8, 0x01CB }, { 0x13EB3, 0x001F }, { 0x24653, 0x002A }, { 0x15155, 0x01A4 }, { 0x192E5, 0x0031 },
+	{ 0x1790A, 0x0087 }, { 0x21606, 0x00DF }, { 0x1D47D, 0x0018 }, { 0x1D495, 0x004E }, { 0x18C57, 0x0005 },
+	{ 0x152F9, 0x011F }, { 0x15418, 0x000B }, { 0x2467D, 0x0136 }, { 0x247B3, 0x0014 }, { 0x1DFB3, 0x0018 },
+	{ 0x247C7, 0x0027 }, { 0x1A053, 0x004A }, { 0x00000, 0x0000 }, { 0x2B454, 0x00A5 }, { 0x2A552, 0x00BB },
+	{ 0x2A60D, 0x0140 }, { 0x197C5, 0x00C6 }, { 0x1988B, 0x014D }, { 0x199D8, 0x0012 }, { 0x2A74D, 0x0005 },
+	{ 0x2A752, 0x0005 }, { 0x2A757, 0x0005 }, { 0x2A75C, 0x0005 }, { 0x2A761, 0x0005 }, { 0x216E5, 0x0033 },
+	{ 0x2A766, 0x0005 }, { 0x00000, 0x0000 }, { 0x2A76B, 0x009C }, { 0x2A807, 0x009C }
+};
+
 const struct t_resgroup res_scripts = {
 	NES_SCRIPT,
 	{
@@ -466,6 +534,7 @@
 	res_scripts_fra,
 	res_scripts_ger,
 	res_scripts_esp,
+	res_scripts_ita,
 	}
 };
 
@@ -589,6 +658,26 @@
 	{ 0x39964, 0x0AC5 }, { 0x3A429, 0x0BE4 }
 };
 
+const struct t_resource res_sounds_ita[82] = {
+	{ 0x0BF54, 0x000A }, { 0x30ECA, 0x0832 }, { 0x30ECA, 0x0832 }, { 0x30ECA, 0x0832 }, { 0x30ECA, 0x0832 },
+	{ 0x30ECA, 0x0832 }, { 0x0BF5E, 0x0011 }, { 0x1FEB9, 0x0073 }, { 0x0BF6F, 0x0011 }, { 0x13F57, 0x0011 },
+	{ 0x23EFE, 0x0056 }, { 0x1BF37, 0x001F }, { 0x13F68, 0x0011 }, { 0x0FF76, 0x000A }, { 0x17F64, 0x000A },
+	{ 0x1BF56, 0x0019 }, { 0x1FF2C, 0x004B }, { 0x17F6E, 0x000A }, { 0x1BF6F, 0x000F }, { 0x23F54, 0x001D },
+	{ 0x2BE61, 0x0045 }, { 0x23F71, 0x000F }, { 0x2BEA6, 0x001B }, { 0x2BEC1, 0x0033 }, { 0x27F6B, 0x0011 },
+	{ 0x2BEF4, 0x000F }, { 0x2BF03, 0x0075 }, { 0x2F7F1, 0x0014 }, { 0x0BF54, 0x000A }, { 0x2F805, 0x00FF },
+	{ 0x2F904, 0x000F }, { 0x2F913, 0x000F }, { 0x2F922, 0x0092 }, { 0x2F922, 0x0092 }, { 0x2F9B4, 0x002D },
+	{ 0x2F9E1, 0x00F8 }, { 0x2FAD9, 0x0016 }, { 0x2FAEF, 0x0011 }, { 0x2FB00, 0x004B }, { 0x2FB4B, 0x0011 },
+	{ 0x2FB5C, 0x003B }, { 0x2FB97, 0x008A }, { 0x2FC21, 0x0011 }, { 0x2FC32, 0x000F }, { 0x2FC41, 0x00A2 },
+	{ 0x2FCE3, 0x00D3 }, { 0x2FDB6, 0x0097 }, { 0x2BEF4, 0x000F }, { 0x2FC41, 0x00A2 }, { 0x316FC, 0x05D1 },
+	{ 0x316FC, 0x05D1 }, { 0x2FE4D, 0x0011 }, { 0x0BF54, 0x000A }, { 0x2BF03, 0x0075 }, { 0x1BF37, 0x001F },
+	{ 0x31CCD, 0x098E }, { 0x2FB00, 0x004B }, { 0x2FE5E, 0x0011 }, { 0x30ECA, 0x0832 }, { 0x2FE6F, 0x000F },
+	{ 0x2FE7E, 0x002F }, { 0x2FEAD, 0x001D }, { 0x2FECA, 0x0018 }, { 0x2FEE2, 0x0016 }, { 0x2FEF8, 0x001B },
+	{ 0x3265B, 0x0088 }, { 0x2FF13, 0x0065 }, { 0x326E3, 0x0065 }, { 0x32748, 0x0073 }, { 0x327BB, 0x00F9 },
+	{ 0x328B4, 0x049E }, { 0x32D52, 0x0EA8 }, { 0x34001, 0x0B18 }, { 0x34B19, 0x0B9C }, { 0x356B5, 0x0C6B },
+	{ 0x36320, 0x0E56 }, { 0x37176, 0x0C70 }, { 0x38001, 0x0DEC }, { 0x38DED, 0x0B77 }, { 0x39964, 0x042F },
+	{ 0x39D93, 0x0AC5 }, { 0x3A858, 0x0BE4 }
+};
+
 const struct t_resgroup res_sounds = {
 	NES_SOUND,
 	{
@@ -598,6 +687,7 @@
 	res_sounds_fra,
 	res_sounds_ger,
 	res_sounds_esp,
+	res_sounds_ita,
 	}
 };
 
@@ -649,6 +739,14 @@
 	{ 0x1FEB1, 0x003C }, { 0x13EEE, 0x003A }, { 0x13EEE, 0x003A }, { 0x0FEF1, 0x0055 }, { 0x13EA3, 0x004B }
 };
 
+const struct t_resource res_costumes_ita[25] = {
+	{ 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 },
+	{ 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x13ED2, 0x004B }, { 0x0FEEB, 0x0055 },
+	{ 0x0FEEB, 0x0055 }, { 0x0FEEB, 0x0055 }, { 0x0FF40, 0x0036 }, { 0x13F1D, 0x003A }, { 0x13F1D, 0x003A },
+	{ 0x0FEEB, 0x0055 }, { 0x17F29, 0x003B }, { 0x0FEEB, 0x0055 }, { 0x1BE76, 0x0045 }, { 0x1BEBB, 0x0040 },
+	{ 0x1BEFB, 0x003C }, { 0x13F1D, 0x003A }, { 0x13F1D, 0x003A }, { 0x0FEEB, 0x0055 }, { 0x13ED2, 0x004B }
+};
+
 const struct t_resgroup res_costumes = {
 	NES_COSTUME,
 	{
@@ -658,6 +756,7 @@
 	res_costumes_fra,
 	res_costumes_ger,
 	res_costumes_esp,
+	res_costumes_ita,
 	}
 };
 
@@ -667,6 +766,7 @@
 const struct t_resource res_globdata_fra[1] = { { 0x2C628, 0x0307 } };
 const struct t_resource res_globdata_ger[1] = { { 0x2C4EE, 0x0307 } };
 const struct t_resource res_globdata_esp[1] = { { 0x2C001, 0x0307 } };
+const struct t_resource res_globdata_ita[1] = { { 0x2C4C0, 0x0307 } };
 
 const struct t_resgroup res_globdata = {
 	NES_GLOBDATA,
@@ -677,6 +777,7 @@
 	res_globdata_fra,
 	res_globdata_ger,
 	res_globdata_esp,
+	res_globdata_ita,
 	}
 };
 
@@ -687,6 +788,7 @@
 const struct t_resource res_sprpals_fra[2] = { { 0x07ED8, 0x0010 }, { 0x07EE8, 0x0010 } };
 const struct t_resource res_sprpals_ger[2] = { { 0x07F6B, 0x0010 }, { 0x0BF17, 0x0010 } };
 const struct t_resource res_sprpals_esp[2] = { { 0x0BF15, 0x0010 }, { 0x0BF25, 0x0010 } };
+const struct t_resource res_sprpals_ita[2] = { { 0x07F54, 0x0010 }, { 0x07F64, 0x0010 } };
 
 const struct t_resgroup res_sprpals = {
 	NES_SPRPALS,
@@ -697,6 +799,7 @@
 	res_sprpals_fra,
 	res_sprpals_ger,
 	res_sprpals_esp,
+	res_sprpals_ita,
 	}
 };
 
@@ -707,6 +810,7 @@
 const struct t_resource res_sprdesc_fra[2] = { { 0x07EF8, 0x0031 }, { 0x07F29, 0x0009 } };
 const struct t_resource res_sprdesc_ger[2] = { { 0x0BF27, 0x0031 }, { 0x0BF58, 0x0009 } };
 const struct t_resource res_sprdesc_esp[2] = { { 0x0BF35, 0x0031 }, { 0x0BF66, 0x0009 } };
+const struct t_resource res_sprdesc_ita[2] = { { 0x0BF17, 0x0031 }, { 0x07F74, 0x0009 } };
 
 const struct t_resgroup res_sprdesc = {
 	NES_SPRDESC,
@@ -717,6 +821,7 @@
 	res_sprdesc_fra,
 	res_sprdesc_ger,
 	res_sprdesc_esp,
+	res_sprdesc_ita,
 	}
 };
 
@@ -727,6 +832,7 @@
 const struct t_resource res_sprlens_fra[2] = { { 0x0FE61, 0x0115 }, { 0x07ED2, 0x0006 } };
 const struct t_resource res_sprlens_ger[2] = { { 0x2BE1A, 0x0115 }, { 0x07F65, 0x0006 } };
 const struct t_resource res_sprlens_esp[2] = { { 0x2EFE1, 0x0115 }, { 0x07F7A, 0x0006 } };
+const struct t_resource res_sprlens_ita[2] = { { 0x23DE9, 0x0115 }, { 0x07F4E, 0x0006 } };
 
 const struct t_resgroup res_sprlens = {
 	NES_SPRLENS,
@@ -737,6 +843,7 @@
 	res_sprlens_fra,
 	res_sprlens_ger,
 	res_sprlens_esp,
+	res_sprlens_ita,
 	}
 };
 
@@ -747,6 +854,7 @@
 const struct t_resource res_sproffs_fra[2] = { { 0x2F959, 0x022A }, { 0x07F32, 0x000C } };
 const struct t_resource res_sproffs_ger[2] = { { 0x2F81F, 0x022A }, { 0x0BF61, 0x000C } };
 const struct t_resource res_sproffs_esp[2] = { { 0x2F447, 0x022A }, { 0x0BF6F, 0x000C } };
+const struct t_resource res_sproffs_ita[2] = { { 0x2BC37, 0x022A }, { 0x0BF48, 0x000C } };
 
 const struct t_resgroup res_sproffs = {
 	NES_SPROFFS,
@@ -757,6 +865,7 @@
 	res_sproffs_fra,
 	res_sproffs_ger,
 	res_sproffs_esp,
+	res_sproffs_ita,
 	}
 };
 
@@ -767,6 +876,7 @@
 const struct t_resource res_sprdata_fra[2] = { { 0x2CA28, 0x2BE0 }, { 0x07E48, 0x008A } };
 const struct t_resource res_sprdata_ger[2] = { { 0x2C8EE, 0x2BE0 }, { 0x0FE61, 0x008A } };
 const struct t_resource res_sprdata_esp[2] = { { 0x2C401, 0x2BE0 }, { 0x0FE67, 0x008A } };
+const struct t_resource res_sprdata_ita[2] = { { 0x2C8C0, 0x2BE0 }, { 0x0FE61, 0x008A } };
 
 const struct t_resgroup res_sprdata = {
 	NES_SPRDATA,
@@ -777,6 +887,7 @@
 	res_sprdata_fra,
 	res_sprdata_ger,
 	res_sprdata_esp,
+	res_sprdata_ita,
 	}
 };
 
@@ -786,6 +897,7 @@
 const struct t_resource res_charset_fra[1] = { { 0x3F739, 0x0090 } };
 const struct t_resource res_charset_ger[1] = { { 0x3F739, 0x0090 } };
 const struct t_resource res_charset_esp[1] = { { 0x3F739, 0x0090 } };
+const struct t_resource res_charset_ita[1] = { { 0x3F739, 0x0090 } };
 
 const struct t_resgroup res_charset = {
 	NES_CHARSET,
@@ -796,6 +908,7 @@
 	res_charset_fra,
 	res_charset_ger,
 	res_charset_esp,
+	res_charset_ita,
 	}
 };
 
@@ -805,6 +918,7 @@
 const struct t_resource res_preplist_fra[1] = { { 0x3FBAF, 0x0010 } };
 const struct t_resource res_preplist_ger[1] = { { 0x3FBAB, 0x000F } };
 const struct t_resource res_preplist_esp[1] = { { 0x3FBAE, 0x000F } };
+const struct t_resource res_preplist_ita[1] = { { 0x3FBAA, 0x0010 } };
 
 const struct t_resgroup res_preplist = {
 	NES_PREPLIST,
@@ -815,6 +929,7 @@
 	res_preplist_fra,
 	res_preplist_ger,
 	res_preplist_esp,
+	res_preplist_ita,
 	}
 };
 
@@ -1114,14 +1229,14 @@
 ExtractMMNes::ExtractMMNes(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
 	
 	ToolInput input;
-	input.format = "*.PRG";
+	input.format = "*.prg";
 	_inputPaths.push_back(input);
 
 	_shorthelp = "Extract data files from the NES version of Maniac Mansion.";
 	_helptext = 
 		"\nUsage: " + _name + " [-o <output dir> = out/] <infile.PRG>\n" +
 		"\t" + _shorthelp + "\n" +
-		"\tSupported versions: USA, Europe, Sweden, France, Germany, Spain\n"
+		"\tSupported versions: USA, Europe, Sweden, France, Germany, Spain, Italy\n"
 		"\tJapanese version is NOT supported!\n";
 }
 
@@ -1169,11 +1284,15 @@
 		ROMset = ROMSET_SPAIN;
 		print("ROM contents verified as Maniac Mansion (Spain)\n");
 		break;
+	case 0xDC529482:
+		ROMset = ROMSET_ITALY;
+		print("ROM contents verified as Maniac Mansion (Italy)\n");
+		break;
 	case 0x3DA2085E:
-		error("Maniac Mansion (Japan) is not supported");
+		error("Maniac Mansion (Japan) is not supported\n");
 		break;
 	default:
-		error("ROM contents not recognized (%08X)", CRC);
+		error("ROM contents not recognized (%08X)\n", CRC);
 		break;
 	}
 
@@ -1292,7 +1411,7 @@
 	for (i = 0; i < 2; i++)
 		dump_resource(input, "sproffs-%d.dmp", i, &res_sproffs.langs[ROMset][i], res_sproffs.type);
 #endif	/* MAKE_LFLS */
-	print("All done!");
+	print("All done!\n");
 }
 
 #ifdef STANDALONE_MAIN

Modified: tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.h
===================================================================
--- tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.h	2009-12-27 11:56:51 UTC (rev 46624)
+++ tools/branches/gsoc2009-gui/engines/scumm/extract_mm_nes.h	2009-12-27 12:02:20 UTC (rev 46625)
@@ -50,6 +50,7 @@
 	ROMSET_FRANCE,
 	ROMSET_GERMANY,
 	ROMSET_SPAIN,
+	ROMSET_ITALY,
 	NUM_ROMSETS
 } t_romset;
 


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