Skip to content

Commit b8f692b

Browse files
committed
Merge branch 'dev' into main
2 parents 14063d7 + 1a02b49 commit b8f692b

36 files changed

+424
-1319
lines changed

VRCOSC.Desktop/Updater/SquirrelUpdateManager.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,20 @@ protected override async Task ApplyUpdatesAsync()
7676
if (updateInfo is null)
7777
throw new InvalidOperationException("Cannot apply updates without checking");
7878

79+
var progressNotification = PostProgressNotification();
80+
7981
try
8082
{
81-
var notification = PostProgressNotification();
82-
await updateManager.DownloadReleases(updateInfo.ReleasesToApply, p => notification.Progress = map(p / 100f, 0, 1, 0, 0.5f));
83-
await updateManager.ApplyReleases(updateInfo, p => notification.Progress = map(p / 100f, 0, 1, 0.5f, 1));
83+
await updateManager.DownloadReleases(updateInfo.ReleasesToApply, p => progressNotification.Progress = map(p / 100f, 0, 1, 0, 0.5f));
84+
await updateManager.ApplyReleases(updateInfo, p => progressNotification.Progress = map(p / 100f, 0, 1, 0.5f, 1));
8485
PostSuccessNotification();
8586
Log("Update successfully applied");
8687
initialise();
8788
}
8889
catch (Exception e)
8990
{
91+
progressNotification.Hide();
92+
9093
// Update may have failed due to the installed version being too outdated
9194
// Retry without trying for delta
9295
if (useDelta)

VRCOSC.Desktop/VRCOSC.Desktop.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<ApplicationIcon>game.ico</ApplicationIcon>
77
<ApplicationManifest>app.manifest</ApplicationManifest>
88
<Version>0.0.0</Version>
9-
<FileVersion>2023.430.0</FileVersion>
9+
<FileVersion>2023.503.0</FileVersion>
1010
<Title>VRCOSC</Title>
1111
<Authors>VolcanicArts</Authors>
1212
<Company>VolcanicArts</Company>
1313
<Nullable>enable</Nullable>
14-
<AssemblyVersion>2023.430.0</AssemblyVersion>
14+
<AssemblyVersion>2023.503.0</AssemblyVersion>
1515
</PropertyGroup>
1616
<ItemGroup Label="Project References">
1717
<ProjectReference Include="..\VRCOSC.Game\VRCOSC.Game.csproj" />

VRCOSC.Game/ChatBox/ChatBoxManager.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.Generic;
66
using System.Collections.Immutable;
77
using System.Linq;
8+
using System.Text.RegularExpressions;
89
using Newtonsoft.Json;
910
using osu.Framework.Bindables;
1011
using osu.Framework.Extensions.IEnumerableExtensions;
@@ -280,7 +281,21 @@ private void handleClip(Clip? clip)
280281

281282
private void sendText(string text)
282283
{
283-
oscClient.SendValues(VRChatOscConstants.ADDRESS_CHATBOX_INPUT, new List<object> { text, true, false });
284+
var finalText = convertSpecialCharacters(text);
285+
oscClient.SendValues(VRChatOscConstants.ADDRESS_CHATBOX_INPUT, new List<object> { finalText, true, false });
286+
}
287+
288+
private static string convertSpecialCharacters(string input)
289+
{
290+
const int required_width = 64;
291+
292+
input = Regex.Replace(input, @"/v", "\v");
293+
294+
return Regex.Replace(input, @"/n", match =>
295+
{
296+
var spaces = match.Index == 0 ? 0 : match.Index - input.LastIndexOf(@"/n", match.Index - 1, StringComparison.Ordinal) - 1;
297+
return spaces < 0 ? string.Empty : new string(' ', required_width - spaces);
298+
});
284299
}
285300

286301
public void Clear()

VRCOSC.Game/ChatBox/DefaultTimeline.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ private static Clip generateSpeechToTextClip(ChatBoxManager chatBoxManager)
9191
clip.Start.Value = 0;
9292
clip.End.Value = 60;
9393
clip.AssociatedModules.Add(@"speechtotextmodule");
94+
clip.GetStateFor(@"speechtotextmodule", @"textgenerating")!.Enabled.Value = true;
9495
clip.GetEventFor(@"speechtotextmodule", @"textgenerated")!.Enabled.Value = true;
9596

9697
return clip;

VRCOSC.Game/ChatBox/Serialisation/V1/TimelineSerialiser.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENSE file in the repository root for full license text.
33

44
using System.IO;
5+
using System.Text;
56
using Newtonsoft.Json;
67
using osu.Framework.Platform;
78
using VRCOSC.Game.ChatBox.Serialisation.V1.Structures;
@@ -23,24 +24,27 @@ public void Serialise(ChatBoxManager chatBoxManager)
2324
{
2425
lock (saveLock)
2526
{
27+
var data = Encoding.Unicode.GetBytes(JsonConvert.SerializeObject(new SerialisableTimeline(chatBoxManager)));
28+
2629
using var stream = storage.CreateFileSafely(file_name);
27-
using var writer = new StreamWriter(stream);
28-
writer.Write(JsonConvert.SerializeObject(new SerialisableTimeline(chatBoxManager)));
30+
stream.Write(data);
2931
}
3032
}
3133

3234
public SerialisableTimeline? Deserialise()
3335
{
34-
using (var stream = storage.GetStream(file_name))
36+
lock (saveLock)
3537
{
36-
if (stream is not null)
37-
{
38-
using var reader = new StreamReader(stream);
38+
if (!storage.Exists(file_name)) return null;
3939

40-
return JsonConvert.DeserializeObject<SerialisableTimeline>(reader.ReadToEnd());
40+
try
41+
{
42+
return JsonConvert.DeserializeObject<SerialisableTimeline>(Encoding.Unicode.GetString(File.ReadAllBytes(storage.GetFullPath(file_name))));
43+
}
44+
catch // migration from UTF-8
45+
{
46+
return JsonConvert.DeserializeObject<SerialisableTimeline>(File.ReadAllText(storage.GetFullPath(file_name)));
4147
}
4248
}
43-
44-
return null;
4549
}
4650
}

VRCOSC.Game/Graphics/ChatBox/SelectedClip/DrawableEvent.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public partial class DrawableEvent : Container
2121
[Resolved]
2222
private GameManager gameManager { get; set; } = null!;
2323

24-
private readonly ClipEvent clipEvent;
24+
public readonly ClipEvent ClipEvent;
2525

2626
public DrawableEvent(ClipEvent clipEvent)
2727
{
28-
this.clipEvent = clipEvent;
28+
ClipEvent = clipEvent;
2929
}
3030

3131
[BackgroundDependencyLoader]
@@ -68,7 +68,7 @@ private void load()
6868
Anchor = Anchor.Centre,
6969
Origin = Anchor.Centre,
7070
RelativeSizeAxes = Axes.Both,
71-
State = clipEvent.Enabled.GetBoundCopy()
71+
State = ClipEvent.Enabled.GetBoundCopy()
7272
}
7373
},
7474
new Container
@@ -82,7 +82,7 @@ private void load()
8282
Anchor = Anchor.CentreLeft,
8383
Origin = Anchor.CentreLeft,
8484
Font = FrameworkFont.Regular.With(size: 20),
85-
Text = gameManager.ModuleManager.GetModuleName(clipEvent.Module) + " - " + clipEvent.Name + ":",
85+
Text = gameManager.ModuleManager.GetModuleName(ClipEvent.Module) + " - " + ClipEvent.Name + ":",
8686
Colour = ThemeManager.Current[ThemeAttribute.Text]
8787
}
8888
}
@@ -110,7 +110,7 @@ private void load()
110110
Child = new VRCOSCTextBox
111111
{
112112
RelativeSizeAxes = Axes.Both,
113-
Current = clipEvent.Format.GetBoundCopy(),
113+
Current = ClipEvent.Format.GetBoundCopy(),
114114
Masking = true,
115115
CornerRadius = 5
116116
}
@@ -122,7 +122,7 @@ private void load()
122122
Child = lengthTextBox = new IntTextBox
123123
{
124124
RelativeSizeAxes = Axes.Both,
125-
Text = clipEvent.Length.Value.ToString(),
125+
Text = ClipEvent.Length.Value.ToString(),
126126
Masking = true,
127127
CornerRadius = 5,
128128
PlaceholderText = "Length"
@@ -135,6 +135,6 @@ private void load()
135135
}
136136
};
137137

