mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-01 13:59:22 +00:00
Merge remote-tracking branch 'AASBufferFix/main'
This commit is contained in:
commit
ba1d08074f
12 changed files with 851 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
398
.gitignore
vendored
Normal file
398
.gitignore
vendored
Normal file
|
@ -0,0 +1,398 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# 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
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.tlog
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# 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
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# 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
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# 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
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# 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
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
|
||||
*.vbp
|
||||
|
||||
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
|
||||
*.dsw
|
||||
*.dsp
|
||||
|
||||
# Visual Studio 6 technical files
|
||||
*.ncb
|
||||
*.aps
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# Visual Studio History (VSHistory) files
|
||||
.vshistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
|
||||
# Fody - auto-generated XML schema
|
||||
FodyWeavers.xsd
|
||||
|
||||
# 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/
|
||||
|
||||
# Windows Installer files from build outputs
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
52
AASBufferFix/AASBufferFix.csproj
Normal file
52
AASBufferFix/AASBufferFix.csproj
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp-firstpass">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="BTKUILib">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\BTKUILib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Cohtml.Runtime">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MelonLoader">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AnimationModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AssetBundleModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule">
|
||||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Deploy" AfterTargets="Build">
|
||||
<Copy SourceFiles="$(TargetPath)" DestinationFolder="C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" />
|
||||
<Message Text="Copied $(TargetPath) to C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" Importance="high" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
25
AASBufferFix/AASBufferFix.sln
Normal file
25
AASBufferFix/AASBufferFix.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32630.192
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AASBufferFix", "AASBufferFix.csproj", "{9C6339E8-657C-4A1F-9324-12BFB2558BBB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9C6339E8-657C-4A1F-9324-12BFB2558BBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C6339E8-657C-4A1F-9324-12BFB2558BBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C6339E8-657C-4A1F-9324-12BFB2558BBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C6339E8-657C-4A1F-9324-12BFB2558BBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D2EEA814-859D-4EE4-ADC8-DDDD36383310}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
133
AASBufferFix/AASBufferHelper.cs
Normal file
133
AASBufferFix/AASBufferHelper.cs
Normal file
|
@ -0,0 +1,133 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.Melons.AASBufferFix;
|
||||
|
||||
public class AASBufferHelper : MonoBehaviour
|
||||
{
|
||||
///public bool DebuggingFlag = false;
|
||||
|
||||
//public stuff
|
||||
public bool GameHandlesAAS { get; private set; }
|
||||
|
||||
//internal references
|
||||
private PuppetMaster _puppetMaster;
|
||||
|
||||
//outside aas buffers
|
||||
private float[] _aasBufferFloat = new float[0];
|
||||
private int[] _aasBufferInt = new int[0];
|
||||
private byte[] _aasBufferByte = new byte[0];
|
||||
|
||||
//calculated footprints
|
||||
private int _aasFootprint = -1;
|
||||
private int _avatarFootprint = 0;
|
||||
|
||||
private void Start() => _puppetMaster = GetComponent<PuppetMaster>();
|
||||
|
||||
public void OnAvatarInstantiated(Animator animator)
|
||||
{
|
||||
//check if avatar uses Avatar Advanced Settings
|
||||
///SendDebug("[OnInit] Remote avatar initialized. Checking for AAS...");
|
||||
CVRAvatar avatar = animator.GetComponent<CVRAvatar>();
|
||||
if (avatar != null && !avatar.avatarUsesAdvancedSettings)
|
||||
{
|
||||
GameHandlesAAS = true;
|
||||
return;
|
||||
}
|
||||
|
||||
//check if AAS footprint is valid
|
||||
///SendDebug("[OnInit] Avatar uses AAS. Generating AAS footprint...");
|
||||
_avatarFootprint = Utils.GenerateAnimatorAASFootprint(animator);
|
||||
if (_avatarFootprint == 1)
|
||||
{
|
||||
// we will let the game handle this by setting GameHandlesAAS to true
|
||||
///SendDebug("[OnInit] Avatar does not contain valid AAS. It is likely hidden or blocked.");
|
||||
GameHandlesAAS = true;
|
||||
return;
|
||||
}
|
||||
|
||||
///SendDebug($"[OnInit] Avatar footprint is : {_avatarFootprint}");
|
||||
|
||||
//check if we received expected AAS while we loaded the avatar, and if so, apply it now
|
||||
if (SyncDataMatchesExpected())
|
||||
{
|
||||
///SendDebug("[OnInit] Valid buffered AAS found. Applying buffer...");
|
||||
ApplyExternalAASBuffer();
|
||||
return;
|
||||
}
|
||||
|
||||
//we loaded avatar faster than wearer
|
||||
///SendDebug("[OnInit] Remote avatar initialized faster than wearer. Waiting on valid AAS...");
|
||||
}
|
||||
|
||||
public void OnAvatarDestroyed()
|
||||
{
|
||||
GameHandlesAAS = false;
|
||||
_aasFootprint = -1;
|
||||
_avatarFootprint = 0;
|
||||
}
|
||||
|
||||
public void OnReceiveAAS(float[] settingsFloat, int[] settingsInt, byte[] settingsByte)
|
||||
{
|
||||
// Calculate AAS footprint to compare against.
|
||||
_aasFootprint = (settingsFloat.Length + 1) * (settingsInt.Length + 1) * (settingsByte.Length + 1);
|
||||
|
||||
//if it matches, apply the settings and let game take over
|
||||
if (SyncDataMatchesExpected())
|
||||
{
|
||||
///SendDebug("[OnSync] Avatar values matched and have been applied.");
|
||||
ApplyExternalAAS(settingsFloat, settingsInt, settingsByte);
|
||||
return;
|
||||
}
|
||||
|
||||
//avatar is still loading on our side, we must assume AAS data is correct and store it until we load
|
||||
//there is also a chance it errored
|
||||
//if (_avatarFootprint == 0)
|
||||
//{
|
||||
// ///SendDebug("[OnSync] Avatar is still loading on our end.");
|
||||
// StoreExternalAASBuffer(settingsFloat, settingsInt, settingsByte);
|
||||
// return;
|
||||
//}
|
||||
|
||||
//avatar is loaded on our end, and is not blocked by filter
|
||||
//this does run if it is manually hidden or distance hidden
|
||||
|
||||
///SendDebug("[OnSync] Avatar is loaded on our side and is not blocked. Comparing for expected values.");
|
||||
///SendDebug($"[OnSync] Avatar Footprint is : {_avatarFootprint}");
|
||||
|
||||
//if it did not match, that means the avatar we see on our side is different than what the remote user is wearing and syncing
|
||||
///SendDebug("[OnSync] Avatar loaded is different than wearer. The wearer is likely still loading the avatar!");
|
||||
StoreExternalAASBuffer(settingsFloat, settingsInt, settingsByte);
|
||||
}
|
||||
|
||||
private void ApplyExternalAASBuffer()
|
||||
{
|
||||
GameHandlesAAS = true;
|
||||
_puppetMaster?.ApplyAdvancedAvatarSettings(_aasBufferFloat, _aasBufferInt, _aasBufferByte);
|
||||
}
|
||||
|
||||
private void ApplyExternalAAS(float[] settingsFloat, int[] settingsInt, byte[] settingsByte)
|
||||
{
|
||||
GameHandlesAAS = true;
|
||||
_puppetMaster?.ApplyAdvancedAvatarSettings(settingsFloat, settingsInt, settingsByte);
|
||||
}
|
||||
|
||||
private void StoreExternalAASBuffer(float[] settingsFloat, int[] settingsInt, byte[] settingsByte)
|
||||
{
|
||||
Array.Resize(ref _aasBufferFloat, settingsFloat.Length);
|
||||
Array.Resize(ref _aasBufferInt, settingsInt.Length);
|
||||
Array.Resize(ref _aasBufferByte, settingsByte.Length);
|
||||
Array.Copy(settingsFloat, _aasBufferFloat, settingsFloat.Length);
|
||||
Array.Copy(settingsInt, _aasBufferInt, settingsInt.Length);
|
||||
Array.Copy(settingsByte, _aasBufferByte, settingsByte.Length);
|
||||
}
|
||||
|
||||
private bool SyncDataMatchesExpected() => _aasFootprint == _avatarFootprint;
|
||||
|
||||
///private void SendDebug(string message)
|
||||
///{
|
||||
/// if (!DebuggingFlag) return;
|
||||
/// AASBufferFix.Logger.Msg(message);
|
||||
///}
|
||||
}
|
68
AASBufferFix/HarmonyPatches.cs
Normal file
68
AASBufferFix/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,68 @@
|
|||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.Base;
|
||||
using ABI_RC.Core.Player;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.Melons.AASBufferFix.HarmonyPatches;
|
||||
|
||||
[HarmonyPatch]
|
||||
internal class HarmonyPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "Start")]
|
||||
private static void Postfix_PuppetMaster_Start(ref PuppetMaster __instance)
|
||||
{
|
||||
__instance.AddComponentIfMissing<AASBufferHelper>();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "AvatarInstantiated")]
|
||||
private static void Postfix_PuppetMaster_AvatarInstantiated(ref PuppetMaster __instance, ref Animator ____animator)
|
||||
{
|
||||
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
||||
if (externalBuffer != null) externalBuffer.OnAvatarInstantiated(____animator);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "AvatarDestroyed")]
|
||||
private static void Postfix_PuppetMaster_AvatarDestroyed(ref PuppetMaster __instance)
|
||||
{
|
||||
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
||||
if (externalBuffer != null) externalBuffer.OnAvatarDestroyed();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PuppetMaster), "ApplyAdvancedAvatarSettings")]
|
||||
private static bool Prefix_PuppetMaster_ApplyAdvancedAvatarSettings(float[] settingsFloat, int[] settingsInt, byte[] settingsByte, ref PuppetMaster __instance)
|
||||
{
|
||||
AASBufferHelper externalBuffer = __instance.GetComponent<AASBufferHelper>();
|
||||
if (externalBuffer != null && !externalBuffer.GameHandlesAAS)
|
||||
{
|
||||
externalBuffer.OnReceiveAAS(settingsFloat, settingsInt, settingsByte);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVRAnimatorManager), "ApplyAdvancedAvatarSettingsFromBuffer")]
|
||||
private static bool Prefix_CVRAnimatorManager_ApplyAdvancedAvatarSettingsFromBuffer(ref Animator ____animator)
|
||||
{
|
||||
AASBufferHelper externalBuffer = ____animator.GetComponentInParent<AASBufferHelper>();
|
||||
if (externalBuffer != null && !externalBuffer.GameHandlesAAS)
|
||||
{
|
||||
//dont apply if stable buffer no exist
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), "SendAdvancedAvatarSettings")]
|
||||
private static bool Prefix_PlayerSetup_SendAdvancedAvatarSettings(ref PlayerSetup __instance)
|
||||
{
|
||||
//dont sync wrong settings to remote users
|
||||
return !__instance.avatarIsLoading;
|
||||
}
|
||||
}
|
12
AASBufferFix/Main.cs
Normal file
12
AASBufferFix/Main.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using MelonLoader;
|
||||
|
||||
namespace NAK.Melons.AASBufferFix;
|
||||
|
||||
public class AASBufferFix : MelonMod
|
||||
{
|
||||
///public static MelonLogger.Instance Logger;
|
||||
public override void OnInitializeMelon()
|
||||
{
|
||||
///Logger = LoggerInstance;
|
||||
}
|
||||
}
|
30
AASBufferFix/Properties/AssemblyInfo.cs
Normal file
30
AASBufferFix/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using MelonLoader;
|
||||
using NAK.Melons.AASBufferFix.Properties;
|
||||
using System.Reflection;
|
||||
|
||||
|
||||
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||
[assembly: AssemblyTitle(nameof(NAK.Melons.AASBufferFix))]
|
||||
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||
[assembly: AssemblyProduct(nameof(NAK.Melons.AASBufferFix))]
|
||||
|
||||
[assembly: MelonInfo(
|
||||
typeof(NAK.Melons.AASBufferFix.AASBufferFix),
|
||||
nameof(NAK.Melons.AASBufferFix),
|
||||
AssemblyInfoParams.Version,
|
||||
AssemblyInfoParams.Author,
|
||||
downloadLink: "https://github.com/NotAKidOnSteam/AASBufferFix"
|
||||
)]
|
||||
|
||||
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||
|
||||
namespace NAK.Melons.AASBufferFix.Properties;
|
||||
internal static class AssemblyInfoParams
|
||||
{
|
||||
public const string Version = "1.0.5";
|
||||
public const string Author = "NotAKidoS";
|
||||
}
|
60
AASBufferFix/Utils.cs
Normal file
60
AASBufferFix/Utils.cs
Normal file
|
@ -0,0 +1,60 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace NAK.Melons.AASBufferFix;
|
||||
|
||||
public class Utils
|
||||
{
|
||||
public static int GenerateAnimatorAASFootprint(Animator animator)
|
||||
{
|
||||
int avatarFloatCount = 0;
|
||||
int avatarIntCount = 0;
|
||||
int avatarBoolCount = 0;
|
||||
|
||||
foreach (AnimatorControllerParameter animatorControllerParameter in animator.parameters)
|
||||
{
|
||||
if (animatorControllerParameter.name.Length > 0 && animatorControllerParameter.name[0] != '#' && !coreParameters.Contains(animatorControllerParameter.name))
|
||||
{
|
||||
AnimatorControllerParameterType type = animatorControllerParameter.type;
|
||||
switch (type)
|
||||
{
|
||||
case AnimatorControllerParameterType.Float:
|
||||
avatarFloatCount++;
|
||||
break;
|
||||
case (AnimatorControllerParameterType)2:
|
||||
break;
|
||||
case AnimatorControllerParameterType.Int:
|
||||
avatarIntCount++;
|
||||
break;
|
||||
case AnimatorControllerParameterType.Bool:
|
||||
avatarBoolCount++;
|
||||
break;
|
||||
default:
|
||||
//we dont count triggers
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//bool to byte
|
||||
avatarBoolCount = ((int)Math.Ceiling((double)avatarBoolCount / 8));
|
||||
|
||||
//create the footprint
|
||||
return (avatarFloatCount + 1) * (avatarIntCount + 1) * (avatarBoolCount + 1);
|
||||
}
|
||||
|
||||
private static HashSet<string> coreParameters = new HashSet<string>
|
||||
{
|
||||
"MovementX",
|
||||
"MovementY",
|
||||
"Grounded",
|
||||
"Emote",
|
||||
"GestureLeft",
|
||||
"GestureRight",
|
||||
"Toggle",
|
||||
"Sitting",
|
||||
"Crouching",
|
||||
"CancelEmote",
|
||||
"Prone",
|
||||
"Flying"
|
||||
};
|
||||
}
|
23
AASBufferFix/format.json
Normal file
23
AASBufferFix/format.json
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"_id": 126,
|
||||
"name": "AASBufferFix",
|
||||
"modversion": "1.0.5",
|
||||
"gameversion": "2022r170",
|
||||
"loaderversion": "0.5.7",
|
||||
"modtype": "Mod",
|
||||
"author": "NotAKidoS",
|
||||
"description": "Fixes two issues with the Avatar Advanced Settings buffers when loading remote avatars. In simple terms, it means 'fewer wardrobe malfunctions'.\n\nEmpty buffer (all 0/false) will no longer be applied on load.\nReceived AAS data is ignored until the wearer has loaded into the expected avatar.\n(The avatar will sit in its default state until the wearer has loaded and started syncing correct AAS)\nAAS will no longer be sent while switching avatar.\n\nPlease view the GitHub README for links to relevant feedback posts.",
|
||||
"searchtags": [
|
||||
"aas",
|
||||
"sync",
|
||||
"naked",
|
||||
"buffer"
|
||||
],
|
||||
"requirements": [
|
||||
"None"
|
||||
],
|
||||
"downloadlink": "https://github.com/NotAKidOnSteam/AASBufferFix/releases/download/v1.0.5/AASBufferFix.dll",
|
||||
"sourcelink": "https://github.com/NotAKidOnSteam/AASBufferFix/",
|
||||
"changelog": "- Don't send AAS while switching avatar.\n\nPlease read the changelog for [v1.0.5](https://github.com/NotAKidOnSteam/AASBufferFix/releases/tag/v1.0.5) for better understanding of why syncing nothing may be worse than syncing garbage AAS.",
|
||||
"embedcolor": "9b59b6"
|
||||
}
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 NotAKidoS
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
27
README.md
Normal file
27
README.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
# AASBufferFix
|
||||
|
||||
Fixes two issues with the Avatar Advanced Settings buffers when loading remote avatars:
|
||||
|
||||
https://feedback.abinteractive.net/p/aas-is-still-synced-while-loading-an-avatar
|
||||
|
||||
https://feedback.abinteractive.net/p/aas-buffer-is-nuked-on-remote-load
|
||||
|
||||
Avatars will no longer load in naked or transition to the wrong state on load.
|
||||
|
||||
AAS will also not be updated unless the expected data matches what is received.
|
||||
|
||||
The avatar will stay in the default animator state until AAS data is received that is deemed correct.
|
||||
|
||||
You will no longer sync garbage AAS while switching avatar.
|
||||
|
||||
---
|
||||
|
||||
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
|
||||
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||
|
||||
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
|
||||
|
||||
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||
|
||||
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue