From b1405598bb71cffba4800d776966b9b7248e2c67 Mon Sep 17 00:00:00 2001 From: wcko87 Date: Sat, 15 Apr 2017 01:59:55 +0800 Subject: [PATCH] Add option to don't split on reload during boss fights. Experimental. (1.75 only. I don't have the addresses for older versions) --- rabi_splitter_WPF/MainContext.cs | 14 ++++++++++++++ rabi_splitter_WPF/MainWindow.xaml | 1 + rabi_splitter_WPF/MainWindow.xaml.cs | 16 ++++++++++++++-- rabi_splitter_WPF/StaticData.cs | 2 ++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/rabi_splitter_WPF/MainContext.cs b/rabi_splitter_WPF/MainContext.cs index b545002..64329f8 100644 --- a/rabi_splitter_WPF/MainContext.cs +++ b/rabi_splitter_WPF/MainContext.cs @@ -140,6 +140,7 @@ namespace rabi_splitter_WPF private bool _aliusI; private bool _tm2; private bool _irisu1; + private bool _dontSplitOnReload; private bool _debugArea; private int _serverPort; private string _gameVer; @@ -245,6 +246,17 @@ namespace rabi_splitter_WPF } } + public bool DontSplitOnReload + { + get { return _dontSplitOnReload; } + set + { + if (value == _dontSplitOnReload) return; + _dontSplitOnReload = value; + OnPropertyChanged(nameof(DontSplitOnReload)); + } + } + public bool DebugArea { get { return _debugArea; } @@ -318,6 +330,7 @@ namespace rabi_splitter_WPF public int lastmoney; public int lastmapid; public int lastmusicid; + public int lastplaytime = 0; public bool bossbattle; public List lastbosslist; public int lastnoah3hp; @@ -335,6 +348,7 @@ namespace rabi_splitter_WPF this.AliusI = true; this.Tm2 = true; this.Irisu1 = true; + this.DontSplitOnReload = false; this.DebugArea = false; this.ServerPort = 16834; this.Igt = true; diff --git a/rabi_splitter_WPF/MainWindow.xaml b/rabi_splitter_WPF/MainWindow.xaml index 8a99f90..ec37d13 100644 --- a/rabi_splitter_WPF/MainWindow.xaml +++ b/rabi_splitter_WPF/MainWindow.xaml @@ -36,6 +36,7 @@ + diff --git a/rabi_splitter_WPF/MainWindow.xaml.cs b/rabi_splitter_WPF/MainWindow.xaml.cs index a5de5ea..4586315 100644 --- a/rabi_splitter_WPF/MainWindow.xaml.cs +++ b/rabi_splitter_WPF/MainWindow.xaml.cs @@ -83,6 +83,18 @@ namespace rabi_splitter_WPF #endregion + #region Detect Reload + + bool reloaded = false; + { + int playtime = MemoryHelper.GetMemoryValue(process, StaticData.PlaytimeAddr[mainContext.veridx]); + reloaded = playtime != 0 && playtime < mainContext.lastplaytime; + if (reloaded) DebugLog("Reload Game!"); + mainContext.lastplaytime = playtime; + } + + #endregion + #region CheckMoney if (mainContext.Computer) @@ -216,8 +228,8 @@ namespace rabi_splitter_WPF mainContext.bossbattle = false; if (mainContext.MusicEnd) { - sendsplit(); - DebugLog("music end, split"); + if (!mainContext.DontSplitOnReload || !reloaded) sendsplit(); + DebugLog(reloaded ? "music end, don't split (reload)" : "music end, split"); } } diff --git a/rabi_splitter_WPF/StaticData.cs b/rabi_splitter_WPF/StaticData.cs index 5cf1eee..d391681 100644 --- a/rabi_splitter_WPF/StaticData.cs +++ b/rabi_splitter_WPF/StaticData.cs @@ -164,5 +164,7 @@ namespace rabi_splitter_WPF public static int[] TownMemberAddr = {0xD38934, 0xD5C0F4, 0xD63BC4, 0xD65BC4 }; public static int[] IGTAddr = { 0xD388E0, 0xD5C0A0, 0xD63B70, 0xD65B70 }; + + public static int[] PlaytimeAddr = { 0, 0, 0, 0xD642D8 }; } }