rabi_display
Copy Liu 8 years ago
parent daef372766
commit 097e0e7af0
No known key found for this signature in database
GPG Key ID: 63A453DBF23409AF
  1. 92
      rabiribi_splitter/Form1.Designer.cs
  2. 130
      rabiribi_splitter/Form1.cs
  3. 14
      rabiribi_splitter/MemoryHelper.cs
  4. 11
      rabiribi_splitter/StaticData.cs

@ -39,6 +39,12 @@
this.musicLabel = new System.Windows.Forms.Label();
this.cbBoss = new System.Windows.Forms.CheckBox();
this.cbComputer = new System.Windows.Forms.CheckBox();
this.cbBoss1 = new System.Windows.Forms.CheckBox();
this.cbBoss3 = new System.Windows.Forms.CheckBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
this.t1 = new System.Windows.Forms.Label();
this.t2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.portNum)).BeginInit();
this.SuspendLayout();
//
@ -120,8 +126,9 @@
//
// musicLabel
//
this.musicLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.musicLabel.AutoSize = true;
this.musicLabel.Location = new System.Drawing.Point(13, 159);
this.musicLabel.Location = new System.Drawing.Point(13, 477);
this.musicLabel.Name = "musicLabel";
this.musicLabel.Size = new System.Drawing.Size(41, 12);
this.musicLabel.TabIndex = 14;
@ -129,13 +136,14 @@
//
// cbBoss
//
this.cbBoss.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.cbBoss.AutoSize = true;
this.cbBoss.Enabled = false;
this.cbBoss.Location = new System.Drawing.Point(15, 174);
this.cbBoss.Location = new System.Drawing.Point(15, 492);
this.cbBoss.Name = "cbBoss";
this.cbBoss.Size = new System.Drawing.Size(138, 16);
this.cbBoss.Size = new System.Drawing.Size(84, 16);
this.cbBoss.TabIndex = 15;
this.cbBoss.Text = "BOSS music playing!";
this.cbBoss.Text = "BOSS event";
this.cbBoss.UseVisualStyleBackColor = true;
//
// cbComputer
@ -150,11 +158,79 @@
this.cbComputer.Text = "Split when find the computer";
this.cbComputer.UseVisualStyleBackColor = true;
//
// cbBoss1
//
this.cbBoss1.AutoSize = true;
this.cbBoss1.Checked = true;
this.cbBoss1.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbBoss1.Location = new System.Drawing.Point(15, 119);
this.cbBoss1.Name = "cbBoss1";
this.cbBoss1.Size = new System.Drawing.Size(318, 16);
this.cbBoss1.TabIndex = 17;
this.cbBoss1.Text = "Split when Miru/Nixie despawn, ignore their music";
this.cbBoss1.UseVisualStyleBackColor = true;
//
// cbBoss3
//
this.cbBoss3.AutoSize = true;
this.cbBoss3.Checked = true;
this.cbBoss3.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbBoss3.Location = new System.Drawing.Point(15, 141);
this.cbBoss3.Name = "cbBoss3";
this.cbBoss3.Size = new System.Drawing.Size(276, 16);
this.cbBoss3.TabIndex = 19;
this.cbBoss3.Text = "Split when Noah 3 HP = 0, ignore her music";
this.cbBoss3.UseVisualStyleBackColor = true;
//
// linkLabel1
//
this.linkLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(804, 496);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(41, 12);
this.linkLabel1.TabIndex = 20;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "GitHub";
//
// t1
//
this.t1.AutoSize = true;
this.t1.Location = new System.Drawing.Point(498, 37);
this.t1.Name = "t1";
this.t1.Size = new System.Drawing.Size(41, 12);
this.t1.TabIndex = 21;
this.t1.Text = "label1";
//
// t2
//
this.t2.AutoSize = true;
this.t2.Location = new System.Drawing.Point(694, 36);
this.t2.Name = "t2";
this.t2.Size = new System.Drawing.Size(41, 12);
this.t2.TabIndex = 22;
this.t2.Text = "label4";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(500, 13);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(59, 12);
this.label1.TabIndex = 23;
this.label1.Text = "DebugArea";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(334, 221);
this.ClientSize = new System.Drawing.Size(857, 520);
this.Controls.Add(this.label1);
this.Controls.Add(this.t2);
this.Controls.Add(this.t1);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.cbBoss3);
this.Controls.Add(this.cbBoss1);
this.Controls.Add(this.cbComputer);
this.Controls.Add(this.cbBoss);
this.Controls.Add(this.musicLabel);
@ -185,6 +261,12 @@
private System.Windows.Forms.Label musicLabel;
private System.Windows.Forms.CheckBox cbBoss;
private System.Windows.Forms.CheckBox cbComputer;
private System.Windows.Forms.CheckBox cbBoss1;
private System.Windows.Forms.CheckBox cbBoss3;
private System.Windows.Forms.LinkLabel linkLabel1;
private System.Windows.Forms.Label t1;
private System.Windows.Forms.Label t2;
private System.Windows.Forms.Label label1;
}
}

