Skip to content

Commit 2c94cc1

Browse files
authored
Merge pull request #4 from pikepikeid/Fix4
2 parents a69d176 + 28ffb2a commit 2c94cc1

3 files changed

Lines changed: 44 additions & 11 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"start-init": "初期化を開始しています...",
3+
"config-path": "設定ファイルの場所: {0}",
4+
"force-disable-eye": "アイトラッキングは強制的に無効化されています",
5+
"force-disable-expression": "フェイストラッキングは強制的に無効化されています",
6+
"initializing-udp-clients": "UDPクライアントのポートを {0} で初期化しています",
7+
"using-port": "使用ポート: {0}",
8+
"eye-tracking-disabled": "アイトラッキングは無効です",
9+
"expression-tracking-disabled": "フェイストラッキングは無効です",
10+
"legacy-protocol": "レガシープロトコル",
11+
"full-face-tracking": "フルフェイストラッキング",
12+
"eye-tracking": "アイトラッキング",
13+
"expression-tracking": "フェイストラッキング",
14+
"init-failed": "初期化に失敗しました。例外: {0}",
15+
"update-timeout": "データ受信がタイムアウトしました",
16+
"update-failed": "アップデートに失敗しました: {0}",
17+
"eye-gain-loaded": "視線ゲインを読み込みました: X={0}, Y={1}",
18+
"eye-gain-invalid": "eye_gain.txt の形式が無効です: \"{0}\"",
19+
"eye-gain-not-found": "eye_gain.txt が見つからないため、デフォルト値(1.0)を使用します",
20+
"eye-gain-disabled": "視線ゲインは無効です",
21+
"eye-gain-failed": "eye_gain.txt の読み込みに失敗しました"
22+
}

VRCFTPicoModule/VRCFTPicoModule.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace VRCFTPicoModule;
1111
public class VRCFTPicoModule : ExtTrackingModule
1212
{
1313
private static readonly int[] Ports = [29765, 29763];
14-
private static readonly UdpClient[] Clients = Ports.Select(port => new UdpClient(port) { Client = { ReceiveTimeout = 100 } }).ToArray();
14+
private UdpClient[] _clients = [];
1515
private static UdpClient _udpClient = new();
1616
private static int _port;
1717
private Updater? _updater;
@@ -108,7 +108,7 @@ private void UpdateModuleInfo((bool, bool) initializationResult)
108108
{ Item1: false, Item2: true } => T("expression-tracking"),
109109
_ => ""
110110
};
111-
ModuleInformation.Name = "PICO / " + moduleTrackingStatus + moduleProtocol;
111+
ModuleInformation.Name = "VRCFTPicoModule (modified) / " + moduleTrackingStatus + moduleProtocol;
112112
var stream = GetType().Assembly.GetManifestResourceStream("VRCFTPicoModule.Assets.pico.png");
113113
ModuleInformation.StaticImages = stream != null ? [stream] : ModuleInformation.StaticImages;
114114
}
@@ -117,7 +117,12 @@ private async Task<int> ListenOnPorts()
117117
{
118118
try
119119
{
120-
var tasks = Clients.Select(client => client.ReceiveAsync()).ToArray();
120+
_clients = Ports.Select(port => new UdpClient(port)
121+
{
122+
Client = { ReceiveTimeout = 100 }
123+
}).ToArray();
124+
125+
var tasks = _clients.Select(client => client.ReceiveAsync()).ToArray();
121126

122127
if (tasks.Length == 0)
123128
{
@@ -126,7 +131,7 @@ private async Task<int> ListenOnPorts()
126131

127132
var completedTask = await Task.WhenAny(tasks);
128133

129-
foreach (var client in Clients) client.Dispose();
134+
foreach (var client in _clients) client.Dispose();
130135

131136
return Array.IndexOf(tasks, completedTask);
132137
}
@@ -143,7 +148,7 @@ public override void Update()
143148
if (_shuttingDown) return;
144149

145150
try
146-
{
151+
{
147152
_updater?.Update(Status);
148153
}
149154
catch (AggregateException ex) when (ex.InnerException is ObjectDisposedException) { }
@@ -154,7 +159,7 @@ public override void Teardown()
154159
{
155160
_shuttingDown = true;
156161

157-
foreach (var client in Clients)
162+
foreach (var client in _clients)
158163
client.Dispose();
159164
_udpClient.Dispose();
160165
}
@@ -164,7 +169,7 @@ private void LoadEyeGain()
164169
{
165170
if (!File.Exists(GainFilePath))
166171
{
167-
Logger.LogDebug("eye_gain.txt not found, using default values");
172+
Logger.LogInformation(T("eye-gain-not-found"));
168173
return;
169174
}
170175

@@ -178,16 +183,16 @@ private void LoadEyeGain()
178183
_eyeGainX = x;
179184
_eyeGainY = y;
180185

181-
Logger.LogInformation($"Eye gain loaded: X={_eyeGainX}, Y={_eyeGainY}");
186+
Logger.LogInformation(T("eye-gain-loaded"),_eyeGainX,_eyeGainY);
182187
}
183188
else
184189
{
185-
Logger.LogWarning($"Invalid eye_gain.txt format: \"{text}\"");
190+
Logger.LogWarning(T("eye-gain-invalid"),text);
186191
}
187192
}
188193
catch (Exception ex)
189194
{
190-
Logger.LogError(ex, "Failed to read eye_gain.txt");
195+
Logger.LogError(ex, T("eye-gain-failed"));
191196
}
192197
}
193198
}

VRCFTPicoModule/VRCFTPicoModule.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<LangVersion>preview</LangVersion>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<AssemblyVersion>0.1.11</AssemblyVersion>
7+
<AssemblyVersion>0.1.10.4</AssemblyVersion>
88
<FileVersion>$(AssemblyVersion)</FileVersion>
99
<Version>$(AssemblyVersion)</Version>
1010
</PropertyGroup>
@@ -26,6 +26,12 @@
2626
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2727
</EmbeddedResource>
2828
</ItemGroup>
29+
<ItemGroup>
30+
<None Remove="Assets\Locales\ja-JP.json" />
31+
<EmbeddedResource Include="Assets\Locales\ja-JP.json">
32+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
33+
</EmbeddedResource>
34+
</ItemGroup>
2935
<Target Name="PostBuild" AfterTargets="Build" Condition="'$(ContinuousIntegrationBuild)' != 'true'">
3036
<Copy SourceFiles="$(TargetPath)" DestinationFiles="$(APPDATA)\VRCFaceTracking\CustomLibs\$(TargetFileName)" OverwriteReadOnlyFiles="True" SkipUnchangedFiles="True" />
3137
</Target>

0 commit comments

Comments
 (0)