Compare commits

..

2 Commits

5 changed files with 54 additions and 17 deletions

View File

@@ -84,9 +84,9 @@ public class Initialization
"Always present patch. Never get kicked to dorm."); "Always present patch. Never get kicked to dorm.");
ServerPatchesConfig.CustomEmotes = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomEmotes", ServerPatchesConfigDefaults.CustomEmotes, ServerPatchesConfig.CustomEmotes = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomEmotes", ServerPatchesConfigDefaults.CustomEmotes,
"Modify the game's emote text with a configuration from the server. Requires a custom server."); "Modify the game's emote text with a configuration from the server.");
ServerPatchesConfig.CustomPhoton = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomPhoton", ServerPatchesConfigDefaults.CustomPhoton, ServerPatchesConfig.CustomPhoton = UniversalPatchPlugin.Instance.Config.Bind("ServerPatches", "CustomPhoton", ServerPatchesConfigDefaults.CustomPhoton,
"Patch ServerSettings values with a configuration from the server." + "Patch Photon ServerSettings values with a configuration from the server." +
"\nWhen the server fails to provide a valid configuration, values from the local config will be used." + "\nWhen the server fails to provide a valid configuration, values from the local config will be used." +
"\nPhoton.PatchPhotonIds must be enabled for this fallback to work."); "\nPhoton.PatchPhotonIds must be enabled for this fallback to work.");
@@ -98,25 +98,25 @@ public class Initialization
PhotonConfig.PatchPhotonIds = UniversalPatchPlugin.Instance.Config.Bind("Photon", "PatchPhotonIds", PhotonConfigDefaults.PatchPhotonIds, PhotonConfig.PatchPhotonIds = UniversalPatchPlugin.Instance.Config.Bind("Photon", "PatchPhotonIds", PhotonConfigDefaults.PatchPhotonIds,
"Patch Photon configuration."); "Patch Photon configuration.");
PhotonConfig.PunLogging = UniversalPatchPlugin.Instance.Config.Bind("Photon", "PunLogging", PhotonConfigDefaults.PunLogging, PhotonConfig.PunLogging = UniversalPatchPlugin.Instance.Config.Bind("Photon", "PunLogging", PhotonConfigDefaults.PunLogging,
"Enable all logging sent by Photon/PUN/Voice (useful for server debugging)"); "Enable all PUN/Voice logging (useful for server debugging)");
PhotonConfig.SelfHosted = UniversalPatchPlugin.Instance.Config.Bind("Photon", "IsSelfHosted", PhotonConfigDefaults.SelfHosted, PhotonConfig.SelfHosted = UniversalPatchPlugin.Instance.Config.Bind("Photon", "IsSelfHosted", PhotonConfigDefaults.SelfHosted,
"When enabled, use a self-hosted 'OnPremises' PhotonSocketServer. (EXPERIMENTAL)" + "When enabled, use a self-hosted ('OnPremises' or 'PhotonSocketServer') Photon server." +
"\nWhen disabled, AppID and VoiceAppID are sent to Photon Cloud and a cloud masterserver is used."); "\nWhen disabled, AppID and VoiceAppID are sent to Photon Cloud and a cloud masterserver is used.");
PhotonConfig.AppID = UniversalPatchPlugin.Instance.Config.Bind("Photon", "AppID", PhotonConfigDefaults.AppID, PhotonConfig.AppID = UniversalPatchPlugin.Instance.Config.Bind("Photon", "AppID", PhotonConfigDefaults.AppID,
"The new target (PUN) App ID from the Photon dashboard." + "The new target (PUN) App ID from the Photon dashboard." +
"\nWhen self-hosting, this should be the name of your application (either 'Master' or 'Game')"); "\nWhen self-hosting, this should be the name of your Photon application (usually 'Master' without quotes)");
PhotonConfig.VoiceAppID = UniversalPatchPlugin.Instance.Config.Bind("Photon", "VoiceAppID", PhotonConfigDefaults.VoiceAppID, PhotonConfig.VoiceAppID = UniversalPatchPlugin.Instance.Config.Bind("Photon", "VoiceAppID", PhotonConfigDefaults.VoiceAppID,
"The new target Voice App ID from the Photon dashboard." + "The new target Voice App ID from the Photon dashboard." +
"\nWhen self-hosting, this value is ignored, since Photon voice in Rec Room is based on PUN."); "\nWhen self-hosting, this should be the same as AppID.");
PhotonConfig.ServerAddress = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ServerAddress", PhotonConfigDefaults.ServerAddress, PhotonConfig.ServerAddress = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ServerAddress", PhotonConfigDefaults.ServerAddress,
"Address of the Photon target server (ignored if not using self-hosted)"); "Address of the Photon Master server (ignored if using cloud)");
PhotonConfig.ServerPort = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ServerPort", PhotonConfigDefaults.ServerPort, PhotonConfig.ServerPort = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ServerPort", PhotonConfigDefaults.ServerPort,
"Photon target server port (ignored if not using self-hosted)." + "Photon Master server port (ignored if using cloud)." +
"\nYou can set this port to the matching protocol port from the server, e.g. 5055 for UDP, 9091 for WebSockets"); "\nYou can set this port to the matching protocol port from the server, e.g. 5055 for UDP, 9091 for WebSockets");
PhotonConfig.ConnectionProtocol = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ConnectionProtocol", PhotonConfigDefaults.ConnectionProtocol, PhotonConfig.ConnectionProtocol = UniversalPatchPlugin.Instance.Config.Bind("Photon", "ConnectionProtocol", PhotonConfigDefaults.ConnectionProtocol,
"Connection protocol to use when connecting to the target port (ignored if not using self-hosted)." + "Connection protocol to use when connecting to the Photon servers (ignored if using cloud)." +
"\n0: UDP, 1: TCP;" + "\n0: UDP, 1: TCP;" +
"\nWebSockets are not supported by Photon in this build."); "\nWebSockets are not supported by Photon in this build. TCP is experimental and may cause instability/crashes.");
NameserverConfig.Rewrite = UniversalPatchPlugin.Instance.Config.Bind("Nameserver", "Rewrite", NameserverConfigDefaults.Rewrite, NameserverConfig.Rewrite = UniversalPatchPlugin.Instance.Config.Bind("Nameserver", "Rewrite", NameserverConfigDefaults.Rewrite,
"Enable/disable rewriting the URL for nameserver requests."); "Enable/disable rewriting the URL for nameserver requests.");

View File

@@ -1,5 +1,7 @@
using System.Linq;
using System.Reflection; using System.Reflection;
using HarmonyLib; using HarmonyLib;
using Mapster;
using undead_universal_patch_il2cpp.Core; using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Config; using undead_universal_patch_il2cpp.Core.Config;
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomPhoton; using undead_universal_patch_il2cpp.Core.Content.CustomRecNet.CustomPhoton;
@@ -101,7 +103,12 @@ public class PhotonThrottlingPatch
"UpdatePhotonThrottling" "UpdatePhotonThrottling"
); );
static bool Prepare() => patchTypesResult.Success; static bool Prepare()
{
if (PhotonConfig.ConnectionProtocol.Value == 1) return patchTypesResult.Success;
else return false;
}
static MethodBase TargetMethod() => patchTypesResult.Method; static MethodBase TargetMethod() => patchTypesResult.Method;
static bool Prefix() => PhotonConfig.ConnectionProtocol.Value != 1; static bool Prefix() => PhotonConfig.ConnectionProtocol.Value != 1;

View File

@@ -6,7 +6,7 @@ using undead_universal_patch_il2cpp.Core;
namespace undead_universal_patch_il2cpp; namespace undead_universal_patch_il2cpp;
[BepInPlugin("dev.proxnet.recroom.universalpatch.noneac.il2cpp", "Undead Universal Patch", "2.1.0")] [BepInPlugin("dev.proxnet.recroom.universalpatch.noneac.il2cpp", "Undead Universal Patch", "2.1.1")]
public class UniversalPatchPlugin : BasePlugin public class UniversalPatchPlugin : BasePlugin
{ {
public static new readonly ManualLogSource Log = Logger.CreateLogSource("UUPatch"); public static new readonly ManualLogSource Log = Logger.CreateLogSource("UUPatch");

View File

@@ -8,15 +8,31 @@ Requests are sent after any of these events:
* Local account fetch response * Local account fetch response
## Endpoints ## Endpoints
### `API: GET "/api/undead/v1/emotes"`
Expects: `List<EmoteConfigDTO>`
[EmoteConfigDTO](#emoteconfigdto) ### `API: GET "/api/undead/v1/emotes"`
Expects: `List<EmoteConfigDTO>` [(to DTO)](#emoteconfigdto)
Replace existing emotes in the game with these, keyed by `UniqueName`. Replace existing emotes in the game with these, keyed by `UniqueName`.
See [the source](./Core/CustomRecNet/CustomEmotes/RecNetEmotes.cs) for more information.
See [the source](.\Core\CustomRecNet\CustomEmotes\RecNetEmotes.cs) for more information.
### `API: GET "/api/undead/v1/photon"`
Expects: `PhotonConfigDTO` [(to DTO)](#photonconfigdto)
The patch uses a Photon configuration given by the server.<br>
When this fails, the patch will fall back to the local config, if enabled.
`ConnectionProtocol` is 0 for UDP, or 1 for TCP. Use UDP if you don't know what to use.<br>
`ServerAddress`, `ServerPort`, and `ConnectionProtocol` are ignored when `SelfHosted` is enabled.
When using a self-hosted server, ideally, you should set the `AppID` *and* `VoiceAppID` to the name<br>
of your application, e.g. Master when using the port for a default Masterserver.<br>
Voice will go over the same gameserver port as PUN does when selfhosting.
See [the source](.\Core\Content\CustomRecNet\CustomPhoton\CustomPhoton.cs) for more information.
## DTOs ## DTOs
### `EmoteConfigDTO` ### `EmoteConfigDTO`
```c# ```c#
public class EmoteConfigDTO public class EmoteConfigDTO
@@ -28,4 +44,18 @@ public class EmoteConfigDTO
public bool ForceEmoteBubble { get; set; } public bool ForceEmoteBubble { get; set; }
public bool OnlyBroadcastToTeam { get; set; } public bool OnlyBroadcastToTeam { get; set; }
} }
```
### `PhotonConfigDTO`
```c#
public class PhotonConfigDTO
{
public bool Logging { get; set; }
public string AppID { get; set; }
public string VoiceAppID { get; set; }
public bool SelfHosted { get; set; }
public string ServerAddress { get; set; }
public int ServerPort { get; set; }
public byte ConnectionProtocol { get; set; }
}
``` ```

View File

@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AssemblyName>undead_universal_patch_il2cpp</AssemblyName> <AssemblyName>undead_universal_patch_il2cpp</AssemblyName>
<Description>Non-EAC, IL2CPP build patcher for Rec Room (Late 2018*-*April 2020) </Description> <Description>Non-EAC, IL2CPP build patcher for Rec Room (Late 2018*-*April 2020) </Description>
<Version>2.1.0</Version> <Version>2.1.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>