Refactor memory reading, now reads by snapshots. Implement death/reset counter
This commit is contained in:
parent
62a3b6a64d
commit
d4fa840616
@ -166,7 +166,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text1) return;
|
||||
_gameVer = value;
|
||||
_text1 = value;
|
||||
OnPropertyChanged(nameof(Text1));
|
||||
}
|
||||
}
|
||||
@ -177,7 +177,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text2) return;
|
||||
_gameVer = value;
|
||||
_text2 = value;
|
||||
OnPropertyChanged(nameof(Text2));
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text3) return;
|
||||
_gameVer = value;
|
||||
_text3 = value;
|
||||
OnPropertyChanged(nameof(Text3));
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text4) return;
|
||||
_gameVer = value;
|
||||
_text4 = value;
|
||||
OnPropertyChanged(nameof(Text4));
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text5) return;
|
||||
_gameVer = value;
|
||||
_text5 = value;
|
||||
OnPropertyChanged(nameof(Text5));
|
||||
}
|
||||
}
|
||||
@ -221,7 +221,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text6) return;
|
||||
_gameVer = value;
|
||||
_text6 = value;
|
||||
OnPropertyChanged(nameof(Text6));
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text7) return;
|
||||
_gameVer = value;
|
||||
_text7 = value;
|
||||
OnPropertyChanged(nameof(Text7));
|
||||
}
|
||||
}
|
||||
@ -243,7 +243,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text8) return;
|
||||
_gameVer = value;
|
||||
_text8 = value;
|
||||
OnPropertyChanged(nameof(Text8));
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text9) return;
|
||||
_gameVer = value;
|
||||
_text9 = value;
|
||||
OnPropertyChanged(nameof(Text9));
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text10) return;
|
||||
_gameVer = value;
|
||||
_text10 = value;
|
||||
OnPropertyChanged(nameof(Text10));
|
||||
}
|
||||
}
|
||||
@ -276,7 +276,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text11) return;
|
||||
_gameVer = value;
|
||||
_text11 = value;
|
||||
OnPropertyChanged(nameof(Text11));
|
||||
}
|
||||
}
|
||||
@ -287,7 +287,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text12) return;
|
||||
_gameVer = value;
|
||||
_text12 = value;
|
||||
OnPropertyChanged(nameof(Text12));
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text13) return;
|
||||
_gameVer = value;
|
||||
_text13 = value;
|
||||
OnPropertyChanged(nameof(Text13));
|
||||
}
|
||||
}
|
||||
@ -309,7 +309,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text14) return;
|
||||
_gameVer = value;
|
||||
_text14 = value;
|
||||
OnPropertyChanged(nameof(Text14));
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace rabi_splitter_WPF
|
||||
set
|
||||
{
|
||||
if (value == _text15) return;
|
||||
_gameVer = value;
|
||||
_text15 = value;
|
||||
OnPropertyChanged(nameof(Text15));
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,11 @@ namespace rabi_splitter_WPF
|
||||
break;
|
||||
case TypeCode.Int32:
|
||||
|
||||
case TypeCode.Single:
|
||||
case TypeCode.UInt32:
|
||||
datasize = 4;
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
case TypeCode.Int64:
|
||||
case TypeCode.UInt64:
|
||||
datasize = 8;
|
||||
@ -73,18 +75,21 @@ namespace rabi_splitter_WPF
|
||||
case TypeCode.Char:
|
||||
return (T)Convert.ChangeType((char)buffer[0], typeof(T));
|
||||
|
||||
case TypeCode.Single:
|
||||
return (T)Convert.ChangeType(BitConverter.ToSingle(buffer, 0), typeof(T));
|
||||
|
||||
case TypeCode.Int16:
|
||||
|
||||
return (T)Convert.ChangeType(BitConverter.ToInt16(buffer,0), typeof(T));
|
||||
|
||||
case TypeCode.UInt16:
|
||||
return (T)Convert.ChangeType(BitConverter.ToUInt16(buffer, 0), typeof(T));
|
||||
case TypeCode.Int32:
|
||||
return (T)Convert.ChangeType(BitConverter.ToInt32(buffer, 0), typeof(T));
|
||||
case TypeCode.UInt32:
|
||||
return (T)Convert.ChangeType(BitConverter.ToUInt32(buffer, 0), typeof(T));
|
||||
|
||||
|
||||
case TypeCode.Double:
|
||||
return (T)Convert.ChangeType(BitConverter.ToDouble(buffer, 0), typeof(T));
|
||||
|
||||
case TypeCode.Int64:
|
||||
return (T)Convert.ChangeType(BitConverter.ToInt64(buffer, 0), typeof(T));
|
||||
case TypeCode.UInt64:
|
||||
|
64
rabi_splitter_WPF/MemorySnapshot.cs
Normal file
64
rabi_splitter_WPF/MemorySnapshot.cs
Normal file
@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace rabi_splitter_WPF
|
||||
{
|
||||
class MemorySnapshot
|
||||
{
|
||||
public readonly int t_playtime;
|
||||
public readonly int playtime;
|
||||
public readonly int blackness;
|
||||
public readonly int mapid;
|
||||
public readonly int musicid;
|
||||
public readonly int money;
|
||||
public readonly int hp;
|
||||
public readonly int maxhp;
|
||||
|
||||
public readonly int entityArrayPtr;
|
||||
|
||||
public readonly float amulet;
|
||||
public readonly int boost;
|
||||
public readonly float mana;
|
||||
public readonly int stamina;
|
||||
|
||||
public readonly float px;
|
||||
public readonly float py;
|
||||
|
||||
public MemorySnapshot(Process process, int veridx)
|
||||
{
|
||||
t_playtime = MemoryHelper.GetMemoryValue<int>(process, StaticData.IGTAddr[veridx]);
|
||||
playtime = MemoryHelper.GetMemoryValue<int>(process, StaticData.PlaytimeAddr[veridx]);
|
||||
blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[veridx]);
|
||||
|
||||
mapid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MapAddress[veridx]);
|
||||
musicid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MusicAddr[veridx]);
|
||||
money = MemoryHelper.GetMemoryValue<int>(process, StaticData.MoneyAddress[veridx]);
|
||||
|
||||
entityArrayPtr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[veridx]);
|
||||
|
||||
hp = MemoryHelper.GetMemoryValue<int>(process, entityArrayPtr + 0x4D8, false);
|
||||
maxhp = MemoryHelper.GetMemoryValue<int>(process, entityArrayPtr + 0x4E8, false);
|
||||
|
||||
amulet = MemoryHelper.GetMemoryValue<float>(process, entityArrayPtr + 0x52C, false);
|
||||
boost = MemoryHelper.GetMemoryValue<int>(process, entityArrayPtr + 0x5DC, false);
|
||||
mana = MemoryHelper.GetMemoryValue<float>(process, entityArrayPtr + 0x6B8, false);
|
||||
stamina = MemoryHelper.GetMemoryValue<int>(process, entityArrayPtr + 0x5B4, false);
|
||||
|
||||
px = MemoryHelper.GetMemoryValue<float>(process, entityArrayPtr + 0xC, false);
|
||||
py = MemoryHelper.GetMemoryValue<float>(process, entityArrayPtr + 0x10, false);
|
||||
}
|
||||
|
||||
public bool CurrentMapIs(Map? map)
|
||||
{
|
||||
return StaticData.GetMap(mapid) == map;
|
||||
}
|
||||
|
||||
public bool CurrentMusicIs(Music? music)
|
||||
{
|
||||
return StaticData.GetMusic(musicid) == music;
|
||||
}
|
||||
}
|
||||
}
|
212
rabi_splitter_WPF/RabiEnums.cs
Normal file
212
rabi_splitter_WPF/RabiEnums.cs
Normal file
@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace rabi_splitter_WPF
|
||||
{
|
||||
public enum Boss
|
||||
{
|
||||
Cocoa,
|
||||
Rumi,
|
||||
Ashuri,
|
||||
Rita,
|
||||
Ribbon,
|
||||
Cocoa2,
|
||||
Cicini,
|
||||
Saya,
|
||||
Syaro,
|
||||
Pandora,
|
||||
Nieve,
|
||||
Nixie,
|
||||
Aruraune,
|
||||
Seana,
|
||||
Lilith,
|
||||
Vanilla,
|
||||
Chocolate,
|
||||
IllusionAlius,
|
||||
PinkKotri,
|
||||
Noah1,
|
||||
Irisu,
|
||||
Miriam,
|
||||
Miru,
|
||||
Noah3,
|
||||
KekeBunny,
|
||||
}
|
||||
|
||||
public enum Map
|
||||
{
|
||||
SouthernWoodland,
|
||||
WesternCoast,
|
||||
IslandCore,
|
||||
NorthernTundra,
|
||||
EasternHighlands,
|
||||
RabiRabiTown,
|
||||
Plurkwood,
|
||||
SubterraneanArea,
|
||||
WarpDestination,
|
||||
SystemInterior,
|
||||
}
|
||||
|
||||
public enum Music
|
||||
{
|
||||
NO_MUSIC,
|
||||
ADVENTURE_STARTS_HERE,
|
||||
SPECTRAL_CAVE,
|
||||
FORGOTTEN_CAVE,
|
||||
UNDERWATER_AMBIENT,
|
||||
LIBRARY_AMBIENT,
|
||||
FORGOTTEN_CAVE_II,
|
||||
STARTING_FOREST_NIGHT,
|
||||
BOUNCE_BOUNCE,
|
||||
RABI_RABI_BEACH,
|
||||
PANDORAS_PALACE,
|
||||
RABI_RABI_RAVINE,
|
||||
HOME_SWEET_HOME,
|
||||
RABI_RABI_PARK,
|
||||
INSIDE_UPRPRC,
|
||||
SKY_ISLAND_TOWN,
|
||||
WINTER_WONDERLAND,
|
||||
CYBERSPACE_EXE,
|
||||
EVERNIGHT_PEAK,
|
||||
EXOTIC_LABORATORY,
|
||||
GOLDEN_RIVERBANK,
|
||||
FLOATING_GRAVEYARD,
|
||||
SYSTEM_INTERIOR_II,
|
||||
AURORA_PALACE,
|
||||
SPEICHER_GALERIE,
|
||||
DEEP_UNDER_THE_SEA,
|
||||
SKY_HIGH_BRIDGE,
|
||||
WARP_DESTINATION,
|
||||
VOLCANIC_CANERNS,
|
||||
PLURKWOOD,
|
||||
ANOTHER_D,
|
||||
ICY_SUMMIT,
|
||||
PREPARE_EVENT,
|
||||
MIDBOSS_BATTLE,
|
||||
MIDSTREAM_JAM,
|
||||
MIRIAMS_SHOP,
|
||||
BUNNY_PANIC,
|
||||
THE_TRUTH_NEVER_SPOKEN,
|
||||
BRAWL_BREAKS_VER_2,
|
||||
BRAWL_BREAKS,
|
||||
SANDBAG_MINI_GAME,
|
||||
STAFF_ROLL,
|
||||
RFN_III,
|
||||
NO_REMORSE,
|
||||
GET_ON_WITH_IT,
|
||||
THEME_OF_RABI_RIBI_8BIT,
|
||||
THEME_OF_RABI_RIBI,
|
||||
FULL_ON_COMBAT,
|
||||
HI_TECH_DUEL,
|
||||
UNFAMILIAR_PLACE,
|
||||
UNFAMILIAR_PLACE_AGAIN,
|
||||
KITTY_ATTACK,
|
||||
M_R_,
|
||||
MAIN_MENU,
|
||||
SUDDEN_DEATH,
|
||||
RABI_RABI_RAVINE_VER_2,
|
||||
WASTE,
|
||||
ARTBOOK_INTRO,
|
||||
RABI_RIBI_PIANO_TITLE,
|
||||
MISCHIEVOUS_MASQUERADE,
|
||||
}
|
||||
|
||||
// A set of (id, enum, string)
|
||||
public class IdEnumAssociation<EnumType> : List<Tuple<int, EnumType, string>>
|
||||
{
|
||||
public void Add(int id, EnumType value, string name)
|
||||
{
|
||||
Add(new Tuple<int, EnumType, string>(id, value, name));
|
||||
}
|
||||
}
|
||||
|
||||
// A set of (enum, string)
|
||||
public class IndexEnumAssociation<EnumType> : List<Tuple<EnumType, string>>
|
||||
{
|
||||
public void Add(EnumType value, string name)
|
||||
{
|
||||
Add(new Tuple<EnumType, string>(value, name));
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class StaticData {
|
||||
|
||||
public static readonly Dictionary<int, Boss> _getBoss;
|
||||
public static readonly Dictionary<int, string> _getBossName;
|
||||
public static readonly Dictionary<Boss, string> _getBossFromType;
|
||||
|
||||
public static readonly Map[] _getMap;
|
||||
public static readonly string[] _getMapName;
|
||||
public static readonly Dictionary<Map, string> _getMapFromType;
|
||||
|
||||
public static readonly Music[] _getMusic;
|
||||
public static readonly string[] _getMusicName;
|
||||
public static readonly Dictionary<Music, string> _getMusicFromType;
|
||||
|
||||
static StaticData()
|
||||
{
|
||||
_getBoss = BossList.ToDictionary(t => t.Item1, t => t.Item2);
|
||||
_getBossName = BossList.ToDictionary(t => t.Item1, t => t.Item3);
|
||||
_getBossFromType = BossList.ToDictionary(t => t.Item2, t => t.Item3);
|
||||
|
||||
_getMap = MapList.Select(t => t.Item1).ToArray();
|
||||
_getMapName = MapList.Select(t => t.Item2).ToArray();
|
||||
_getMapFromType = MapList.ToDictionary(t => t.Item1, t => t.Item2);
|
||||
|
||||
_getMusic = MusicList.Select(t => t.Item1).ToArray();
|
||||
_getMusicName = MusicList.Select(t => t.Item2).ToArray();
|
||||
_getMusicFromType = MusicList.ToDictionary(t => t.Item1, t => t.Item2);
|
||||
}
|
||||
|
||||
public static Boss? GetBoss(int id) {
|
||||
Boss value;
|
||||
if (_getBoss.TryGetValue(id, out value)) return value;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetBossName(int id) {
|
||||
string value;
|
||||
if (_getBossName.TryGetValue(id, out value)) return value;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static string GetBossName(Boss? boss) {
|
||||
string value;
|
||||
if (boss.HasValue && _getBossFromType.TryGetValue(boss.Value, out value)) return value;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Map? GetMap(int id) {
|
||||
if (0 <= id && id < _getMap.Length) return _getMap[id];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetMapName(int id) {
|
||||
if (0 <= id && id < _getMapName.Length) return _getMapName[id];
|
||||
return "Unknown ID " + id;
|
||||
}
|
||||
|
||||
public static string GetMapName(Map? map) {
|
||||
string value;
|
||||
if (map.HasValue && _getMapFromType.TryGetValue(map.Value, out value)) return value;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Music? GetMusic(int id) {
|
||||
if (0 <= id && id < _getMusic.Length) return _getMusic[id];
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetMusicName(int id) {
|
||||
if (0 <= id && id < _getMusicName.Length) return _getMusicName[id];
|
||||
return "Unknown ID " + id;
|
||||
}
|
||||
|
||||
public static string GetMusicName(Music? music) {
|
||||
string value;
|
||||
if (music.HasValue && _getMusicFromType.TryGetValue(music.Value, out value)) return value;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
29
rabi_splitter_WPF/RabiGameState.cs
Normal file
29
rabi_splitter_WPF/RabiGameState.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace rabi_splitter_WPF
|
||||
{
|
||||
enum GameActivity
|
||||
{
|
||||
WALKING,
|
||||
BOSS_BATTLE,
|
||||
}
|
||||
|
||||
class RabiGameState
|
||||
{
|
||||
public int nRestarts;
|
||||
public int nDeaths;
|
||||
|
||||
public GameActivity currentActivity;
|
||||
public int currentBoss;
|
||||
|
||||
public RabiGameState()
|
||||
{
|
||||
currentActivity = GameActivity.WALKING;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -6,90 +6,108 @@ using System.Text;
|
||||
|
||||
namespace rabi_splitter_WPF
|
||||
{
|
||||
enum GameStatus
|
||||
{
|
||||
INGAME,
|
||||
MENU
|
||||
}
|
||||
|
||||
class RabiRibiDisplay
|
||||
{
|
||||
private MainContext mainContext;
|
||||
private DebugContext debugContext;
|
||||
private MainWindow mainWindow;
|
||||
|
||||
private GameStatus gameStatus = GameStatus.MENU;
|
||||
private RabiGameState gameState;
|
||||
private MemorySnapshot prevSnapshot;
|
||||
private MemorySnapshot snapshot;
|
||||
|
||||
public int previousBlackness = -1;
|
||||
public int lastmoney;
|
||||
public int lastmapid;
|
||||
public int lastmusicid;
|
||||
public int lastplaytime = 0;
|
||||
public bool bossbattle;
|
||||
public List<int> lastbosslist;
|
||||
public int lastnoah3hp;
|
||||
public int lastTM;
|
||||
public DateTime LastTMAddTime;
|
||||
private bool _noah1Reload;
|
||||
|
||||
|
||||
|
||||
public RabiRibiDisplay(MainContext mainContext, DebugContext debugContext, MainWindow mainWindow)
|
||||
{
|
||||
this.mainContext = mainContext;
|
||||
this.debugContext = debugContext;
|
||||
this.mainWindow = mainWindow;
|
||||
StartNewGame();
|
||||
}
|
||||
|
||||
|
||||
public void ReadMemory(Process process)
|
||||
{
|
||||
#region read igt
|
||||
// Snapshot Game Memory
|
||||
snapshot = new MemorySnapshot(process, mainContext.veridx);
|
||||
|
||||
int igt = MemoryHelper.GetMemoryValue<int>(process, StaticData.IGTAddr[mainContext.veridx]);
|
||||
if (igt > 0 && mainContext.Igt)
|
||||
{
|
||||
sendigt((float)igt / 60);
|
||||
}
|
||||
mainContext.Text1 = "Music: " + StaticData.GetMusicName(snapshot.musicid);
|
||||
mainContext.Text2 = "Map: " + StaticData.GetMapName(snapshot.mapid);
|
||||
mainContext.Text3 = gameState == null ? "" : ("Deaths: " + gameState.nDeaths + "\n" + "Resets: " + gameState.nRestarts);
|
||||
|
||||
#endregion
|
||||
mainContext.Text4 = "HP: " + snapshot.hp;
|
||||
mainContext.Text5 = "MaxHP: " + snapshot.maxhp;
|
||||
|
||||
mainContext.Text6 = "Amulet: " + snapshot.amulet;
|
||||
mainContext.Text7 = "Boost: " + snapshot.boost;
|
||||
mainContext.Text8 = "Mana: " + snapshot.mana;
|
||||
mainContext.Text9 = "Stamina: " + snapshot.stamina;
|
||||
|
||||
mainContext.Text10 = "x: " + snapshot.px;
|
||||
mainContext.Text11 = "y: " + snapshot.py;
|
||||
|
||||
#region Detect Reload
|
||||
|
||||
bool reloaded = false;
|
||||
{
|
||||
int playtime = MemoryHelper.GetMemoryValue<int>(process, StaticData.PlaytimeAddr[mainContext.veridx]);
|
||||
reloaded = playtime != 0 && playtime < lastplaytime;
|
||||
if (reloaded) DebugLog("Reload Game!");
|
||||
lastplaytime = playtime;
|
||||
if (prevSnapshot != null) {
|
||||
reloaded = snapshot.playtime != 0 && snapshot.playtime < prevSnapshot.playtime;
|
||||
if (reloaded)
|
||||
{
|
||||
if (InGame())
|
||||
{
|
||||
gameState.nRestarts++;
|
||||
}
|
||||
DebugLog("Reload Game!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Detect Death
|
||||
|
||||
bool died = false;
|
||||
if (prevSnapshot != null)
|
||||
{
|
||||
died = snapshot.hp == 0 && prevSnapshot.hp > 0;
|
||||
if (died)
|
||||
{
|
||||
if (InGame())
|
||||
{
|
||||
gameState.nDeaths++;
|
||||
}
|
||||
DebugLog("Death!");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Detect Start Game
|
||||
|
||||
{
|
||||
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]);
|
||||
if (previousBlackness == 0 && blackness >= 100000)
|
||||
{
|
||||
// Sudden increase by 100000
|
||||
// Have to be careful, though. I don't know whether anything else causes blackness to increase by 100000
|
||||
DebugLog("Start Game!");
|
||||
}
|
||||
previousBlackness = blackness;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckMoney
|
||||
|
||||
if (prevSnapshot != null && (snapshot.CurrentMusicIs(Music.MAIN_MENU) || snapshot.CurrentMusicIs(Music.ARTBOOK_INTRO))
|
||||
&& prevSnapshot.blackness == 0 && snapshot.blackness >= 100000)
|
||||
{
|
||||
var newmoney = MemoryHelper.GetMemoryValue<int>(process, StaticData.MoneyAddress[mainContext.veridx]);
|
||||
if (newmoney - lastmoney == 17500)
|
||||
{
|
||||
sendsplit();
|
||||
DebugLog("get 17500 en, split");
|
||||
}
|
||||
lastmoney = newmoney;
|
||||
// Sudden increase by 100000
|
||||
DebugLog("Start Game!");
|
||||
StartNewGame();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
int mapid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MapAddress[mainContext.veridx]);
|
||||
if (lastmapid != mapid)
|
||||
|
||||
if (prevSnapshot == null || prevSnapshot.mapid != snapshot.mapid)
|
||||
{
|
||||
DebugLog("newmap: " + mapid + ":" + StaticData.MapNames[mapid]);
|
||||
lastmapid = mapid;
|
||||
DebugLog("newmap: " + snapshot.mapid + ":" + StaticData.GetMapName(snapshot.mapid));
|
||||
}
|
||||
|
||||
|
||||
@ -100,22 +118,51 @@ namespace rabi_splitter_WPF
|
||||
#endregion
|
||||
|
||||
UpdateDebugArea(process);
|
||||
|
||||
prevSnapshot = snapshot;
|
||||
}
|
||||
|
||||
private void StartNewGame()
|
||||
{
|
||||
gameState = new RabiGameState();
|
||||
gameStatus = GameStatus.INGAME;
|
||||
}
|
||||
|
||||
private void ReturnToMenu()
|
||||
{
|
||||
gameStatus = GameStatus.MENU;
|
||||
gameState = null;
|
||||
}
|
||||
|
||||
private bool InGame()
|
||||
{
|
||||
return gameStatus == GameStatus.INGAME;
|
||||
}
|
||||
|
||||
private bool MusicChanged()
|
||||
{
|
||||
return prevSnapshot != null && prevSnapshot.musicid != snapshot.musicid;
|
||||
}
|
||||
|
||||
private bool MusicChangedTo(Music music)
|
||||
{
|
||||
return MusicChanged() && snapshot.CurrentMusicIs(music);
|
||||
}
|
||||
|
||||
private void UpdateDebugArea(Process process)
|
||||
{
|
||||
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[mainContext.veridx]);
|
||||
int ptr = snapshot.entityArrayPtr;
|
||||
// List<int> bosses = new List<int>();
|
||||
// List<int> HPS = new List<int>();
|
||||
// this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(() => debugContext.BossList.Clear()));
|
||||
// ptr += StaticData.EnenyEntitySize[mainContext.veridx] * 3;
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
ptr += StaticData.EnenyEntitySize[mainContext.veridx];
|
||||
debugContext.BossList[i].BossID = MemoryHelper.GetMemoryValue<int>(process,
|
||||
ptr + StaticData.EnenyEnitiyIDOffset[mainContext.veridx], false);
|
||||
debugContext.BossList[i].BossHP = MemoryHelper.GetMemoryValue<int>(process,
|
||||
ptr + StaticData.EnenyEnitiyHPOffset[mainContext.veridx], false);
|
||||
ptr += StaticData.EnenyEntitySize[mainContext.veridx];
|
||||
}
|
||||
|
||||
debugContext.BossEvent = bossbattle;
|
||||
|
@ -2,51 +2,49 @@
|
||||
|
||||
namespace rabi_splitter_WPF
|
||||
{
|
||||
public static class StaticData
|
||||
public static partial class StaticData
|
||||
{
|
||||
public static Dictionary<int, string> BossNames = new Dictionary<int, string>()
|
||||
public static IdEnumAssociation<Boss> BossList = new IdEnumAssociation<Boss>
|
||||
{
|
||||
{1009, "Cocoa"},
|
||||
{1011, "Rumi"},
|
||||
{1012, "Ashuri"},
|
||||
{1013, "Rita"},
|
||||
{1014, "Ribbon"},
|
||||
{1015, "Cocoa"},
|
||||
{1018, "Cicini"},
|
||||
{1020, "Saya"},
|
||||
{1021, "Syaro"},
|
||||
{1022, "Pandora"},
|
||||
{1023, "Nieve"},
|
||||
{1024, "Nixie"},
|
||||
{1025, "Aruraune"},
|
||||
{1030, "Seana"},
|
||||
{1031, "Lilith"},
|
||||
{1032, "Vanilla"},
|
||||
{1033, "Chocolate"},
|
||||
{1035, "Illusion Alius"},
|
||||
{1036, "Pink Kotri"},
|
||||
{1037, "Noah 1"},
|
||||
{1038, "Irisu"},
|
||||
{1039, "Miriam"},
|
||||
{1043, "Miru"},
|
||||
{1053, "Noah 3"},
|
||||
{1054, "Keke Bunny"},
|
||||
|
||||
|
||||
{1009, Boss.Cocoa, "Cocoa"},
|
||||
{1011, Boss.Rumi, "Rumi"},
|
||||
{1012, Boss.Ashuri, "Ashuri"},
|
||||
{1013, Boss.Rita, "Rita"},
|
||||
{1014, Boss.Ribbon, "Ribbon"},
|
||||
{1015, Boss.Cocoa2, "Cocoa"},
|
||||
{1018, Boss.Cicini, "Cicini"},
|
||||
{1020, Boss.Saya, "Saya"},
|
||||
{1021, Boss.Syaro, "Syaro"},
|
||||
{1022, Boss.Pandora, "Pandora"},
|
||||
{1023, Boss.Nieve, "Nieve"},
|
||||
{1024, Boss.Nixie, "Nixie"},
|
||||
{1025, Boss.Aruraune, "Aruraune"},
|
||||
{1030, Boss.Seana, "Seana"},
|
||||
{1031, Boss.Lilith, "Lilith"},
|
||||
{1032, Boss.Vanilla, "Vanilla"},
|
||||
{1033, Boss.Chocolate, "Chocolate"},
|
||||
{1035, Boss.IllusionAlius, "Illusion Alius"},
|
||||
{1036, Boss.PinkKotri, "Pink Kotri"},
|
||||
{1037, Boss.Noah1, "Noah 1"},
|
||||
{1038, Boss.Irisu, "Irisu"},
|
||||
{1039, Boss.Miriam, "Miriam"},
|
||||
{1043, Boss.Miru, "Miru"},
|
||||
{1053, Boss.Noah3, "Noah 3"},
|
||||
{1054, Boss.KekeBunny, "Keke Bunny"},
|
||||
};
|
||||
|
||||
public static string[] MapNames = new string[]
|
||||
public static IndexEnumAssociation<Map> MapList = new IndexEnumAssociation<Map>
|
||||
{
|
||||
"Southern Woodland",
|
||||
"Western Coast",
|
||||
"Island Core",
|
||||
"Northern Tundra",
|
||||
"Eastern Highlands",
|
||||
"Rabi Rabi Town",
|
||||
"Plurkwood",
|
||||
"Subterranean Area",
|
||||
"Warp Destination",
|
||||
"System Interior",
|
||||
{Map.SouthernWoodland, "Southern Woodland"},
|
||||
{Map.WesternCoast, "Western Coast"},
|
||||
{Map.IslandCore, "Island Core"},
|
||||
{Map.NorthernTundra, "Northern Tundra"},
|
||||
{Map.EasternHighlands, "Eastern Highlands"},
|
||||
{Map.RabiRabiTown, "Rabi Rabi Town"},
|
||||
{Map.Plurkwood, "Plurkwood"},
|
||||
{Map.SubterraneanArea, "Subterranean Area"},
|
||||
{Map.WarpDestination, "Warp Destination"},
|
||||
{Map.SystemInterior, "System Interior"},
|
||||
};
|
||||
|
||||
public static int[][] MapBoss = new int[][]
|
||||
@ -64,68 +62,68 @@ namespace rabi_splitter_WPF
|
||||
|
||||
};
|
||||
|
||||
public static string[] MusicNames = new[]
|
||||
public static IndexEnumAssociation<Music> MusicList = new IndexEnumAssociation<Music>
|
||||
{
|
||||
"-NO MUSIC-",
|
||||
"ADVENTURE STARTS HERE",
|
||||
"SPECTRAL CAVE",
|
||||
"FORGOTTEN CAVE",
|
||||
"UNDERWATER AMBIENT",
|
||||
"LIBRARY AMBIENT",
|
||||
"FORGOTTEN CAVE II",
|
||||
"STARTING FOREST NIGHT",
|
||||
"BOUNCE BOUNCE",
|
||||
"RABI RABI BEACH",
|
||||
"PANDORA'S PALACE",
|
||||
"RABI RABI RAVINE",
|
||||
"HOME SWEET HOME",
|
||||
"RABI RABI PARK",
|
||||
"INSIDE UPRPRC",
|
||||
"SKY ISLAND TOWN",
|
||||
"WINTER WONDERLAND",
|
||||
"CYBERSPACE.EXE",
|
||||
"EVERNIGHT PEAK",
|
||||
"EXOTIC LABORATORY",
|
||||
"GOLDEN RIVERBANK",
|
||||
"FLOATING GRAVEYARD",
|
||||
"SYSTEM INTERIOR II",
|
||||
"AURORA PALACE",
|
||||
"SPEICHER GALERIE",
|
||||
"DEEP UNDER THE SEA",
|
||||
"SKY-HIGH BRIDGE",
|
||||
"WARP DESTINATION",
|
||||
"VOLCANIC CANERNS",
|
||||
"PLURKWOOD",
|
||||
"ANOTHER D",
|
||||
"ICY SUMMIT",
|
||||
"PREPARE EVENT",
|
||||
"MIDBOSS BATTLE",
|
||||
"MIDSTREAM JAM",
|
||||
"MIRIAM'S SHOP",
|
||||
"BUNNY PANIC!!!",
|
||||
"THE TRUTH NEVER SPOKEN",
|
||||
"BRAWL BREAKS VER.2",
|
||||
"BRAWL BREAKS",
|
||||
"SANDBAG MINI GAME",
|
||||
"STAFF ROLL",
|
||||
"RFN - III",
|
||||
"NO REMORSE",
|
||||
"GET ON WITH IT",
|
||||
"THEME OF RABI-RIBI 8BIT",
|
||||
"THEME OF RABI-RIBI",
|
||||
"FULL ON COMBAT",
|
||||
"HI-TECH DUEL",
|
||||
"UNFAMILIAR PLACE",
|
||||
"UNFAMILIAR PLACE AGAIN",
|
||||
"KITTY ATTACK",
|
||||
"M.R.",
|
||||
"MAIN MENU",
|
||||
"SUDDEN DEATH",
|
||||
"RABI RABI RAVINE VER.2",
|
||||
"WASTE",
|
||||
"ARTBOOK INTRO",
|
||||
"RABI-RIBI PIANO TITLE",
|
||||
"MISCHIEVOUS MASQUERADE",
|
||||
{Music.NO_MUSIC, "-NO MUSIC-"},
|
||||
{Music.ADVENTURE_STARTS_HERE, "ADVENTURE STARTS HERE"},
|
||||
{Music.SPECTRAL_CAVE, "SPECTRAL CAVE"},
|
||||
{Music.FORGOTTEN_CAVE, "FORGOTTEN CAVE"},
|
||||
{Music.UNDERWATER_AMBIENT, "UNDERWATER AMBIENT"},
|
||||
{Music.LIBRARY_AMBIENT, "LIBRARY AMBIENT"},
|
||||
{Music.FORGOTTEN_CAVE_II, "FORGOTTEN CAVE II"},
|
||||
{Music.STARTING_FOREST_NIGHT, "STARTING FOREST NIGHT"},
|
||||
{Music.BOUNCE_BOUNCE, "BOUNCE BOUNCE"},
|
||||
{Music.RABI_RABI_BEACH, "RABI RABI BEACH"},
|
||||
{Music.PANDORAS_PALACE, "PANDORA'S PALACE"},
|
||||
{Music.RABI_RABI_RAVINE, "RABI RABI RAVINE"},
|
||||
{Music.HOME_SWEET_HOME, "HOME SWEET HOME"},
|
||||
{Music.RABI_RABI_PARK, "RABI RABI PARK"},
|
||||
{Music.INSIDE_UPRPRC, "INSIDE UPRPRC"},
|
||||
{Music.SKY_ISLAND_TOWN, "SKY ISLAND TOWN"},
|
||||
{Music.WINTER_WONDERLAND, "WINTER WONDERLAND"},
|
||||
{Music.CYBERSPACE_EXE, "CYBERSPACE.EXE"},
|
||||
{Music.EVERNIGHT_PEAK, "EVERNIGHT PEAK"},
|
||||
{Music.EXOTIC_LABORATORY, "EXOTIC LABORATORY"},
|
||||
{Music.GOLDEN_RIVERBANK, "GOLDEN RIVERBANK"},
|
||||
{Music.FLOATING_GRAVEYARD, "FLOATING GRAVEYARD"},
|
||||
{Music.SYSTEM_INTERIOR_II, "SYSTEM INTERIOR II"},
|
||||
{Music.AURORA_PALACE, "AURORA PALACE"},
|
||||
{Music.SPEICHER_GALERIE, "SPEICHER GALERIE"},
|
||||
{Music.DEEP_UNDER_THE_SEA, "DEEP UNDER THE SEA"},
|
||||
{Music.SKY_HIGH_BRIDGE, "SKY-HIGH BRIDGE"},
|
||||
{Music.WARP_DESTINATION, "WARP DESTINATION"},
|
||||
{Music.VOLCANIC_CANERNS, "VOLCANIC CANERNS"},
|
||||
{Music.PLURKWOOD, "PLURKWOOD"},
|
||||
{Music.ANOTHER_D, "ANOTHER D"},
|
||||
{Music.ICY_SUMMIT, "ICY SUMMIT"},
|
||||
{Music.PREPARE_EVENT, "PREPARE EVENT"},
|
||||
{Music.MIDBOSS_BATTLE, "MIDBOSS BATTLE"},
|
||||
{Music.MIDSTREAM_JAM, "MIDSTREAM JAM"},
|
||||
{Music.MIRIAMS_SHOP, "MIRIAM'S SHOP"},
|
||||
{Music.BUNNY_PANIC, "BUNNY PANIC!!!"},
|
||||
{Music.THE_TRUTH_NEVER_SPOKEN, "THE TRUTH NEVER SPOKEN"},
|
||||
{Music.BRAWL_BREAKS_VER_2, "BRAWL BREAKS VER.2"},
|
||||
{Music.BRAWL_BREAKS, "BRAWL BREAKS"},
|
||||
{Music.SANDBAG_MINI_GAME, "SANDBAG MINI GAME"},
|
||||
{Music.STAFF_ROLL, "STAFF ROLL"},
|
||||
{Music.RFN_III, "RFN - III"},
|
||||
{Music.NO_REMORSE, "NO REMORSE"},
|
||||
{Music.GET_ON_WITH_IT, "GET ON WITH IT"},
|
||||
{Music.THEME_OF_RABI_RIBI_8BIT, "THEME OF RABI-RIBI 8BIT"},
|
||||
{Music.THEME_OF_RABI_RIBI, "THEME OF RABI-RIBI"},
|
||||
{Music.FULL_ON_COMBAT, "FULL ON COMBAT"},
|
||||
{Music.HI_TECH_DUEL, "HI-TECH DUEL"},
|
||||
{Music.UNFAMILIAR_PLACE, "UNFAMILIAR PLACE"},
|
||||
{Music.UNFAMILIAR_PLACE_AGAIN, "UNFAMILIAR PLACE AGAIN"},
|
||||
{Music.KITTY_ATTACK, "KITTY ATTACK"},
|
||||
{Music.M_R_, "M.R."},
|
||||
{Music.MAIN_MENU, "MAIN MENU"},
|
||||
{Music.SUDDEN_DEATH, "SUDDEN DEATH"},
|
||||
{Music.RABI_RABI_RAVINE_VER_2, "RABI RABI RAVINE VER.2"},
|
||||
{Music.WASTE, "WASTE"},
|
||||
{Music.ARTBOOK_INTRO, "ARTBOOK INTRO"},
|
||||
{Music.RABI_RIBI_PIANO_TITLE, "RABI-RIBI PIANO TITLE"},
|
||||
{Music.MISCHIEVOUS_MASQUERADE, "MISCHIEVOUS MASQUERADE"},
|
||||
};
|
||||
|
||||
public static int[] BossMusics = new[]
|
||||
|
@ -55,6 +55,9 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="RabiEnums.cs" />
|
||||
<Compile Include="MemorySnapshot.cs" />
|
||||
<Compile Include="RabiGameState.cs" />
|
||||
<Compile Include="RabiRibiDisplay.cs" />
|
||||
<Compile Include="StaticData.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
|
Loading…
x
Reference in New Issue
Block a user