Skip to content

Commit b0b929a

Browse files
committed
CreatePortal fixed, mod is actually working now
1 parent 4112178 commit b0b929a

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

AdvancedInvites/BuildInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public static class BuildInfo
4444
// 1.6.9 Updated for VRC build 1151
4545
// 1.6.10 Hopefully fixed NRE
4646
// 1.7.0 Updated for VRC build 1171
47-
public const string Version = "1.7.0";
47+
// 1.7.1 CreatePortal fixed, mod actually working
48+
public const string Version = "1.7.1";
4849

4950
}
5051

AdvancedInvites/InviteHandler.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private static void DropPortal()
8989

9090
// CreatePortal (before il2cpp)
9191
bool created = Utilities.CreatePortal(apiWorld, apiWorldInstance, playerTransform.position, playerTransform.forward,
92-
GetFunctionPointer(nameof(ShowErrorReason)));
92+
Utilities.ShowErrorReason);
9393
if (created && DeleteNotifications)
9494
Utilities.DeleteNotification(currentNotification);
9595
}),
@@ -98,16 +98,6 @@ private static void DropPortal()
9898
new Action<ApiContainer>(container => Utilities.ShowAlert("Error Fetching World", container.Error)));
9999
}
100100

101-
public static void ShowErrorReason(string error)
102-
{
103-
Utilities.ShowAlert("Error Creating Portal", error);
104-
}
105-
106-
private static IntPtr GetFunctionPointer(string methodName)
107-
{
108-
return typeof(Utilities).GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Static)!.MethodHandle.GetFunctionPointer();
109-
}
110-
111101
private static void JoinYourself()
112102
{
113103
Utilities.HideCurrentPopup();

AdvancedInvites/Utilities.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,21 @@ public static bool AllowedToInvite()
352352
};
353353
}
354354

355-
public static bool CreatePortal(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 position, Vector3 forward, IntPtr errorReasonCallback)
355+
public static bool CreatePortal(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 position, Vector3 forward, Action<string> errorReasonCallback)
356356
{
357357
return GetCreatePortalDelegate(apiWorld, apiWorldInstance, position, forward, errorReasonCallback);
358358
}
359359

360+
public static void ShowErrorReason(string error)
361+
{
362+
Utilities.ShowAlert("Error Creating Portal", error);
363+
}
364+
365+
internal static IntPtr GetFunctionPointer(string methodName)
366+
{
367+
return typeof(Utilities).GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Static)!.MethodHandle.GetFunctionPointer();
368+
}
369+
360370
public static void DeleteNotification(Notification notification)
361371
{
362372
try
@@ -515,7 +525,7 @@ private delegate void SendNotificationDelegate(
515525
NotificationDetails notificationDetails,
516526
Il2CppStructArray<byte> picDataIGuess = null);
517527

518-
private delegate bool CreatePortalDelegate(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 position, Vector3 forward, IntPtr errorReasonCallback);
528+
private delegate bool CreatePortalDelegate(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 position, Vector3 forward, Il2CppSystem.Action<string> errorReasonCallback = null);
519529

520530
private delegate void DeleteNotificationDelegate(Notification notification);
521531

0 commit comments

Comments
 (0)