MCPcopy Create free account
hub / github.com/EasyRPG/Player / CreateGameObjects

Method CreateGameObjects

src/player.cpp:685–855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683}
684
685void Player::CreateGameObjects() {
686 // Parse game specific settings
687 CmdlineParser cp(arguments);
688 game_config = Game_ConfigGame::Create(cp);
689
690 // Reinit MIDI
691 MidiDecoder::Reset();
692
693 // Load the meta information file.
694 // Note: This should eventually be split across multiple folders as described in Issue #1210
695 std::string meta_file = FileFinder::Game().FindFile(META_NAME);
696 meta.reset(new Meta(meta_file));
697
698 // Guess non-standard extensions (for the DB) before loading the encoding
699 GuessNonStandardExtensions();
700
701 GetEncoding();
702 escape_symbol = lcf::ReaderUtil::Recode("\\", encoding);
703 if (escape_symbol.empty()) {
704 Output::Error("Invalid encoding: {}.", encoding);
705 }
706 escape_char = Utils::DecodeUTF32(Player::escape_symbol).front();
707
708 // Special handling for games with altered files
709 FileFinder::SetGameFilesystem(HookFilesystem::Detect(FileFinder::Game()));
710
711 // Check for translation-related directories and load language names.
712 translation.InitTranslations();
713
714 std::string game_path = FileFinder::GetFullFilesystemPath(FileFinder::Game());
715 std::string save_path = FileFinder::GetFullFilesystemPath(FileFinder::Save());
716 shared_game_and_save_directory = (game_path == save_path);
717
718 if (shared_game_and_save_directory) {
719 Output::DebugStr("Game and Save Directory:");
720 FileFinder::DumpFilesystem(FileFinder::Game());
721 } else {
722 Output::Debug("Game Directory:");
723 FileFinder::DumpFilesystem(FileFinder::Game());
724 Output::Debug("SaveDirectory:", save_path);
725 FileFinder::DumpFilesystem(FileFinder::Save());
726 }
727
728 LoadDatabase();
729
730 bool no_rtp_warning_flag = false;
731 Player::has_custom_resolution = false;
732 { // Scope lifetime of variables for ini parsing
733 std::string ini_file = FileFinder::Game().FindFile(INI_NAME);
734
735 auto ini_stream = FileFinder::Game().OpenInputStream(ini_file, std::ios_base::in);
736 if (ini_stream) {
737 lcf::INIReader ini(ini_stream);
738 if (ini.ParseError() != -1) {
739 auto title = ini.Get("RPG_RT", "GameTitle", GAME_TITLE);
740 game_title = lcf::ReaderUtil::Recode(title, encoding);
741 no_rtp_warning_flag = ini.Get("RPG_RT", "FullPackageFlag", "0") == "1" ? true : no_rtp_flag;
742 if (ini.HasValue("RPG_RT", "WinW") || ini.HasValue("RPG_RT", "WinH")) {

Callers

nothing calls this directly

Calls 15

GameClass · 0.85
InitTranslationsMethod · 0.80
OpenInputStreamMethod · 0.80
OpenFileMethod · 0.80
GetExFontMethod · 0.80
PrintMethod · 0.80
GetEngineTypeMethod · 0.80
PrintActivePatchesMethod · 0.80
ExecuteScriptListMethod · 0.80
FindFileMethod · 0.45
resetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected