Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Lamp | bfba6943ea | |
Lamp | d9af0db860 | |
Lamp | 54f7a8dca6 | |
Lamp | 65d70aca42 | |
Lamp | 95763cb8bb | |
Lamp | a728d8d100 | |
Lamp | 707578104c |
47
Program.cs
47
Program.cs
|
@ -45,6 +45,9 @@ namespace VRChatboxApp {
|
||||||
private int quota = QUOTA_SIZE;
|
private int quota = QUOTA_SIZE;
|
||||||
private System.Timers.Timer quotaResetTimer;
|
private System.Timers.Timer quotaResetTimer;
|
||||||
private string pendingMessage;
|
private string pendingMessage;
|
||||||
|
//private string lastMessage;
|
||||||
|
//private DateTime lastMessageTime;
|
||||||
|
public bool soundOnNextSend = false;
|
||||||
|
|
||||||
public VRChatboxSender(string ip_address, int dstport, int srcport) {
|
public VRChatboxSender(string ip_address, int dstport, int srcport) {
|
||||||
osc = new OscSender(System.Net.IPAddress.Parse(ip_address), srcport, dstport);
|
osc = new OscSender(System.Net.IPAddress.Parse(ip_address), srcport, dstport);
|
||||||
|
@ -53,14 +56,21 @@ namespace VRChatboxApp {
|
||||||
|
|
||||||
public event EventHandler<EventArgs<string>> OnSend;
|
public event EventHandler<EventArgs<string>> OnSend;
|
||||||
|
|
||||||
public void send(string text) {
|
public void send(string message) {
|
||||||
|
/* this is only good if viewer hasnt turned down chatbox display duration
|
||||||
|
if (message == lastMessage && (DateTime.Now - lastMessageTime).Seconds < 30) return;
|
||||||
|
else {
|
||||||
|
lastMessage = message;
|
||||||
|
lastMessageTime = DateTime.Now;
|
||||||
|
}*/
|
||||||
if (quota == 0) {
|
if (quota == 0) {
|
||||||
//Console.WriteLine("pending: " + text);
|
//Console.WriteLine("pending: " + text);
|
||||||
pendingMessage = text;
|
pendingMessage = message;
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("send: " + text);
|
Console.WriteLine("send: " + message);
|
||||||
OnSend(this, new EventArgs<string>(text));
|
OnSend(this, new EventArgs<string>(message));
|
||||||
osc.Send(new OscMessage("/chatbox/input", text, true));
|
osc.Send(new OscMessage("/chatbox/input", message, true, soundOnNextSend));
|
||||||
|
soundOnNextSend = false;
|
||||||
quota--;
|
quota--;
|
||||||
if (quotaResetTimer == null) {
|
if (quotaResetTimer == null) {
|
||||||
quotaResetTimer = new System.Timers.Timer(QUOTA_TIME);
|
quotaResetTimer = new System.Timers.Timer(QUOTA_TIME);
|
||||||
|
@ -88,31 +98,37 @@ namespace VRChatboxApp {
|
||||||
public static VRChatboxSender chatbox = new VRChatboxSender("127.0.0.1", 9000, 8999);
|
public static VRChatboxSender chatbox = new VRChatboxSender("127.0.0.1", 9000, 8999);
|
||||||
|
|
||||||
private static System.Timers.Timer timer;
|
private static System.Timers.Timer timer;
|
||||||
private static string chatMessage = "";
|
private static List<string> chats = new List<string>();
|
||||||
|
|
||||||
private static string GenerateStats() {
|
private static string GenerateStats() {
|
||||||
var time = DateTime.Now.ToShortTimeString();
|
var time = DateTime.Now.ToShortTimeString();
|
||||||
var fps = VRChatFPSMonitor.GetFPS();
|
var fps = VRChatFPSMonitor.GetFPS();
|
||||||
var stats = time + ", " + "FPS: " + fps;
|
var stats = time + ", " + fps + " FPS";
|
||||||
var app = ActiveAppGetter.GetActiveAppName();
|
var app = ActiveAppGetter.GetActiveAppName();
|
||||||
var self = Process.GetCurrentProcess().ProcessName;
|
var self = Process.GetCurrentProcess().ProcessName;
|
||||||
if (app == self && chatMessage == "") stats += ", ...";
|
if (app != "VRChat.exe" && app != self) stats += ", using " + app;
|
||||||
else if (app != "VRChat.exe" && app != self) stats += ", using " + app;
|
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderChatbox() {
|
private static void RenderChatbox() {
|
||||||
string content;
|
string content;
|
||||||
var stats = GenerateStats();
|
var stats = GenerateStats();
|
||||||
if (String.IsNullOrEmpty(chatMessage)) {
|
if (chats.Count == 0) {
|
||||||
chatbox.send(stats);
|
chatbox.send(stats);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var separator = " | ";
|
var separator = " | ";
|
||||||
var excessLength = stats.Length + separator.Length + chatMessage.Length - 144;
|
var chatString = String.Join(separator, chats);
|
||||||
|
while (chatString.Length > 144) {
|
||||||
|
chats.RemoveAt(0);
|
||||||
|
chatString = String.Join(separator, chats);
|
||||||
|
}
|
||||||
|
|
||||||
|
var excessLength = stats.Length + separator.Length + chatString.Length - 144;
|
||||||
if (excessLength > 0) stats = stats.Substring(0, Math.Max(stats.Length - separator.Length - excessLength, 0));
|
if (excessLength > 0) stats = stats.Substring(0, Math.Max(stats.Length - separator.Length - excessLength, 0));
|
||||||
if (stats.Length > 0) stats += separator;
|
if (stats.Length > 0) stats += separator;
|
||||||
content = stats + chatMessage;
|
content = stats + chatString;
|
||||||
|
|
||||||
chatbox.send(content);
|
chatbox.send(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +140,12 @@ namespace VRChatboxApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendChatMessage(string message) {
|
public static void SendChatMessage(string message) {
|
||||||
chatMessage = message;
|
if (message.Length > 144) message = message.Substring(0, 144);
|
||||||
|
if (String.IsNullOrEmpty(message)) chats.Clear();
|
||||||
|
else {
|
||||||
|
chats.Add(message);
|
||||||
|
chatbox.soundOnNextSend = true;
|
||||||
|
}
|
||||||
RenderChatbox();
|
RenderChatbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("lamp")]
|
[assembly: AssemblyCompany("lamp")]
|
||||||
[assembly: AssemblyProduct("VRChatboxApp")]
|
[assembly: AssemblyProduct("VRChatboxApp")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
[assembly: AssemblyCopyright("Copyright © 2024")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0")]
|
[assembly: AssemblyVersion("1.2")]
|
||||||
[assembly: AssemblyFileVersion("1.0")]
|
[assembly: AssemblyFileVersion("1.2")]
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
# VRChatboxApp
|
||||||
|
|
||||||
|
- Shows time and FPS in chatbox (updates every 2 seconds)
|
||||||
|
- Shows the active application if it's not VRChat (useful when chilling on desktop while alt-tabbing to other things)
|
||||||
|
- Input chat with external window
|
||||||
|
- Allows you to **continue chatting on desktop after taking off your headset and loosing control of VRChat**
|
||||||
|
- Chat persists until cleared
|
||||||
|
- Chat messages are appended so you have some **chat history**
|
||||||
|
- Able to update chatbox instantly while avoiding spam timeout
|
||||||
|
|
||||||
|
![screenshot](screenshot.png)
|
||||||
|
|
||||||
|
Download latest build from [releases](https://gitea.moe/lamp/VRChatboxApp/releases) and just run the executable.
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
- If it doesn't work, run it as administrator, or add your user to the "Performance Log Users" group: open "Computer Management", find your user, type in this exact group name, then log out and back in.
|
||||||
|
- This app uses VRChat OSC; make sure to [enable it](https://docs.vrchat.com/docs/osc-overview#enabling-it).
|
||||||
|
- You cannot use in-game chatbox input, hence the external window.
|
||||||
|
- Anti-spam-timeout isn't foolproof apparently; you might trigger it if you spam chat input of this app.
|
||||||
|
- The timeout may also trigger after VRChat freezes (such as when loading a world).
|
||||||
|
|
||||||
|
|
||||||
|
### Todo
|
||||||
|
|
||||||
|
- Osc receiver so that other stuff can be plugged into this app
|
||||||
|
- GUI improvements, typing indicator
|
||||||
|
- What other cool stuff could be put in the chatbox?
|
|
@ -53,6 +53,9 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<SignManifests>false</SignManifests>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Dia2Lib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Dia2Lib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Microsoft.Diagnostics.Tracing.TraceEvent.3.0.5\lib\net462\Dia2Lib.dll</HintPath>
|
<HintPath>packages\Microsoft.Diagnostics.Tracing.TraceEvent.3.0.5\lib\net462\Dia2Lib.dll</HintPath>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 336 KiB |
Loading…
Reference in New Issue