diff options
| author | Eugene Sandulenko | 2012-02-26 07:18:52 -0800 | 
|---|---|---|
| committer | Eugene Sandulenko | 2012-02-26 07:18:52 -0800 | 
| commit | 80923297e3e186ceef557dc86113acd3870e3583 (patch) | |
| tree | 4283f700e253762c070d05ed2ec9df4836db0afb | |
| parent | d3c4243ab5aa8438645340dca1900e678d8fd6ba (diff) | |
| parent | 367131ef0ebbc446f5589b3523049eac3d5a572d (diff) | |
| download | scummvm-rg350-80923297e3e186ceef557dc86113acd3870e3583.tar.gz scummvm-rg350-80923297e3e186ceef557dc86113acd3870e3583.tar.bz2 scummvm-rg350-80923297e3e186ceef557dc86113acd3870e3583.zip | |
Merge pull request #192 from fingolfin/refactor-common
COMMON: Split common/util.h
37 files changed, 783 insertions, 513 deletions
| diff --git a/audio/mididrv.cpp b/audio/mididrv.cpp index 6817791c6b..0518915e81 100644 --- a/audio/mididrv.cpp +++ b/audio/mididrv.cpp @@ -22,6 +22,7 @@  #include "common/config-manager.h"  #include "common/error.h" +#include "common/gui_options.h"  #include "common/str.h"  #include "common/system.h"  #include "common/textconsole.h" diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index 2e32ff3eb4..8ca48bf19e 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -29,6 +29,8 @@  #include "backends/audiocd/default/default-audiocd.h"  #include "backends/fs/fs-factory.h"  #include "audio/mixer_intern.h" +#include "common/language.h" +#include "common/platform.h"  #ifdef DYNAMIC_MODULES  #include "backends/plugins/dynamic-plugin.h"  #endif diff --git a/base/commandLine.cpp b/base/commandLine.cpp index aa589ed15f..08838167e9 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -33,9 +33,10 @@  #include "base/version.h"  #include "common/config-manager.h" +#include "common/fs.h" +#include "common/rendermode.h"  #include "common/system.h"  #include "common/textconsole.h" -#include "common/fs.h"  #include "gui/ThemeEngine.h" diff --git a/common/gui_options.cpp b/common/gui_options.cpp new file mode 100644 index 0000000000..5b7d939dc4 --- /dev/null +++ b/common/gui_options.cpp @@ -0,0 +1,132 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#include "common/gui_options.h" + +#include "common/config-manager.h" +#include "common/str.h" + +namespace Common { + +const struct GameOpt { +	const char *option; +	const char *desc; +} g_gameOptions[] = { +	{ GUIO_NOSUBTITLES,  "sndNoSubs" }, +	{ GUIO_NOMUSIC,      "sndNoMusic" }, +	{ GUIO_NOSPEECH,     "sndNoSpeech" }, +	{ GUIO_NOSFX,        "sndNoSFX" }, +	{ GUIO_NOMIDI,       "sndNoMIDI" }, + +	{ GUIO_NOLAUNCHLOAD, "launchNoLoad" }, + +	{ GUIO_MIDIPCSPK,    "midiPCSpk" }, +	{ GUIO_MIDICMS,      "midiCMS" }, +	{ GUIO_MIDIPCJR,     "midiPCJr" }, +	{ GUIO_MIDIADLIB,    "midiAdLib" }, +	{ GUIO_MIDIC64,      "midiC64" }, +	{ GUIO_MIDIAMIGA,    "midiAmiga" }, +	{ GUIO_MIDIAPPLEIIGS,"midiAppleIIgs" }, +	{ GUIO_MIDITOWNS,    "midiTowns" }, +	{ GUIO_MIDIPC98,     "midiPC98" }, +	{ GUIO_MIDIMT32,     "midiMt32" }, +	{ GUIO_MIDIGM,       "midiGM" }, + +	{ GUIO_NOASPECT,     "noAspect" }, +	{ GUIO_EGAUNDITHER,  "egaUndither" }, + +	{ GUIO_RENDERHERCGREEN,	"hercGreen" }, +	{ GUIO_RENDERHERCAMBER,	"hercAmber" }, +	{ GUIO_RENDERCGA,		"cga" }, +	{ GUIO_RENDEREGA,		"ega" }, +	{ GUIO_RENDERVGA,		"vga" }, +	{ GUIO_RENDERAMIGA,		"amiga" }, +	{ GUIO_RENDERFMTOWNS,	"fmtowns" }, +	{ GUIO_RENDERPC9821,	"pc9821" }, +	{ GUIO_RENDERPC9801,	"pc9801" }, + +	{ GUIO_NONE, 0 } +}; + +bool checkGameGUIOption(const String &option, const String &str) { +	for (int i = 0; g_gameOptions[i].desc; i++) { +		if (option.contains(g_gameOptions[i].option)) { +			if (str.contains(g_gameOptions[i].desc)) +				return true; +			else +				return false; +		} +	} +	return false; +} + +bool checkGameGUIOptionLanguage(Language lang, const String &str) { +	if (!str.contains("lang_")) // If no languages are specified +		return true; + +	if (str.contains(getGameGUIOptionsDescriptionLanguage(lang))) +		return true; + +	return false; +} + +const String getGameGUIOptionsDescriptionLanguage(Language lang) { +	if (lang == UNK_LANG) +		return ""; + +	return String("lang_") + getLanguageDescription(lang); +} + +String parseGameGUIOptions(const String &str) { +	String res; + +	for (int i = 0; g_gameOptions[i].desc; i++) +		if (str.contains(g_gameOptions[i].desc)) +			res += g_gameOptions[i].option; + +	return res; +} + +const String getGameGUIOptionsDescription(const String &options) { +	String res; + +	for (int i = 0; g_gameOptions[i].desc; i++) +		if (options.contains(g_gameOptions[i].option[0])) +			res += String(g_gameOptions[i].desc) + " "; + +	res.trim(); + +	return res; +} + +void updateGameGUIOptions(const String &options, const String &langOption) { +	const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption; + +	if ((!options.empty() && !ConfMan.hasKey("guioptions")) || +	    (ConfMan.hasKey("guioptions") && ConfMan.get("guioptions") != newOptionString)) { +		ConfMan.set("guioptions", newOptionString); +		ConfMan.flushToDisk(); +	} +} + + +} // End of namespace Common diff --git a/common/gui_options.h b/common/gui_options.h new file mode 100644 index 0000000000..5649f1103d --- /dev/null +++ b/common/gui_options.h @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#ifndef COMMON_GUI_OPTIONS_H +#define COMMON_GUI_OPTIONS_H + +#include "common/language.h" + +#define GUIO_NONE			"\000" +#define GUIO_NOSUBTITLES	"\001" +#define GUIO_NOMUSIC		"\002" +#define GUIO_NOSPEECH		"\003" +#define GUIO_NOSFX			"\004" +#define GUIO_NOMIDI			"\005" +#define GUIO_NOLAUNCHLOAD	"\006" + +#define GUIO_MIDIPCSPK		"\007" +#define GUIO_MIDICMS		"\010" +#define GUIO_MIDIPCJR		"\011" +#define GUIO_MIDIADLIB		"\012" +#define GUIO_MIDIC64        "\013" +#define GUIO_MIDIAMIGA      "\014" +#define GUIO_MIDIAPPLEIIGS  "\015" +#define GUIO_MIDITOWNS		"\016" +#define GUIO_MIDIPC98		"\017" +#define GUIO_MIDIMT32		"\020" +#define GUIO_MIDIGM			"\021" + +#define GUIO_NOASPECT		"\022" +#define GUIO_EGAUNDITHER	"\023" + +#define GUIO_RENDERHERCGREEN	"\030" +#define GUIO_RENDERHERCAMBER	"\031" +#define GUIO_RENDERCGA		"\032" +#define GUIO_RENDEREGA		"\033" +#define GUIO_RENDERVGA		"\034" +#define GUIO_RENDERAMIGA	"\035" +#define GUIO_RENDERFMTOWNS	"\036" +#define GUIO_RENDERPC9821	"\037" +#define GUIO_RENDERPC9801	"\040" + +#define GUIO0() (GUIO_NONE) +#define GUIO1(a) (a) +#define GUIO2(a,b) (a b) +#define GUIO3(a,b,c) (a b c) +#define GUIO4(a,b,c,d) (a b c d) +#define GUIO5(a,b,c,d,e) (a b c d e) +#define GUIO6(a,b,c,d,e,f) (a b c d e f) + +namespace Common { + + +bool checkGameGUIOption(const String &option, const String &str); +bool checkGameGUIOptionLanguage(Common::Language lang, const String &str); +String parseGameGUIOptions(const String &str); +const String getGameGUIOptionsDescription(const String &options); +const String getGameGUIOptionsDescriptionLanguage(Common::Language lang); + +/** + * Updates the GUI options of the current config manager + * domain, when they differ to the ones passed as + * parameter. + */ +void updateGameGUIOptions(const String &options, const String &langOption); + + +} // End of namespace Common + +#endif diff --git a/common/language.cpp b/common/language.cpp new file mode 100644 index 0000000000..1de01b0207 --- /dev/null +++ b/common/language.cpp @@ -0,0 +1,107 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + */ + +#include "common/language.h" +#include "common/str.h" + +namespace Common { + +const LanguageDescription g_languages[] = { +	{ "zh-cn", "zh_CN", "Chinese (China)", ZH_CNA }, +	{    "zh", "zh_TW", "Chinese (Taiwan)", ZH_TWN }, +	{    "cz", "cs_CZ", "Czech", CZ_CZE }, +	{    "nl", "nl_NL", "Dutch", NL_NLD }, +	{    "en",    "en", "English", EN_ANY }, // Generic English (when only one game version exist) +	{    "gb", "en_GB", "English (GB)", EN_GRB }, +	{    "us", "en_US", "English (US)", EN_USA }, +	{    "fr", "fr_FR", "French", FR_FRA }, +	{    "de", "de_DE", "German", DE_DEU }, +	{    "gr", "el_GR", "Greek", GR_GRE }, +	{    "he", "he_IL", "Hebrew", HE_ISR }, +	{    "hb", "he_IL", "Hebrew", HE_ISR }, // Deprecated +	{    "hr", "hr_HR", "Croatian", HR_HRV }, +	{    "hu", "hu_HU", "Hungarian", HU_HUN }, +	{    "it", "it_IT", "Italian", IT_ITA }, +	{    "jp", "ja_JP", "Japanese", JA_JPN }, +	{    "kr", "ko_KR", "Korean", KO_KOR }, +	{    "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale +	{    "pl", "pl_PL", "Polish", PL_POL }, +	{    "br", "pt_BR", "Portuguese", PT_BRA }, +	{    "ru", "ru_RU", "Russian", RU_RUS }, +	{    "es", "es_ES", "Spanish", ES_ESP }, +	{    "se", "sv_SE", "Swedish", SE_SWE }, +	{       0,       0, 0, UNK_LANG } +}; + +Language parseLanguage(const String &str) { +	if (str.empty()) +		return UNK_LANG; + +	const LanguageDescription *l = g_languages; +	for (; l->code; ++l) { +		if (str.equalsIgnoreCase(l->code)) +			return l->id; +	} + +	return UNK_LANG; +} + +Language parseLanguageFromLocale(const char *locale) { +	if (!locale || !*locale) +		return UNK_LANG; + +	const LanguageDescription *l = g_languages; +	for (; l->code; ++l) { +		if (!strcmp(l->unixLocale, locale)) +			return l->id; +	} + +	return UNK_LANG; +} + +const char *getLanguageCode(Language id) { +	const LanguageDescription *l = g_languages; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->code; +	} +	return 0; +} + +const char *getLanguageLocale(Language id) { +	const LanguageDescription *l = g_languages; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->unixLocale; +	} +	return 0; +} + +const char *getLanguageDescription(Language id) { +	const LanguageDescription *l = g_languages; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->description; +	} +	return 0; +} + +} // End of namespace Common diff --git a/common/language.h b/common/language.h new file mode 100644 index 0000000000..b83f0d34fd --- /dev/null +++ b/common/language.h @@ -0,0 +1,80 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + */ + +#ifndef COMMON_LANGUAGE_H +#define COMMON_LANGUAGE_H + +#include "common/scummsys.h" + +namespace Common { + +class String; + +/** + * List of game language. + */ +enum Language { +	ZH_CNA, +	ZH_TWN, +	CZ_CZE, +	NL_NLD, +	EN_ANY,     // Generic English (when only one game version exist) +	EN_GRB, +	EN_USA, +	FR_FRA, +	DE_DEU, +	GR_GRE, +	HE_ISR, +	HR_HRV, +	HU_HUN, +	IT_ITA, +	JA_JPN, +	KO_KOR, +	NB_NOR, +	PL_POL, +	PT_BRA, +	RU_RUS, +	ES_ESP, +	SE_SWE, + +	UNK_LANG = -1	// Use default language (i.e. none specified) +}; + +struct LanguageDescription { +	const char *code; +	const char *unixLocale; +	const char *description; +	Language id; +}; + +extern const LanguageDescription g_languages[]; + + +/** Convert a string containing a language name into a Language enum value. */ +extern Language parseLanguage(const String &str); +extern Language parseLanguageFromLocale(const char *locale); +extern const char *getLanguageCode(Language id); +extern const char *getLanguageLocale(Language id); +extern const char *getLanguageDescription(Language id); + +}	// End of namespace Common + +#endif diff --git a/common/localization.h b/common/localization.h index 3945cf5fab..e908485b99 100644 --- a/common/localization.h +++ b/common/localization.h @@ -22,7 +22,7 @@  #ifndef COMMON_LOCALIZATION_H  #define COMMON_LOCALIZATION_H -#include "common/util.h" +#include "common/language.h"  #include "common/keyboard.h"  namespace Common { diff --git a/common/module.mk b/common/module.mk index ae5e41cb8c..b4928fabda 100644 --- a/common/module.mk +++ b/common/module.mk @@ -12,16 +12,20 @@ MODULE_OBJS := \  	EventRecorder.o \  	file.o \  	fs.o \ +	gui_options.o \  	hashmap.o \  	iff_container.o \ +	language.o \  	localization.o \  	macresman.o \  	memorypool.o \  	md5.o \  	mutex.o \ +	platform.o \  	quicktime.o \  	random.o \  	rational.o \ +	rendermode.o \  	str.o \  	stream.o \  	system.o \ diff --git a/common/platform.cpp b/common/platform.cpp new file mode 100644 index 0000000000..9986048b48 --- /dev/null +++ b/common/platform.cpp @@ -0,0 +1,107 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + */ + +#include "common/platform.h" +#include "common/str.h" + +namespace Common { + +const PlatformDescription g_platforms[] = { +	{ "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS }, +	{ "3do", "3do", "3do", "3DO", kPlatform3DO }, +	{ "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn }, +	{ "amiga", "ami", "amiga", "Amiga", kPlatformAmiga }, +	{ "atari", "atari-st", "st", "Atari ST", kPlatformAtariST }, +	{ "c64", "c64", "c64", "Commodore 64", kPlatformC64 }, +	{ "pc", "dos", "ibm", "DOS", kPlatformPC }, +	{ "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 }, +	{ "wii", "wii", "wii", "Nintendo Wii", kPlatformWii }, +	{ "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, + +	// The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo). +	// However, on the net many variations can be seen, like "FMTOWNS", +	// "FM TOWNS", "FmTowns", etc. +	{ "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns }, + +	{ "linux", "linux", "linux", "Linux", kPlatformLinux }, +	{ "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh }, +	{ "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine }, +	{ "nes", "nes", "nes", "NES", kPlatformNES }, +	{ "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD }, +	{ "windows", "win", "win", "Windows", kPlatformWindows }, +	{ "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX }, +	{ "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi }, +	{ "ios", "ios", "ios", "Apple iOS", kPlatformIOS }, + +	{ 0, 0, 0, "Default", kPlatformUnknown } +}; + +Platform parsePlatform(const String &str) { +	if (str.empty()) +		return kPlatformUnknown; + +	// Handle some special case separately, for compatibility with old config +	// files. +	if (str == "1") +		return kPlatformAmiga; +	else if (str == "2") +		return kPlatformAtariST; +	else if (str == "3") +		return kPlatformMacintosh; + +	const PlatformDescription *l = g_platforms; +	for (; l->code; ++l) { +		if (str.equalsIgnoreCase(l->code) || str.equalsIgnoreCase(l->code2) || str.equalsIgnoreCase(l->abbrev)) +			return l->id; +	} + +	return kPlatformUnknown; +} + + +const char *getPlatformCode(Platform id) { +	const PlatformDescription *l = g_platforms; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->code; +	} +	return 0; +} + +const char *getPlatformAbbrev(Platform id) { +	const PlatformDescription *l = g_platforms; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->abbrev; +	} +	return 0; +} + +const char *getPlatformDescription(Platform id) { +	const PlatformDescription *l = g_platforms; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->description; +	} +	return l->description; +} + +} // End of namespace Common diff --git a/common/platform.h b/common/platform.h new file mode 100644 index 0000000000..1891c7096d --- /dev/null +++ b/common/platform.h @@ -0,0 +1,80 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + */ + +#ifndef COMMON_PLATFORM_H +#define COMMON_PLATFORM_H + +#include "common/scummsys.h" + +namespace Common { + +class String; + +/** + * List of game platforms. Specifying a platform for a target can be used to + * give the game engines a hint for which platform the game data file are. + * This may be optional or required, depending on the game engine and the + * game in question. + */ +enum Platform { +	kPlatformPC, +	kPlatformAmiga, +	kPlatformAtariST, +	kPlatformMacintosh, +	kPlatformFMTowns, +	kPlatformWindows, +	kPlatformNES, +	kPlatformC64, +	kPlatformCoCo3, +	kPlatformLinux, +	kPlatformAcorn, +	kPlatformSegaCD, +	kPlatform3DO, +	kPlatformPCEngine, +	kPlatformApple2GS, +	kPlatformPC98, +	kPlatformWii, +	kPlatformPSX, +	kPlatformCDi, +	kPlatformIOS, + +	kPlatformUnknown = -1 +}; + +struct PlatformDescription { +	const char *code; +	const char *code2; +	const char *abbrev; +	const char *description; +	Platform id; +}; + +extern const PlatformDescription g_platforms[]; + +/** Convert a string containing a platform name into a Platform enum value. */ +extern Platform parsePlatform(const String &str); +extern const char *getPlatformCode(Platform id); +extern const char *getPlatformAbbrev(Platform id); +extern const char *getPlatformDescription(Platform id); + +}	// End of namespace Common + +#endif diff --git a/common/rendermode.cpp b/common/rendermode.cpp new file mode 100644 index 0000000000..62b67faee5 --- /dev/null +++ b/common/rendermode.cpp @@ -0,0 +1,81 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#include "common/rendermode.h" + +#include "common/str.h" +#include "common/translation.h" + + +namespace Common { + + +const RenderModeDescription g_renderModes[] = { +	// I18N: Hercules is graphics card name +	{ "hercGreen", _s("Hercules Green"), kRenderHercG }, +	{ "hercAmber", _s("Hercules Amber"), kRenderHercA }, +	{ "cga", "CGA", kRenderCGA }, +	{ "ega", "EGA", kRenderEGA }, +	{ "vga", "VGA", kRenderVGA }, +	{ "amiga", "Amiga", kRenderAmiga }, +	{ "fmtowns", "FM-Towns", kRenderFMTowns }, +	{ "pc9821", "PC-9821 (256 Colors)", kRenderPC9821 }, +	{ "pc9801", "PC-9801 (16 Colors)", kRenderPC9801 }, +	{0, 0, kRenderDefault} +}; + +DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres") +DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Amber", "lowres") + +RenderMode parseRenderMode(const String &str) { +	if (str.empty()) +		return kRenderDefault; + +	const RenderModeDescription *l = g_renderModes; +	for (; l->code; ++l) { +		if (str.equalsIgnoreCase(l->code)) +			return l->id; +	} + +	return kRenderDefault; +} + +const char *getRenderModeCode(RenderMode id) { +	const RenderModeDescription *l = g_renderModes; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->code; +	} +	return 0; +} + +const char *getRenderModeDescription(RenderMode id) { +	const RenderModeDescription *l = g_renderModes; +	for (; l->code; ++l) { +		if (l->id == id) +			return l->description; +	} +	return 0; +} + + +} // End of namespace Common diff --git a/common/rendermode.h b/common/rendermode.h new file mode 100644 index 0000000000..c2fece77ee --- /dev/null +++ b/common/rendermode.h @@ -0,0 +1,67 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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. + * + */ + +#ifndef COMMON_RENDERMODE_H +#define COMMON_RENDERMODE_H + +#include "common/scummsys.h" + +namespace Common { + +class String; + +/** + * List of render modes. It specifies which original graphics mode + * to use. Some targets used postprocessing dithering routines for + * reducing color depth of final image which let it to be rendered on + * such low-level adapters as CGA or Hercules. + */ +enum RenderMode { +	kRenderDefault = 0, +	kRenderVGA = 1, +	kRenderEGA = 2, +	kRenderCGA = 3, +	kRenderHercG = 4, +	kRenderHercA = 5, +	kRenderAmiga = 6, +	kRenderFMTowns = 7, +	kRenderPC9821 = 8, +	kRenderPC9801 = 9 +}; + +struct RenderModeDescription { +	const char *code; +	const char *description; +	RenderMode id; +}; + +extern const RenderModeDescription g_renderModes[]; + +/** Convert a string containing a render mode name into a RenderingMode enum value. */ +extern RenderMode parseRenderMode(const String &str); +extern const char *getRenderModeCode(RenderMode id); +extern const char *getRenderModeDescription(RenderMode id); + + +} // End of namespace Common + +#endif diff --git a/common/util.cpp b/common/util.cpp index 5911f9b1a4..4d9ff11c5c 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -29,8 +29,6 @@  #include "common/util.h" -#include "common/translation.h" -#include "common/config-manager.h"  #include "common/debug.h"  namespace Common { @@ -112,323 +110,6 @@ bool parseBool(const String &val, bool &valAsBool) {  #pragma mark - -const LanguageDescription g_languages[] = { -	{ "zh-cn", "zh_CN", "Chinese (China)", ZH_CNA }, -	{    "zh", "zh_TW", "Chinese (Taiwan)", ZH_TWN }, -	{    "cz", "cs_CZ", "Czech", CZ_CZE }, -	{    "nl", "nl_NL", "Dutch", NL_NLD }, -	{    "en",    "en", "English", EN_ANY }, // Generic English (when only one game version exist) -	{    "gb", "en_GB", "English (GB)", EN_GRB }, -	{    "us", "en_US", "English (US)", EN_USA }, -	{    "fr", "fr_FR", "French", FR_FRA }, -	{    "de", "de_DE", "German", DE_DEU }, -	{    "gr", "el_GR", "Greek", GR_GRE }, -	{    "he", "he_IL", "Hebrew", HE_ISR }, -	{    "hb", "he_IL", "Hebrew", HE_ISR }, // Deprecated -	{    "hr", "hr_HR", "Croatian", HR_HRV }, -	{    "hu", "hu_HU", "Hungarian", HU_HUN }, -	{    "it", "it_IT", "Italian", IT_ITA }, -	{    "jp", "ja_JP", "Japanese", JA_JPN }, -	{    "kr", "ko_KR", "Korean", KO_KOR }, -	{    "nb", "nb_NO", "Norwegian Bokm\xE5l", NB_NOR }, // TODO Someone should verify the unix locale -	{    "pl", "pl_PL", "Polish", PL_POL }, -	{    "br", "pt_BR", "Portuguese", PT_BRA }, -	{    "ru", "ru_RU", "Russian", RU_RUS }, -	{    "es", "es_ES", "Spanish", ES_ESP }, -	{    "se", "sv_SE", "Swedish", SE_SWE }, -	{       0,       0, 0, UNK_LANG } -}; - -Language parseLanguage(const String &str) { -	if (str.empty()) -		return UNK_LANG; - -	const LanguageDescription *l = g_languages; -	for (; l->code; ++l) { -		if (str.equalsIgnoreCase(l->code)) -			return l->id; -	} - -	return UNK_LANG; -} - -Language parseLanguageFromLocale(const char *locale) { -	if (!locale || !*locale) -		return UNK_LANG; - -	const LanguageDescription *l = g_languages; -	for (; l->code; ++l) { -		if (!strcmp(l->unixLocale, locale)) -			return l->id; -	} - -	return UNK_LANG; -} - -const char *getLanguageCode(Language id) { -	const LanguageDescription *l = g_languages; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->code; -	} -	return 0; -} - -const char *getLanguageLocale(Language id) { -	const LanguageDescription *l = g_languages; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->unixLocale; -	} -	return 0; -} - -const char *getLanguageDescription(Language id) { -	const LanguageDescription *l = g_languages; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->description; -	} -	return 0; -} - - -#pragma mark - - - -const PlatformDescription g_platforms[] = { -	{ "2gs", "2gs", "2gs", "Apple IIgs", kPlatformApple2GS }, -	{ "3do", "3do", "3do", "3DO", kPlatform3DO }, -	{ "acorn", "acorn", "acorn", "Acorn", kPlatformAcorn }, -	{ "amiga", "ami", "amiga", "Amiga", kPlatformAmiga }, -	{ "atari", "atari-st", "st", "Atari ST", kPlatformAtariST }, -	{ "c64", "c64", "c64", "Commodore 64", kPlatformC64 }, -	{ "pc", "dos", "ibm", "DOS", kPlatformPC }, -	{ "pc98", "pc98", "pc98", "PC-98", kPlatformPC98 }, -	{ "wii", "wii", "wii", "Nintendo Wii", kPlatformWii }, -	{ "coco3", "coco3", "coco3", "CoCo3", kPlatformCoCo3 }, - -	// The 'official' spelling seems to be "FM-TOWNS" (e.g. in the Indy4 demo). -	// However, on the net many variations can be seen, like "FMTOWNS", -	// "FM TOWNS", "FmTowns", etc. -	{ "fmtowns", "towns", "fm", "FM-TOWNS", kPlatformFMTowns }, - -	{ "linux", "linux", "linux", "Linux", kPlatformLinux }, -	{ "macintosh", "mac", "mac", "Macintosh", kPlatformMacintosh }, -	{ "pce", "pce", "pce", "PC-Engine", kPlatformPCEngine }, -	{ "nes", "nes", "nes", "NES", kPlatformNES }, -	{ "segacd", "segacd", "sega", "SegaCD", kPlatformSegaCD }, -	{ "windows", "win", "win", "Windows", kPlatformWindows }, -	{ "playstation", "psx", "psx", "Sony PlayStation", kPlatformPSX }, -	{ "cdi", "cdi", "cdi", "Philips CD-i", kPlatformCDi }, -	{ "ios", "ios", "ios", "Apple iOS", kPlatformIOS }, - -	{ 0, 0, 0, "Default", kPlatformUnknown } -}; - -Platform parsePlatform(const String &str) { -	if (str.empty()) -		return kPlatformUnknown; - -	// Handle some special case separately, for compatibility with old config -	// files. -	if (str == "1") -		return kPlatformAmiga; -	else if (str == "2") -		return kPlatformAtariST; -	else if (str == "3") -		return kPlatformMacintosh; - -	const PlatformDescription *l = g_platforms; -	for (; l->code; ++l) { -		if (str.equalsIgnoreCase(l->code) || str.equalsIgnoreCase(l->code2) || str.equalsIgnoreCase(l->abbrev)) -			return l->id; -	} - -	return kPlatformUnknown; -} - - -const char *getPlatformCode(Platform id) { -	const PlatformDescription *l = g_platforms; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->code; -	} -	return 0; -} - -const char *getPlatformAbbrev(Platform id) { -	const PlatformDescription *l = g_platforms; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->abbrev; -	} -	return 0; -} - -const char *getPlatformDescription(Platform id) { -	const PlatformDescription *l = g_platforms; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->description; -	} -	return l->description; -} - - -#pragma mark - - - -const RenderModeDescription g_renderModes[] = { -	// I18N: Hercules is graphics card name -	{ "hercGreen", _s("Hercules Green"), kRenderHercG }, -	{ "hercAmber", _s("Hercules Amber"), kRenderHercA }, -	{ "cga", "CGA", kRenderCGA }, -	{ "ega", "EGA", kRenderEGA }, -	{ "vga", "VGA", kRenderVGA }, -	{ "amiga", "Amiga", kRenderAmiga }, -	{ "fmtowns", "FM-Towns", kRenderFMTowns }, -	{ "pc9821", "PC-9821 (256 Colors)", kRenderPC9821 }, -	{ "pc9801", "PC-9801 (16 Colors)", kRenderPC9801 }, -	{0, 0, kRenderDefault} -}; - -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Green", "lowres") -DECLARE_TRANSLATION_ADDITIONAL_CONTEXT("Hercules Amber", "lowres") - -RenderMode parseRenderMode(const String &str) { -	if (str.empty()) -		return kRenderDefault; - -	const RenderModeDescription *l = g_renderModes; -	for (; l->code; ++l) { -		if (str.equalsIgnoreCase(l->code)) -			return l->id; -	} - -	return kRenderDefault; -} - -const char *getRenderModeCode(RenderMode id) { -	const RenderModeDescription *l = g_renderModes; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->code; -	} -	return 0; -} - -const char *getRenderModeDescription(RenderMode id) { -	const RenderModeDescription *l = g_renderModes; -	for (; l->code; ++l) { -		if (l->id == id) -			return l->description; -	} -	return 0; -} - -const struct GameOpt { -	const char *option; -	const char *desc; -} g_gameOptions[] = { -	{ GUIO_NOSUBTITLES,  "sndNoSubs" }, -	{ GUIO_NOMUSIC,      "sndNoMusic" }, -	{ GUIO_NOSPEECH,     "sndNoSpeech" }, -	{ GUIO_NOSFX,        "sndNoSFX" }, -	{ GUIO_NOMIDI,       "sndNoMIDI" }, - -	{ GUIO_NOLAUNCHLOAD, "launchNoLoad" }, - -	{ GUIO_MIDIPCSPK,    "midiPCSpk" }, -	{ GUIO_MIDICMS,      "midiCMS" }, -	{ GUIO_MIDIPCJR,     "midiPCJr" }, -	{ GUIO_MIDIADLIB,    "midiAdLib" }, -	{ GUIO_MIDIC64,      "midiC64" }, -	{ GUIO_MIDIAMIGA,    "midiAmiga" }, -	{ GUIO_MIDIAPPLEIIGS,"midiAppleIIgs" }, -	{ GUIO_MIDITOWNS,    "midiTowns" }, -	{ GUIO_MIDIPC98,     "midiPC98" }, -	{ GUIO_MIDIMT32,     "midiMt32" }, -	{ GUIO_MIDIGM,       "midiGM" }, - -	{ GUIO_NOASPECT,     "noAspect" }, -	{ GUIO_EGAUNDITHER,  "egaUndither" }, - -	{ GUIO_RENDERHERCGREEN,	"hercGreen" }, -	{ GUIO_RENDERHERCAMBER,	"hercAmber" }, -	{ GUIO_RENDERCGA,		"cga" }, -	{ GUIO_RENDEREGA,		"ega" }, -	{ GUIO_RENDERVGA,		"vga" }, -	{ GUIO_RENDERAMIGA,		"amiga" }, -	{ GUIO_RENDERFMTOWNS,	"fmtowns" }, -	{ GUIO_RENDERPC9821,	"pc9821" }, -	{ GUIO_RENDERPC9801,	"pc9801" }, - -	{ GUIO_NONE, 0 } -}; - -bool checkGameGUIOption(const String &option, const String &str) { -	for (int i = 0; g_gameOptions[i].desc; i++) { -		if (option.contains(g_gameOptions[i].option)) { -			if (str.contains(g_gameOptions[i].desc)) -				return true; -			else -				return false; -		} -	} -	return false; -} - -bool checkGameGUIOptionLanguage(Language lang, const String &str) { -	if (!str.contains("lang_")) // If no languages are specified -		return true; - -	if (str.contains(getGameGUIOptionsDescriptionLanguage(lang))) -		return true; - -	return false; -} - -const String getGameGUIOptionsDescriptionLanguage(Language lang) { -	if (lang == UNK_LANG) -		return ""; - -	return String(String("lang_") + getLanguageDescription(lang)); -} - -String parseGameGUIOptions(const String &str) { -	Common::String res; - -	for (int i = 0; g_gameOptions[i].desc; i++) -		if (str.contains(g_gameOptions[i].desc)) -			res += g_gameOptions[i].option; - -	return res; -} - -const String getGameGUIOptionsDescription(const String &options) { -	String res; - -	for (int i = 0; g_gameOptions[i].desc; i++) -		if (options.contains(g_gameOptions[i].option[0])) -			res += String(g_gameOptions[i].desc) + " "; - -	res.trim(); - -	return res; -} - -void updateGameGUIOptions(const String &options, const String &langOption) { -	const String newOptionString = getGameGUIOptionsDescription(options) + " " + langOption; - -	if ((!options.empty() && !ConfMan.hasKey("guioptions")) || -	    (ConfMan.hasKey("guioptions") && ConfMan.get("guioptions") != newOptionString)) { -		ConfMan.set("guioptions", newOptionString); -		ConfMan.flushToDisk(); -	} -} -  #define ENSURE_ASCII_CHAR(c) \  		if (c < 0 || c > 127) \  			return false diff --git a/common/util.h b/common/util.h index 841280f7ae..b90be0675b 100644 --- a/common/util.h +++ b/common/util.h @@ -25,7 +25,6 @@  #include "common/scummsys.h"  #include "common/str.h" -  /**   * Check whether a given pointer is aligned correctly.   * Note that 'alignment' must be a power of two! @@ -78,47 +77,6 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }  #  define SCUMMVM_CURRENT_FUNCTION "<unknown>"  #endif -#define GUIO_NONE			"\000" -#define GUIO_NOSUBTITLES	"\001" -#define GUIO_NOMUSIC		"\002" -#define GUIO_NOSPEECH		"\003" -#define GUIO_NOSFX			"\004" -#define GUIO_NOMIDI			"\005" -#define GUIO_NOLAUNCHLOAD	"\006" - -#define GUIO_MIDIPCSPK		"\007" -#define GUIO_MIDICMS		"\010" -#define GUIO_MIDIPCJR		"\011" -#define GUIO_MIDIADLIB		"\012" -#define GUIO_MIDIC64        "\013" -#define GUIO_MIDIAMIGA      "\014" -#define GUIO_MIDIAPPLEIIGS  "\015" -#define GUIO_MIDITOWNS		"\016" -#define GUIO_MIDIPC98		"\017" -#define GUIO_MIDIMT32		"\020" -#define GUIO_MIDIGM			"\021" - -#define GUIO_NOASPECT		"\022" -#define GUIO_EGAUNDITHER	"\023" - -#define GUIO_RENDERHERCGREEN	"\030" -#define GUIO_RENDERHERCAMBER	"\031" -#define GUIO_RENDERCGA		"\032" -#define GUIO_RENDEREGA		"\033" -#define GUIO_RENDERVGA		"\034" -#define GUIO_RENDERAMIGA	"\035" -#define GUIO_RENDERFMTOWNS	"\036" -#define GUIO_RENDERPC9821	"\037" -#define GUIO_RENDERPC9801	"\040" - -#define GUIO0() (GUIO_NONE) -#define GUIO1(a) (a) -#define GUIO2(a,b) (a b) -#define GUIO3(a,b,c) (a b c) -#define GUIO4(a,b,c,d) (a b c d) -#define GUIO5(a,b,c,d,e) (a b c d e) -#define GUIO6(a,b,c,d,e,f) (a b c d e f) -  namespace Common {  /** @@ -207,146 +165,6 @@ bool isSpace(int c);   */  bool isUpper(int c); - -/** - * List of game language. - */ -enum Language { -	ZH_CNA, -	ZH_TWN, -	CZ_CZE, -	NL_NLD, -	EN_ANY,     // Generic English (when only one game version exist) -	EN_GRB, -	EN_USA, -	FR_FRA, -	DE_DEU, -	GR_GRE, -	HE_ISR, -	HR_HRV, -	HU_HUN, -	IT_ITA, -	JA_JPN, -	KO_KOR, -	NB_NOR, -	PL_POL, -	PT_BRA, -	RU_RUS, -	ES_ESP, -	SE_SWE, - -	UNK_LANG = -1	// Use default language (i.e. none specified) -}; - -struct LanguageDescription { -	const char *code; -	const char *unixLocale; -	const char *description; -	Language id; -}; - -extern const LanguageDescription g_languages[]; - - -/** Convert a string containing a language name into a Language enum value. */ -extern Language parseLanguage(const String &str); -extern Language parseLanguageFromLocale(const char *locale); -extern const char *getLanguageCode(Language id); -extern const char *getLanguageLocale(Language id); -extern const char *getLanguageDescription(Language id); - -/** - * List of game platforms. Specifying a platform for a target can be used to - * give the game engines a hint for which platform the game data file are. - * This may be optional or required, depending on the game engine and the - * game in question. - */ -enum Platform { -	kPlatformPC, -	kPlatformAmiga, -	kPlatformAtariST, -	kPlatformMacintosh, -	kPlatformFMTowns, -	kPlatformWindows, -	kPlatformNES, -	kPlatformC64, -	kPlatformCoCo3, -	kPlatformLinux, -	kPlatformAcorn, -	kPlatformSegaCD, -	kPlatform3DO, -	kPlatformPCEngine, -	kPlatformApple2GS, -	kPlatformPC98, -	kPlatformWii, -	kPlatformPSX, -	kPlatformCDi, -	kPlatformIOS, - -	kPlatformUnknown = -1 -}; - -struct PlatformDescription { -	const char *code; -	const char *code2; -	const char *abbrev; -	const char *description; -	Platform id; -}; - -extern const PlatformDescription g_platforms[]; - -/** Convert a string containing a platform name into a Platform enum value. */ -extern Platform parsePlatform(const String &str); -extern const char *getPlatformCode(Platform id); -extern const char *getPlatformAbbrev(Platform id); -extern const char *getPlatformDescription(Platform id); - -/** - * List of render modes. It specifies which original graphics mode - * to use. Some targets used postprocessing dithering routines for - * reducing color depth of final image which let it to be rendered on - * such low-level adapters as CGA or Hercules. - */ -enum RenderMode { -	kRenderDefault = 0, -	kRenderVGA = 1, -	kRenderEGA = 2, -	kRenderCGA = 3, -	kRenderHercG = 4, -	kRenderHercA = 5, -	kRenderAmiga = 6, -	kRenderFMTowns = 7, -	kRenderPC9821 = 8, -	kRenderPC9801 = 9 -}; - -struct RenderModeDescription { -	const char *code; -	const char *description; -	RenderMode id; -}; - -extern const RenderModeDescription g_renderModes[]; - -/** Convert a string containing a render mode name into a RenderingMode enum value. */ -extern RenderMode parseRenderMode(const String &str); -extern const char *getRenderModeCode(RenderMode id); -extern const char *getRenderModeDescription(RenderMode id); - -bool checkGameGUIOption(const String &option, const String &str); -bool checkGameGUIOptionLanguage(Language lang, const String &str); -String parseGameGUIOptions(const String &str); -const String getGameGUIOptionsDescription(const String &options); -const String getGameGUIOptionsDescriptionLanguage(Language lang); - -/** - * Updates the GUI options of the current config manager - * domain, when they differ to the ones passed as - * parameter. - */ -void updateGameGUIOptions(const String &options, const String &langOption); -  }	// End of namespace Common  #endif diff --git a/engines/advancedDetector.h b/engines/advancedDetector.h index c31c8bd66e..3bb00618b1 100644 --- a/engines/advancedDetector.h +++ b/engines/advancedDetector.h @@ -26,6 +26,8 @@  #include "engines/metaengine.h"  #include "engines/engine.h" +#include "common/gui_options.h" // FIXME: Temporary hack? +  namespace Common {  class Error;  class FSList; diff --git a/engines/agi/agi.h b/engines/agi/agi.h index ea3afa5ca3..55b4805022 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -28,6 +28,7 @@  #include "common/util.h"  #include "common/file.h"  #include "common/rect.h" +#include "common/rendermode.h"  #include "common/stack.h"  #include "common/system.h" diff --git a/engines/engine.h b/engines/engine.h index a020dc4951..4f4223384a 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -24,6 +24,8 @@  #include "common/scummsys.h"  #include "common/str.h" +#include "common/language.h" +#include "common/platform.h"  class OSystem; diff --git a/engines/game.cpp b/engines/game.cpp index be15240745..4bfd8f3bf2 100644 --- a/engines/game.cpp +++ b/engines/game.cpp @@ -21,6 +21,7 @@   */  #include "engines/game.h" +#include "common/gui_options.h"  const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const PlainGameDescriptor *list) { diff --git a/engines/game.h b/engines/game.h index d5136936bc..3417203ea7 100644 --- a/engines/game.h +++ b/engines/game.h @@ -26,7 +26,8 @@  #include "common/array.h"  #include "common/hash-str.h"  #include "common/str.h" -#include "common/util.h" +#include "common/language.h" +#include "common/platform.h"  /**   * A simple structure used to map gameids (like "monkey", "sword1", ...) to diff --git a/engines/gob/databases.h b/engines/gob/databases.h index fb65d8cf96..cde123e6a8 100644 --- a/engines/gob/databases.h +++ b/engines/gob/databases.h @@ -26,7 +26,7 @@  #include "common/str.h"  #include "common/hashmap.h"  #include "common/hash-str.h" -#include "common/util.h" +#include "common/language.h"  #include "gob/dbase.h" diff --git a/engines/kyra/kyra_v1.h b/engines/kyra/kyra_v1.h index 499f575a0c..11173a45c7 100644 --- a/engines/kyra/kyra_v1.h +++ b/engines/kyra/kyra_v1.h @@ -28,8 +28,9 @@  #include "common/array.h"  #include "common/error.h"  #include "common/events.h" -#include "common/random.h"  #include "common/hashmap.h" +#include "common/random.h" +#include "common/rendermode.h"  #include "audio/mixer.h" diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index a0cf5742c6..b064c72bb0 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -28,6 +28,7 @@  #include "common/list.h"  #include "common/array.h"  #include "common/rect.h" +#include "common/rendermode.h"  #include "common/stream.h"  class OSystem; diff --git a/engines/queen/input.h b/engines/queen/input.h index 0aa04dd026..b3bf811cd1 100644 --- a/engines/queen/input.h +++ b/engines/queen/input.h @@ -23,7 +23,7 @@  #ifndef QUEEN_INPUT_H  #define QUEEN_INPUT_H -#include "common/util.h" +#include "common/language.h"  #include "common/rect.h"  #include "common/events.h"  #include "queen/defs.h" diff --git a/engines/queen/queen.cpp b/engines/queen/queen.cpp index c610ef9921..d17268e16b 100644 --- a/engines/queen/queen.cpp +++ b/engines/queen/queen.cpp @@ -25,6 +25,7 @@  #include "common/config-manager.h"  #include "common/file.h"  #include "common/fs.h" +#include "common/gui_options.h"  #include "common/savefile.h"  #include "common/system.h"  #include "common/events.h" diff --git a/engines/queen/resource.h b/engines/queen/resource.h index ef8e463631..7317ec5134 100644 --- a/engines/queen/resource.h +++ b/engines/queen/resource.h @@ -25,7 +25,8 @@  #include "common/file.h"  #include "common/str-array.h" -#include "common/util.h" +#include "common/language.h" +#include "common/platform.h"  #include "queen/defs.h"  namespace Queen { diff --git a/engines/scumm/detection.h b/engines/scumm/detection.h index ad8b3cec12..b6dfa757bb 100644 --- a/engines/scumm/detection.h +++ b/engines/scumm/detection.h @@ -23,7 +23,8 @@  #ifndef SCUMM_DETECTION_H  #define SCUMM_DETECTION_H -#include "common/util.h" +#include "common/language.h" +#include "common/platform.h"  namespace Scumm { diff --git a/engines/scumm/detection_tables.h b/engines/scumm/detection_tables.h index a44497f193..d7eedc3a83 100644 --- a/engines/scumm/detection_tables.h +++ b/engines/scumm/detection_tables.h @@ -24,6 +24,7 @@  #define SCUMM_DETECTION_TABLES_H  #include "engines/obsolete.h" +#include "common/gui_options.h"  #include "common/rect.h"  #include "common/util.h" diff --git a/engines/scumm/help.h b/engines/scumm/help.h index 5ba6bdc65c..a3948566c4 100644 --- a/engines/scumm/help.h +++ b/engines/scumm/help.h @@ -24,6 +24,7 @@  #define SCUMM_HELP_H  #include "common/str.h" +#include "common/platform.h"  namespace Scumm { diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 2f1e536f0a..cacf8c214e 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -24,6 +24,7 @@  #define SCUMM_H  #include "engines/engine.h" +  #include "common/endian.h"  #include "common/events.h"  #include "common/file.h" @@ -31,6 +32,7 @@  #include "common/keyboard.h"  #include "common/random.h"  #include "common/rect.h" +#include "common/rendermode.h"  #include "common/str.h"  #include "common/textconsole.h"  #include "graphics/surface.h" diff --git a/engines/sword1/detection.cpp b/engines/sword1/detection.cpp index 2214e72067..087dcd09d8 100644 --- a/engines/sword1/detection.cpp +++ b/engines/sword1/detection.cpp @@ -25,6 +25,7 @@  #include "base/plugins.h"  #include "common/fs.h" +#include "common/gui_options.h"  #include "common/savefile.h"  #include "common/system.h"  #include "graphics/thumbnail.h" diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index bdfc388c5f..c395186570 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -25,9 +25,10 @@  #include "base/plugins.h"  #include "common/config-manager.h" +#include "common/events.h"  #include "common/file.h"  #include "common/fs.h" -#include "common/events.h" +#include "common/gui_options.h"  #include "common/savefile.h"  #include "common/system.h"  #include "common/textconsole.h" diff --git a/engines/sword25/util/lua/scummvm_file.cpp b/engines/sword25/util/lua/scummvm_file.cpp index 33053a71cb..b5f1388129 100644 --- a/engines/sword25/util/lua/scummvm_file.cpp +++ b/engines/sword25/util/lua/scummvm_file.cpp @@ -22,7 +22,7 @@  #include "sword25/util/lua/scummvm_file.h"  #include "common/config-manager.h" -#include "common/util.h" +#include "common/language.h"  namespace Sword25 { diff --git a/engines/touche/graphics.h b/engines/touche/graphics.h index 4b769b0a66..5b2ea39a24 100644 --- a/engines/touche/graphics.h +++ b/engines/touche/graphics.h @@ -23,7 +23,7 @@  #ifndef TOUCHE_GRAPHICS_H  #define TOUCHE_GRAPHICS_H -#include "common/util.h" +#include "common/language.h"  namespace Touche { diff --git a/graphics/sjis.h b/graphics/sjis.h index f96eef6ad1..2d05005fc3 100644 --- a/graphics/sjis.h +++ b/graphics/sjis.h @@ -43,7 +43,7 @@  #endif  #include "common/scummsys.h" -#include "common/util.h" +#include "common/platform.h"  namespace Graphics { diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 5bb358452a..a3e4925848 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -24,6 +24,7 @@  #include "common/config-manager.h"  #include "common/events.h"  #include "common/fs.h" +#include "common/gui_options.h"  #include "common/util.h"  #include "common/system.h"  #include "common/translation.h" diff --git a/gui/options.cpp b/gui/options.cpp index fbbb938e97..5085f9cdd9 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -30,6 +30,8 @@  #include "common/fs.h"  #include "common/config-manager.h" +#include "common/gui_options.h" +#include "common/rendermode.h"  #include "common/system.h"  #include "common/textconsole.h"  #include "common/translation.h" | 
