Skip to content

Instantly share code, notes, and snippets.

@holly-hacker
Created May 30, 2018 20:21
Show Gist options
  • Save holly-hacker/519c073c10b1536d68a1e08aa3539839 to your computer and use it in GitHub Desktop.
Save holly-hacker/519c073c10b1536d68a1e08aa3539839 to your computer and use it in GitHub Desktop.
private static void Main(string[] args)
{
// Find the location of the running osu! client
string p = Process.GetProcessesByName("osu!").FirstOrDefault()?.MainModule.FileName;
if (p == null)
throw new Exception("Couldn't find process");
// Load this assembly and find the InterProcessOsu class
var ass = Assembly.LoadFrom(p);
var ipoType = ass.ExportedTypes.First(a => a.FullName == "osu.Helpers.InterProcessOsu");
// Create an assembly resolver, we'll need it later
AppDomain.CurrentDomain.AssemblyResolve += (sender, eventArgs) => eventArgs.Name.Contains("osu!") ? Assembly.LoadFrom(p) : null;
// Get an instance of the InterProcessOsu class and get the method we need
object ipo = Activator.GetObject(ipoType, "ipc://osu!/loader");
var method = ipoType.GetMethod("GetBulkClientData");
if (method == null)
throw new Exception("Couldn't find method");
// Invoke this method. This will require the AssemblyResolve event to return a proper Assembly where this type is located
var data = method.Invoke(ipo, null);
// And now pick any field and show it. There isn't much anymore, now.
string md5 = (string)data.GetType().GetField("BeatmapChecksum").GetValue(data);
OsuModes mode = (OsuModes)data.GetType().GetField("Mode").GetValue(data);
var lastAction = data.GetType().GetField("LLastAction").GetValue(data);
Console.WriteLine("MD5: " + md5);
Console.WriteLine("Mode: " + mode);
Console.WriteLine("Last Replay Action: " + lastAction);
Console.WriteLine("Done");
Console.ReadKey();
}
public enum OsuModes
{
Menu,
Edit,
Play,
Exit,
SelectEdit,
SelectPlay,
SelectDrawings,
Rank,
Update,
Busy,
Unknown,
Lobby,
MatchSetup,
SelectMulti,
RankingVs,
OnlineSelection,
OptionsOffsetWizard,
RankingTagCoop,
RankingTeam,
BeatmapImport,
PackageUpdater,
Benchmark,
Tourney,
Charts
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment