/// <summary> /// Detect the language for the current installation /// </summary> /// <param name="gameDefinition"></param> /// <param name="rootDirectory"></param> /// <returns>language as string</returns> public static string ReadCurrentLanguage(IGameDefinition gameDefinition, FileSystem fileSystem) { if (PlatformUtility.IsWindowsPlatform()) { if (gameDefinition.LanguageRegistryKeys != null && gameDefinition.LanguageRegistryKeys.Any()) { if (ReadFromRegistry(gameDefinition.LanguageRegistryKeys, out var language)) { return(language); } } } switch (gameDefinition.Game) { case SageGame.CncGenerals: return(DetectFromFileSystem(fileSystem, "", "Audio", ".big")); case SageGame.CncGeneralsZeroHour: return(DetectFromFileSystem(fileSystem, "", "Audio", "ZH.big")); case SageGame.Bfme: case SageGame.Bfme2: case SageGame.Bfme2Rotwk: return(DetectFromFileSystem(fileSystem, "lang", "", "Audio.big")); case SageGame.Ra3Uprising: case SageGame.Ra3: return(DetectFromFileSystem(fileSystem, "Data", "", "Audio.big")); } return(DefaultLanguage); }
public static unsafe float GetDisplayScale(int displayIndex) { float hdpi; SDL_GetDisplayDPI(displayIndex, null, &hdpi, null); var defaultDpi = PlatformUtility.GetDefaultDpi(); return(hdpi / defaultDpi); }
public static unsafe float GetDisplayScale(int displayIndex) { float hdpi; int result = SDL_GetDisplayDPI(displayIndex, null, &hdpi, null); // The function call did not succeed. // TODO: We should check why with SDL_GetError if (result != 0) { return(1.0f); } var defaultDpi = PlatformUtility.GetDefaultDpi(); return(hdpi / defaultDpi); }
/// <summary> /// Detect the language for the current installation /// </summary> /// <param name="gameDefinition"></param> /// <param name="rootDirectory"></param> /// <returns>language as string</returns> public static string ReadCurrentLanguage(IGameDefinition gameDefinition, string rootDirectory) { if (PlatformUtility.IsWindowsPlatform()) { if (gameDefinition.LanguageRegistryKeys != null && gameDefinition.LanguageRegistryKeys.Any()) { return(ReadFromRegistry(gameDefinition.LanguageRegistryKeys)); } } switch (gameDefinition.Game) { case SageGame.CncGenerals: return(DetectFromFileSystem(rootDirectory, "Audio", ".big")); case SageGame.CncGeneralsZeroHour: return(DetectFromFileSystem(rootDirectory, "Audio", "ZH.big")); } return(DefaultLanguage); }