Skip to content

Commit

Permalink
Updated to support Beat Saber 1.7.0 and Custom Sabers 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kylon99 committed Mar 29, 2020
1 parent b0abc6d commit 8b945eb
Show file tree
Hide file tree
Showing 13 changed files with 187 additions and 106 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
52 changes: 36 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
Expand All @@ -12,17 +13,23 @@
# 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/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand All @@ -36,9 +43,10 @@ Generated\ Files/
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Build Results of an ATL Project
[Dd]ebugPS/
Expand All @@ -52,15 +60,14 @@ BenchmarkDotNet.Artifacts/
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

# StyleCop
StyleCopReport.xml

# Files built by Visual Studio
*_i.c
*_p.c
*_i.h
*_h.h
*.ilk
*.meta
*.obj
Expand All @@ -77,6 +84,7 @@ StyleCopReport.xml
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
Expand Down Expand Up @@ -119,9 +127,6 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

Expand Down Expand Up @@ -179,6 +184,8 @@ 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.
Expand All @@ -203,12 +210,14 @@ 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/
!?*.[Cc]ache/

# Others
ClientBin/
Expand All @@ -221,7 +230,7 @@ ClientBin/
*.publishsettings
orleans.codegen.cs

# Including strong name files can present a security risk
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk

Expand Down Expand Up @@ -252,6 +261,9 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/
Expand Down Expand Up @@ -287,12 +299,8 @@ paket-files/
# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml

# CodeRush
.cr/
# CodeRush personal settings
.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
Expand All @@ -317,7 +325,7 @@ __pycache__/
# OpenCover UI analysis results
OpenCover/

# Azure Stream Analytics local run output
# Azure Stream Analytics local run output
ASALocalRun/

# MSBuild Binary and Structured Log
Expand All @@ -326,5 +334,17 @@ ASALocalRun/
# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
# MFractors (Xamarin productivity tool) working folder
.mfractor/

# Local History for Visual Studio
.localhistory/

# 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/
8 changes: 8 additions & 0 deletions CustomMenuPointers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ VisualStudioVersion = 16.0.29209.62
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomMenuPointers", "CustomMenuPointers\CustomMenuPointers.csproj", "{4488C785-6249-4CDC-8203-38CB97045BFE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3CDBAA68-B56A-4F3B-B81A-1D9814E338A0}"
ProjectSection(SolutionItems) = preProject
.gitattributes = .gitattributes
.gitignore = .gitignore
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion CustomMenuPointers/CustomMenuPointers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void ReplaceWithCustomSabersForScene(bool showMenuCore = true)

this.UnloadEverything();

Logger.Info($"Current Custom Saber: {CustomSaber.Plugin._currentSaberName}");
Logger.Info($"Current Custom Saber: {CustomSabersMod.instance.CurrentSaberName}");

// Load the asset bundle objects
var loadedSaberAssetBundle = CustomSabersMod.instance.GetCurrentDefaultSaberAssetBundle();
Expand Down
38 changes: 20 additions & 18 deletions CustomMenuPointers/CustomMenuPointers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,27 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BeatSaberCustomUI, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BeatSaberCustomUI.dll</HintPath>
</Reference>
<Reference Include="BSML">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BSML.dll</HintPath>
<HintPath>$(GameDirPath)Plugins\BSML.dll</HintPath>
</Reference>
<Reference Include="BS_Utils">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\BS_Utils.dll</HintPath>
<HintPath>$(GameDirPath)Plugins\BS_Utils.dll</HintPath>
</Reference>
<Reference Include="CustomSaber, Version=3.2.2.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins\CustomSaber.dll</HintPath>
<HintPath>$(GameDirPath)Plugins\CustomSaber.dll</HintPath>
</Reference>
<Reference Include="HMLib">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\HMLib.dll</HintPath>
</Reference>
<Reference Include="HMUI">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\HMUI.dll</HintPath>
</Reference>
<Reference Include="IPA.Loader">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
</Reference>
<Reference Include="MainAssembly">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\MainAssembly.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -61,21 +63,21 @@
<Reference Include="System.Xml" />
<Reference Include="Unity.TextMeshPro, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Beat Saber\Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -111,6 +113,6 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy CustomMenuPointers.dll "C:\Program Files (x86)\Steam\steamapps\common\Beat Saber\Plugins"</PostBuildEvent>
<PostBuildEvent>copy "$(TargetFileName)" "$(GameDirPath)Plugins"</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
18 changes: 8 additions & 10 deletions CustomMenuPointers/CustomSabersMod.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using IPA.Loader;
using System.Reflection;
using CustomSaber.Settings;
using IPA.Loader;
using UnityEngine;

namespace CustomMenuPointers
Expand All @@ -8,7 +8,7 @@ public class CustomSabersMod : PersistentSingleton<CustomSabersMod>
{

public bool IsLoaded { get; private set; }
public string CurrentSaberName => CustomSaber.Plugin._currentSaberName;
public string CurrentSaberName => Configuration.CurrentlySelectedSaber;


private void Awake()
Expand All @@ -19,20 +19,18 @@ private void Awake()
public bool IsUsingDefaultSabers()
{
return !IsLoaded ||
CustomSaber.Plugin._currentSaberName == null ||
CustomSaber.Plugin._currentSaberName == "Default Sabers";
this.CurrentSaberName == null ||
this.CurrentSaberName == "Default Sabers";
}

public AssetBundle GetCurrentDefaultSaberAssetBundle()
{
if (!IsLoaded) return null;

// Get the Custom Saber AssetBundle
var assembly = Assembly.GetAssembly(typeof(CustomSaber.CustomTrail));
var type = assembly.GetType("CustomSaber.SaberLoader");
MethodInfo getSaberAssetBundle = type.GetMethod("GetSaberAssetBundle", BindingFlags.Static | BindingFlags.Public);
object assetBundleObj = getSaberAssetBundle.Invoke(null, new[] { CustomSaber.Plugin._currentSaberName });
return assetBundleObj as AssetBundle;
int index = CustomSaber.Utilities.SaberAssetLoader.SelectedSaber;
var currentSaberData = CustomSaber.Utilities.SaberAssetLoader.CustomSabers[index];
return currentSaberData.AssetBundle;
}

/// <summary>
Expand Down
Loading

0 comments on commit 8b945eb

Please sign in to comment.