1
0
mirror of synced 2025-01-30 19:43:47 +01:00

0.6.0.30 - Set default Graphics Device type on first boot & only show supported Graphics Devices per OS (#770)

- Set default Graphics Device type on first boot & only show supported Graphics Devices per OS
This commit is contained in:
DragonRatTiger / リュウコ 2024-12-22 01:21:06 -06:00 committed by GitHub
parent fa7bc2a359
commit d43ff025ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 95 additions and 12 deletions

View File

@ -22,7 +22,7 @@ public static class ImGuiDebugWindow {
private static int currentStageMemoryUsage = 0;
private static int sortType = -1;
private static readonly string[] sortNames = ["Memory Usage (Highest->Lowest)", "Memory Usage (Lowest->Highest)", "Pointer ID"];
private static readonly string[] sortNames = ["Memory Usage (Highest -> Lowest)", "Memory Usage (Lowest -> Highest)", "Pointer ID"];
private static string reloadTexPath = "";
public static void Draw() {
if (SampleFramework.Game.ImGuiController == null) return;
@ -214,6 +214,28 @@ public static class ImGuiDebugWindow {
ImGui.EndCombo();
}
if (ImGui.TreeNodeEx("Edit Dan Title")) {
ImGui.InputText("Title", ref OpenTaiko.SaveFileInstances[save].data.Dan, 16);
ImGui.Checkbox("Gold", ref OpenTaiko.SaveFileInstances[save].data.DanGold);
string[] clear_types = ["Clear", "FC", "Perfect"];
int clear_int = OpenTaiko.SaveFileInstances[save].data.DanType;
if (ImGui.BeginCombo("Clear Type", clear_types[clear_int])) {
for (int clear = 0; clear < clear_types.Length; clear++) {
if (ImGui.Selectable(clear_types[clear], clear_int == clear)) OpenTaiko.SaveFileInstances[save].data.DanType = clear;
}
ImGui.EndCombo();
}
if (ImGui.Button("Update")) {
OpenTaiko.SaveFileInstances[save].tApplyHeyaChanges();
OpenTaiko.NamePlate.tNamePlateRefreshTitles(save);
}
ImGui.TreePop();
}
ImGui.NewLine();
ImGui.Text($"Total Plays: {OpenTaiko.SaveFileInstances[save].data.TotalPlaycount}");

View File

@ -479,7 +479,25 @@ internal class OpenTaiko : Game {
ConfigIsNew = true;
}
switch (ConfigIni.nGraphicsDeviceType) {
if (ConfigIsNew) {
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.OpenGL;
if (OperatingSystem.IsWindows()) {
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.OpenGL;
ConfigIni.nGraphicsDeviceType = 0;
}
// While we aren't able to support MacOS, this check is included just in case this changes.
else if (OperatingSystem.IsMacOS()) {
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.Metal;
ConfigIni.nGraphicsDeviceType = 3;
}
else if (OperatingSystem.IsLinux()) {
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.Vulkan;
ConfigIni.nGraphicsDeviceType = 2;
}
}
else {
switch (ConfigIni.nGraphicsDeviceType) {
case 0:
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.OpenGL;
break;
@ -492,7 +510,9 @@ internal class OpenTaiko : Game {
case 3:
GraphicsDeviceType_ = Silk.NET.GLFW.AnglePlatformType.Metal;
break;
}
}
WindowPosition = new Silk.NET.Maths.Vector2D<int>(ConfigIni.nWindowBaseXPosition, ConfigIni.nWindowBaseYPosition);
WindowSize = new Silk.NET.Maths.Vector2D<int>(ConfigIni.nWindowWidth, ConfigIni.nWindowHeight);
@ -1561,6 +1581,14 @@ internal class OpenTaiko : Game {
Trace.TraceInformation("OS Version: " + Environment.OSVersion);
Trace.TraceInformation("Processors: " + Environment.ProcessorCount.ToString());
Trace.TraceInformation("CLR Version: " + Environment.Version.ToString());
if (ConfigIsNew) {
Trace.TraceInformation("----------------------");
Trace.TraceInformation("No Config.ini file was found. This usually means you've launched the game for the first time. A Config.ini file will be generated after safely closing the game.");
Trace.TraceInformation("Thanks for joining us! (≧∇≦)ノ");
Trace.TraceInformation($"{GraphicsDeviceType_} was selected as the recommended Graphics Device for your OS.");
Trace.TraceInformation($"{(CConfigIni.ESoundDeviceTypeForConfig)ConfigIni.nSoundDeviceType} was selected as the recommended Sound Device for your OS.");
}
//---------------------
#endregion
@ -1774,7 +1802,7 @@ internal class OpenTaiko : Game {
Trace.TraceInformation("Initialized loudness scanning, song gain control, and sound group level control.");
}
ShowWindowTitleWithSoundType();
ShowWindowTitle();
FDK.SoundManager.bIsTimeStretch = OpenTaiko.ConfigIni.bTimeStretch;
SoundManager.nMasterVolume = OpenTaiko.ConfigIni.nMasterVolume;
Trace.TraceInformation("サウンドデバイスの初期化を完了しました。");
@ -1887,13 +1915,13 @@ internal class OpenTaiko : Game {
#endregion
}
public void ShowWindowTitleWithSoundType() {
public void ShowWindowTitle() {
string delay = "";
if (SoundManager.GetCurrentSoundDeviceType() != "DirectSound") {
delay = "(" + SoundManager.GetSoundDelay() + "ms)";
}
AssemblyName asmApp = Assembly.GetExecutingAssembly().GetName();
base.Text = asmApp.Name + " Ver." + VERSION + " (" + SoundManager.GetCurrentSoundDeviceType() + delay + ")";
base.Text = asmApp.Name + " Ver." + VERSION + " - (" + GraphicsDeviceType_ + ") - (" + SoundManager.GetCurrentSoundDeviceType() + delay + ")";
}
private void tExitProcess() {

View File

@ -41,6 +41,37 @@ internal class CActConfigList : CActivity {
}
public int n現在の選択項目;
private static int GraphicsDeviceFromString(string device) {
switch (device) {
case "OpenGL": return 0;
case "DirectX11": return 1;
case "Vulkan": return 2;
case "Metal": return 3;
default: return 0;
}
}
private static string GraphicsDeviceFromInt(int device) {
switch (device) {
case 0: return "OpenGL";
case 1: return "DirectX11";
case 2: return "Vulkan";
case 3: return "Metal";
default: return "OpenGL";
}
}
private static string[] AvailableGraphicsDevices { get {
if (OperatingSystem.IsWindows()) return ["OpenGL", "DirectX11", "Vulkan"];
if (OperatingSystem.IsMacOS()) return ["OpenGL", "Metal"];
if (OperatingSystem.IsLinux()) return ["OpenGL", "Vulkan"];
return ["OpenGL", "DirectX11", "Vulkan", "Metal"];
}
}
private static int GraphicsDeviceIntFromConfigInt() {
return Math.Max(0, Array.IndexOf(AvailableGraphicsDevices, GraphicsDeviceFromInt(OpenTaiko.ConfigIni.nGraphicsDeviceType)));
}
// General system options
#region [ t項目リストの設定_System() ]
@ -88,10 +119,9 @@ internal class CActConfigList : CActivity {
CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_TIMESTRETCH_DESC"));
this.list項目リスト.Add(this.iSystemTimeStretch);
this.iSystemGraphicsType = new CItemList(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_GRAPHICSAPI"), CItemList.EPanelType.Normal, OpenTaiko.ConfigIni.nGraphicsDeviceType,
this.iSystemGraphicsType = new CItemList(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_GRAPHICSAPI"), CItemList.EPanelType.Normal, GraphicsDeviceIntFromConfigInt(),
CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_GRAPHICSAPI_DESC"),
//new string[] { "OpenGL", "DirectX9", "DirectX11", "Vulkan", "Metal" });
new string[] { "OpenGL", "DirectX11", "Vulkan", "Metal" });
AvailableGraphicsDevices);
this.list項目リスト.Add(this.iSystemGraphicsType);
this.iSystemFullscreen = new CItemToggle(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_FULLSCREEN"), OpenTaiko.ConfigIni.bFullScreen,
@ -190,10 +220,13 @@ internal class CActConfigList : CActivity {
// #24820 2013.1.3 yyagi
this.iSystemSoundType = new CItemList(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_AUDIOPLAYBACK"), CItemList.EPanelType.Normal, OpenTaiko.ConfigIni.nSoundDeviceType,
// Hide this option for non-Windows users since all other sound device options are Windows-exclusive.
if (OperatingSystem.IsWindows()) {
this.iSystemSoundType = new CItemList(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_AUDIOPLAYBACK"), CItemList.EPanelType.Normal, OpenTaiko.ConfigIni.nSoundDeviceType,
CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_AUDIOPLAYBACK_DESC"),
new string[] { "Bass", "ASIO", "WASAPI Exclusive", "WASAPI Shared" });
this.list項目リスト.Add(this.iSystemSoundType);
this.list項目リスト.Add(this.iSystemSoundType);
}
// #24820 2013.1.15 yyagi
this.iSystemBassBufferSizeMs = new CItemInteger(CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_BASSBUFFER"), 0, 99999, OpenTaiko.ConfigIni.nBassBufferSizeMs,
@ -1032,7 +1065,7 @@ internal class CActConfigList : CActivity {
0,
this.iSystemASIODevice.n現在選択されている項目番号,
this.iSystemSoundTimerType.bON);
OpenTaiko.app.ShowWindowTitleWithSoundType();
OpenTaiko.app.ShowWindowTitle();
OpenTaiko.Skin.ReloadSkin();// 音声の再読み込みをすることによって、音量の初期化を防ぐ
}
#endregion
@ -1607,7 +1640,7 @@ internal class CActConfigList : CActivity {
private void tConfigIniへ記録する_System() {
OpenTaiko.ConfigIni.nSongSpeed = this.iCommonPlaySpeed.n現在の値;
OpenTaiko.ConfigIni.nGraphicsDeviceType = this.iSystemGraphicsType.n現在選択されている項目番号;
OpenTaiko.ConfigIni.nGraphicsDeviceType = GraphicsDeviceFromString(AvailableGraphicsDevices[this.iSystemGraphicsType.n現在選択されている項目番号]);
OpenTaiko.ConfigIni.bFullScreen = this.iSystemFullscreen.bON;
OpenTaiko.ConfigIni.bIncludeSubfoldersOnRandomSelect = this.iSystemRandomFromSubBox.bON;