138-
lengthTextBox.OnValidEntry = newLength => clipEvent.Length.Value = newLength;
138+
lengthTextBox.OnValidEntry = newLength => ClipEvent.Length.Value = newLength;
139139
}
140140
}

VRCOSC.Game/Graphics/ChatBox/SelectedClip/SelectedClipStateEditorContainer.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,17 @@ private void filterFlows()
255255

256256
drawableState.Alpha = enabledModuleNames.SequenceEqual(sortedClipModuleNames) ? 1 : 0;
257257
});
258+
259+
eventFlow.ForEach(drawableEvent =>
260+
{
261+
var moduleName = drawableEvent.ClipEvent.Module;
262+
drawableEvent.Alpha = enabledModuleNames.Contains(moduleName) ? 1 : 0;
263+
});
258264
}
259265
else
260266
{
261267
stateFlow.ForEach(drawableState => drawableState.Alpha = 1);
268+
eventFlow.ForEach(drawableState => drawableState.Alpha = 1);
262269
}
263270
}
264271

VRCOSC.Game/Graphics/ChatBox/Timeline/DrawableClip.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ protected override void OnDrag(DragEvent e)
229229
var mousePosNormalised = e.MousePosition.X / timelineLayer.DrawWidth;
230230
var newStart = (int)Math.Floor(mousePosNormalised * chatBoxManager.TimelineLengthSeconds);
231231

