Initial commit

This commit is contained in:
2026-04-06 21:08:06 -04:00
commit 85bdf31a4d
5 changed files with 367 additions and 0 deletions

210
.gitignore vendored Normal file
View File

@@ -0,0 +1,210 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Bb]in/
[Oo]bj/
[Ee]xt/
[Ll]og/
[Ll]ogs/
# MSBuild Binary and Structured Log
*.binlog
# MSBuild response files
!MSBuild.rsp
!Directory.Build.rsp
# Visual Studio 14+ cache/options directory
.vs/
# Visual Studio 15+ auto generated files
Generated\ Files/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*~.*
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# Microsoft Fakes
FakesAssemblies/
# CodeRush personal settings
.cr/personal
# JetBrains Rider
*.sln.iml

19
GameObject.cs Normal file
View File

@@ -0,0 +1,19 @@
using System;
using UnityEngine;
namespace PhotonViewDumper
{
internal class GameObject : MonoBehaviour
{
void Update()
{
try
{
if (Input.GetKeyDown(KeyCode.F6)) Plugin.Dump();
} catch (Exception ex)
{
Plugin.Log.LogError($"Failed to dump views: {ex}");
}
}
}
}

44
PhotonViewDumper.csproj Normal file
View File

@@ -0,0 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>PhotonViewDumper</AssemblyName>
<Product>My first plugin</Product>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json;
https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources>
<RootNamespace>PhotonViewDumper</RootNamespace>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.*" IncludeAssets="compile" />
<PackageReference Include="CsvHelper" Version="33.1.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>./AssemblyReferences/Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>./AssemblyReferences/Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="PhotonRealtime">
<HintPath>./AssemblyReferences/PhotonRealtime.dll</HintPath>
</Reference>
<Reference Include="PhotonUnityNetworking">
<HintPath>./AssemblyReferences/PhotonUnityNetworking.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>./AssemblyReferences/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>./AssemblyReferences/UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

25
PhotonViewDumper.sln Normal file
View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.3.11520.95 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotonViewDumper", "PhotonViewDumper.csproj", "{1C893A91-9E01-4217-F6A1-1ED17CEB7D62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1C893A91-9E01-4217-F6A1-1ED17CEB7D62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C893A91-9E01-4217-F6A1-1ED17CEB7D62}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C893A91-9E01-4217-F6A1-1ED17CEB7D62}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C893A91-9E01-4217-F6A1-1ED17CEB7D62}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F128F9B7-243F-4045-A691-C9D38AFF4162}
EndGlobalSection
EndGlobal

69
Plugin.cs Normal file
View File

@@ -0,0 +1,69 @@
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CsvHelper;
using Il2CppInterop.Runtime;
using Photon.Pun;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
namespace PhotonViewDumper;
public class ViewElement
{
public int RecNetId { get; set; }
public int ActorId { get; set; }
public string NickName { get; set; }
public string RecNetUserName { get; set; }
public int ViewId { get; set; }
public string PrefabName { get; set; }
}
[BepInPlugin("dev.proxnet.recroom.photonviewdumper", "PhotonViewDumper", "0.1.0")]
public class Plugin : BasePlugin
{
public static new ManualLogSource Log;
public override void Load()
{
Log = base.Log;
Log.LogInfo($"Loaded");
AddComponent<GameObject>();
}
public static void Dump()
{
List<ViewElement> views = new();
foreach (PhotonView view in PhotonNetwork.PhotonViews)
{
try
{
var recNetId = view.Owner == null ? -1 : view.Owner.RecNetAccountId;
CCEOLAOLEKJ recNetAccount = null;
PEGGCEDHBOF.DKNKKLPCGLM.TryGetValue(recNetId, out recNetAccount);
views.Add(new ViewElement
{
RecNetId = recNetId,
ActorId = view.Owner == null ? -1 : view.Owner.ActorNumber,
NickName = view.Owner == null ? "" : view.Owner.nickName,
RecNetUserName = recNetAccount == null ? "" : recNetAccount.BIOGKFGIMDG.ToString(),
ViewId = view.ViewID,
PrefabName = view.name
});
} catch (Exception ex)
{
Log.LogWarning($"Failed to dump view {view.ViewID}: {ex}");
}
}
using var writer = new StreamWriter("views.csv");
using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture);
csv.WriteRecords(views);
Log.LogInfo($"Wrote {views.Count} to views.csv");
}
}