Skip to content
This repository was archived by the owner on Mar 12, 2022. It is now read-only.

Commit 26b6f0a

Browse files
committed
v1.0.7
1 parent ce415d1 commit 26b6f0a

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

Buttons/SingleButton.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
using DesktopCamera.Utils;
55

66
namespace DesktopCamera.Buttons {
7+
8+
// Based on https://github.com/DubyaDude/RubyButtonAPI
9+
// Thanks DubyaDude and Emilia (yoshifan#9550) <3
10+
// I promise that one day I'll actually use the repo above, I just don't feel like rewriting the buttons codes in Main.cs right now :c
11+
712
class SingleButton {
813

914
public Transform button;

DesktopCamera.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@
9696
<Reference Include="UnityEngine.Networking">
9797
<HintPath>D:\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.Networking.dll</HintPath>
9898
</Reference>
99+
<Reference Include="UnityEngine.PhysicsModule, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL">
100+
<SpecificVersion>False</SpecificVersion>
101+
<HintPath>D:\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.PhysicsModule.dll</HintPath>
102+
</Reference>
99103
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
100104
<SpecificVersion>False</SpecificVersion>
101105
<HintPath>D:\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.UI.dll</HintPath>

Main.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static class ModBuildInfo {
1717
public const string Name = "DesktopCamera";
1818
public const string Author = "nitro.";
1919
public const string Company = null;
20-
public const string Version = "1.0.6";
20+
public const string Version = "1.0.7";
2121
public const string DownloadLink = "https://github.com/nitrog0d/DesktopCamera/releases/latest/download/DesktopCamera.dll";
2222
public const string GameDeveloper = "VRChat";
2323
public const string Game = "VRChat";
@@ -46,6 +46,8 @@ private IEnumerator Setup() {
4646
request.downloadHandler = new DownloadHandlerBuffer();
4747
request.SetRequestHeader("Content-Type", "application/json");
4848

49+
//yield return request.SendWebRequest();
50+
4951
var asyncOperation = request.SendWebRequest();
5052

5153
// yield return doesn't work for now, so I had to change it to this.
@@ -85,6 +87,19 @@ private IEnumerator Setup() {
8587
var screenshotButton = cameraMenu.Find("Screenshot");
8688
screenshotButton.localPosition = SingleButton.getButtonPositionFor(4, 1);
8789

90+
// Thank you Janni9009#1751 <3
91+
quickMenu.GetComponent<BoxCollider>().size += new Vector3(0f, 840f, 0f);
92+
93+
var photoModeButton = cameraMenu.Find("PhotoMode");
94+
photoModeButton.localPosition = SingleButton.getButtonPositionFor(0, 3);
95+
96+
var videoModeButton = cameraMenu.Find("VideoMode");
97+
videoModeButton.localPosition = SingleButton.getButtonPositionFor(1, 3);
98+
99+
var disableCameraButton = cameraMenu.Find("DisableCamera");
100+
disableCameraButton.localPosition = SingleButton.getButtonPositionFor(2, 3);
101+
102+
88103
var cameraButton = new SingleButton("Camera", "Camera\n<color=red>Off</color>", "Toggles the Camera", 0, 0, cameraMenu);
89104
cameraButton.setAction((Action)(() => {
90105
Settings.cameraEnabled = !Settings.cameraEnabled;
@@ -164,8 +179,8 @@ private IEnumerator Setup() {
164179
break;
165180
}
166181
switchPinButton.setText("Cycle Pin\n<color=#845bff>" + pin + "</color>");
167-
// Eventually change this to the same way I do the other buttons
168-
VRCUtils.GetUserCameraController().Method_Public_Void_Int32_0(newPin);
182+
// Eventually change this to the same way I do the other buttons, I suppose it changes every VRChat update so yeah as soon as possible please Lucas...
183+
VRCUtils.GetUserCameraController().Method_Public_Void_Int32_3(newPin);
169184
}
170185
}));
171186

@@ -278,8 +293,8 @@ private IEnumerator Setup() {
278293
var button = new SingleButton("Filter" + filter.Value, filter.Key, "Sets the filter to " + filter.Key.Replace("\n", " "), position, row, filtersMenu);
279294
button.setAction((Action)(() => {
280295
if (Settings.cameraEnabled) {
281-
// Eventually change this to the same way I do the other buttons
282-
VRCUtils.GetUserCameraController().Method_Public_Void_Int32_1(filter.Value);
296+
// Eventually change this to the same way I do the other buttons, I suppose it changes every VRChat update so yeah as soon as possible please Lucas...
297+
VRCUtils.GetUserCameraController().Method_Public_Void_Int32_0(filter.Value);
283298
}
284299
}));
285300
position++;
@@ -306,6 +321,11 @@ private IEnumerator Setup() {
306321
// This is a mess please don't look
307322
// and also pull request to improve it thx
308323
public override void OnUpdate() {
324+
//if (Input.GetKeyDown(KeyCode.F1)) {
325+
// var quickMenu = VRCUtils.GetQuickMenu();
326+
// var cameraMenu = quickMenu.transform.Find("CameraMenu");
327+
// VRCUtils.ShowQuickMenuPage(quickMenu, cameraMenu);
328+
//}
309329
if (Settings.cameraEnabled && Settings.arrowKeysEnabled) {
310330
if (Input.GetKey(KeyCode.LeftArrow)) {
311331
if (Settings.moveCamera) {

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A mod that allows Desktop users use the VRChat Camera feature, yay!
66
* **USE IT AT YOUR OWN RISK**, I am not responsible for any bans or any punishments you may get by using this mod!
77

88
## Installation
9-
* **Make sure you have run the [MelonLoader Auto Installer](https://github.com/Slaynash/MelonLoaderAutoInstaller) by [Slaynash](https://github.com/Slaynash) first.**
9+
* **Make sure you have run the [MelonLoader Installer](https://github.com/HerpDerpinstine/MelonLoader/releases/latest/download/MelonLoader.Installer.exe) by [HerpDerpinstine](https://github.com/HerpDerpinstine) first (please check [MelonLoader Wiki](https://melonwiki.xyz) for more help!).**
1010
* Download the [latest version](https://github.com/nitrog0d/DesktopCamera/releases/latest/download/DesktopCamera.dll) of the mod.
1111
* Drag/copy the DLL file that you have downloaded into the Mods folder.
1212
* That's it! Now just run the game and the mod should be installed!
@@ -33,5 +33,9 @@ A mod that allows Desktop users use the VRChat Camera feature, yay!
3333
* The Viewer is the Camera view, if it's not obvious.
3434
* **Warning: The Camera Space must be in "World" mode, or else the camera won't move**.
3535

36-
*Brought to you by the VRChat Modding Group.*
37-
*Thanks to [Emilia](https://github.com/thetrueyoshifan) (for letting me use the README from [VRCDiscordRichPresence-ML](https://github.com/thetrueyoshifan/VRCDiscordRichPresence-ML)), who helped me and who contributed to MelonLoader!*
36+
*Thanks to everyone in the VRChat Modding community!*
37+
38+
*Special thanks to:*
39+
*[Emilia](https://github.com/thetrueyoshifan) for letting me use the README from [VRCDiscordRichPresence-ML](https://github.com/thetrueyoshifan/VRCDiscordRichPresence-ML) and helping me with opening new pages in the QuickMenu.*
40+
*[DubyaDude](https://github.com/DubyaDude) and [Emilia](https://github.com/thetrueyoshifan) for [RubyButtonAPI](https://github.com/DubyaDude/RubyButtonAPI).*
41+
*[Janni9009](https://github.com/Janni9009) for helping me with resizing the QuickMenu Collider.*

Utils/VRCUtils.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ namespace DesktopCamera.Utils {
1111
public static class VRCUtils {
1212

1313
private static FieldInfo currentPageGetter;
14+
// Thanks Emilia (yoshifan#9550) <3
1415
public static void ShowQuickMenuPage(QuickMenu quickMenu, Transform pageTransform, string currentMenu = "ShortcutMenu") {
1516
if (currentPageGetter == null) {
1617
var menu = quickMenu.transform.Find(currentMenu).gameObject;
17-
var fis = Il2CppTypeOf<QuickMenu>.Type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(f => f.FieldType == Il2CppTypeOf<GameObject>.Type).ToArray();
18+
var fis = Il2CppType.Of<QuickMenu>().GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where(f => f.FieldType == Il2CppType.Of<GameObject>()).ToArray();
1819
int count = 0;
1920
foreach (FieldInfo fi in fis) {
2021
var value = fi.GetValue(quickMenu)?.TryCast<GameObject>();
@@ -55,7 +56,6 @@ public static UserCameraController GetUserCameraController() {
5556
}
5657

5758
public static Player GetPlayer() {
58-
// This *probably* needs to be updated every VRChat has an update that changes the code
5959
return PlayerManager.Method_Public_Static_Player_String_1(APIUser.CurrentUser.id);
6060
}
6161

@@ -64,7 +64,7 @@ public static VRCUiManager GetVRCUiManager() {
6464
}
6565

6666
public static void QueueHudMessage(string message) {
67-
GetVRCUiManager().Method_Public_Void_String_3(message);
67+
GetVRCUiManager().Method_Public_Void_String_2(message);
6868
}
6969
}
7070
}

0 commit comments

Comments
 (0)