@ -29,22 +29,34 @@ namespace rabiribi_splitter
private string rabiribititle;
private string rabiver;
private int veridx;
private List<int> lastbosslist = new List<int>();
private int lastnoah3hp = -1;
public Form1()
{
InitializeComponent();
memoryThread=new Thread(() =>
{
while (true)
{
readmemory();
Thread.Sleep(10);
}
});
LinkLabel.Link link = new LinkLabel.Link();
link.LinkData = "https://github.com/copyliu/rabiribi_splitter";
linkLabel1.Links.Add(link);
linkLabel1.LinkClicked += LinkLabel1_LinkClicked;
memoryThread = new Thread(() =>
{
while (true)
{
readmemory();
Thread.Sleep(10);
}
});
memoryThread.IsBackground = true;
memoryThread.Start();
}
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
// Send the URL to the operating system.
Process.Start(e.Link.LinkData as string);
}
private void readmemory()
@ -114,7 +126,7 @@ namespace rabiribi_splitter
int musicaddr = StaticData.MusicAddr[veridx];
int musicid = MemoryHelper.GetMemoryValue<int>(process, musicaddr);
if (musicid < StaticData.MusicNames.Length)
if (musicid >= 0 && musicid < StaticData.MusicNames.Length)
{
if (lastmusicid != musicid)
{
@ -141,13 +153,15 @@ namespace rabiribi_splitter
if (bossmusicflag) //boss music start!
{
bossbattle = true;
lastbosslist = new List<int>();
lastnoah3hp = -1;
if (cbBossStart.Checked)
{
sendsplit();
}
}
}
if (bossbattle)
else
{
if (!bossmusicflag) //boss music end!
{
@ -171,8 +185,96 @@ namespace rabiribi_splitter
#region SpecialBOSS
if (bossbattle)
{
if (cbBoss1.Checked || cbBoss3.Checked)
{
int Noah3HP = -1;
int mapid = MemoryHelper.GetMemoryValue<int>(process, StaticData.MapAddress[veridx]);
if (mapid >= 0 && mapid < StaticData.MapNames.Length)
{
int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[veridx]);
List<int> bosses = new List<int>();
for (var i = 0; i < 50; i++)
{
ptr = ptr + StaticData.EnenyEntitySize[veridx];
var emyid = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyIDOffset[veridx], false);
if (StaticData.BossNames.ContainsKey(emyid))
{
bosses.Add(emyid);
if (emyid == 1053)
{
Noah3HP = MemoryHelper.GetMemoryValue<int>(process,
ptr + StaticData.EnenyEnitiyHPOffset[veridx], false);
}
}
}
if (cbBoss1.Checked)
{
foreach (var boss in lastbosslist)
{
if (boss == 1024 || boss == 1043)
{
if (!bosses.Contains(boss)) //despawn
{
sendsplit();
bossbattle = false;
}
}
}
}
if (cbBoss3.Checked)
{
if (bosses.Contains(1053) && Noah3HP < lastnoah3hp && Noah3HP == 1)
{
sendsplit();
bossbattle = false;
}
}
lastbosslist = bosses;
lastnoah3hp = Noah3HP;
}
}
}
#endregion SpecialBOSS
// {
// int ptr = MemoryHelper.GetMemoryValue<int>(process, StaticData.EnenyPtrAddr[veridx]);
// List<int> bosses = new List<int>();
// List<int> HPS = new List<int>();
// for (var i = 0; i < 50; i++)
// {
// ptr += StaticData.EnenyEntitySize[veridx];
//
//
// bosses.Add(MemoryHelper.GetMemoryValue<int>(process,
// ptr + StaticData.EnenyEnitiyIDOffset[veridx], false));
// HPS.Add(MemoryHelper.GetMemoryValue<int>(process,
// ptr + StaticData.EnenyEnitiyHPOffset[veridx], false));
//
//
// this.Invoke(new Action(() =>
// {
// t1.Text = string.Join("\n", bosses);
// t2.Text = string.Join("\n", HPS);
// }));
//
// }
// }
this.Invoke(new Action(() => cbBoss.Checked = bossbattle));
}
else
@ -197,21 +299,21 @@ namespace rabiribi_splitter
try
{
var b = Encoding.UTF8.GetBytes("split\r\n");
networkStream.Write(b,0,b.Length);
networkStream.Write(b, 0, b.Length);
}
catch (Exception)
{
disconnect();
}
}
}
}
void disconnect()
{
tcpclient = null;
connectBtn.Enabled = true;
}
private void button2_Click(object sender, EventArgs e)

