-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
52 lines (45 loc) · 1.47 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Harmony;
using Microsoft.Xna.Framework;
using System;
using System.IO;
using System.Reflection;
namespace CelesteHFR
{
class Program
{
static void Main(string[] args)
{
// install patches
var harmony = HarmonyInstance.Create("celeste.hfr");
harmony.PatchAll(Assembly.GetExecutingAssembly());
// place a steam_appid.txt file in the current dir
File.WriteAllText("steam_appid.txt", "504230");
// run celeste
typeof(Celeste.Celeste).GetMethod("Main", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new object[] { new string[] { } });
}
// Main patch: Ensure XNA's FixedTimeStep is false.
[HarmonyPatch(typeof(Game))]
[HarmonyPatch("set_IsFixedTimeStep")]
[HarmonyPatch(new Type[] { typeof(bool) })]
class Patch
{
static bool Prefix(ref bool value)
{
value = false;
return true;
}
}
// Secondary patch: Many things expect Celeste.exe to be the entry point, so make it the entry point.
[HarmonyPatch(typeof(Assembly))]
[HarmonyPatch("GetEntryAssembly")]
[HarmonyPatch(new Type[] { })]
class Patch2
{
static bool Prefix(ref Assembly __result)
{
__result = typeof(Celeste.Celeste).Assembly;
return false;
}
}
}
}