remove DrawHooks, use new penumbra IPC calls (otter pls)
This commit is contained in:
@@ -7,45 +7,20 @@ namespace MareSynchronos.Factories
|
||||
public class FileReplacementFactory
|
||||
{
|
||||
private readonly IpcManager ipcManager;
|
||||
private readonly ClientState clientState;
|
||||
private string playerName;
|
||||
|
||||
public FileReplacementFactory(IpcManager ipcManager, ClientState clientState)
|
||||
public FileReplacementFactory(IpcManager ipcManager)
|
||||
{
|
||||
this.ipcManager = ipcManager;
|
||||
this.clientState = clientState;
|
||||
playerName = null!;
|
||||
}
|
||||
|
||||
public FileReplacement Create(string gamePath, bool resolve = true)
|
||||
public FileReplacement Create()
|
||||
{
|
||||
if (!ipcManager.CheckPenumbraAPI())
|
||||
{
|
||||
throw new System.Exception();
|
||||
}
|
||||
|
||||
var fileReplacement = new FileReplacement(gamePath, ipcManager.PenumbraModDirectory()!);
|
||||
if (!resolve) return fileReplacement;
|
||||
|
||||
if (clientState.LocalPlayer != null)
|
||||
{
|
||||
playerName = clientState.LocalPlayer.Name.ToString();
|
||||
}
|
||||
fileReplacement.SetResolvedPath(ipcManager.PenumbraResolvePath(gamePath, playerName)!);
|
||||
if (!fileReplacement.HasFileReplacement)
|
||||
{
|
||||
// try to resolve path with --filename instead?
|
||||
string[] tempGamePath = gamePath.Split('/');
|
||||
tempGamePath[^1] = "--" + tempGamePath[^1];
|
||||
string newTempGamePath = string.Join('/', tempGamePath);
|
||||
var resolvedPath = ipcManager.PenumbraResolvePath(newTempGamePath, playerName)!;
|
||||
if (resolvedPath != newTempGamePath)
|
||||
{
|
||||
fileReplacement.SetResolvedPath(resolvedPath);
|
||||
fileReplacement.SetGamePath(newTempGamePath);
|
||||
}
|
||||
}
|
||||
return fileReplacement;
|
||||
return new FileReplacement(ipcManager.PenumbraModDirectory()!);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user