mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 02:53:29 +08:00
new MOD: UserCloak
This commit is contained in:
@@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PoolOpt", "PoolOpt\PoolOpt.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UXAssist", "UXAssist\UXAssist.csproj", "{9C048229-6A50-4642-BC5E-02CD39D3869A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserCloak", "UserCloak\UserCloak.csproj", "{096D2E4B-D1CE-424D-9954-C36A23E9E279}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -93,5 +95,9 @@ Global
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C048229-6A50-4642-BC5E-02CD39D3869A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{096D2E4B-D1CE-424D-9954-C36A23E9E279}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -55,6 +55,11 @@ Performance optimizations for Matrix Labs
|
||||
Optimize memory pools on loading gamesaves
|
||||
加载游戏存档时优化内存池的使用
|
||||
|
||||
# [UserCloak](UserCloak)
|
||||
|
||||
Cloak(Fake) user account info
|
||||
隐匿(伪装)用户账号信息
|
||||
|
||||
# [UXAssist](UXAssist)
|
||||
|
||||
Some functions and patches for better user experience
|
||||
|
||||
40
UserCloak/README.md
Normal file
40
UserCloak/README.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# UserCloak
|
||||
|
||||
#### Cloak(Fake) user account info
|
||||
#### 隐匿(伪装)用户账号信息
|
||||
|
||||
## Changlog
|
||||
* 1.0.0
|
||||
+ Initial release
|
||||
|
||||
## Usage
|
||||
* Works only for Steam version.
|
||||
* Config entries:
|
||||
+`[Cloak]`
|
||||
- `Mode` [Default Value: false]:
|
||||
- `0`: Disable cloaking.
|
||||
- `1`: Fake user account info.
|
||||
- `2`: Completely hide user account info. This also disables Milkyway completely.
|
||||
- `FakeUserID` [Default Value: random on first launch]: Fake Steam user ID. Works when `Mode` is set to 1. This number is part Z of SteamID as described [here](https://developer.valvesoftware.com/wiki/SteamID).
|
||||
- `FakeUsername` [Default Value: anonymous]: Fake Steam user name. Works when `Mode` is set to 1.
|
||||
|
||||
## CREDITS
|
||||
* [Dyson Sphere Program](https://store.steampowered.com/app/1366540): The great game
|
||||
|
||||
## 更新日志
|
||||
* 1.0.0
|
||||
+ 初始版本
|
||||
|
||||
## 使用说明
|
||||
* 仅支持Steam版
|
||||
* 设置选项:
|
||||
+`[Cloak]`
|
||||
- `Mode` [默认值: false]:
|
||||
- `0`: 关闭隐匿
|
||||
- `1`: 伪装用户账号信息
|
||||
- `2`: 完全隐藏用户账号信息,同时完全禁用银河系
|
||||
- `FakeUserID` [默认值: 首次启动时随机生成]: 伪装的Steam用户ID,仅在`Mode`设置为1时生效。这个数字是SteamID中的Z部分,详见[这里](https://developer.valvesoftware.com/wiki/SteamID)
|
||||
- `FakeUsername` [默认值: anonymous]: 伪装的Steam用户名,仅在`Mode`设置为1时生效
|
||||
|
||||
## 鸣谢
|
||||
* [戴森球计划](https://store.steampowered.com/app/1366540): 伟大的游戏
|
||||
148
UserCloak/UserCloak.cs
Normal file
148
UserCloak/UserCloak.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using Steamworks;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace UserCloak;
|
||||
|
||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||
public class UserCloak: BaseUnityPlugin
|
||||
{
|
||||
private static Harmony _patch;
|
||||
private static ConfigEntry<int> _mode;
|
||||
private static ConfigEntry<int> _fakeUserId;
|
||||
private static ConfigEntry<string> _fakeUsername;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_mode = Config.Bind("General", "Mode", 0, "Cloak Mode:\n" +
|
||||
" 0: Disable cloaking.\n" +
|
||||
" 1: Fake user account info.\n" +
|
||||
" 2: Completely hide user account info. This also disables Milkyway completely.\n");
|
||||
_fakeUserId = Config.Bind("General", "FakeUserId", 0, "Fake Steam user ID");
|
||||
_fakeUsername = Config.Bind("General", "FakeUsername", "anonymous", "Fake Steam username");
|
||||
|
||||
if (_mode.Value == 1 && _fakeUserId.Value == 0)
|
||||
{
|
||||
_fakeUserId.Value = Random.Range(10000, 2000000000);
|
||||
}
|
||||
|
||||
if (_mode.Value != 0)
|
||||
{
|
||||
_patch ??= Harmony.CreateAndPatchAll(typeof(UserCloak));
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
_patch?.UnpatchSelf();
|
||||
_patch = null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SteamManager), nameof(SteamManager.Awake))]
|
||||
private static bool SteamManager_Awake_Prefix(SteamManager __instance)
|
||||
{
|
||||
if (_mode.Value == 0)
|
||||
return true;
|
||||
if (SteamManager.s_instance != null)
|
||||
{
|
||||
UnityEngine.Object.Destroy(__instance.gameObject);
|
||||
return false;
|
||||
}
|
||||
SteamManager.s_instance = __instance;
|
||||
if (SteamManager.s_EverInitialized)
|
||||
{
|
||||
throw new Exception("Tried to Initialize the SteamAPI twice in one session!");
|
||||
}
|
||||
__instance.m_bInitialized = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(STEAMX), nameof(STEAMX.Awake))]
|
||||
private static bool STEAMX_Awake_Prefix(STEAMX __instance)
|
||||
{
|
||||
switch (_mode.Value)
|
||||
{
|
||||
case 1:
|
||||
STEAMX.instance = __instance;
|
||||
STEAMX.userId = new CSteamID(0x0110000100000001UL | (uint)_fakeUserId.Value);
|
||||
return false;
|
||||
case 2:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SteamManager), nameof(SteamManager.OnEnable))]
|
||||
private static bool SteamManager_OnEnable_Prefix(SteamManager __instance)
|
||||
{
|
||||
if (_mode.Value == 0)
|
||||
return true;
|
||||
if (SteamManager.s_instance == null)
|
||||
{
|
||||
SteamManager.s_instance = __instance;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SteamManager), nameof(SteamManager.Update))]
|
||||
private static bool SteamManager_Update_Prefix()
|
||||
{
|
||||
return _mode.Value == 0;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PARTNER), nameof(PARTNER.STEAMWORKS), MethodType.Getter)]
|
||||
private static bool PARTNER_STEAMWORKS_Prefix(ref bool __result)
|
||||
{
|
||||
if (_mode.Value != 2)
|
||||
return true;
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PARTNER), nameof(PARTNER.UserLogin))]
|
||||
private static bool PARTNER_UserLogin_Prefix()
|
||||
{
|
||||
switch (_mode.Value)
|
||||
{
|
||||
case 1:
|
||||
AccountData.me.platform = ESalePlatform.Steam;
|
||||
AccountData.me.userId = 0x0110000100000001UL | (uint)_fakeUserId.Value;
|
||||
AccountData.me.detail.userName = _fakeUsername.Value;
|
||||
PARTNER.logined = true;
|
||||
return false;
|
||||
case 2:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_ClusterGeneration), nameof(SteamLeaderboardManager_ClusterGeneration.Start))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_ClusterGeneration), nameof(SteamLeaderboardManager_ClusterGeneration.Update))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_ClusterGeneration), nameof(SteamLeaderboardManager_ClusterGeneration.UploadScore))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_PowerConsumption), nameof(SteamLeaderboardManager_PowerConsumption.Start))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_PowerConsumption), nameof(SteamLeaderboardManager_PowerConsumption.Update))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_PowerConsumption), nameof(SteamLeaderboardManager_PowerConsumption.UploadScore))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_SolarSail), nameof(SteamLeaderboardManager_SolarSail.Start))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_SolarSail), nameof(SteamLeaderboardManager_SolarSail.Update))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_SolarSail), nameof(SteamLeaderboardManager_SolarSail.UploadScore))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_UniverseMatrix), nameof(SteamLeaderboardManager_UniverseMatrix.Start))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_UniverseMatrix), nameof(SteamLeaderboardManager_UniverseMatrix.Update))]
|
||||
[HarmonyPatch(typeof(SteamLeaderboardManager_UniverseMatrix), nameof(SteamLeaderboardManager_UniverseMatrix.UploadScore))]
|
||||
[HarmonyPatch(typeof(SteamAchievementManager), nameof(SteamAchievementManager.Start))]
|
||||
[HarmonyPatch(typeof(SteamAchievementManager), nameof(SteamAchievementManager.Update))]
|
||||
[HarmonyPatch(typeof(SteamAchievementManager), nameof(SteamAchievementManager.UnlockAchievement))]
|
||||
private static bool SteamLeaderBoard_functions_Prefix()
|
||||
{
|
||||
return _mode.Value == 0;
|
||||
}
|
||||
}
|
||||
29
UserCloak/UserCloak.csproj
Normal file
29
UserCloak/UserCloak.csproj
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.usercloak</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UserCloak</Description>
|
||||
<Version>1.0.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UserCloak</PackageId>
|
||||
<RootNamespace>UserCloak</RootNamespace>
|
||||
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
zip -9 -j package/$(ProjectName)-$(Version).zip $(TargetPath) package/icon.png package/manifest.json README.md" />
|
||||
</Target>
|
||||
</Project>
|
||||
BIN
UserCloak/package/icon.png
Normal file
BIN
UserCloak/package/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
9
UserCloak/package/manifest.json
Normal file
9
UserCloak/package/manifest.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "UserCloak",
|
||||
"version_number": "1.0.0",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UserCloak",
|
||||
"description": "Cloak(Fake) user account info / 隐匿(伪装)用户账号信息",
|
||||
"dependencies": [
|
||||
"xiaoye97-BepInEx-5.4.17"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user