@ -18,7 +18,7 @@ namespace rabiribi_splitter
private const int PROCESS_WM_READ = 0x0010;
public static T GetMemoryValue<T>(Process process, int addr)
public static T GetMemoryValue<T>(Process process, int addr,bool baseaddr=true)
{
int datasize;
switch (Type.GetTypeCode(typeof(T)))
@ -49,9 +49,17 @@ namespace rabiribi_splitter
byte[] buffer = new byte[datasize];
int bytesRead = 0;
IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
ReadProcessMemory((int) processHandle, process.MainModule.BaseAddress.ToInt32() + addr, buffer,
datasize, ref bytesRead);
if (baseaddr)
{ ReadProcessMemory((int) processHandle, process.MainModule.BaseAddress.ToInt32() + addr, buffer,
datasize, ref bytesRead);}
else
{
ReadProcessMemory((int)processHandle, addr, buffer,
datasize, ref bytesRead);
}
switch (Type.GetTypeCode(typeof(T)))
{

@ -149,12 +149,13 @@ namespace rabiribi_splitter
};
public static int[] MapAddress = { 0xA3353C,0};
public static int[] EnenyPtrAddr = { 0x00940EE0,0};
public static int[] EnenyEnitiyOffset = { 0x4e4,0};
public static int[] EnenyEntitySize = {0x6F4, 0x6F4 };
public static int[] MapAddress = { 0xA3353C, 0xA57020 };
public static int[] EnenyPtrAddr = { 0x00940EE0, 0x00964A1C };
public static int[] EnenyEnitiyHPOffset = { 0x4c8, 0x4d0 };
public static int[] EnenyEnitiyIDOffset = { 0x4e4,0x4ec};
public static int[] EnenyEntitySize = {0x6F4, 0x6FC };
public static int[] MaxEntityEntry = { 50,50 };
public static int[] MoneyAddress = { 0xD3823C, };
public static int[] MoneyAddress = { 0xD3823C, 0xD5B9FC };
public static string[] VerNames = {"1.65", "1.70"};
public static int[] MusicAddr =
{

Loading…
Cancel
Save