na most talán ez a geci mukodik???

This commit is contained in:
2025-12-13 23:55:28 +01:00
parent 5abd025860
commit 9868d30810
4 changed files with 164 additions and 6 deletions

View File

@@ -0,0 +1,48 @@
using Harmony;
using KCM.LoadSaveOverrides;
using System;
using System.IO;
using UnityEngine;
namespace KCM
{
public static class LoadSaveLoadAtPathHook
{
public static byte[] saveData = new byte[1];
public static string lastLoadedPath = string.Empty;
}
public static class LoadSaveLoadHook
{
public static byte[] saveBytes = null;
public static bool memoryStreamHook = false;
public static MultiplayerSaveContainer saveContainer = null;
}
[HarmonyPatch(typeof(LoadSave), "LoadAtPath")]
public class LoadSaveLoadAtPathCaptureHook
{
public static void Prefix(string path)
{
try
{
if (string.IsNullOrEmpty(path))
return;
LoadSaveLoadAtPathHook.lastLoadedPath = path;
if (!File.Exists(path))
return;
LoadSaveLoadAtPathHook.saveData = File.ReadAllBytes(path);
Main.Log($"Captured save bytes from: {path} ({LoadSaveLoadAtPathHook.saveData.Length} bytes)");
}
catch (Exception ex)
{
Main.Log("Failed capturing save bytes from LoadSave.LoadAtPath");
Main.Log(ex);
}
}
}
}