diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp index 2b7f1aa8f3d..ac610ec9080 100644 --- a/engines/access/resources.cpp +++ b/engines/access/resources.cpp @@ -41,7 +41,7 @@ bool Resources::load(Common::String &errorMessage) { Common::File f; Common::String filename = "access.dat"; if (!f.open(filename.c_str())) { - errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); return false; } @@ -49,7 +49,7 @@ bool Resources::load(Common::String &errorMessage) { char buffer[4]; f.read(buffer, 4); if (strncmp(buffer, "SVMA", 4)) { - errorMessage = Common::String::format(_("The '%s' engine data file is corrupt."), filename.c_str()); + errorMessage = Common::String::format(_("The '%s' engine data file is corrupt.").encode().c_str(), filename.c_str()); return false; } @@ -58,7 +58,7 @@ bool Resources::load(Common::String &errorMessage) { uint version = f.readUint16LE(); if (version != expectedVersion) { errorMessage = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), filename.c_str(), expectedVersion, 0, version, 0); return false; } diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp index e374c147011..db2e7b3828b 100644 --- a/engines/agos/animation.cpp +++ b/engines/agos/animation.cpp @@ -555,7 +555,7 @@ MoviePlayer *makeMoviePlayer(AGOSEngine_Feeble *vm, const char *name) { return new MoviePlayerSMK(vm, baseName); } - Common::String buf = Common::String::format(_("Cutscene file '%s' not found!"), baseName); + Common::U32String buf = Common::String::format(_("Cutscene file '%s' not found!").encode().c_str(), baseName); GUI::MessageDialog dialog(buf, _("OK")); dialog.runModal(); diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp index 3dce7bf2df2..de34e02dd1c 100644 --- a/engines/agos/saveload.cpp +++ b/engines/agos/saveload.cpp @@ -125,7 +125,7 @@ void AGOSEngine_Feeble::quickLoadOrSave() { // was disabled void AGOSEngine::quickLoadOrSave() { bool success; - Common::String buf; + Common::U32String buf; // Disable loading and saving when it was not possible in the original: // In overhead maps areas in Simon the Sorcerer 2 @@ -135,7 +135,7 @@ void AGOSEngine::quickLoadOrSave() { (getGameType() == GType_SIMON1 && (getFeatures() & GF_DEMO)) || _mouseHideCount || _showPreposition) { buf = Common::String::format("Quick load or save game isn't supported in this location"); - GUI::MessageDialog dialog(buf, "OK"); + GUI::MessageDialog dialog(buf); dialog.runModal(); return; } @@ -156,7 +156,7 @@ void AGOSEngine::quickLoadOrSave() { Subroutine *sub; success = loadGame(genSaveName(_saveLoadSlot)); if (!success) { - buf = Common::String::format(_("Failed to load saved game from file:\n\n%s"), filename.c_str()); + buf = Common::String::format(_("Failed to load saved game from file:\n\n%s").encode().c_str(), filename.c_str()); } else if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) { drawIconArray(2, me(), 0, 0); setBitFlag(97, true); @@ -191,15 +191,15 @@ void AGOSEngine::quickLoadOrSave() { } else { success = saveGame(_saveLoadSlot, _saveLoadName); if (!success) - buf = Common::String::format(_("Failed to save game to file:\n\n%s"), filename.c_str()); + buf = Common::String::format(_("Failed to save game to file:\n\n%s").encode().c_str(), filename.c_str()); } if (!success) { - GUI::MessageDialog dialog(buf, "OK"); + GUI::MessageDialog dialog(buf); dialog.runModal(); } else if (_saveLoadType == 1) { - buf = Common::String::format(_("Successfully saved game in file:\n\n%s"), filename.c_str()); + buf = Common::String::format(_("Successfully saved game in file:\n\n%s").encode().c_str(), filename.c_str()); GUI::TimedMessageDialog dialog(buf, 1500); dialog.runModal(); diff --git a/engines/bbvs/dialogs.cpp b/engines/bbvs/dialogs.cpp index a0aa23733bc..9f22c26c46d 100644 --- a/engines/bbvs/dialogs.cpp +++ b/engines/bbvs/dialogs.cpp @@ -86,11 +86,11 @@ MainMenu::~MainMenu() { } void MainMenu::init() { - _buttons[0] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); - _buttons[1] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); - _buttons[2] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); - _buttons[3] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); - _buttons[4] = new GUI::ButtonWidget(this, 0, 0, 1, 1, "", 0, 0); + _buttons[0] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String(""), Common::U32String(""), 0); + _buttons[1] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String(""), Common::U32String(""), 0); + _buttons[2] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String(""), Common::U32String(""), 0); + _buttons[3] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String(""), Common::U32String(""), 0); + _buttons[4] = new GUI::ButtonWidget(this, 0, 0, 1, 1, Common::U32String(""), Common::U32String(""), 0); gotoMenuScreen(kMainMenuScr); } @@ -192,7 +192,7 @@ void MainMenu::gotoMenuScreen(int screen) { } else { btn = &kMenuButtons[screen * 5 + i]; } - _buttons[i]->setLabel(btn->label); + _buttons[i]->setLabel(Common::U32String(btn->label)); _buttons[i]->setCmd(btn->cmd); _buttons[i]->setEnabled(btn->cmd != 0); } diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 3682737e507..eaa2d44c2fd 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -2238,13 +2238,13 @@ bool BladeRunnerEngine::loadGame(Common::SeekableReadStream &stream) { if ((_gameFlags->query(kFlagGamePlayedInRestoredContentMode) && !_cutContent) || (!_gameFlags->query(kFlagGamePlayedInRestoredContentMode) && _cutContent) ) { - Common::String warningMsg; + Common::U32String warningMsg; if (!_cutContent) { warningMsg = _("WARNING: This game was saved in Restored Cut Content mode, but you are playing in Original Content mode. The mode will be adjusted to Restored Cut Content for this session until you completely Quit the game."); } else { warningMsg = _("WARNING: This game was saved in Original Content mode, but you are playing in Restored Cut Content mode. The mode will be adjusted to Original Content mode for this session until you completely Quit the game."); } - GUI::MessageDialog dialog(warningMsg, _("Continue"), 0); + GUI::MessageDialog dialog(warningMsg, _("Continue")); dialog.runModal(); _cutContent = !_cutContent; // force a Key Down event, since we need it to remove the KIA diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp index 2e30bde32bf..d9d97f4612c 100644 --- a/engines/bladerunner/subtitles.cpp +++ b/engines/bladerunner/subtitles.cpp @@ -270,7 +270,7 @@ void Subtitles::loadOuttakeSubsText(const Common::String &outtakesName, int fram * Used for debug purposes mainly. */ void Subtitles::setGameSubsText(Common::String dbgQuote, bool forceShowWhenNoSpeech) { - _currentText = _useUTF8 ? Common::convertUtf8ToUtf32(dbgQuote) : dbgQuote; + _currentText = _useUTF8 ? Common::convertUtf8ToUtf32(dbgQuote) : Common::convertToU32String(dbgQuote.c_str()); _forceShowWhenNoSpeech = forceShowWhenNoSpeech; // overrides not showing subtitles when no one is speaking } diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp index 62881c3fc45..5592f485eb7 100644 --- a/engines/cge/cge.cpp +++ b/engines/cge/cge.cpp @@ -225,10 +225,10 @@ Common::Error CGEEngine::run() { // If game is finished, display ending message if (_flag[3]) { - Common::String msg = Common::String(_text->getText(kSayTheEnd)); - if (msg.size() != 0) { + Common::U32String msg = Common::U32String(_text->getText(kSayTheEnd)); + if (!msg.empty()) { g_system->delayMillis(10); - GUI::MessageDialog dialog(msg, "OK"); + GUI::MessageDialog dialog(msg, Common::U32String("OK")); dialog.runModal(); } } diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 460da8e1b34..fc21c8b2cca 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -928,7 +928,7 @@ bool DrasculaEngine::loadDrasculaDat() { in.open(filename.c_str()); if (!in.isOpen()) { - Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); @@ -942,7 +942,7 @@ bool DrasculaEngine::loadDrasculaDat() { buf[8] = '\0'; if (strcmp(buf, "DRASCULA") != 0) { - Common::String errorMessage = Common::String::format(_("The '%s' engine data file is corrupt."), filename.c_str()); + Common::String errorMessage = Common::String::format(_("The '%s' engine data file is corrupt.").encode().c_str(), filename.c_str()); GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); @@ -953,7 +953,7 @@ bool DrasculaEngine::loadDrasculaDat() { if (ver != DRASCULA_DAT_VER) { Common::String errorMessage = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), filename.c_str(), DRASCULA_DAT_VER, 0, ver, 0); GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); diff --git a/engines/glk/adrift/os_glk.cpp b/engines/glk/adrift/os_glk.cpp index 958cf55d7d7..c5f25f76ca3 100644 --- a/engines/glk/adrift/os_glk.cpp +++ b/engines/glk/adrift/os_glk.cpp @@ -2811,7 +2811,7 @@ static int gsc_startup_code(Common::SeekableReadStream *game_stream, int restore * Display a brief loading game message; here we have to use a timeout * to ensure that the text is flushed to Glk. */ - g_vm->glk_put_string(_("Loading game...\n")); + g_vm->glk_put_string(_("Loading game...\n").encode().c_str()); if (g_vm->glk_gestalt(gestalt_Timer, 0)) { event_t event; diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp index 1cb42dad7b0..eb264b44855 100644 --- a/engines/glk/advsys/vm.cpp +++ b/engines/glk/advsys/vm.cpp @@ -593,7 +593,7 @@ bool VM::getWord(Common::String &line) { _words.push_back(iw); return true; } else { - Common::String msg = Common::String::format(_("I don't know the word \"%s\".\n"), iw._text.c_str()); + Common::String msg = Common::String::format(_("I don't know the word \"%s\".\n").encode().c_str(), iw._text.c_str()); print(msg); return false; } diff --git a/engines/glk/glk_api.cpp b/engines/glk/glk_api.cpp index d7ea0e0f309..9de8aa6b2fd 100644 --- a/engines/glk/glk_api.cpp +++ b/engines/glk/glk_api.cpp @@ -60,7 +60,7 @@ GlkAPI::GlkAPI(OSystem *syst, const GlkGameDescription &gameDesc) : } void GlkAPI::glk_exit(void) { - glk_put_string(_("[ press any key to exit ]")); + glk_put_string(_("[ press any key to exit ]").encode().c_str()); _events->waitForPress(); // Trigger a ScumMVM shutdown of game diff --git a/engines/glk/scott/scott.cpp b/engines/glk/scott/scott.cpp index a974b839a98..24b1363f23e 100644 --- a/engines/glk/scott/scott.cpp +++ b/engines/glk/scott/scott.cpp @@ -391,7 +391,7 @@ void Scott::outputNumber(int a) { void Scott::look(void) { const char *const ExitNames[6] = { - _("North"), _("South"), _("East"), _("West"), _("Up"), _("Down") + _("North").encode().c_str(), _("South").encode().c_str(), _("East").encode().c_str(), _("West").encode().c_str(), _("Up").encode().c_str(), _("Down").encode().c_str() }; Room *r; int ct, f; @@ -403,9 +403,9 @@ void Scott::look(void) { if ((_bitFlags & (1 << DARKBIT)) && _items[LIGHT_SOURCE]._location != CARRIED && _items[LIGHT_SOURCE]._location != MY_LOC) { if (_options & YOUARE) - display(_topWindow, _("You can't see. It is too dark!\n")); + display(_topWindow, _("You can't see. It is too dark!\n").encode().c_str()); else - display(_topWindow, _("I can't see. It is too dark!\n")); + display(_topWindow, _("I can't see. It is too dark!\n").encode().c_str()); if (_options & TRS80_STYLE) display(_topWindow, TRS80_LINE); return; @@ -415,14 +415,14 @@ void Scott::look(void) { display(_topWindow, "%s\n", r->_text.c_str() + 1); else { if (_options & YOUARE) - display(_topWindow, _("You are in a %s\n"), r->_text.c_str()); + display(_topWindow, _("You are in a %s\n").encode().c_str(), r->_text.c_str()); else - display(_topWindow, _("I'm in a %s\n"), r->_text.c_str()); + display(_topWindow, _("I'm in a %s\n").encode().c_str(), r->_text.c_str()); } ct = 0; f = 0; - display(_topWindow, _("\nObvious exits: ")); + display(_topWindow, _("\nObvious exits: ").encode().c_str()); while (ct < 6) { if (r->_exits[ct] != 0) { if (f == 0) @@ -435,7 +435,7 @@ void Scott::look(void) { } if (f == 0) - display(_topWindow, _("none")); + display(_topWindow, _("none").encode().c_str()); display(_topWindow, ".\n"); ct = 0; f = 0; @@ -444,10 +444,10 @@ void Scott::look(void) { if (_items[ct]._location == MY_LOC) { if (f == 0) { if (_options & YOUARE) { - display(_topWindow, _("\nYou can also see: ")); + display(_topWindow, _("\nYou can also see: ").encode().c_str()); pos = 18; } else { - display(_topWindow, _("\nI can also see: ")); + display(_topWindow, _("\nI can also see: ").encode().c_str()); pos = 16; } f++; diff --git a/engines/glk/zcode/zcode.cpp b/engines/glk/zcode/zcode.cpp index 66df44cb706..4cd1612dc06 100644 --- a/engines/glk/zcode/zcode.cpp +++ b/engines/glk/zcode/zcode.cpp @@ -141,7 +141,7 @@ Common::Error ZCode::saveGameState(int slot, const Common::String &desc, bool is bool success = q.save(*file, this, desc); if (!success) - print_string(_("Error writing save file\n")); + print_string(_("Error writing save file\n").encode().c_str()); return Common::kNoError; diff --git a/engines/hdb/detection.cpp b/engines/hdb/detection.cpp index 438ec89e03e..f04227ead2b 100644 --- a/engines/hdb/detection.cpp +++ b/engines/hdb/detection.cpp @@ -254,7 +254,7 @@ SaveStateList HDBMetaEngine::listSaves(const char *target) const { if (slotNum < 8) desc.setDescription(Common::String::format("Auto: %s", mapName)); else - desc.setDescription(mapName); + desc.setDescription(Common::convertToU32String(mapName)); saveList.push_back(desc); } @@ -284,7 +284,7 @@ SaveStateDescriptor HDBMetaEngine::querySaveMetaInfos(const char *target, int sl desc.setSaveSlot(slot); desc.setPlayTime(timeSeconds * 1000); - desc.setDescription(mapName); + desc.setDescription(Common::convertToU32String(mapName)); return desc; } diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp index c2caf421e00..62a508953ae 100644 --- a/engines/hugo/dialogs.cpp +++ b/engines/hugo/dialogs.cpp @@ -56,15 +56,15 @@ void TopMenu::init() { int x = kMenuX; int y = kMenuY; - _whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "What is it?", kCmdWhat); - _musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Music", kCmdMusic); - _soundFXButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Sound FX", kCmdSoundFX); - _saveButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Save game", kCmdSave); - _loadButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Load game", kCmdLoad); - _recallButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Recall last command", kCmdRecall); - _turboButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Turbo", kCmdTurbo); - _lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Description of the scene", kCmdLook); - _inventButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Inventory", kCmdInvent); + _whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("What is it?"), kCmdWhat); + _musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Music"), kCmdMusic); + _soundFXButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Sound FX"), kCmdSoundFX); + _saveButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Save game"), kCmdSave); + _loadButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Load game"), kCmdLoad); + _recallButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Recall last command"), kCmdRecall); + _turboButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Turbo"), kCmdTurbo); + _lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Description of the scene"), kCmdLook); + _inventButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, Common::U32String("Inventory"), kCmdInvent); } void TopMenu::reflowLayout() { @@ -276,14 +276,14 @@ EntryDialog::EntryDialog(const Common::String &title, const Common::String &butt lines[i], Graphics::kTextAlignCenter); } - _text = new GUI::EditTextWidget(this, 10, 10 + lineCount * (kLineHeight + 1), _w - 20, kLineHeight, "", "", 0, kCmdFinishEdit); + _text = new GUI::EditTextWidget(this, 10, 10 + lineCount * (kLineHeight + 1), _w - 20, kLineHeight, Common::U32String(""), Common::U32String(""), 0, kCmdFinishEdit); _text->setEditString(defaultValue); _h += kLineHeight + 5; buttonPos = (_w - buttonWidth) / 2; - new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, buttonLabel, 0, kCmdButton, Common::ASCII_RETURN); // Confirm dialog + new GUI::ButtonWidget(this, buttonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, buttonLabel, Common::U32String(""), kCmdButton, Common::ASCII_RETURN); // Confirm dialog } diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h index 138b29de064..f1f75375493 100644 --- a/engines/hugo/dialogs.h +++ b/engines/hugo/dialogs.h @@ -107,7 +107,7 @@ public: void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) override; - const Common::String &getEditString() const { return _text->getEditString(); } + const Common::U32String &getEditString() const { return _text->getEditString(); } protected: GUI::EditTextWidget *_text; diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 62a1e3e485f..9919d87c070 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -433,7 +433,7 @@ bool HugoEngine::loadHugoDat() { in.open(filename.c_str()); if (!in.isOpen()) { - Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); return false; @@ -444,7 +444,7 @@ bool HugoEngine::loadHugoDat() { in.read(buf, 4); if (memcmp(buf, "HUGO", 4)) { - Common::String errorMessage = Common::String::format(_("The '%s' engine data file is corrupt."), filename.c_str()); + Common::String errorMessage = Common::String::format(_("The '%s' engine data file is corrupt.").encode().c_str(), filename.c_str()); GUIErrorMessage(errorMessage); return false; } @@ -454,7 +454,7 @@ bool HugoEngine::loadHugoDat() { if ((majVer != HUGO_DAT_VER_MAJ) || (minVer != HUGO_DAT_VER_MIN)) { Common::String errorMessage = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), filename.c_str(),HUGO_DAT_VER_MAJ, HUGO_DAT_VER_MIN, majVer, minVer); GUIErrorMessage(errorMessage); return false; diff --git a/engines/hugo/util.cpp b/engines/hugo/util.cpp index bc1525382ce..3e44908ae92 100644 --- a/engines/hugo/util.cpp +++ b/engines/hugo/util.cpp @@ -87,10 +87,14 @@ void reverseByte(byte *data) { } void notifyBox(const Common::String &msg) { + notifyBox(Common::U32String(msg)); +} + +void notifyBox(const Common::U32String &msg) { if (msg.empty()) return; - GUI::MessageDialog dialog(msg, "OK"); + GUI::MessageDialog dialog(msg); dialog.runModal(); } @@ -106,10 +110,14 @@ Common::String promptBox(const Common::String &msg) { } bool yesNoBox(const Common::String &msg) { + return yesNoBox(Common::U32String(msg)); +} + +bool yesNoBox(const Common::U32String &msg) { if (msg.empty()) return 0; - GUI::MessageDialog dialog(msg, "YES", "NO"); + GUI::MessageDialog dialog(msg, Common::U32String("YES"), Common::U32String("NO")); return (dialog.runModal() == GUI::kMessageOK); } diff --git a/engines/hugo/util.h b/engines/hugo/util.h index 3a76e3c6f48..66be189b802 100644 --- a/engines/hugo/util.h +++ b/engines/hugo/util.h @@ -47,7 +47,8 @@ void reverseByte(byte *data); * Show a dialog notifying the user about something, with * only a simple "OK" button to dismiss it. */ -void notifyBox(const Common::String &msg); +void notifyBox(const Common::String &msg); // Redirect to call notifyBox with u32strings +void notifyBox(const Common::U32String &msg); /** * Show a dialog prompting the player to input some text. @@ -57,7 +58,8 @@ Common::String promptBox(const Common::String &msg); /** * Show a dialog prompting the player for a "yes"/"no" choice. */ -bool yesNoBox(const Common::String &msg); +bool yesNoBox(const Common::String &msg); // Redirect to call yesNoBox with u32strings +bool yesNoBox(const Common::U32String &msg); /** * Convert a string to lower case, in place. diff --git a/engines/illusions/menusystem.cpp b/engines/illusions/menusystem.cpp index 72cdeeeaded..c00dace72dc 100644 --- a/engines/illusions/menusystem.cpp +++ b/engines/illusions/menusystem.cpp @@ -697,12 +697,12 @@ MenuActionSaveGame::MenuActionSaveGame(BaseMenuSystem *menuSystem, uint choiceIn void MenuActionSaveGame::execute() { GUI::SaveLoadChooser *dialog; - Common::String desc; + Common::U32String desc; int slot; dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true); slot = dialog->runModalWithCurrentTarget(); - desc = dialog->getResultString().c_str(); + desc = dialog->getResultString().encode().c_str(); delete dialog; diff --git a/engines/kyra/gui/saveload_eob.cpp b/engines/kyra/gui/saveload_eob.cpp index 0d6f156a28c..83bf5987ef7 100644 --- a/engines/kyra/gui/saveload_eob.cpp +++ b/engines/kyra/gui/saveload_eob.cpp @@ -594,7 +594,7 @@ bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile) } delete fs; - ::GUI::MessageDialog dialog(Common::String::format(_("The following original saved game file has been found in your game path:\n\n%s %s\n\nDo you wish to use this saved game file with ScummVM?\n\n"), temp.c_str(), dsc.c_str()), _("Yes"), _("No")); + ::GUI::MessageDialog dialog(Common::String::format(_("The following original saved game file has been found in your game path:\n\n%s %s\n\nDo you wish to use this saved game file with ScummVM?\n\n").encode().c_str(), temp.c_str(), dsc.c_str()), _("Yes"), _("No")); if (dialog.runModal()) origFiles.push_back(temp); } @@ -627,7 +627,7 @@ bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile) if (destSlot != -1) { if (Common::find(_gui->_saveSlots.begin(), _gui->_saveSlots.end(), destSlot) != _gui->_saveSlots.end()) { - ::GUI::MessageDialog dialog(Common::String::format(_("A saved game file was found in the specified slot %d. Overwrite?\n\n"), destSlot), _("Yes"), _("No")); + ::GUI::MessageDialog dialog(Common::String::format(_("A saved game file was found in the specified slot %d. Overwrite?\n\n").encode().c_str(), destSlot), _("Yes"), _("No")); if (!dialog.runModal()) return false; } @@ -660,7 +660,7 @@ bool EoBCoreEngine::importOriginalSaveFile(int destSlot, const char *sourceFile) _inf->reset(); if (destSlot == -1 && importedCount) { - ::GUI::MessageDialog dialog(Common::String::format(_("%d original saved games have been successfully imported into\nScummVM. If you want to manually import original saved game later you will\nneed to open the ScummVM debug console and use the command 'import_savefile'.\n\n"), importedCount)); + ::GUI::MessageDialog dialog(Common::String::format(_("%d original saved games have been successfully imported into\nScummVM. If you want to manually import original saved game later you will\nneed to open the ScummVM debug console and use the command 'import_savefile'.\n\n").encode().c_str(), importedCount)); dialog.runModal(); } diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index d6eccb1f30a..b39e3002f7d 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -61,7 +61,7 @@ Common::Error LureEngine::init() { Common::File f; VersionStructure version; if (!f.open(SUPPORT_FILENAME)) { - GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), SUPPORT_FILENAME); + GUIErrorMessageFormat(Common::convertFromU32String(_("Unable to locate the '%s' engine data file.")).c_str(), SUPPORT_FILENAME); return Common::kUnknownError; } @@ -70,10 +70,10 @@ Common::Error LureEngine::init() { f.close(); if (READ_LE_UINT16(&version.id) != 0xffff) { - GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), SUPPORT_FILENAME); + GUIErrorMessageFormat(Common::convertFromU32String(_("The '%s' engine data file is corrupt.")).c_str(), SUPPORT_FILENAME); return Common::kUnknownError; } else if ((version.vMajor != LURE_DAT_MAJOR) || (version.vMinor != LURE_DAT_MINOR)) { - GUIErrorMessageFormat(_("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + GUIErrorMessageFormat(Common::convertFromU32String(_("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.")).c_str(), SUPPORT_FILENAME, LURE_DAT_MAJOR, LURE_DAT_MINOR, version.vMajor, version.vMinor); return Common::kUnknownError; diff --git a/engines/mohawk/dialogs.cpp b/engines/mohawk/dialogs.cpp index 18219ef13c6..18766f410d9 100644 --- a/engines/mohawk/dialogs.cpp +++ b/engines/mohawk/dialogs.cpp @@ -122,16 +122,16 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name assert(vm); // I18N: Drop book page - _dropPageButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.DropPage", _("~D~rop Page"), nullptr, kDropCmd); + _dropPageButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.DropPage", _("~D~rop Page"), Common::U32String(""), kDropCmd); // Myst ME only has maps if (vm->isGameVariant(GF_ME)) { - _showMapButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.ShowMap", _("Show ~M~ap"), nullptr, kMapCmd); + _showMapButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.ShowMap", _("Show ~M~ap"), Common::U32String(""), kMapCmd); } // Myst demo only has a menu if (vm->isGameVariant(GF_DEMO)) { - _returnToMenuButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.MainMenu", _("Main Men~u~"), nullptr, kMenuCmd); + _returnToMenuButton = new GUI::ButtonWidget(widgetsBoss(), "MystOptionsDialog.MainMenu", _("Main Men~u~"), Common::U32String(""), kMenuCmd); } if (vm->isGameVariant(GF_25TH)) { @@ -142,7 +142,7 @@ MystOptionsWidget::MystOptionsWidget(GuiObject *boss, const Common::String &name const MystLanguage *languages = MohawkEngine_Myst::listLanguages(); while (languages->language != Common::UNK_LANG) { - _languagePopUp->appendEntry(Common::getLanguageDescription(languages->language), languages->language); + _languagePopUp->appendEntry(Common::convertToU32String(Common::getLanguageDescription(languages->language)), languages->language); languages++; } } @@ -344,7 +344,7 @@ RivenOptionsWidget::RivenOptionsWidget(GuiObject *boss, const Common::String &na const RivenLanguage *languages = MohawkEngine_Riven::listLanguages(); while (languages->language != Common::UNK_LANG) { - _languagePopUp->appendEntry(Common::getLanguageDescription(languages->language), languages->language); + _languagePopUp->appendEntry(Common::convertToU32String(Common::getLanguageDescription(languages->language)), languages->language); languages++; } } diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 1b426518d1e..28db0c4f824 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -560,7 +560,7 @@ Common::KeymapArray MohawkEngine_Myst::initKeymaps(const char *target) { bool is25th = checkGameGUIOption(GAMEOPTION_25TH, guiOptions); bool isDemo = checkGameGUIOption(GAMEOPTION_DEMO, guiOptions); - Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "myst", "Myst"); + Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "myst", Common::convertToU32String("Myst")); Action *act; diff --git a/engines/mohawk/myst_stacks/menu.cpp b/engines/mohawk/myst_stacks/menu.cpp index 3e97104481f..f31eacd8dcb 100644 --- a/engines/mohawk/myst_stacks/menu.cpp +++ b/engines/mohawk/myst_stacks/menu.cpp @@ -366,7 +366,7 @@ void Menu::introMovies_run() { } } -bool Menu::showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton) { +bool Menu::showConfirmationDialog(const Common::U32String &message, const Common::U32String &confirmButton, const Common::U32String &cancelButton) { if (!_inGame) { return true; } diff --git a/engines/mohawk/myst_stacks/menu.h b/engines/mohawk/myst_stacks/menu.h index 75140b41f48..3cdeae84b03 100644 --- a/engines/mohawk/myst_stacks/menu.h +++ b/engines/mohawk/myst_stacks/menu.h @@ -80,7 +80,7 @@ private: int _introStep; void introMovies_run(); - bool showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton); + bool showConfirmationDialog(const Common::U32String &message, const Common::U32String &confirmButton, const Common::U32String &cancelButton); void drawButtonImages(const Common::U32String &text, MystAreaImageSwitch *area, Graphics::TextAlign align, uint16 highlightedIndex, uint16 disabledIndex) const; void replaceButtonSubImageWithText(const Common::U32String &text, const Graphics::TextAlign &align, MystAreaImageSwitch *area, diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 47dc9a129d5..e92ac48526a 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -498,7 +498,7 @@ bool MohawkEngine_Riven::checkDatafiles() { return true; } - Common::String message = _("You are missing the following required Riven data files:\n") + missingFiles; + Common::String message = _("You are missing the following required Riven data files:\n").encode() + missingFiles; warning("%s", message.c_str()); GUIErrorMessage(message); @@ -829,7 +829,7 @@ Common::KeymapArray MohawkEngine_Riven::initKeymaps(const char *target) { bool is25th = checkGameGUIOption(GAMEOPTION_25TH, guiOptions); bool isDemo = checkGameGUIOption(GAMEOPTION_DEMO, guiOptions); - Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "riven", "Riven"); + Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "riven", Common::convertToU32String("Riven")); Action *act; diff --git a/engines/mohawk/riven_stacks/aspit.cpp b/engines/mohawk/riven_stacks/aspit.cpp index ed353aa9177..5bed1abd3ad 100644 --- a/engines/mohawk/riven_stacks/aspit.cpp +++ b/engines/mohawk/riven_stacks/aspit.cpp @@ -387,14 +387,14 @@ void ASpit::xaNewGame(const ArgumentArray &args) { _vm->_scriptMan->runScript(script, false); } -bool ASpit::showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton) { +bool ASpit::showConfirmationDialog(const Common::U32String &message, const Common::U32String &confirmButton, const Common::U32String &cancelButton) { if (!_vm->isGameStarted()) { return true; } GUI::MessageDialog dialog(message, confirmButton, cancelButton); - return dialog.runModal() !=0; + return dialog.runModal() != 0; } void ASpit::xadisablemenureturn(const ArgumentArray &args) { diff --git a/engines/mohawk/riven_stacks/aspit.h b/engines/mohawk/riven_stacks/aspit.h index aa3c20f4371..509d8b9ce03 100644 --- a/engines/mohawk/riven_stacks/aspit.h +++ b/engines/mohawk/riven_stacks/aspit.h @@ -89,7 +89,7 @@ private: void cathBookDrawPage(uint32 page); - bool showConfirmationDialog(const char *message, const char *confirmButton, const char *cancelButton); + bool showConfirmationDialog(const Common::U32String &message, const Common::U32String &confirmButton, const Common::U32String &cancelButton); }; } // End of namespace RivenStacks diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index 1853f33fe40..dd29a10c039 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -302,7 +302,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { // Open the mort.dat file if (!f.open(MORT_DAT)) { - GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), MORT_DAT); + GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file.").encode().c_str(), MORT_DAT); return Common::kReadingFailed; } @@ -310,7 +310,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { char fileId[4]; f.read(fileId, 4); if (strncmp(fileId, "MORT", 4) != 0) { - GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), MORT_DAT); + GUIErrorMessageFormat(_("The '%s' engine data file is corrupt.").encode().c_str(), MORT_DAT); return Common::kReadingFailed; } @@ -320,7 +320,7 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (majVer < MORT_DAT_REQUIRED_VERSION) { GUIErrorMessageFormat( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), MORT_DAT, MORT_DAT_REQUIRED_VERSION, 0, majVer, minVer); return Common::kReadingFailed; } diff --git a/engines/mutationofjb/util.cpp b/engines/mutationofjb/util.cpp index 1483fb26e48..fe4440b7eed 100644 --- a/engines/mutationofjb/util.cpp +++ b/engines/mutationofjb/util.cpp @@ -30,7 +30,7 @@ namespace MutationOfJB { void reportFileMissingError(const char *fileName) { - Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file"), fileName); + Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file").encode().c_str(), fileName); GUIErrorMessage(errorMessage); warning("%s", errorMessage.c_str()); } diff --git a/engines/parallaction/saveload.cpp b/engines/parallaction/saveload.cpp index 56cb3632c3f..b3193854092 100644 --- a/engines/parallaction/saveload.cpp +++ b/engines/parallaction/saveload.cpp @@ -127,7 +127,7 @@ void SaveLoad_ns::doLoadGame(uint16 slot) { void SaveLoad_ns::doSaveGame(uint16 slot, const char* name) { Common::OutSaveFile *f = getOutSaveFile(slot); if (f == 0) { - Common::String buf = Common::String::format(_("Can't save game in slot %i\n\n"), slot); + Common::String buf = Common::String::format(_("Can't save game in slot %i\n\n").encode().c_str(), slot); GUI::MessageDialog dialog(buf); dialog.runModal(); return; diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index 4a944b7ad85..e6568aae16b 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -384,7 +384,7 @@ Common::Error PegasusEngine::showSaveDialog() { void PegasusEngine::showSaveFailedDialog(const Common::Error &status) { Common::String failMessage = Common::String::format(_("Failed to save game (%s)! " "Please consult the README for basic information, and for " - "instructions on how to obtain further assistance."), status.getDesc().c_str()); + "instructions on how to obtain further assistance.").encode().c_str(), status.getDesc().c_str()); GUI::MessageDialog dialog(failMessage); dialog.runModal(); } @@ -2476,7 +2476,7 @@ uint PegasusEngine::getNeighborhoodCD(const NeighborhoodID neighborhood) const { Common::KeymapArray PegasusEngine::initKeymaps() { using namespace Common; - Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "pegasus", "Pegasus Prime"); + Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "pegasus", Common::convertToU32String("Pegasus Prime")); Action *act; diff --git a/engines/savestate.cpp b/engines/savestate.cpp index e440a58f233..75b5b624f25 100644 --- a/engines/savestate.cpp +++ b/engines/savestate.cpp @@ -38,6 +38,10 @@ SaveStateDescriptor::SaveStateDescriptor(int s, const Common::U32String &d) _thumbnail(), _saveType(kSaveTypeUndetermined) { } +SaveStateDescriptor::SaveStateDescriptor(int s, const Common::String &d) { + SaveStateDescriptor(s, Common::U32String(d)); +} + void SaveStateDescriptor::setThumbnail(Graphics::Surface *t) { if (_thumbnail.get() == t) return; diff --git a/engines/savestate.h b/engines/savestate.h index 2baf47e2c48..ae8e0649a27 100644 --- a/engines/savestate.h +++ b/engines/savestate.h @@ -53,6 +53,7 @@ private: public: SaveStateDescriptor(); SaveStateDescriptor(int s, const Common::U32String &d); + SaveStateDescriptor(int s, const Common::String &d); /** * @param slot The saveslot id, as it would be passed to the "-x" command line switch. diff --git a/engines/sci/detection.cpp b/engines/sci/detection.cpp index b47191b7c05..7166933e124 100644 --- a/engines/sci/detection.cpp +++ b/engines/sci/detection.cpp @@ -1017,7 +1017,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl // invalid delete in; - descriptor.setDescription("*Invalid*"); + descriptor.setDescription(Common::convertToU32String("*Invalid*")); return descriptor; } @@ -1028,7 +1028,7 @@ SaveStateDescriptor SciMetaEngine::querySaveMetaInfos(const char *target, int sl // invalid delete in; - descriptor.setDescription("*Invalid*"); + descriptor.setDescription(Common::convertToU32String("*Invalid*")); return descriptor; } descriptor.setThumbnail(thumbnail); diff --git a/engines/sci/engine/guest_additions.cpp b/engines/sci/engine/guest_additions.cpp index 266113a5a5e..b6f7da665c4 100644 --- a/engines/sci/engine/guest_additions.cpp +++ b/engines/sci/engine/guest_additions.cpp @@ -672,7 +672,7 @@ reg_t GuestAdditions::promptSaveRestoreRama(EngineState *s, int argc, reg_t *arg int GuestAdditions::runSaveRestore(const bool isSave, reg_t outDescription, const int forcedSaveId) const { assert(!(isSave && outDescription.isNull())); - Common::String descriptionString; + Common::U32String descriptionString; int saveId = runSaveRestore(isSave, descriptionString, forcedSaveId); if (!outDescription.isNull()) { @@ -686,14 +686,14 @@ int GuestAdditions::runSaveRestore(const bool isSave, reg_t outDescription, cons return saveId; } -int GuestAdditions::runSaveRestore(const bool isSave, Common::String &outDescription, const int forcedSaveId) const { +int GuestAdditions::runSaveRestore(const bool isSave, Common::U32String &outDescription, const int forcedSaveId) const { int saveId; if (!isSave && forcedSaveId != -1) { saveId = forcedSaveId; } else { - const char *title; - const char *action; + Common::U32String title; + Common::U32String action; if (isSave) { title = _("Save game:"); action = _("Save"); diff --git a/engines/sci/engine/guest_additions.h b/engines/sci/engine/guest_additions.h index 7cae8fb2017..1f066dfcc96 100644 --- a/engines/sci/engine/guest_additions.h +++ b/engines/sci/engine/guest_additions.h @@ -271,7 +271,7 @@ public: * id to this value. */ int runSaveRestore(const bool isSave, const reg_t outDescription, const int forcedSaveId = -1) const; - int runSaveRestore(const bool isSave, Common::String &outDescription, const int forcedSaveId = -1) const; + int runSaveRestore(const bool isSave, Common::U32String &outDescription, const int forcedSaveId = -1) const; #endif #pragma mark - diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 91be30fc766..f00c963db95 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -70,7 +70,7 @@ static int16 adjustGraphColor(int16 color) { return color; } -int showScummVMDialog(const Common::String &message, const char *altButton = nullptr, bool alignCenter = true) { +int showScummVMDialog(const Common::U32String &message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true) { Graphics::TextAlign alignment = alignCenter ? Graphics::kTextAlignCenter : Graphics::kTextAlignLeft; GUI::MessageDialog dialog(message, _("OK"), altButton, alignment); return dialog.runModal(); diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index 9768911613f..e22be3ee2f8 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -62,7 +62,7 @@ namespace Sci { #ifdef ENABLE_SCI32 -extern int showScummVMDialog(const Common::String& message, const char* altButton = nullptr, bool alignCenter = true); +extern int showScummVMDialog(const Common::U32String& message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv) { reg_t object = argv[0]; @@ -355,7 +355,7 @@ reg_t kWinHelp(EngineState *s, int argc, reg_t *argv) { case 1: // Load a help file // Maybe in the future we can implement this, but for now this message should suffice - showScummVMDialog(Common::String::format(_("Please use an external viewer to open the game's help file: %s"), s->_segMan->getString(argv[1]).c_str())); + showScummVMDialog(Common::String::format(_("Please use an external viewer to open the game's help file: %s").encode().c_str(), s->_segMan->getString(argv[1]).c_str())); break; case 2: // Looks like some init function diff --git a/engines/sci/engine/kmisc.cpp b/engines/sci/engine/kmisc.cpp index aae0d15eb99..8ea18be757b 100644 --- a/engines/sci/engine/kmisc.cpp +++ b/engines/sci/engine/kmisc.cpp @@ -795,7 +795,7 @@ reg_t kPlatform(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } -extern int showScummVMDialog(const Common::String& message, const char* altButton = nullptr, bool alignCenter = true); +extern int showScummVMDialog(const Common::U32String& message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); #ifdef ENABLE_SCI32 reg_t kPlatform32(EngineState *s, int argc, reg_t *argv) { @@ -870,7 +870,7 @@ reg_t kWinDLL(EngineState *s, int argc, reg_t *argv) { switch (operation) { case 0: // load DLL if (dllName == "PENGIN16.DLL") - showScummVMDialog("The Poker logic is hardcoded in an external DLL, and is not implemented yet. There exists some dummy logic for now, where opponent actions are chosen randomly"); + showScummVMDialog(Common::convertToU32String("The Poker logic is hardcoded in an external DLL, and is not implemented yet. There exists some dummy logic for now, where opponent actions are chosen randomly")); // This is originally a call to LoadLibrary() and to the Watcom function GetIndirectFunctionHandle return make_reg(0, 1000); // fake ID for loaded DLL, normally returned from Windows LoadLibrary() diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index 9ebebb3848f..3f048ff0b05 100644 --- a/engines/sci/engine/savegame.cpp +++ b/engines/sci/engine/savegame.cpp @@ -1239,7 +1239,7 @@ bool gamestate_save(EngineState *s, Common::WriteStream *fh, const Common::Strin return true; } -extern int showScummVMDialog(const Common::String& message, const char* altButton = nullptr, bool alignCenter = true); +extern int showScummVMDialog(const Common::U32String& message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); void gamestate_afterRestoreFixUp(EngineState *s, int savegameId) { switch (g_sci->getGameId()) { @@ -1406,7 +1406,7 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) { if (meta.version < MINIMUM_SAVEGAME_VERSION) { showScummVMDialog(_("The format of this saved game is obsolete, unable to load it")); } else { - Common::String msg = Common::String::format(_("Savegame version is %d, maximum supported is %0d"), meta.version, CURRENT_SAVEGAME_VERSION); + Common::U32String msg = Common::String::format(_("Savegame version is %d, maximum supported is %0d").encode().c_str(), meta.version, CURRENT_SAVEGAME_VERSION); showScummVMDialog(msg); } diff --git a/engines/sci/engine/state.h b/engines/sci/engine/state.h index 46161a31879..31b4fb8db9f 100644 --- a/engines/sci/engine/state.h +++ b/engines/sci/engine/state.h @@ -138,7 +138,7 @@ public: // see kmisc.cpp / kMacPlatform32 int _kq7MacSaveGameId; // the saved game id to use when saving (might not exist yet) - Common::String _kq7MacSaveGameDescription; // description to use when saving game + Common::U32String _kq7MacSaveGameDescription; // description to use when saving game uint _chosenQfGImportItem; // Remembers the item selected in QfG import rooms diff --git a/engines/sci/graphics/controls32.cpp b/engines/sci/graphics/controls32.cpp index cb71a4e62f6..7b903529b3b 100644 --- a/engines/sci/graphics/controls32.cpp +++ b/engines/sci/graphics/controls32.cpp @@ -907,7 +907,7 @@ void GfxControls32::destroyScrollWindow(const reg_t id) { #pragma mark - #pragma mark Message box -int16 GfxControls32::showMessageBox(const Common::String &message, const char *const okLabel, const char *const altLabel, const int16 okValue, const int16 altValue) { +int16 GfxControls32::showMessageBox(const Common::U32String &message, const Common::U32String &okLabel, const Common::U32String &altLabel, const int16 okValue, const int16 altValue) { GUI::MessageDialog dialog(message, okLabel, altLabel); return (dialog.runModal() == GUI::kMessageOK) ? okValue : altValue; } @@ -922,7 +922,7 @@ reg_t GfxControls32::kernelMessageBox(const Common::String &message, const Commo switch (style & 0xF) { case kMessageBoxOK: - result = showMessageBox(message, _("OK"), NULL, 1, 1); + result = showMessageBox(message, _("OK"), Common::U32String(""), 1, 1); break; case kMessageBoxYesNo: result = showMessageBox(message, _("Yes"), _("No"), 6, 7); diff --git a/engines/sci/graphics/controls32.h b/engines/sci/graphics/controls32.h index 3f743191fc2..43feed3419e 100644 --- a/engines/sci/graphics/controls32.h +++ b/engines/sci/graphics/controls32.h @@ -481,7 +481,7 @@ private: /** * Convenience function for creating and showing a message box. */ - int16 showMessageBox(const Common::String &message, const char *const okLabel, const char *const altLabel, const int16 okValue, const int16 altValue); + int16 showMessageBox(const Common::U32String &message, const Common::U32String &okLabel, const Common::U32String &altLabel, const int16 okValue, const int16 altValue); }; } // End of namespace Sci diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index 8c1741686e8..cc3a3815d7b 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -65,8 +65,8 @@ bool VideoPlayer::open(const Common::String &fileName) { // KQ7 2.00b videos are compressed in 24bpp Cinepak, so cannot play on a // system with no RGB support if (_decoder->getPixelFormat().bytesPerPixel != 1) { - void showScummVMDialog(const Common::String &message, const char* altButton = nullptr, bool alignCenter = true); - showScummVMDialog(Common::String::format(_("Cannot play back %dbpp video on a system with maximum color depth of 8bpp"), _decoder->getPixelFormat().bpp())); + void showScummVMDialog(const Common::U32String &message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); + showScummVMDialog(Common::String::format(_("Cannot play back %dbpp video on a system with maximum color depth of 8bpp").encode().c_str(), _decoder->getPixelFormat().bpp())); _decoder->close(); return false; } diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp index 0881521f391..79bc64ce9a4 100644 --- a/engines/sci/resource.cpp +++ b/engines/sci/resource.cpp @@ -813,7 +813,7 @@ void ResourceManager::addScriptChunkSources() { #endif } -extern int showScummVMDialog(const Common::String& message, const char* altButton = nullptr, bool alignCenter = true); +extern int showScummVMDialog(const Common::U32String& message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); void ResourceManager::scanNewSources() { _hasBadResources = false; diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 8bed5e1ee5f..ae4e6b4140a 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -256,7 +256,7 @@ SciEngine::~SciEngine() { g_sci = 0; } -extern int showScummVMDialog(const Common::String& message, const char* altButton = nullptr, bool alignCenter = true); +extern int showScummVMDialog(const Common::U32String& message, Common::U32String altButton = Common::U32String(""), bool alignCenter = true); Common::Error SciEngine::run() { _resMan = new ResourceManager(); @@ -511,15 +511,15 @@ bool SciEngine::gameHasFanMadePatch() { } void SciEngine::suggestDownloadGK2SubTitlesPatch() { - const char* altButton; - Common::String downloadMessage; + Common::U32String altButton; + Common::U32String downloadMessage; if (g_system->hasFeature(OSystem::kFeatureOpenUrl)) { altButton = _("Download patch"); downloadMessage = _("(or click 'Download patch' button. But note - it only downloads, you will have to continue from there)\n"); } else { - altButton = nullptr; + altButton = ""; downloadMessage = ""; } diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index a624e4040bd..c2637b57ea7 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -157,10 +157,10 @@ void SciMusic::init() { } else { const char *missingFiles = _pMidiDrv->reportMissingFiles(); if (missingFiles) { - Common::String message = _( + Common::U32String message = _( "The selected audio driver requires the following file(s):\n\n" ); - message += missingFiles; + message += Common::convertToU32String(missingFiles); message += _("\n\n" "Some audio drivers (at least for some games) were made\n" "available by Sierra as aftermarket patches and thus might not\n" @@ -170,7 +170,7 @@ void SciMusic::init() { "separately but only as content of (patched) resource bundles.\n" "In that case you may need to apply the original Sierra patch.\n\n" ); - ::GUI::displayErrorDialog(message.c_str()); + ::GUI::displayErrorDialog(message); } error("Failed to initialize sound driver"); } diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index c5d85f04bf7..25ac9211d2e 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -26,6 +26,7 @@ #include "common/events.h" #include "common/localization.h" #include "common/translation.h" +#include "common/ustr.h" #include "graphics/scaler.h" @@ -269,7 +270,7 @@ enum { HelpDialog::HelpDialog(const GameSettings &game) : ScummDialog("ScummHelp"), _game(game) { - _title = new GUI::StaticTextWidget(this, "ScummHelp.Title", ""); + _title = new GUI::StaticTextWidget(this, "ScummHelp.Title", Common::U32String("")); _page = 1; _backgroundType = GUI::ThemeEngine::kDialogBackgroundDefault; @@ -277,10 +278,10 @@ HelpDialog::HelpDialog(const GameSettings &game) _numPages = ScummHelp::numPages(_game.id); // I18N: Previous page button - _prevButton = new GUI::ButtonWidget(this, "ScummHelp.Prev", _("~P~revious"), 0, kPrevCmd); + _prevButton = new GUI::ButtonWidget(this, "ScummHelp.Prev", _("~P~revious"), Common::U32String(""), kPrevCmd); // I18N: Next page button - _nextButton = new GUI::ButtonWidget(this, "ScummHelp.Next", _("~N~ext"), 0, kNextCmd); - new GUI::ButtonWidget(this, "ScummHelp.Close", _("~C~lose"), 0, GUI::kCloseCmd); + _nextButton = new GUI::ButtonWidget(this, "ScummHelp.Next", _("~N~ext"), Common::U32String(""), kNextCmd); + new GUI::ButtonWidget(this, "ScummHelp.Close", _("~C~lose"), Common::U32String(""), GUI::kCloseCmd); _prevButton->clearFlags(WIDGET_ENABLED); GUI::ContainerWidget *placeHolder = new GUI::ContainerWidget(this, "ScummHelp.HelpText"); @@ -290,8 +291,8 @@ HelpDialog::HelpDialog(const GameSettings &game) // Dummy entries for (int i = 0; i < HELP_NUM_LINES; i++) { - _key[i] = new GUI::StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignRight); - _dsc[i] = new GUI::StaticTextWidget(this, 0, 0, 10, 10, "", Graphics::kTextAlignLeft); + _key[i] = new GUI::StaticTextWidget(this, 0, 0, 10, 10, Common::U32String(""), Graphics::kTextAlignRight); + _dsc[i] = new GUI::StaticTextWidget(this, 0, 0, 10, 10, Common::U32String(""), Graphics::kTextAlignLeft); } } @@ -388,7 +389,7 @@ InfoDialog::InfoDialog(ScummEngine *scumm, int res) _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter); } -InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) +InfoDialog::InfoDialog(ScummEngine *scumm, const U32String& message) : ScummDialog(0, 0, 0, 0), _vm(scumm) { // dummy x and w _message = message; @@ -397,7 +398,7 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) _text = new GUI::StaticTextWidget(this, 0, 0, 10, 10, _message, kTextAlignCenter); } -void InfoDialog::setInfoText(const String& message) { +void InfoDialog::setInfoText(const U32String& message) { _message = message; _text->setLabel(_message); //reflowLayout(); // FIXME: Should we call this here? Depends on the usage patterns, I guess... @@ -476,8 +477,8 @@ void PauseDialog::handleKeyDown(Common::KeyState state) { ConfirmDialog::ConfirmDialog(ScummEngine *scumm, int res) : InfoDialog(scumm, res), _yesKey('y'), _noKey('n') { - if (_message.lastChar() != ')') { - _yesKey = _message.lastChar(); + if (_message.encode().lastChar() != ')') { + _yesKey = _message.encode().lastChar(); _message.deleteLastChar(); if (_yesKey >= 'A' && _yesKey <= 'Z') @@ -566,7 +567,7 @@ void ValueDisplayDialog::open() { } SubtitleSettingsDialog::SubtitleSettingsDialog(ScummEngine *scumm, int value) - : InfoDialog(scumm, ""), _value(value), _timer(0) { + : InfoDialog(scumm, U32String("")), _value(value), _timer(0) { } @@ -605,7 +606,7 @@ void SubtitleSettingsDialog::cycleValue() { _value = 0; if (_value == 1 && g_system->getOverlayWidth() <= 320) - setInfoText(_sc("Speech & Subs", "lowres")); + setInfoText(Common::convertToU32String(_sc("Speech & Subs", "lowres"))); else setInfoText(_(subtitleDesc[_value])); @@ -613,7 +614,7 @@ void SubtitleSettingsDialog::cycleValue() { } Indy3IQPointsDialog::Indy3IQPointsDialog(ScummEngine *scumm, char* text) - : InfoDialog(scumm, text) { + : InfoDialog(scumm, U32String(text)) { } void Indy3IQPointsDialog::handleKeyDown(Common::KeyState state) { @@ -624,7 +625,7 @@ void Indy3IQPointsDialog::handleKeyDown(Common::KeyState state) { } DebugInputDialog::DebugInputDialog(ScummEngine *scumm, char* text) - : InfoDialog(scumm, text) { + : InfoDialog(scumm, U32String(text)) { mainText = text; done = 0; } @@ -656,9 +657,9 @@ LoomTownsDifficultyDialog::LoomTownsDifficultyDialog() GUI::StaticTextWidget *text2 = new GUI::StaticTextWidget(this, "LoomTownsDifficultyDialog.Description2", _("Refer to your Loom(TM) manual for help.")); text2->setAlign(Graphics::kTextAlignCenter); - new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Standard", _("Standard"), 0, kStandardCmd); - new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Practice", _("Practice"), 0, kPracticeCmd); - new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Expert", _("Expert"), 0, kExpertCmd); + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Standard", _("Standard"), Common::U32String(""), kStandardCmd); + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Practice", _("Practice"), Common::U32String(""), kPracticeCmd); + new GUI::ButtonWidget(this, "LoomTownsDifficultyDialog.Expert", _("Expert"), Common::U32String(""), kExpertCmd); } void LoomTownsDifficultyDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h index 59cc471deca..afcf301b288 100644 --- a/engines/scumm/dialogs.h +++ b/engines/scumm/dialogs.h @@ -45,6 +45,7 @@ public: protected: typedef Common::String String; + typedef Common::U32String U32String; }; #ifndef DISABLE_HELP @@ -68,16 +69,16 @@ protected: class InfoDialog : public ScummDialog { protected: ScummEngine *_vm; - String _message; + U32String _message; GUI::StaticTextWidget *_text; public: // arbitrary message - InfoDialog(ScummEngine *scumm, const String& message); + InfoDialog(ScummEngine *scumm, const U32String& message); // from resources InfoDialog(ScummEngine *scumm, int res); - void setInfoText(const String& message); + void setInfoText(const U32String& message); void handleMouseDown(int x, int y, int button, int clickCount) override { setResult(0); diff --git a/engines/scumm/help.cpp b/engines/scumm/help.cpp index 15f1977c8f8..16d796a9575 100644 --- a/engines/scumm/help.cpp +++ b/engines/scumm/help.cpp @@ -82,9 +82,9 @@ void ScummHelp::updateStrings(byte gameId, byte version, Common::Platform platfo #ifdef MACOSX ADD_BIND("Cmd q", _("Quit")); #else - ADD_BIND(String(_("Alt")) + " x, " + _("Ctrl") + " z", _("Quit")); + ADD_BIND(String(_("Alt")) + " x, " + _("Ctrl").encode() + " z", _("Quit").encode()); #endif - ADD_BIND(String(_("Alt")) + " " + _("Enter"), _("Toggle fullscreen")); + ADD_BIND(String(_("Alt")) + " " + _("Enter").encode(), _("Toggle fullscreen")); ADD_BIND("[, ]", _("Music volume up / down")); ADD_BIND("-, +", _("Text speed slower / faster")); ADD_BIND(_("Enter"), _("Simulate left mouse button")); @@ -98,9 +98,9 @@ void ScummHelp::updateStrings(byte gameId, byte version, Common::Platform platfo ADD_BIND(String(_("Ctrl")) + " f", _("Run in fast mode (*)")); ADD_BIND(String(_("Ctrl")) + " g", _("Run in really fast mode (*)")); ADD_BIND(String(_("Ctrl")) + " m", _("Toggle mouse capture")); - ADD_BIND(String(_("Ctrl")) + " " + _("Alt") + " 1-8", _("Switch between graphics filters")); - ADD_BIND(String(_("Ctrl")) + " " + _("Alt") + " +, -", _("Increase / Decrease scale factor")); - ADD_BIND(String(_("Ctrl")) + " " + _("Alt") + " a", _("Toggle aspect-ratio correction")); + ADD_BIND(String(_("Ctrl")) + " " + _("Alt").encode() + " 1-8", _("Switch between graphics filters")); + ADD_BIND(String(_("Ctrl")) + " " + _("Alt").encode() + " +, -", _("Increase / Decrease scale factor")); + ADD_BIND(String(_("Ctrl")) + " " + _("Alt").encode() + " a", _("Toggle aspect-ratio correction")); ADD_LINE; ADD_LINE; // FIXME: This should use word-wrapping, and should not assume diff --git a/engines/scumm/imuse/drivers/amiga.cpp b/engines/scumm/imuse/drivers/amiga.cpp index 9407f78a92c..9e819939c60 100644 --- a/engines/scumm/imuse/drivers/amiga.cpp +++ b/engines/scumm/imuse/drivers/amiga.cpp @@ -651,13 +651,13 @@ int IMuseDriver_Amiga::open() { // when playing from the floppy disks. Obviously we don't need the redundancy files. The error dialog will display // only the required files. These are different for MI2 and INDY4. if (_missingFiles) { - Common::String message = _("This AMIGA version is missing (at least) the following file(s):\n\n"); + Common::U32String message = _("This AMIGA version is missing (at least) the following file(s):\n\n"); for (int i = 0; i < 11; ++i) { if (_missingFiles & (1 << i)) message += Common::String::format("AMIGA%d.IMS\n", i + 1); } message += _("\nPlease copy these file(s) into the game data directory.\n\n"); - ::GUI::displayErrorDialog(message.c_str()); + ::GUI::displayErrorDialog(message); return MERR_DEVICE_NOT_AVAILABLE; } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 6dccf993340..a894be6d4de 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -232,7 +232,7 @@ void ScummEngine::askForDisk(const char *filename, int disknum) { #endif } else { sprintf(buf, "Cannot find file: '%s'", filename); - InfoDialog dialog(this, (char *)buf); + InfoDialog dialog(this, Common::convertToU32String(buf)); runDialog(dialog); error("Cannot find file: '%s'", filename); } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 7a2565f6cba..d3851269ca6 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1896,8 +1896,8 @@ void ScummEngine::setupMusic(int midi) { GUI::MessageDialog dialog( Common::String::format( _("Native MIDI support requires the Roland Upgrade from LucasArts,\n" - "but %s is missing. Using AdLib instead."), fileName.c_str()), - _("OK")); + "but %s is missing. Using AdLib instead.").encode().c_str(), fileName.c_str()), + _("OK").encode()); dialog.runModal(); _sound->_musicType = MDT_ADLIB; } @@ -2444,7 +2444,7 @@ void ScummEngine::scummLoop_updateScummVars() { void ScummEngine::scummLoop_handleSaveLoad() { if (_saveLoadFlag) { bool success; - const char *errMsg = 0; + Common::U32String errMsg(""); if (_game.version == 8 && _saveTemporaryState) VAR(VAR_GAME_LOADED) = 0; @@ -2470,13 +2470,13 @@ void ScummEngine::scummLoop_handleSaveLoad() { } if (!success) { - displayMessage(0, errMsg, filename.c_str()); + displayMessage(0, errMsg.encode().c_str(), filename.c_str()); } else if (_saveLoadFlag == 1 && _saveLoadSlot != 0 && !_saveTemporaryState) { // Display "Save successful" message, except for auto saves char buf[256]; - snprintf(buf, sizeof(buf), _("Successfully saved game in file:\n\n%s"), filename.c_str()); + snprintf(buf, sizeof(buf), _("Successfully saved game in file:\n\n%s").encode().c_str(), filename.c_str()); - GUI::TimedMessageDialog dialog(buf, 1500); + GUI::TimedMessageDialog dialog(Common::convertToU32String(buf), 1500); runDialog(dialog); } if (success && _saveLoadFlag != 1) @@ -2759,7 +2759,7 @@ bool ScummEngine::startManiac() { eventMan->pushEvent(event); return true; } else { - displayMessage(0, "%s", _("Usually, Maniac Mansion would start now. But for that to work, the game files for Maniac Mansion have to be in the 'Maniac' directory inside the Tentacle game directory, and the game has to be added to ScummVM.")); + displayMessage(0, "%s", _("Usually, Maniac Mansion would start now. But for that to work, the game files for Maniac Mansion have to be in the 'Maniac' directory inside the Tentacle game directory, and the game has to be added to ScummVM.").encode().c_str()); return false; } } @@ -2802,7 +2802,7 @@ void ScummEngine_v7::pauseEngineIntern(bool pause) { } #endif -void ScummEngine::messageDialog(const char *message) { +void ScummEngine::messageDialog(const Common::U32String &message) { if (!_messageDialog) _messageDialog = new InfoDialog(this, message); ((InfoDialog *)_messageDialog)->setInfoText(message); diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index 52c88af1f21..550ae0f6b1a 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -500,7 +500,7 @@ protected: void confirmExitDialog(); void confirmRestartDialog(); void pauseDialog(); - void messageDialog(const char *message); + void messageDialog(const Common::U32String &message); void versionDialog(); public: diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 0735546446d..3ef6b9b766e 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -115,7 +115,7 @@ void ScummEngine::showMessageDialog(const byte *msg) { if (_string[3].color == 0) _string[3].color = 4; - InfoDialog dialog(this, (char *)buf); + InfoDialog dialog(this, Common::convertToU32String((char *)buf)); VAR(VAR_KEYPRESS) = runDialog(dialog); } diff --git a/engines/sky/compact.cpp b/engines/sky/compact.cpp index 160004eeb40..dd9b83e349c 100644 --- a/engines/sky/compact.cpp +++ b/engines/sky/compact.cpp @@ -128,7 +128,7 @@ SkyCompact::SkyCompact() { _cptFile = new Common::File(); Common::String filename = "sky.cpt"; if (!_cptFile->open(filename.c_str())) { - Common::String msg = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + Common::String msg = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); error("%s", msg.c_str()); } @@ -138,7 +138,7 @@ SkyCompact::SkyCompact() { error("unknown \"sky.cpt\" version"); if (SKY_CPT_SIZE != _cptFile->size()) { - GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."), _("OK"), NULL); + GUI::MessageDialog dialog(_("The \"sky.cpt\" engine data file has an incorrect size."), _("OK")); dialog.runModal(); error("Incorrect sky.cpt size (%d, expected: %d)", _cptFile->size(), SKY_CPT_SIZE); } diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp index 59c65a40968..0984ad0b74a 100644 --- a/engines/sky/detection.cpp +++ b/engines/sky/detection.cpp @@ -209,7 +209,7 @@ Common::KeymapArray SkyMetaEngine::initKeymaps(const char *target) const { using namespace Common; using namespace Sky; - Keymap *mainKeymap = new Keymap(Keymap::kKeymapTypeGame, "sky-main", "Beneath a Steel Sky"); + Keymap *mainKeymap = new Keymap(Keymap::kKeymapTypeGame, "sky-main", Common::convertToU32String("Beneath a Steel Sky")); Action *act; @@ -237,7 +237,7 @@ Common::KeymapArray SkyMetaEngine::initKeymaps(const char *target) const { act->addDefaultInputMapping("JOY_Y"); mainKeymap->addAction(act); - Keymap *shortcutsKeymap = new Keymap(Keymap::kKeymapTypeGame, SkyEngine::shortcutsKeymapId, "Beneath a Steel Sky - Shortcuts"); + Keymap *shortcutsKeymap = new Keymap(Keymap::kKeymapTypeGame, SkyEngine::shortcutsKeymapId, Common::convertToU32String("Beneath a Steel Sky - Shortcuts")); act = new Action(kStandardActionOpenMainMenu, _("Open control panel")); act->setCustomEngineActionEvent(kSkyActionOpenControlPanel); @@ -313,7 +313,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const { Common::InSaveFile *in = saveFileMan->openForLoading(*file); if (in) { saveList.push_back(SaveStateDescriptor(slotNum, - (slotNum == 0) ? _("Autosave") : savenames[slotNum - 1])); + (slotNum == 0) ? _("Autosave").encode() : savenames[slotNum - 1])); delete in; } } diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index f731cc89048..e95bcb94182 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -184,7 +184,7 @@ Common::Error SupernovaEngine::loadGameStrings() { if (stream == nullptr) { Common::Language l = Common::parseLanguage(ConfMan.get("language")); - GUIErrorMessageFormat(_("Unable to locate the text for %s language in engine data file."), Common::getLanguageDescription(l)); + GUIErrorMessageFormat(_("Unable to locate the text for %s language in engine data file.").encode().c_str(), Common::getLanguageDescription(l)); return Common::kReadingFailed; } @@ -455,19 +455,19 @@ Common::SeekableReadStream *SupernovaEngine::getBlockFromDatFile(Common::String char id[5], lang[5]; id[4] = lang[4] = '\0'; if (!f.open(SUPERNOVA_DAT)) { - GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file."), SUPERNOVA_DAT); + GUIErrorMessageFormat(_("Unable to locate the '%s' engine data file.").encode().c_str(), SUPERNOVA_DAT); return nullptr; } f.read(id, 3); if (strncmp(id, "MSN", 3) != 0) { - GUIErrorMessageFormat(_("The '%s' engine data file is corrupt."), SUPERNOVA_DAT); + GUIErrorMessageFormat(_("The '%s' engine data file is corrupt.").encode().c_str(), SUPERNOVA_DAT); return nullptr; } int version = f.readByte(); if (version != SUPERNOVA_DAT_VERSION) { GUIErrorMessageFormat( - _("Incorrect version of the '%s' engine data file found. Expected %d but got %d."), + _("Incorrect version of the '%s' engine data file found. Expected %d but got %d.").encode().c_str(), SUPERNOVA_DAT, SUPERNOVA_DAT_VERSION, version); return nullptr; } @@ -477,7 +477,7 @@ Common::SeekableReadStream *SupernovaEngine::getBlockFromDatFile(Common::String int part = f.readByte(); gameBlockSize = f.readUint32LE(); if (f.eos()){ - GUIErrorMessageFormat(_("Unable to find block for part %d"), _MSPart); + GUIErrorMessageFormat(_("Unable to find block for part %d").encode().c_str(), _MSPart); return nullptr; } if (part == _MSPart) { @@ -520,7 +520,7 @@ Common::Error SupernovaEngine::showTextReader(const char *extension) { filename = Common::String::format("ms2.%s", extension); if (!file.open(filename)) { - GUIErrorMessageFormat(_("Unable to find '%s' in game folder or the engine data file."), filename.c_str()); + GUIErrorMessageFormat(_("Unable to find '%s' in game folder or the engine data file.").encode().c_str(), filename.c_str()); return Common::kReadingFailed; } stream = file.readStream(file.size()); diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index bf2ab654d51..777c7264b8f 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -573,7 +573,7 @@ MoviePlayer *makeMoviePlayer(uint32 id, SwordEngine *vm, Text *textMan, ResMan * } if (!vm->isPsx() || scumm_stricmp(sequenceList[id], "enddemo") != 0) { - Common::String buf = Common::String::format(_("Cutscene '%s' not found"), sequenceList[id]); + Common::U32String buf = Common::String::format(_("Cutscene '%s' not found").encode().c_str(), sequenceList[id]); GUI::MessageDialog dialog(buf, _("OK")); dialog.runModal(); } diff --git a/engines/sword1/control.cpp b/engines/sword1/control.cpp index 43b2f13bb5e..2f94a0ef4da 100644 --- a/engines/sword1/control.cpp +++ b/engines/sword1/control.cpp @@ -1258,8 +1258,8 @@ bool Control::convertSaveGame(uint8 slot, char *desc) { if (testSave) { delete testSave; - Common::String msg = Common::String::format(_("Target new saved game already exists!\n" - "Would you like to keep the old saved game (%s) or the new one (%s)?\n"), + Common::U32String msg = Common::String::format(_("Target new saved game already exists!\n" + "Would you like to keep the old saved game (%s) or the new one (%s)?\n").encode().c_str(), oldFileName, newFileName); GUI::MessageDialog dialog0(msg, _("Keep the old one"), _("Keep the new one")); diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp index a4c6cf675cc..a5d98ad1503 100644 --- a/engines/sword1/logic.cpp +++ b/engines/sword1/logic.cpp @@ -1632,7 +1632,7 @@ int Logic::fnRestartGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 int Logic::fnQuitGame(Object *cpt, int32 id, int32 a, int32 b, int32 c, int32 d, int32 z, int32 x) { if (SwordEngine::_systemVars.isDemo) { - GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"), _("OK"), NULL); + GUI::MessageDialog dialog(_("This is the end of the Broken Sword 1 Demo"), _("OK")); dialog.runModal(); Engine::quitGame(); } else diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 907e406b38a..ee2f22d3289 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -471,7 +471,7 @@ MoviePlayer *makeMoviePlayer(const char *name, Sword2Engine *vm, OSystem *system // The demo tries to play some cutscenes that aren't there, so make those warnings more discreet. // In addition, some of the later re-releases of the game don't have the "eye" Virgin logo movie. if (!vm->_logic->readVar(DEMO) && strcmp(name, "eye") != 0) { - Common::String buf = Common::String::format(_("Cutscene '%s' not found"), name); + Common::U32String buf = Common::String::format(_("Cutscene '%s' not found").encode().c_str(), name); GUI::MessageDialog dialog(buf, _("OK")); dialog.runModal(); } else diff --git a/engines/teenagent/resources.cpp b/engines/teenagent/resources.cpp index 8388ee032e9..4cc602dd35d 100644 --- a/engines/teenagent/resources.cpp +++ b/engines/teenagent/resources.cpp @@ -94,7 +94,7 @@ bool Resources::loadArchives(const ADGameDescription *gd) { Common::String filename = "teenagent.dat"; if (!dat_file->open(filename.c_str())) { delete dat_file; - Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + Common::String errorMessage = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); warning("%s", errorMessage.c_str()); GUIErrorMessage(errorMessage); return false; diff --git a/engines/testbed/config.cpp b/engines/testbed/config.cpp index 4831eb89c10..c8313a6d6e1 100644 --- a/engines/testbed/config.cpp +++ b/engines/testbed/config.cpp @@ -34,8 +34,8 @@ TestbedOptionsDialog::TestbedOptionsDialog(Common::Array &tsList, T GUI::Dialog("TestbedOptions"), _testbedConfMan(tsConfMan) { - new GUI::StaticTextWidget(this, "TestbedOptions.Headline", "Select Testsuites to Execute"); - new GUI::StaticTextWidget(this, "TestbedOptions.Info", "Use Doubleclick to select/deselect"); + new GUI::StaticTextWidget(this, "TestbedOptions.Headline", Common::convertToU32String("Select Testsuites to Execute")); + new GUI::StaticTextWidget(this, "TestbedOptions.Info", Common::convertToU32String("Use Doubleclick to select/deselect")); // Construct a String Array Common::Array::const_iterator iter; @@ -63,12 +63,12 @@ TestbedOptionsDialog::TestbedOptionsDialog(Common::Array &tsList, T _testListDisplay->setEditable(false); if (selected > (tsList.size() - selected)) { - _selectButton = new GUI::ButtonWidget(this, "TestbedOptions.SelectAll", "Deselect All", 0, kTestbedDeselectAll, 0); + _selectButton = new GUI::ButtonWidget(this, "TestbedOptions.SelectAll", Common::convertToU32String("Deselect All"), Common::U32String(""), kTestbedDeselectAll, 0); } else { - _selectButton = new GUI::ButtonWidget(this, "TestbedOptions.SelectAll", "Select All", 0, kTestbedSelectAll, 0); + _selectButton = new GUI::ButtonWidget(this, "TestbedOptions.SelectAll", Common::convertToU32String("Select All"), Common::U32String(""), kTestbedSelectAll, 0); } - new GUI::ButtonWidget(this, "TestbedOptions.RunTests", "Run tests", 0, GUI::kCloseCmd); - new GUI::ButtonWidget(this, "TestbedOptions.Quit", "Exit Testbed", 0, kTestbedQuitCmd); + new GUI::ButtonWidget(this, "TestbedOptions.RunTests", Common::convertToU32String("Run tests"), Common::U32String(""), GUI::kCloseCmd); + new GUI::ButtonWidget(this, "TestbedOptions.Quit", Common::convertToU32String("Exit Testbed"), Common::U32String(""), kTestbedQuitCmd); } TestbedOptionsDialog::~TestbedOptionsDialog() {} @@ -102,7 +102,7 @@ void TestbedOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, break; case kTestbedDeselectAll: - _selectButton->setLabel("Select All"); + _selectButton->setLabel(Common::convertToU32String("Select All")); _selectButton->setCmd(kTestbedSelectAll); for (uint i = 0; i < _testSuiteArray.size(); i++) { _testListDisplay->markAsDeselected(i); @@ -114,7 +114,7 @@ void TestbedOptionsDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, break; case kTestbedSelectAll: - _selectButton->setLabel("Deselect All"); + _selectButton->setLabel(Common::convertToU32String("Deselect All")); _selectButton->setCmd(kTestbedDeselectAll); for (uint i = 0; i < _testSuiteArray.size(); i++) { _testListDisplay->markAsSelected(i); @@ -152,11 +152,11 @@ void TestbedInteractionDialog::addButton(uint w, uint h, const Common::String na xOffset = _xOffset; } _yOffset += yPadding; - _buttonArray.push_back(new GUI::ButtonWidget(this, xOffset, _yOffset, w, h, name, 0, cmd)); + _buttonArray.push_back(new GUI::ButtonWidget(this, xOffset, _yOffset, w, h, name, Common::U32String(""), cmd)); _yOffset += h; } -void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, const Common::Array &strArray, GUI::ListWidget::ColorList *colors, uint yPadding) { +void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, const Common::Array &strArray, GUI::ListWidget::ColorList *colors, uint yPadding) { _yOffset += yPadding; GUI::ListWidget *list = new GUI::ListWidget(this, x, y, w, h); list->setEditable(false); @@ -166,7 +166,7 @@ void TestbedInteractionDialog::addList(uint x, uint y, uint w, uint h, const Com } void TestbedInteractionDialog::addButtonXY(uint x, uint /* y */, uint w, uint h, const Common::String name, uint32 cmd) { - _buttonArray.push_back(new GUI::ButtonWidget(this, x, _yOffset, w, h, name, 0, cmd)); + _buttonArray.push_back(new GUI::ButtonWidget(this, x, _yOffset, w, h, name, Common::U32String(""), cmd)); } void TestbedInteractionDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data) { diff --git a/engines/testbed/config.h b/engines/testbed/config.h index ac48486d227..02149e6d090 100644 --- a/engines/testbed/config.h +++ b/engines/testbed/config.h @@ -72,15 +72,15 @@ public: TestbedListWidget(GUI::Dialog *boss, const Common::String &name, Common::Array tsArray) : GUI::ListWidget(boss, name), _testSuiteArray(tsArray) {} void markAsSelected(int i) { - if (!_list[i].contains("selected")) { - _list[i] += " (selected)"; + if (!_list[i].encode().contains("selected")) { + _list[i] += Common::convertToU32String(" (selected)"); } _listColors[i] = GUI::ThemeEngine::kFontColorNormal; draw(); } void markAsDeselected(int i) { - if (_list[i].contains("selected")) { + if (_list[i].encode().contains("selected")) { _list[i] = _testSuiteArray[i]->getDescription(); } _listColors[i] = GUI::ThemeEngine::kFontColorAlternate; @@ -107,7 +107,7 @@ private: GUI::ListWidget::ColorList _colors; GUI::ButtonWidget *_selectButton; Common::Array _testSuiteArray; - Common::StringArray _testSuiteDescArray; + Common::U32StringArray _testSuiteDescArray; TestbedListWidget *_testListDisplay; TestbedConfigManager *_testbedConfMan; }; @@ -120,7 +120,7 @@ public: void addButton(uint w, uint h, const Common::String name, uint32 cmd, uint xOffset = 0, uint yPadding = 8); void addButtonXY(uint x, uint y, uint w, uint h, const Common::String name, uint32 cmd); void addText(uint w, uint h, const Common::String text, Graphics::TextAlign textAlign, uint xOffset, uint yPadding = 8); - void addList(uint x, uint y, uint w, uint h, const Common::Array &strArray, GUI::ListWidget::ColorList *colors = 0, uint yPadding = 8); + void addList(uint x, uint y, uint w, uint h, const Common::Array &strArray, GUI::ListWidget::ColorList *colors = 0, uint yPadding = 8); protected: Common::Array _buttonArray; uint _xOffset; diff --git a/engines/testbed/sound.cpp b/engines/testbed/sound.cpp index 998afbf7db3..1c8c219cc3a 100644 --- a/engines/testbed/sound.cpp +++ b/engines/testbed/sound.cpp @@ -76,32 +76,32 @@ void SoundSubsystemDialog::handleCommand(GUI::CommandSender *sender, uint32 cmd, switch (cmd) { case kPlayChannel1: - _buttonArray[0]->setLabel("Pause Channel #1"); + _buttonArray[0]->setLabel(Common::convertToU32String("Pause Channel #1")); _buttonArray[0]->setCmd(kPauseChannel1); _mixer->pauseHandle(_h1, false); break; case kPlayChannel2: - _buttonArray[1]->setLabel("Pause Channel #2"); + _buttonArray[1]->setLabel(Common::convertToU32String("Pause Channel #2")); _buttonArray[1]->setCmd(kPauseChannel2); _mixer->pauseHandle(_h2, false); break; case kPlayChannel3: - _buttonArray[2]->setLabel("Pause Channel #3"); + _buttonArray[2]->setLabel(Common::convertToU32String("Pause Channel #3")); _buttonArray[2]->setCmd(kPauseChannel3); _mixer->pauseHandle(_h3, false); break; case kPauseChannel1: - _buttonArray[0]->setLabel("Play Channel #1"); + _buttonArray[0]->setLabel(Common::convertToU32String("Play Channel #1")); _buttonArray[0]->setCmd(kPlayChannel1); _mixer->pauseHandle(_h1, true); break; case kPauseChannel2: - _buttonArray[1]->setLabel("Play Channel #2"); + _buttonArray[1]->setLabel(Common::convertToU32String("Play Channel #2")); _buttonArray[1]->setCmd(kPlayChannel2); _mixer->pauseHandle(_h2, true); break; case kPauseChannel3: - _buttonArray[2]->setLabel("Play Channel #3"); + _buttonArray[2]->setLabel(Common::convertToU32String("Play Channel #3")); _buttonArray[2]->setCmd(kPlayChannel3); _mixer->pauseHandle(_h3, true); break; diff --git a/engines/testbed/testbed.cpp b/engines/testbed/testbed.cpp index e17b68e656b..cf98513d04b 100644 --- a/engines/testbed/testbed.cpp +++ b/engines/testbed/testbed.cpp @@ -58,7 +58,7 @@ void TestbedExitDialog::init() { _yOffset = 0; Common::String text = "Thank you for using ScummVM testbed! Here are yor summarized results:"; addText(450, 20, text, Graphics::kTextAlignCenter, _xOffset, 15); - Common::Array strArray; + Common::Array strArray; GUI::ListWidget::ColorList colors; for (Common::Array::const_iterator i = _testsuiteList.begin(); i != _testsuiteList.end(); ++i) { @@ -67,7 +67,7 @@ void TestbedExitDialog::init() { if ((*i)->isEnabled()) { strArray.push_back(Common::String::format("Passed: %d Failed: %d Skipped: %d", (*i)->getNumTestsPassed(), (*i)->getNumTestsFailed(), (*i)->getNumTestsSkipped())); } else { - strArray.push_back("Skipped"); + strArray.push_back(Common::convertToU32String("Skipped")); } colors.push_back(GUI::ThemeEngine::kFontColorAlternate); } diff --git a/engines/testbed/testsuite.cpp b/engines/testbed/testsuite.cpp index 817b70ede36..14123fd8459 100644 --- a/engines/testbed/testsuite.cpp +++ b/engines/testbed/testsuite.cpp @@ -111,12 +111,12 @@ void Testsuite::genReport() const { } bool Testsuite::handleInteractiveInput(const Common::String &textToDisplay, const char *opt1, const char *opt2, OptionSelected result) { - GUI::MessageDialog prompt(textToDisplay, opt1, opt2); + GUI::MessageDialog prompt(textToDisplay.c_str(), opt1, opt2); return prompt.runModal() == result ? true : false; } void Testsuite::displayMessage(const Common::String &textToDisplay, const char *defaultButton) { - GUI::MessageDialog prompt(textToDisplay, defaultButton); + GUI::MessageDialog prompt(textToDisplay.c_str(), defaultButton); prompt.runModal(); } diff --git a/engines/tinsel/sound.cpp b/engines/tinsel/sound.cpp index b198aa8b304..6794908772a 100644 --- a/engines/tinsel/sound.cpp +++ b/engines/tinsel/sound.cpp @@ -483,12 +483,12 @@ void SoundManager::setSFXVolumes(uint8 volume) { } void SoundManager::showSoundError(const char *errorMsg, const char *soundFile) { - Common::String msg; + Common::U32String msg; msg = Common::String::format(errorMsg, soundFile); - GUI::MessageDialog dialog(msg, "OK"); + GUI::MessageDialog dialog(msg); dialog.runModal(); - error("%s", msg.c_str()); + error("%s", msg.encode().c_str()); } /** diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp index 8ae2fe21b52..8b3d1a77f9f 100644 --- a/engines/tony/tony.cpp +++ b/engines/tony/tony.cpp @@ -193,7 +193,7 @@ bool TonyEngine::loadTonyDat() { in.open(filename.c_str()); if (!in.isOpen()) { - msg = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + msg = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); return false; @@ -205,7 +205,7 @@ bool TonyEngine::loadTonyDat() { buf[4] = '\0'; if (strcmp(buf, "TONY")) { - msg = Common::String::format(_("The '%s' engine data file is corrupt."), filename.c_str()); + msg = Common::String::format(_("The '%s' engine data file is corrupt.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); return false; @@ -216,7 +216,7 @@ bool TonyEngine::loadTonyDat() { if ((majVer != TONY_DAT_VER_MAJ) || (minVer != TONY_DAT_VER_MIN)) { msg = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), filename.c_str(), TONY_DAT_VER_MAJ, TONY_DAT_VER_MIN, majVer, minVer); GUIErrorMessage(msg); warning("%s", msg.c_str()); @@ -253,7 +253,7 @@ bool TonyEngine::loadTonyDat() { int numVariant = in.readUint16BE(); if (expectedLangVariant > numVariant - 1) { - msg = Common::String::format(_("Font variant not present in '%s' engine data file."), filename.c_str()); + msg = Common::String::format(_("Font variant not present in '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); diff --git a/engines/toon/toon.cpp b/engines/toon/toon.cpp index 0f2e0da9c8d..2c7548c1bff 100644 --- a/engines/toon/toon.cpp +++ b/engines/toon/toon.cpp @@ -222,12 +222,12 @@ void ToonEngine::parseInput() { if (slotNum >= 0 && slotNum <= 9 && canSaveGameStateCurrently()) { if (saveGame(slotNum, "")) { // ok - Common::String buf = Common::String::format(_("Saved game in slot #%d "), slotNum); + Common::U32String buf = Common::String::format(_("Saved game in slot #%d ").encode().c_str(), slotNum); GUI::TimedMessageDialog dialog(buf, 1000); dialog.runModal(); } else { - Common::String buf = Common::String::format(_("Could not quick save into slot #%d"), slotNum); - GUI::MessageDialog dialog(buf, "OK", 0); + Common::U32String buf = Common::String::format(_("Could not quick save into slot #%d").encode().c_str(), slotNum); + GUI::MessageDialog dialog(buf); dialog.runModal(); } @@ -239,12 +239,12 @@ void ToonEngine::parseInput() { if (slotNum >= 0 && slotNum <= 9 && canLoadGameStateCurrently()) { if (loadGame(slotNum)) { // ok - Common::String buf = Common::String::format(_("Saved game #%d quick loaded"), slotNum); + Common::U32String buf = Common::String::format(_("Saved game #%d quick loaded").encode().c_str(), slotNum); GUI::TimedMessageDialog dialog(buf, 1000); dialog.runModal(); } else { - Common::String buf = Common::String::format(_("Could not quick load the saved game #%d"), slotNum); - GUI::MessageDialog dialog(buf, "OK", 0); + Common::U32String buf = Common::String::format(_("Could not quick load the saved game #%d").encode().c_str(), slotNum); + GUI::MessageDialog dialog(buf); warning("%s", buf.c_str()); dialog.runModal(); } @@ -1524,7 +1524,7 @@ void ToonEngine::loadScene(int32 SceneId, bool forGameLoad) { // load package if (!resources()->openPackage(createRoomFilename(locationName + ".PAK"))) { - Common::String msg = Common::String::format(_("Unable to locate the '%s' data file."), createRoomFilename(locationName + ".PAK").c_str()); + Common::String msg = Common::String::format(_("Unable to locate the '%s' data file.").encode().c_str(), createRoomFilename(locationName + ".PAK").c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); _shouldQuit = true; @@ -4949,7 +4949,7 @@ bool ToonEngine::loadToonDat() { in.open(filename.c_str()); if (!in.isOpen()) { - msg = Common::String::format(_("Unable to locate the '%s' engine data file."), filename.c_str()); + msg = Common::String::format(_("Unable to locate the '%s' engine data file.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); return false; @@ -4961,7 +4961,7 @@ bool ToonEngine::loadToonDat() { buf[4] = '\0'; if (strcmp(buf, "TOON")) { - msg = Common::String::format(_("The '%s' engine data file is corrupt."), filename.c_str()); + msg = Common::String::format(_("The '%s' engine data file is corrupt.").encode().c_str(), filename.c_str()); GUIErrorMessage(msg); warning("%s", msg.c_str()); return false; @@ -4972,7 +4972,7 @@ bool ToonEngine::loadToonDat() { if ((majVer != TOON_DAT_VER_MAJ) || (minVer != TOON_DAT_VER_MIN)) { msg = Common::String::format( - _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d."), + _("Incorrect version of the '%s' engine data file found. Expected %d.%d but got %d.%d.").encode().c_str(), filename.c_str(), TOON_DAT_VER_MAJ, TOON_DAT_VER_MIN, majVer, minVer); GUIErrorMessage(msg); warning("%s", msg.c_str()); diff --git a/engines/ultima/nuvie/nuvie.cpp b/engines/ultima/nuvie/nuvie.cpp index ff4776f63b2..e9292c48402 100644 --- a/engines/ultima/nuvie/nuvie.cpp +++ b/engines/ultima/nuvie/nuvie.cpp @@ -321,7 +321,7 @@ Common::Error NuvieEngine::saveGameState(int slot, const Common::String &desc, b // Display that the game was saved MsgScroll *scroll = Game::get_game()->get_scroll(); - scroll->display_string(_("\nGame Saved\n\n")); + scroll->display_string(_("\nGame Saved\n\n").encode().c_str()); scroll->display_prompt(); } @@ -370,12 +370,12 @@ bool NuvieEngine::quickSave(int saveSlot, bool isLoad) { if (!canLoadGameStateCurrently(false)) return false; - text = _("loading quick save %d"); + text = Common::convertFromU32String(_("loading quick save %d")); } else { if (!canSaveGameStateCurrently(false)) return false; - text = _("saving quick save %d"); + text = Common::convertFromU32String(_("saving quick save %d")); } text = Std::string::format(text.c_str(), saveSlot); @@ -389,7 +389,7 @@ bool NuvieEngine::quickSave(int saveSlot, bool isLoad) { return false; } } else { - Common::String saveDesc = Common::String::format(_("Quicksave %03d"), saveSlot); + Common::String saveDesc = Common::String::format(_("Quicksave %03d").encode().c_str(), saveSlot); return saveGameState(saveSlot, saveDesc, false).getCode() == Common::kNoError; } } diff --git a/engines/ultima/shared/engine/data_archive.cpp b/engines/ultima/shared/engine/data_archive.cpp index 5966431a708..457bbfe6aba 100644 --- a/engines/ultima/shared/engine/data_archive.cpp +++ b/engines/ultima/shared/engine/data_archive.cpp @@ -78,7 +78,7 @@ bool UltimaDataArchive::load(const Common::String &subfolder, (dataArchive = Common::makeZipArchive(DATA_FILENAME)) == 0 || !f.open(Common::String::format("%s/version.txt", subfolder.c_str()), *dataArchive)) { delete dataArchive; - errorMsg = Common::String::format(_("Could not locate engine data %s"), DATA_FILENAME); + errorMsg = Common::String::format(_("Could not locate engine data %s").encode().c_str(), DATA_FILENAME); return false; } } @@ -96,7 +96,7 @@ bool UltimaDataArchive::load(const Common::String &subfolder, if (major != reqMajorVersion || minor != reqMinorVersion) { delete dataArchive; - errorMsg = Common::String::format(_("Out of date engine data. Expected %d.%d, but got version %d.%d"), + errorMsg = Common::String::format(_("Out of date engine data. Expected %d.%d, but got version %d.%d").encode().c_str(), reqMajorVersion, reqMinorVersion, major, minor); return false; } diff --git a/engines/ultima/ultima4/meta_engine.cpp b/engines/ultima/ultima4/meta_engine.cpp index 46384354e64..550750924bd 100644 --- a/engines/ultima/ultima4/meta_engine.cpp +++ b/engines/ultima/ultima4/meta_engine.cpp @@ -201,7 +201,7 @@ Common::KeymapArray MetaEngine::initKeymaps(KeybindingMode mode) { for (int kCtr = 0; recPtr->_id; ++recPtr, ++kCtr) { // Core keymaps keyMap = new Common::Keymap(Common::Keymap::kKeymapTypeGame, - recPtr->_id, recPtr->_desc); + recPtr->_id, Common::convertToU32String(recPtr->_desc)); keymapArray.push_back(keyMap); if (kCtr == 0) { diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp index f97201e93ea..a3af0d67a24 100644 --- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp +++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp @@ -296,13 +296,13 @@ void U8SaveGump::loadDescriptions() { // FIXME: move version checks elsewhere!! switch (state) { case SavegameReader::SAVE_CORRUPT: - _descriptions[i] = _("[corrupt]"); + _descriptions[i] = Common::convertFromU32String(_("[corrupt]")); break; case SavegameReader::SAVE_OUT_OF_DATE: - _descriptions[i] = _("[outdated]"); + _descriptions[i] = Common::convertFromU32String(_("[outdated]")); break; case SavegameReader::SAVE_TOO_RECENT: - _descriptions[i] = _("[too modern]"); + _descriptions[i] = Common::convertFromU32String(_("[too modern]")); break; default: break; diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index ad38f5d529f..d0c495bf9c1 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -153,7 +153,7 @@ void BasePersistenceManager::getSaveStateDesc(int slot, SaveStateDescriptor &des return; } desc.setSaveSlot(slot); - desc.setDescription(_savedDescription); + desc.setDescription(Common::convertToU32String(_savedDescription)); desc.setDeletableFlag(true); desc.setWriteProtectedFlag(false); diff --git a/engines/wintermute/detection.cpp b/engines/wintermute/detection.cpp index ebd54879739..0ead7579d4d 100644 --- a/engines/wintermute/detection.cpp +++ b/engines/wintermute/detection.cpp @@ -209,7 +209,7 @@ public: SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const override { Wintermute::BasePersistenceManager pm(target, true); SaveStateDescriptor retVal; - retVal.setDescription("Invalid savegame"); + retVal.setDescription(Common::convertToU32String("Invalid savegame")); pm.getSaveStateDesc(slot, retVal); return retVal; } diff --git a/engines/wintermute/keymapper_tables.h b/engines/wintermute/keymapper_tables.h index f65030661f7..52bc3b9557c 100644 --- a/engines/wintermute/keymapper_tables.h +++ b/engines/wintermute/keymapper_tables.h @@ -34,9 +34,9 @@ inline Common::KeymapArray getWintermuteKeymaps(const char *target, const Common using namespace Common; - Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "wintermute", "Wintermute engine"); - Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, gameId, gameDescr); - Keymap *extraKeyMap = new Keymap(Keymap::kKeymapTypeGame, "extras", "ScummVM extra actions"); + Keymap *engineKeyMap = new Keymap(Keymap::kKeymapTypeGame, "wintermute", Common::convertToU32String("Wintermute engine")); + Keymap *gameKeyMap = new Keymap(Keymap::kKeymapTypeGame, gameId, Common::convertToU32String(gameDescr)); + Keymap *extraKeyMap = new Keymap(Keymap::kKeymapTypeGame, "extras", Common::convertToU32String("ScummVM extra actions")); Action *act; diff --git a/engines/zvision/detection.cpp b/engines/zvision/detection.cpp index d97cee5ef4d..3723a8f217a 100644 --- a/engines/zvision/detection.cpp +++ b/engines/zvision/detection.cpp @@ -129,7 +129,7 @@ Common::KeymapArray ZVisionMetaEngine::initKeymaps(const char *target) const { using namespace Common; using namespace ZVision; - Keymap *mainKeymap = new Keymap(Keymap::kKeymapTypeGame, mainKeymapId, "Z-Vision"); + Keymap *mainKeymap = new Keymap(Keymap::kKeymapTypeGame, mainKeymapId, Common::convertToU32String("Z-Vision")); Action *act; @@ -145,7 +145,7 @@ Common::KeymapArray ZVisionMetaEngine::initKeymaps(const char *target) const { act->addDefaultInputMapping("JOY_B"); mainKeymap->addAction(act); - Keymap *gameKeymap = new Keymap(Keymap::kKeymapTypeGame, gameKeymapId, "Z-Vision - Game"); + Keymap *gameKeymap = new Keymap(Keymap::kKeymapTypeGame, gameKeymapId, Common::convertToU32String("Z-Vision - Game")); act = new Action(kStandardActionMoveUp, _("Look Up")); act->setCustomEngineActionEvent(kZVisionActionUp); @@ -232,7 +232,7 @@ Common::KeymapArray ZVisionMetaEngine::initKeymaps(const char *target) const { act->addDefaultInputMapping("C+p"); gameKeymap->addAction(act); - Keymap *cutscenesKeymap = new Keymap(Keymap::kKeymapTypeGame, cutscenesKeymapId, "Z-Vision - Cutscenes"); + Keymap *cutscenesKeymap = new Keymap(Keymap::kKeymapTypeGame, cutscenesKeymapId, Common::convertToU32String("Z-Vision - Cutscenes")); act = new Action(kStandardActionSkip, _("Skip cutscene")); act->setCustomEngineActionEvent(kZVisionActionSkipCutscene); diff --git a/engines/zvision/file/save_manager.cpp b/engines/zvision/file/save_manager.cpp index ec5e28375e6..8d7c7a42b9d 100644 --- a/engines/zvision/file/save_manager.cpp +++ b/engines/zvision/file/save_manager.cpp @@ -221,7 +221,7 @@ bool SaveManager::readSaveGameHeader(Common::InSaveFile *in, SaveGameHeader &hea Common::String::format( _("This saved game uses version %u, but this engine only " "supports up to version %d. You will need an updated version " - "of the engine to use this saved game."), tempVersion, SAVE_VERSION + "of the engine to use this saved game.").encode().c_str(), tempVersion, SAVE_VERSION ), _("OK")); dialog.runModal(); diff --git a/gui/about.cpp b/gui/about.cpp index a82e3252e77..4238607fdc2 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -99,7 +99,7 @@ AboutDialog::AboutDialog() version += gScummVMVersion; _lines.push_back(version); - Common::String date = Common::String::format(_("(built on %s)").encode().c_str(), gScummVMBuildDate); + Common::U32String date = Common::String::format(_("(built on %s)").encode().c_str(), gScummVMBuildDate); _lines.push_back(U32String("C2") + date); for (i = 0; i < ARRAYSIZE(copyright_text); i++) diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp index aeb4d927cd4..0708978719d 100644 --- a/gui/downloaddialog.cpp +++ b/gui/downloaddialog.cpp @@ -224,8 +224,8 @@ Common::U32String DownloadDialog::getSpeedLabelText() { void DownloadDialog::refreshWidgets() { _localDirectory = CloudMan.getDownloadLocalDirectory(); - _remoteDirectoryLabel->setLabel(_("From: ") + CloudMan.getDownloadRemoteDirectory()); - _localDirectoryLabel->setLabel(_("To: ") + _localDirectory); + _remoteDirectoryLabel->setLabel(_("From: ").encode() + CloudMan.getDownloadRemoteDirectory()); + _localDirectoryLabel->setLabel(_("To: ").encode() + _localDirectory); uint32 progress = (uint32)(100 * CloudMan.getDownloadingProgress()); _percentLabel->setLabel(Common::String::format("%u %%", progress)); _downloadSizeLabel->setLabel(getSizeLabelText()); diff --git a/gui/fluidsynth-dialog.cpp b/gui/fluidsynth-dialog.cpp index 82405a90918..25ec69cab84 100644 --- a/gui/fluidsynth-dialog.cpp +++ b/gui/fluidsynth-dialog.cpp @@ -75,28 +75,28 @@ FluidSynthSettingsDialog::FluidSynthSettingsDialog() // 0.00 - 1.20, Default: 0.20 _reverbRoomSizeSlider->setMinValue(0); _reverbRoomSizeSlider->setMaxValue(120); - _reverbRoomSizeLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.RoomSizeLabel", "20"); + _reverbRoomSizeLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.RoomSizeLabel", Common::U32String("20")); _reverbDampingDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingText", _("Damp:")); _reverbDampingSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingSlider", Common::U32String(""), kReverbDampingChangedCmd); // 0.00 - 1.00, Default: 0.00 _reverbDampingSlider->setMinValue(0); _reverbDampingSlider->setMaxValue(100); - _reverbDampingLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingLabel", "0"); + _reverbDampingLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.DampingLabel", Common::U32String("0")); _reverbWidthDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthText", _("Width:")); _reverbWidthSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthSlider", Common::U32String(""), kReverbWidthChangedCmd); // 0 - 100, Default: 1 _reverbWidthSlider->setMinValue(0); _reverbWidthSlider->setMaxValue(100); - _reverbWidthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthLabel", "1"); + _reverbWidthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.WidthLabel", Common::U32String("1")); _reverbLevelDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelText", _("Level:")); _reverbLevelSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelSlider", Common::U32String(""), kReverbLevelChangedCmd); // 0.00 - 1.00, Default: 0.90 _reverbLevelSlider->setMinValue(0); _reverbLevelSlider->setMaxValue(100); - _reverbLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelLabel", "90"); + _reverbLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Reverb.LevelLabel", Common::U32String("90")); _tabWidget->addTab(_("Chorus"), "FluidSynthSettings_Chorus"); @@ -107,28 +107,28 @@ FluidSynthSettingsDialog::FluidSynthSettingsDialog() // 0-99, Default: 3 _chorusVoiceCountSlider->setMinValue(0); _chorusVoiceCountSlider->setMaxValue(99); - _chorusVoiceCountLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.VoiceCountLabel", "3"); + _chorusVoiceCountLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.VoiceCountLabel", Common::U32String("3")); _chorusLevelDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelText", _("Level:")); _chorusLevelSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelSlider", Common::U32String(""), kChorusLevelChangedCmd); // 0.00 - 1.00, Default: 1.00 _chorusLevelSlider->setMinValue(0); _chorusLevelSlider->setMaxValue(100); - _chorusLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelLabel", "100"); + _chorusLevelLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.LevelLabel", Common::U32String("100")); _chorusSpeedDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedText", _("Speed:")); _chorusSpeedSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedSlider", Common::U32String(""), kChorusSpeedChangedCmd); // 0.30 - 5.00, Default: 0.30 _chorusSpeedSlider->setMinValue(30); _chorusSpeedSlider->setMaxValue(500); - _chorusSpeedLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedLabel", "30"); + _chorusSpeedLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.SpeedLabel", Common::U32String("30")); _chorusDepthDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthText", _("Depth:")); _chorusDepthSlider = new SliderWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthSlider", Common::U32String(""), kChorusDepthChangedCmd); // 0.00 - 21.00, Default: 8.00 _chorusDepthSlider->setMinValue(0); _chorusDepthSlider->setMaxValue(210); - _chorusDepthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthLabel", "80"); + _chorusDepthLabel = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.DepthLabel", Common::U32String("80")); _chorusWaveFormTypePopUpDesc = new StaticTextWidget(_tabWidget, "FluidSynthSettings_Chorus.WaveFormTypeText", _("Type:")); _chorusWaveFormTypePopUp = new PopUpWidget(_tabWidget, "FluidSynthSettings_Chorus.WaveFormType"); diff --git a/gui/message.cpp b/gui/message.cpp index 8981c712796..9c23120d3ae 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -100,6 +100,12 @@ MessageDialog::MessageDialog(const Common::U32String &message, Common::U32String new ButtonWidget(this, cancelButtonPos, _h - buttonHeight - 8, buttonWidth, buttonHeight, altButton, Common::U32String(""), kCancelCmd, Common::ASCII_ESCAPE); // Cancel dialog } +MessageDialog::MessageDialog(const char *message, const char *defaultButton, const char *altButton, Graphics::TextAlign alignment) + : Dialog(30, 20, 260, 124) { + + MessageDialog::MessageDialog(Common::U32String(message), Common::U32String(defaultButton), Common::U32String(altButton), alignment); +} + void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { // FIXME: It's a really bad thing that we use two arbitrary constants if (cmd == kOkCmd) { diff --git a/gui/message.h b/gui/message.h index 49a11c90b64..89ccd8ff257 100644 --- a/gui/message.h +++ b/gui/message.h @@ -42,6 +42,7 @@ enum { class MessageDialog : public Dialog { public: MessageDialog(const Common::U32String &message, Common::U32String defaultButton = Common::U32String("OK"), Common::U32String altButton = Common::U32String(""), Graphics::TextAlign alignment = Graphics::kTextAlignCenter, const char *url = nullptr); + MessageDialog(const char *message, const char *defaultButton = "OK", const char *altButton = "", Graphics::TextAlign alignment = Graphics::kTextAlignCenter, const char *url = nullptr); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override; diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp index 48369033f0c..2676b50590d 100644 --- a/gui/saveload-dialog.cpp +++ b/gui/saveload-dialog.cpp @@ -591,11 +591,11 @@ void SaveLoadChooserSimple::updateSelection(bool redraw) { if (_saveDateSupport) { const Common::String &saveDate = desc.getSaveDate(); if (!saveDate.empty()) - _date->setLabel(_("Date: ") + saveDate); + _date->setLabel(_("Date: ").encode() + saveDate); const Common::String &saveTime = desc.getSaveTime(); if (!saveTime.empty()) - _time->setLabel(_("Time: ") + saveTime); + _time->setLabel(_("Time: ").encode() + saveTime); } if (_playTimeSupport) { @@ -1108,13 +1108,13 @@ void SaveLoadChooserGrid::updateSaves() { tooltip += desc.getDescription(); if (_saveDateSupport) { - const Common::String &saveDate = desc.getSaveDate(); + const Common::U32String &saveDate = desc.getSaveDate(); if (!saveDate.empty()) { tooltip += Common::U32String("\n"); tooltip += _("Date: ") + saveDate; } - const Common::String &saveTime = desc.getSaveTime(); + const Common::U32String &saveTime = desc.getSaveTime(); if (!saveTime.empty()) { tooltip += Common::U32String("\n"); tooltip += _("Time: ") + saveTime;