1
0
mirror of synced 2024-12-02 19:17:26 +01:00

fix a crash DRT didnt notice 👀

This commit is contained in:
0auBSQ 2024-10-24 01:02:03 +09:00
parent fcf4f80b34
commit 3b2cef2636

View File

@ -39,7 +39,7 @@ public static class ImGuiDebugWindow {
#endregion #endregion
ImGui.SetNextWindowPos(new System.Numerics.Vector2(0, 0), ImGuiCond.FirstUseEver); ImGui.SetNextWindowPos(new System.Numerics.Vector2(0, 0), ImGuiCond.FirstUseEver);
ImGui.SetNextWindowSize(new System.Numerics.Vector2(400,300), ImGuiCond.FirstUseEver); ImGui.SetNextWindowSize(new System.Numerics.Vector2(400, 300), ImGuiCond.FirstUseEver);
if (ImGui.Begin("Debug Window (Toggle Visbility with F11)###DEBUG")) { if (ImGui.Begin("Debug Window (Toggle Visbility with F11)###DEBUG")) {
#region Debug Info #region Debug Info
@ -48,7 +48,7 @@ public static class ImGuiDebugWindow {
ImGui.Separator(); ImGui.Separator();
ImGui.Text($"Game Version: {OpenTaiko.VERSION}"); ImGui.Text($"Game Version: {OpenTaiko.VERSION}");
ImGui.Text($"Allocated Memory: {pagedmemory} bytes ({String.Format("{0:0.###}",(float)pagedmemory / (1024 * 1024 * 1024))}GB)"); ImGui.Text($"Allocated Memory: {pagedmemory} bytes ({String.Format("{0:0.###}", (float)pagedmemory / (1024 * 1024 * 1024))}GB)");
ImGui.Text($"FPS: {(OpenTaiko.FPS != null ? OpenTaiko.FPS.NowFPS : "???")}"); ImGui.Text($"FPS: {(OpenTaiko.FPS != null ? OpenTaiko.FPS.NowFPS : "???")}");
ImGui.Text("Current Stage: " + OpenTaiko.r現在のステージ.eStageID.ToString() + " (StageID " + ((int)OpenTaiko.r現在のステージ.eStageID).ToString() + ")"); ImGui.Text("Current Stage: " + OpenTaiko.r現在のステージ.eStageID.ToString() + " (StageID " + ((int)OpenTaiko.r現在のステージ.eStageID).ToString() + ")");
#endregion #endregion
@ -179,7 +179,7 @@ public static class ImGuiDebugWindow {
OpenTaiko.NamePlate.tNamePlateRefreshTitles(save); OpenTaiko.NamePlate.tNamePlateRefreshTitles(save);
} }
string preview = OpenTaiko.SaveFileInstances[save].data.TitleId == 0 ? "初心者" : OpenTaiko.Databases.DBNameplateUnlockables.data[OpenTaiko.SaveFileInstances[save].data.TitleId].nameplateInfo.cld.GetString(""); string preview = OpenTaiko.SaveFileInstances[save].data.TitleId == -1 ? "初心者" : OpenTaiko.Databases.DBNameplateUnlockables.data[OpenTaiko.SaveFileInstances[save].data.TitleId].nameplateInfo.cld.GetString("");
if (ImGui.BeginCombo("Nameplate", preview)) { if (ImGui.BeginCombo("Nameplate", preview)) {
foreach (long id in OpenTaiko.Databases.DBNameplateUnlockables.data.Keys) { foreach (long id in OpenTaiko.Databases.DBNameplateUnlockables.data.Keys) {
@ -285,7 +285,7 @@ public static class ImGuiDebugWindow {
break; break;
case CStage.EStage.Game: case CStage.EStage.Game:
for (int i = 0; i < OpenTaiko.ConfigIni.nPlayerCount; i++) { for (int i = 0; i < OpenTaiko.ConfigIni.nPlayerCount; i++) {
if (ImGui.TreeNodeEx($"Player {i+1}###GAME_CHART_{i}", ImGuiTreeNodeFlags.Framed)) { if (ImGui.TreeNodeEx($"Player {i + 1}###GAME_CHART_{i}", ImGuiTreeNodeFlags.Framed)) {
Difficulty game_difficulty = OpenTaiko.DifficultyNumberToEnum(OpenTaiko.stageSongSelect.nChoosenSongDifficulty[i]); Difficulty game_difficulty = OpenTaiko.DifficultyNumberToEnum(OpenTaiko.stageSongSelect.nChoosenSongDifficulty[i]);
var dtx = OpenTaiko.GetDTX(i); var dtx = OpenTaiko.GetDTX(i);
@ -332,8 +332,8 @@ public static class ImGuiDebugWindow {
ImGui.Text("Note Count: "); ImGui.Text("Note Count: ");
ImGui.Indent(); ImGui.Indent();
ImGui.Text("Normal: " + dtx.nーツ数_Branch[0] + ImGui.Text("Normal: " + dtx.nーツ数_Branch[0] +
" / Expert: " + dtx.nーツ数_Branch[1] + " / Expert: " + dtx.nーツ数_Branch[1] +
" / Master: " + dtx.nーツ数_Branch[2]); " / Master: " + dtx.nーツ数_Branch[2]);
ImGui.Unindent(); ImGui.Unindent();
ImGui.TreePop(); ImGui.TreePop();
@ -428,8 +428,7 @@ public static class ImGuiDebugWindow {
"AI Full Combo", "TEXTURE_LUA_AIFC"); "AI Full Combo", "TEXTURE_LUA_AIFC");
currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.AIWin_PerfectScript, currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.AIWin_PerfectScript,
"AI Perfect Combo", "TEXTURE_LUA_AIPFC"); "AI Perfect Combo", "TEXTURE_LUA_AIPFC");
} } else {
else {
currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.FailedScript, currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.FailedScript,
"Clear Failed", "TEXTURE_LUA_GAMEFAILED"); "Clear Failed", "TEXTURE_LUA_GAMEFAILED");
currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.ClearScript, currentStageMemoryUsage += CTextureListPopup(OpenTaiko.stage演奏ドラム画面.actEnd.ClearScript,
@ -474,9 +473,8 @@ public static class ImGuiDebugWindow {
if (DrawCTextureForImGui(texture, 800, 800)) { if (DrawCTextureForImGui(texture, 800, 800)) {
ImGui.Text("Pointer: " + texture.Pointer); ImGui.Text("Pointer: " + texture.Pointer);
ImGui.Text("Size: x" + texture.szTextureSize.Width + ",y" + texture.szTextureSize.Height); ImGui.Text("Size: x" + texture.szTextureSize.Width + ",y" + texture.szTextureSize.Height);
ImGui.Text("Memory allocated: " + String.Format("{0:0.###}",GetTextureMemAllocationInMegabytes(texture)) + "MB"); ImGui.Text("Memory allocated: " + String.Format("{0:0.###}", GetTextureMemAllocationInMegabytes(texture)) + "MB");
} } else {
else {
ImGui.TextDisabled("Texture is not loaded."); ImGui.TextDisabled("Texture is not loaded.");
} }
ImGui.EndTooltip(); ImGui.EndTooltip();
@ -503,7 +501,7 @@ public static class ImGuiDebugWindow {
if (texture == null) return false; if (texture == null) return false;
return DrawCTextureForImGui(texture, return DrawCTextureForImGui(texture,
new Vector2(texture.szTextureSize.Width, texture.szTextureSize.Height), new Vector2(texture.szTextureSize.Width, texture.szTextureSize.Height),
new Vector2(0,0), new Vector2(1,1)); new Vector2(0, 0), new Vector2(1, 1));
} }
private static bool DrawCTextureForImGui(CTexture texture, int max_width, int max_height) { private static bool DrawCTextureForImGui(CTexture texture, int max_width, int max_height) {
if (texture == null) return false; if (texture == null) return false;