Pushing source files - Update .gitattributes, .gitignore, and 7 more files...

This commit is contained in:
2020-10-22 19:58:02 +02:00
parent f5ded321ba
commit 6e98c4867e
9 changed files with 1091 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@@ -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

261
.gitignore vendored Normal file
View File

@@ -0,0 +1,261 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.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
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# 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
# TODO: 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
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable 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
# 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
node_modules/
orleans.codegen.cs
# 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
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# 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/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc

227
DiscordRpc.cs Normal file
View File

@@ -0,0 +1,227 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
/// <summary>
/// Credit to https://github.com/Slaynash
/// </summary>
namespace DiscordRichPresense
{
public class DiscordRpc
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ReadyCallback(ref DiscordUser connectedUser);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void DisconnectedCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void ErrorCallback(int errorCode, string message);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void JoinCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void SpectateCallback(string secret);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate void RequestCallback(ref DiscordUser request);
public struct EventHandlers
{
public ReadyCallback readyCallback;
public DisconnectedCallback disconnectedCallback;
public ErrorCallback errorCallback;
public JoinCallback joinCallback;
public SpectateCallback spectateCallback;
public RequestCallback requestCallback;
}
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct RichPresenceStruct
{
public IntPtr state; /* max 128 bytes */
public IntPtr details; /* max 128 bytes */
public long startTimestamp;
public long endTimestamp;
public IntPtr largeImageKey; /* max 32 bytes */
public IntPtr largeImageText; /* max 128 bytes */
public IntPtr smallImageKey; /* max 32 bytes */
public IntPtr smallImageText; /* max 128 bytes */
public IntPtr partyId; /* max 128 bytes */
public int partySize;
public int partyMax;
public IntPtr matchSecret; /* max 128 bytes */
public IntPtr joinSecret; /* max 128 bytes */
public IntPtr spectateSecret; /* max 128 bytes */
public bool instance;
}
[Serializable]
public struct DiscordUser
{
public string userId;
public string username;
public string discriminator;
public string avatar;
}
public enum Reply
{
No = 0,
Yes = 1,
Ignore = 2
}
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_Initialize", CallingConvention = CallingConvention.Cdecl)]
public static extern void Initialize(string applicationId, ref EventHandlers handlers, bool autoRegister, string optionalSteamId);
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)]
public static extern void Shutdown();
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)]
public static extern void RunCallbacks();
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)]
private static extern void UpdatePresenceNative(ref RichPresenceStruct presence);
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_ClearPresence", CallingConvention = CallingConvention.Cdecl)]
public static extern void ClearPresence();
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_Respond", CallingConvention = CallingConvention.Cdecl)]
public static extern void Respond(string userId, Reply reply);
[DllImport("/PhasmodLoader/Dependencies/discord-rpc", EntryPoint = "Discord_UpdateHandlers", CallingConvention = CallingConvention.Cdecl)]
public static extern void UpdateHandlers(ref EventHandlers handlers);
public static void UpdatePresence(RichPresence presence)
{
var presencestruct = presence.GetStruct();
UpdatePresenceNative(ref presencestruct);
presence.FreeMem();
}
public class RichPresence
{
private RichPresenceStruct _presence;
private readonly List<IntPtr> _buffers = new List<IntPtr>(10);
public string state; /* max 128 bytes */
public string details; /* max 128 bytes */
public long startTimestamp;
public long endTimestamp;
public string largeImageKey; /* max 32 bytes */
public string largeImageText; /* max 128 bytes */
public string smallImageKey; /* max 32 bytes */
public string smallImageText; /* max 128 bytes */
public string partyId; /* max 128 bytes */
public int partySize;
public int partyMax;
public string matchSecret; /* max 128 bytes */
public string joinSecret; /* max 128 bytes */
public string spectateSecret; /* max 128 bytes */
public bool instance;
/// <summary>
/// Get the <see cref="RichPresenceStruct"/> reprensentation of this instance
/// </summary>
/// <returns><see cref="RichPresenceStruct"/> reprensentation of this instance</returns>
internal RichPresenceStruct GetStruct()
{
if (_buffers.Count > 0)
{
FreeMem();
}
_presence.state = StrToPtr(state, 128);
_presence.details = StrToPtr(details, 128);
_presence.startTimestamp = startTimestamp;
_presence.endTimestamp = endTimestamp;
_presence.largeImageKey = StrToPtr(largeImageKey, 32);
_presence.largeImageText = StrToPtr(largeImageText, 128);
_presence.smallImageKey = StrToPtr(smallImageKey, 32);
_presence.smallImageText = StrToPtr(smallImageText, 128);
_presence.partyId = StrToPtr(partyId, 128);
_presence.partySize = partySize;
_presence.partyMax = partyMax;
_presence.matchSecret = StrToPtr(matchSecret, 128);
_presence.joinSecret = StrToPtr(joinSecret, 128);
_presence.spectateSecret = StrToPtr(spectateSecret, 128);
_presence.instance = instance;
return _presence;
}
/// <summary>
/// Returns a pointer to a representation of the given string with a size of maxbytes
/// </summary>
/// <param name="input">String to convert</param>
/// <param name="maxbytes">Max number of bytes to use</param>
/// <returns>Pointer to the UTF-8 representation of <see cref="input"/></returns>
private IntPtr StrToPtr(string input, int maxbytes)
{
if (string.IsNullOrEmpty(input)) return IntPtr.Zero;
var convstr = StrClampBytes(input, maxbytes);
var convbytecnt = Encoding.UTF8.GetByteCount(convstr);
var buffer = Marshal.AllocHGlobal(convbytecnt);
_buffers.Add(buffer);
Marshal.Copy(Encoding.UTF8.GetBytes(convstr), 0, buffer, convbytecnt);
return buffer;
}
/// <summary>
/// Convert string to UTF-8 and add null termination
/// </summary>
/// <param name="toconv">string to convert</param>
/// <returns>UTF-8 representation of <see cref="toconv"/> with added null termination</returns>
private static string StrToUtf8NullTerm(string toconv)
{
var str = toconv.Trim();
var bytes = Encoding.Default.GetBytes(str);
if (bytes.Length > 0 && bytes[bytes.Length - 1] != 0)
{
str += "\0\0";
}
return Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(str));
}
/// <summary>
/// Clamp the string to the given byte length preserving null termination
/// </summary>
/// <param name="toclamp">string to clamp</param>
/// <param name="maxbytes">max bytes the resulting string should have (including null termination)</param>
/// <returns>null terminated string with a byte length less or equal to <see cref="maxbytes"/></returns>
private static string StrClampBytes(string toclamp, int maxbytes)
{
var str = StrToUtf8NullTerm(toclamp);
var strbytes = Encoding.UTF8.GetBytes(str);
if (strbytes.Length <= maxbytes)
{
return str;
}
var newstrbytes = new byte[] { };
Array.Copy(strbytes, 0, newstrbytes, 0, maxbytes - 1);
newstrbytes[newstrbytes.Length - 1] = 0;
newstrbytes[newstrbytes.Length - 2] = 0;
return Encoding.UTF8.GetString(newstrbytes);
}
/// <summary>
/// Free the allocated memory for conversion to <see cref="RichPresenceStruct"/>
/// </summary>
internal void FreeMem()
{
for (var i = _buffers.Count - 1; i >= 0; i--)
{
Marshal.FreeHGlobal(_buffers[i]);
_buffers.RemoveAt(i);
}
}
}
}
}

310
PhasmodHandler.csproj Normal file
View File

@@ -0,0 +1,310 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D18A3585-0909-41F0-9576-A2CF6766F599}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PhasmodHandler</RootNamespace>
<AssemblyName>PhasmodHandler</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Accessibility" />
<Reference Include="AntiCheat">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\AntiCheat.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=3.7.1.6, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia - Copy\Phasmophobia_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Compiler">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.Compiler.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Extensions">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.Extensions.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Parser">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.Parser.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.PatternMatching">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.PatternMatching.dll</HintPath>
</Reference>
<Reference Include="Boo.Lang.Useful">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Boo.Lang.Useful.dll</HintPath>
</Reference>
<Reference Include="com.unity.multiplayer-hlapi.Runtime">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\com.unity.multiplayer-hlapi.Runtime.dll</HintPath>
</Reference>
<Reference Include="Commons.Xml.Relaxng">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Commons.Xml.Relaxng.dll</HintPath>
</Reference>
<Reference Include="cscompmgd, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\cscompmgd.dll</HintPath>
</Reference>
<Reference Include="CustomMarshalers" />
<Reference Include="DiscordRPC, Version=1.0.150.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\DiscordRichPresence.1.0.150\lib\net35\DiscordRPC.dll</HintPath>
</Reference>
<Reference Include="I18N">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.dll</HintPath>
</Reference>
<Reference Include="I18N.CJK">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.CJK.dll</HintPath>
</Reference>
<Reference Include="I18N.MidEast">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.MidEast.dll</HintPath>
</Reference>
<Reference Include="I18N.Other">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.Other.dll</HintPath>
</Reference>
<Reference Include="I18N.Rare">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.Rare.dll</HintPath>
</Reference>
<Reference Include="I18N.West">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\I18N.West.dll</HintPath>
</Reference>
<Reference Include="IBM.Data.DB2">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\IBM.Data.DB2.dll</HintPath>
</Reference>
<Reference Include="Iced">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Iced.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Il2CppMono.Security">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppMono.Security.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.Configuration">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.Configuration.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.Core">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.Diagnostics.StackTrace">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.Diagnostics.StackTrace.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.Globalization.Extensions">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.Globalization.Extensions.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.IO.Compression">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.IO.Compression.dll</HintPath>
</Reference>
<Reference Include="Il2CppSystem.Xml">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Il2CppSystem.Xml.dll</HintPath>
</Reference>
<Reference Include="MelonLoader.ModHandler">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\MelonLoader.ModHandler.dll</HintPath>
</Reference>
<Reference Include="MeshExtension">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\MeshExtension.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Photon3Unity3D">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Photon3Unity3D.dll</HintPath>
</Reference>
<Reference Include="PhotonChat">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonChat.dll</HintPath>
</Reference>
<Reference Include="PhotonRealtime">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonRealtime.dll</HintPath>
</Reference>
<Reference Include="PhotonUnityNetworking">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonUnityNetworking.dll</HintPath>
</Reference>
<Reference Include="PhotonUnityNetworking.Utilities">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonUnityNetworking.Utilities.dll</HintPath>
</Reference>
<Reference Include="PhotonVoice">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonVoice.dll</HintPath>
</Reference>
<Reference Include="PhotonVoice.API">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonVoice.API.dll</HintPath>
</Reference>
<Reference Include="PhotonVoice.PUN">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonVoice.PUN.dll</HintPath>
</Reference>
<Reference Include="PhotonWebSocket">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\PhotonWebSocket.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnhollowerBaseLib">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="UnhollowerRuntimeLib">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnhollowerRuntimeLib.dll</HintPath>
</Reference>
<Reference Include="Unity.Analytics.DataPrivacy">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Unity.Analytics.DataPrivacy.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Unity.InputSystem.dll</HintPath>
</Reference>
<Reference Include="Unity.InputSystem.RebindingUI">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Unity.InputSystem.RebindingUI.dll</HintPath>
</Reference>
<Reference Include="Unity.Postprocessing.Runtime">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\Unity.Postprocessing.Runtime.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AIModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.AIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AndroidJNIModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.AndroidJNIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.AnimationModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AudioModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.AudioModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ClothModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.ClothModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.DirectorModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.DirectorModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.GridModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.GridModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Il2CppAssetBundleManager">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.Il2CppAssetBundleManager.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.InputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.JSONSerializeModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.JSONSerializeModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.ParticleSystemModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.Physics2DModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.Physics2DModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SharedInternalsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.SharedInternalsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.SubsystemsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.SubsystemsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.TerrainModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TerrainPhysicsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.TerrainPhysicsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TilemapModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.TilemapModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UIElementsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UNETModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UNETModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityAnalyticsModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UnityAnalyticsModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UnityWebRequestModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.UnityWebRequestModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VFXModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.VFXModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VideoModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.VideoModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VRModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.VRModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.WindModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.WindModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.XRModule">
<HintPath>E:\SteamLibrary\steamapps\common\Phasmophobia\PhasmodLoader\Managed\UnityEngine.XRModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DiscordRpc.cs" />
<Compile Include="main.cs" />
<Compile Include="patch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

25
PhasmodHandler.sln Normal file
View File

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

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30517.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhasmodHandler", "PhasmodHandler.csproj", "{D18A3585-0909-41F0-9576-A2CF6766F599}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D18A3585-0909-41F0-9576-A2CF6766F599}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D18A3585-0909-41F0-9576-A2CF6766F599}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D18A3585-0909-41F0-9576-A2CF6766F599}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D18A3585-0909-41F0-9576-A2CF6766F599}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {425E68C2-41EE-4A8E-9A1D-25AA941E4CDD}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,18 @@
using System.Reflection;
using MelonLoader;
[assembly: AssemblyTitle(Mod.BuildInfo.Description)]
[assembly: AssemblyDescription(Mod.BuildInfo.Description)]
[assembly: AssemblyCompany(Mod.BuildInfo.Company)]
[assembly: AssemblyProduct(Mod.BuildInfo.Name)]
[assembly: AssemblyCopyright("Created by " + Mod.BuildInfo.Author)]
[assembly: AssemblyTrademark(Mod.BuildInfo.Company)]
[assembly: AssemblyVersion(Mod.BuildInfo.Version)]
[assembly: AssemblyFileVersion(Mod.BuildInfo.Version)]
[assembly: MelonInfo(typeof(Mod.Mod), Mod.BuildInfo.Name, Mod.BuildInfo.Version, Mod.BuildInfo.Author, Mod.BuildInfo.DownloadLink)]
// Create and Setup a MelonGame to mark a Mod as Universal or Compatible with specific Games.
// If no MelonGameAttribute is found or any of the Values for any MelonGame on the Mod is null or empty it will be assumed the Mod is Universal.
// Values for MelonMame can be found in the Game's app.info file or printed at the top of every log directly beneath the Unity version.
[assembly: MelonGame("Kinetic Games", "Phasmophobia")]

165
main.cs Normal file
View File

@@ -0,0 +1,165 @@
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Runtime.InteropServices;
using MelonLoader;
using DiscordRichPresense;
using Harmony;
using UnityEngine.UI;
using UnityEngine;
namespace Mod
{
public static class BuildInfo
{
public const string Name = "PhasmodHandler"; // Name of the Mod. (MUST BE SET)
public const string Description = "Mod for handling specific Phasmophobia mods"; // Description for the Mod. (Set as null if none)
public const string Author = "seppdroid"; // Author of the Mod. (Set as null if none)
public const string Company = null; // Company that made the Mod. (Set as null if none)
public const string Version = "1.0.3"; // Version of the Mod. (MUST BE SET)
public const string DownloadLink = null; // Download Link for the Mod. (Set as null if none)
}
public class Mod : MelonMod
{
private const string DiscordAppID = "767737509656002601";
public static readonly DiscordRpc.RichPresence Presence = new DiscordRpc.RichPresence();
public override void OnApplicationStart() // Runs after Game Initialization.
{
var handlers = new DiscordRpc.EventHandlers();
DiscordRpc.Initialize(DiscordAppID, ref handlers, false, string.Empty);
Presence.state = "Starting game...";
Presence.details = "Playing PhasMODphobia";
Presence.startTimestamp = default(long);
Presence.largeImageKey = "phasmod";
Presence.largeImageText = "Phasmodphobia";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] Phasmophobia Mod Handler has started");
}
public override void OnLevelIsLoading() // Runs when a Scene is Loading or when a Loading Screen is Shown. Currently only runs if the Mod is used in BONEWORKS.
{
MelonLogger.Log("[log] Loading level");
}
public override void OnLevelWasLoaded(int level) // Runs when a Scene has Loaded.
{
if (level == 1)
{
Presence.state = "In Main Menu Lobby";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "lobby";
Presence.largeImageText = "Phasmodphobia";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 2)
{
Presence.state = "In Tanglewood Street";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "tanglewood";
Presence.largeImageText = "Tanglewood Street House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 3)
{
Presence.state = "In Asylum";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "asylum";
Presence.largeImageText = "Asylum";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 4)
{
Presence.state = "In Edgefield Street House";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "streethouse";
Presence.largeImageText = "Edgefield Street House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 5)
{
Presence.state = "In Ridgefield Road House";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "ridgefield";
Presence.largeImageText = "Ridgefield Road House";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 6)
{
Presence.state = "In Brownstone Highschool";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "brownstone";
Presence.largeImageText = "Brownstone Highschool";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 7)
{
Presence.state = "In Bleasdale Farmhouse";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "bleasdale";
Presence.largeImageText = "Bleasdale Farmhouse";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
if (level == 8)
{
Presence.state = "In Grafton Farmhouse";
Presence.details = "Playing PhasMODphobia";
Presence.largeImageKey = "grafton";
Presence.largeImageText = "Grafton Farmhouse";
Presence.smallImageKey = "phasmod";
Presence.smallImageText = "phasmomod";
DiscordRpc.UpdatePresence(Presence);
MelonLogger.Log("[log] RPC Status changed");
}
// else and set an undefined level so you wont be in the main lobby if you play a map above 8?
MelonLogger.Log("[log] loadedlevel: " + level.ToString());
}
public override void OnLevelWasInitialized(int level) // Runs when a Scene has Initialized.
{
MelonLogger.Log("[log] initlevel: " + level.ToString());
}
public override void OnUpdate()
{
DiscordRpc.RunCallbacks(); // for if we are going to handle invites...
}
public override void OnApplicationQuit() // Runs when the Game is told to Close.
{
DiscordRpc.Shutdown();
MelonLogger.Log("[log] Phasmophobia closed");
}
}
}

6
packages.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DiscordRichPresence" version="1.0.150" targetFramework="net472" />
<package id="Lib.Harmony" version="2.0.2" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
</packages>

16
patch.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using System.Text;
using System.Runtime.InteropServices;
using MelonLoader;
using Harmony;
using UnityEngine.UI;
using UnityEngine;
namespace PhasmodHandler
{
// removed all this crap.
}