1
0
mirror of synced 2024-11-24 15:40:22 +01:00

Fix crash with default skin when failing a tower chart

This commit is contained in:
0aubsq 2022-02-04 08:51:13 +01:00
parent 9e3248e6d2
commit 7a8f090188
6 changed files with 22 additions and 14 deletions

View File

@ -50,17 +50,21 @@ namespace TJAPlayer3
[DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
public static extern void Shutdown();
/*
[DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunCallbacks();
*/
[DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdatePresence(ref RichPresence presence);
/*
[DllImport("discord-rpc", EntryPoint = "Discord_ClearPresence", CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPresence();
[DllImport("discord-rpc", EntryPoint = "Discord_UpdateHandlers", CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdateHandlers(ref EventHandlers handlers);
*/
}
public static class Discord
@ -100,8 +104,8 @@ namespace TJAPlayer3
if (startTimeStamp != 0) presence.startTimestamp = startTimeStamp;
if (endTimeStamp != 0) presence.endTimestamp = endTimeStamp;
presence.largeImageKey = StrToPtr("rewrite");
presence.largeImageText = StrToPtr("Ver." + TJAPlayer3.VERSION);
presence.largeImageKey = StrToPtr("OpenTaiko".ToLowerInvariant());
presence.largeImageText = StrToPtr(TJAPlayer3.AppDisplayThreePartVersion);
if (!string.IsNullOrEmpty(smallImageKey)) presence.smallImageKey = StrToPtr(smallImageKey);
if (!string.IsNullOrEmpty(smallImageText)) presence.smallImageText = StrToPtr(smallImageText);

View File

@ -132,21 +132,21 @@ namespace TJAPlayer3
int[] y = new int[] { 0, 176 };
this.ctEnd_ClearFailed.t進行();
if (this.ctEnd_ClearFailed.n現在の値 <= 20)
if (this.ctEnd_ClearFailed.n現在の値 <= 20 || TJAPlayer3.Tx.ClearFailed == null)
{
TJAPlayer3.Tx.End_ClearFailed[this.ctEnd_ClearFailed.n現在の値].t2D描画(TJAPlayer3.app.Device, 505, y[i] + 145);
TJAPlayer3.Tx.End_ClearFailed[Math.Min(this.ctEnd_ClearFailed.n現在の値, TJAPlayer3.Tx.End_ClearFailed.Length - 1)]?.t2D描画(TJAPlayer3.app.Device, 505, y[i] + 145);
}
if (this.ctEnd_ClearFailed.n現在の値 >= 20 && this.ctEnd_ClearFailed.n現在の値 <= 67)
else if(this.ctEnd_ClearFailed.n現在の値 >= 20 && this.ctEnd_ClearFailed.n現在の値 <= 67)
{
TJAPlayer3.Tx.ClearFailed.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
TJAPlayer3.Tx.ClearFailed?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
}
else if (this.ctEnd_ClearFailed.n現在の値 == 68)
{
TJAPlayer3.Tx.ClearFailed1.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
TJAPlayer3.Tx.ClearFailed1?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
}
else if (this.ctEnd_ClearFailed.n現在の値 >= 69)
{
TJAPlayer3.Tx.ClearFailed2.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
TJAPlayer3.Tx.ClearFailed2?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192);
}
}

View File

@ -288,13 +288,17 @@ namespace TJAPlayer3
// this.stream = new StreamWriter("noteTest.txt", false);
//}
// Discord Presence の更新
var endTimeStamp = TJAPlayer3.DTX.listChip.Count == 0
? 0
: Discord.GetUnixTime() + (long)TJAPlayer3.DTX.listChip[TJAPlayer3.DTX.listChip.Count - 1].n発声時刻ms / 1000;
var difficultyName = TJAPlayer3.DifficultyNumberToEnum(TJAPlayer3.stage選曲.n確定された曲の難易度[0]).ToString();
Discord.UpdatePresence(TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? TJAPlayer3.DTX.strファイル名 : "",
Properties.Discord.Stage_InGame + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""),
0,
Discord.GetUnixTime() + (long)TJAPlayer3.DTX.listChip[TJAPlayer3.DTX.listChip.Count - 1].n発声時刻ms / 1000,
endTimeStamp,
TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? difficultyName.ToLower() : "",
TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? String.Format("COURSE:{0} ({1})", difficultyName, TJAPlayer3.stage選曲.n確定された曲の難易度) : "");
TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? String.Format("COURSE:{0} ({1})", difficultyName, TJAPlayer3.stage選曲.n確定された曲の難易度[0]) : "");
}
public override void On非活性化()
{

View File

@ -474,7 +474,7 @@ namespace TJAPlayer3
}
// Discord Presenseの更新
Discord.UpdatePresence(TJAPlayer3.DTX.TITLE + ".tja", Properties.Discord.Stage_Result + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""), TJAPlayer3.StartupTime);
Discord.UpdatePresence(TJAPlayer3.DTX.strファイル名 + ".tja", Properties.Discord.Stage_Result + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""), TJAPlayer3.StartupTime);
#region [Earned medals]

View File

@ -104,9 +104,6 @@
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\Test\dll\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@ -352,6 +349,9 @@
<PackageReference Include="LargeAddressAware">
<Version>1.0.5</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
</PackageReference>
<PackageReference Include="ReadJEnc">
<Version>1.3.1.2</Version>
</PackageReference>

Binary file not shown.