4 Commits

Author SHA1 Message Date
lamp 65d70aca42 assembly ver 1.1 2022-10-20 18:57:43 -07:00
lamp 95763cb8bb add image 2022-10-20 18:55:25 -07:00
lamp a728d8d100 create readme 2022-10-20 18:48:33 -07:00
lamp 707578104c chat history 2022-10-20 18:13:00 -07:00
5 changed files with 62 additions and 15 deletions
+29 -13
View File
@@ -45,6 +45,8 @@ 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 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 +55,20 @@ 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));
quota--; quota--;
if (quotaResetTimer == null) { if (quotaResetTimer == null) {
quotaResetTimer = new System.Timers.Timer(QUOTA_TIME); quotaResetTimer = new System.Timers.Timer(QUOTA_TIME);
@@ -88,31 +96,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 +138,9 @@ 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);
RenderChatbox(); RenderChatbox();
} }
+2 -2
View File
@@ -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.1")]
[assembly: AssemblyFileVersion("1.0")] [assembly: AssemblyFileVersion("1.1")]
+28
View File
@@ -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**
- Alt-tabbing might be easier than finding the in-game input
- 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
- 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?
+3
View File
@@ -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>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 336 KiB