232-
if (newStart != Clip.Start.Value)
232+
if (newStart != Clip.Start.Value && newStart < Clip.End.Value)
233233
{
234234
var (lowerBound, upperBound) = timelineLayer.GetBoundsNearestTo(newStart < Clip.Start.Value ? Clip.Start.Value : newStart, false);
235235

@@ -267,7 +267,7 @@ protected override void OnDrag(DragEvent e)
267267
var mousePosNormalised = e.MousePosition.X / timelineLayer.DrawWidth;
268268
var newEnd = (int)Math.Ceiling(mousePosNormalised * chatBoxManager.TimelineLengthSeconds);
269269

270-
if (newEnd != Clip.Start.Value)
270+
if (newEnd != Clip.End.Value && newEnd > Clip.Start.Value)
271271
{
272272
var (lowerBound, upperBound) = timelineLayer.GetBoundsNearestTo(newEnd < Clip.End.Value ? newEnd : Clip.End.Value, true);
273273

VRCOSC.Game/Graphics/ModuleListing/ModuleCard.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ private Colour4 calculateModuleColour()
183183
Module.ModuleType.Health => Colour4.Red,
184184
Module.ModuleType.Integrations => Colour4.Yellow.Darken(0.25f),
185185
Module.ModuleType.OpenVR => Colour4.FromHex(@"04144d"),
186+
Module.ModuleType.Accessibility => Colour4.FromHex(@"0278D8"),
186187
_ => throw new ArgumentOutOfRangeException()
187188
};
188189
}

VRCOSC.Game/Modules/ChatBox/ChatBoxModule.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ public abstract class ChatBoxModule : Module
1414
protected void SetVariableValue(Enum lookup, string? value) => ChatBoxManager.SetVariable(SerialisedName, lookup.ToLookup(), value);
1515
protected string GetVariableFormat(Enum lookup) => ChatBoxManager.VariableMetadata[SerialisedName][lookup.ToLookup()].DisplayableFormat;
1616

17+
protected void SetAllVariableValues<T>(string? value) where T : Enum => setAllVariableValues(typeof(T), value);
18+
19+
private void setAllVariableValues(Type lookupType, string? value)
20+
{
21+
foreach (Enum lookup in Enum.GetValues(lookupType))
22+
{
23+
SetVariableValue(lookup, value);
24+
}
25+
}
26+
1727
protected void ChangeStateTo(Enum lookup) => ChatBoxManager.ChangeStateTo(SerialisedName, lookup.ToLookup());
1828
protected void TriggerEvent(Enum lookup) => ChatBoxManager.TriggerEvent(SerialisedName, lookup.ToLookup());
1929

VRCOSC.Game/Modules/Module.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,11 @@ public enum ModuleState
284284

285285
public enum ModuleType
286286
{
287-
Health = 0,
288-
OpenVR = 1,
289-
Integrations = 2,
290-
General = 3,
287+
Health,
288+
Accessibility,
289+
OpenVR,
290+
Integrations,
291+
General
291292
}
292293

293294
public int CompareTo(Module? other)

VRCOSC.Game/Modules/SRanipalAPIInterface.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)