mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Add supported_languages.txt to specify which languages are available in a game.
This commit is contained in:
parent
63128907fd
commit
0800649d8f
4 changed files with 52 additions and 0 deletions
|
|
@ -156,6 +156,9 @@ public:
|
|||
//app build id
|
||||
int build_id = 10;
|
||||
|
||||
//supported languages
|
||||
std::set<std::string> supported_languages;
|
||||
|
||||
//make lobby creation fail in the matchmaking interface
|
||||
bool disable_lobby_creation = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -260,6 +260,41 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
|
|||
local_storage->store_data_settings("user_steam_id.txt", temp_text, strlen(temp_text));
|
||||
}
|
||||
|
||||
std::set<std::string> supported_languages;
|
||||
|
||||
{
|
||||
std::string lang_config_path = Local_Storage::get_game_settings_path() + "supported_languages.txt";
|
||||
std::ifstream input( utf8_decode(lang_config_path) );
|
||||
|
||||
std::string first_language;
|
||||
if (input.is_open()) {
|
||||
consume_bom(input);
|
||||
for( std::string line; getline( input, line ); ) {
|
||||
if (!line.empty() && line[line.length()-1] == '\n') {
|
||||
line.pop_back();
|
||||
}
|
||||
|
||||
if (!line.empty() && line[line.length()-1] == '\r') {
|
||||
line.pop_back();
|
||||
}
|
||||
|
||||
try {
|
||||
std::string lang = line;
|
||||
if (!first_language.size()) first_language = lang;
|
||||
supported_languages.insert(lang);
|
||||
PRINT_DEBUG("Added supported_language %s\n", lang.c_str());
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (!supported_languages.count(language)) {
|
||||
if (first_language.size()) {
|
||||
memset(language, 0, sizeof(language));
|
||||
first_language.copy(language, sizeof(language) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool steam_offline_mode = false;
|
||||
bool disable_networking = false;
|
||||
bool disable_overlay = false;
|
||||
|
|
@ -336,6 +371,8 @@ uint32 create_localstorage_settings(Settings **settings_client_out, Settings **s
|
|||
settings_server->warn_forced = warn_forced;
|
||||
settings_client->warn_local_save = local_save;
|
||||
settings_server->warn_local_save = local_save;
|
||||
settings_client->supported_languages = supported_languages;
|
||||
settings_server->supported_languages = supported_languages;
|
||||
|
||||
{
|
||||
std::string dlc_config_path = Local_Storage::get_game_settings_path() + "DLC.txt";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue