now using music for split

rabi_display
Copy Liu 8 years ago
parent 72361f3667
commit f09a473e2e
No known key found for this signature in database
GPG Key ID: 63A453DBF23409AF
  1. 104
      rabiribi_splitter/Form1.Designer.cs
  2. 172
      rabiribi_splitter/Form1.cs
  3. 2765
      rabiribi_splitter/Form1.resx
  4. 159
      rabiribi_splitter/StaticData.cs
  5. BIN
      rabiribi_splitter/irisu.ico
  6. 7
      rabiribi_splitter/rabiribi_splitter.csproj

@ -28,15 +28,16 @@
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.label2 = new System.Windows.Forms.Label();
this.connectBtn = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.rbStatus = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.mapLabel = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.bossLabel = new System.Windows.Forms.Label();
this.portNum = new System.Windows.Forms.NumericUpDown();
this.cbBossStart = new System.Windows.Forms.CheckBox();
this.cbBossEnd = new System.Windows.Forms.CheckBox();
this.musicLabel = new System.Windows.Forms.Label();
this.cbBoss = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.portNum)).BeginInit();
this.SuspendLayout();
//
@ -77,42 +78,6 @@
this.rbStatus.TabIndex = 6;
this.rbStatus.Text = "label4";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(13, 58);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(77, 12);
this.label5.TabIndex = 7;
this.label5.Text = "Current Map:";
//
// mapLabel
//
this.mapLabel.AutoSize = true;
this.mapLabel.Location = new System.Drawing.Point(126, 58);
this.mapLabel.Name = "mapLabel";
this.mapLabel.Size = new System.Drawing.Size(41, 12);
this.mapLabel.TabIndex = 8;
this.mapLabel.Text = "label6";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(13, 78);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(83, 12);
this.label7.TabIndex = 9;
this.label7.Text = "Current Boss:";
//
// bossLabel
//
this.bossLabel.AutoSize = true;
this.bossLabel.Location = new System.Drawing.Point(126, 80);
this.bossLabel.Name = "bossLabel";
this.bossLabel.Size = new System.Drawing.Size(41, 12);
this.bossLabel.TabIndex = 10;
this.bossLabel.Text = "label8";
//
// portNum
//
this.portNum.Location = new System.Drawing.Point(149, 9);
@ -130,20 +95,63 @@
0,
0});
//
// cbBossStart
//
this.cbBossStart.AutoSize = true;
this.cbBossStart.Location = new System.Drawing.Point(15, 53);
this.cbBossStart.Name = "cbBossStart";
this.cbBossStart.Size = new System.Drawing.Size(198, 16);
this.cbBossStart.TabIndex = 12;
this.cbBossStart.Text = "Split when BOSS music STARTED";
this.cbBossStart.UseVisualStyleBackColor = true;
//
// cbBossEnd
//
this.cbBossEnd.AutoSize = true;
this.cbBossEnd.Checked = true;
this.cbBossEnd.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbBossEnd.Location = new System.Drawing.Point(15, 75);
this.cbBossEnd.Name = "cbBossEnd";
this.cbBossEnd.Size = new System.Drawing.Size(192, 16);
this.cbBossEnd.TabIndex = 13;
this.cbBossEnd.Text = "Split when BOSS music STOPED";
this.cbBossEnd.UseVisualStyleBackColor = true;
//
// musicLabel
//
this.musicLabel.AutoSize = true;
this.musicLabel.Location = new System.Drawing.Point(15, 98);
this.musicLabel.Name = "musicLabel";
this.musicLabel.Size = new System.Drawing.Size(41, 12);
this.musicLabel.TabIndex = 14;
this.musicLabel.Text = "label1";
//
// cbBoss
//
this.cbBoss.AutoSize = true;
this.cbBoss.Enabled = false;
this.cbBoss.Location = new System.Drawing.Point(15, 113);
this.cbBoss.Name = "cbBoss";
this.cbBoss.Size = new System.Drawing.Size(138, 16);
this.cbBoss.TabIndex = 15;
this.cbBoss.Text = "BOSS music playing!";
this.cbBoss.UseVisualStyleBackColor = true;
//
// 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.Controls.Add(this.cbBoss);
this.Controls.Add(this.musicLabel);
this.Controls.Add(this.cbBossEnd);
this.Controls.Add(this.cbBossStart);
this.Controls.Add(this.portNum);
this.Controls.Add(this.bossLabel);
this.Controls.Add(this.label7);
this.Controls.Add(this.mapLabel);
this.Controls.Add(this.label5);
this.Controls.Add(this.rbStatus);
this.Controls.Add(this.label3);
this.Controls.Add(this.connectBtn);
this.Controls.Add(this.label2);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1";
this.Text = "Irisu is watching you";
((System.ComponentModel.ISupportInitialize)(this.portNum)).EndInit();
@ -157,11 +165,11 @@
private System.Windows.Forms.Button connectBtn;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label rbStatus;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label mapLabel;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label bossLabel;
private System.Windows.Forms.NumericUpDown portNum;
private System.Windows.Forms.CheckBox cbBossStart;
private System.Windows.Forms.CheckBox cbBossEnd;
private System.Windows.Forms.Label musicLabel;
private System.Windows.Forms.CheckBox cbBoss;
}
}

@ -8,6 +8,7 @@ using System.Linq;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace rabiribi_splitter
@ -26,73 +27,14 @@ namespace rabiribi_splitter
private static TcpClient tcpclient;
private static NetworkStream networkStream;
private static System.Threading.Timer timer;
private int MapAddress = 0xA3353C;
private int PtrAddr = 0x00940EE0;
private int EnitiyOffset = 0x4e4;
private int EntitySize = 0x6F4;
private int MaxEntityEntry = 50;
// private int MapAddress = 0xA3353C;
// private int PtrAddr = 0x00940EE0;
// private int EnitiyOffset = 0x4e4;
// private int EntitySize = 0x6F4;
// private int MaxEntityEntry = 50;
private bool bossbattle = false;
private static Dictionary<int, string> BossNames = new Dictionary<int, string>()
{
{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"},
};
static string[] MapNames = new string[]
{
"Southern Woodland",
"Western Coast",
"Island Core",
"Northern Tundra",
"Eastern Highlands",
"Rabi Rabi Town",
"Plurkwood",
"Subterranean Area",
"Warp Destination",
"System Interior",
};
static int[][] MapBoss = new int[][]
{
new[] {1011, 1009, 1025, 1014},
new[] {1036, 1038, 1031, 1022, 1012},
new[] {1032, 1036, 1030, 1033},
new[] {1024, 1023, 1013, 1030},
new[] {1012, 1020,},
new int[0],
new[] {1054},
new[] {1036, 1039},
new[] {1037, 1053, 1035, 1043},
new[] {1021},
};
private int bossmusicid;
private Regex titleReg = new Regex(@"ver.*?(\d+\.?\d+.*)$");
public Form1()
{
InitializeComponent();
@ -103,66 +45,104 @@ namespace rabiribi_splitter
private void readmemory(object state)
{
string rabiver="";
var processlist = Process.GetProcessesByName("rabiribi");
if (processlist.Length > 0)
{
rbStatus.Text = "Running";
Process process = processlist[0];
var result = titleReg.Match(process.MainWindowTitle);
if (result.Success)
{
rabiver = result.Groups[1].Value;
if (!StaticData.VerNames.Contains(rabiver))
{
this.Invoke(new Action(() =>
{
rbStatus.Text = rabiver + " Running (not support)";
this.musicLabel.Text = "N/A";
}));
return;
}
}
else
{
this.Invoke(new Action(() =>
{
rbStatus.Text = rabiver + " Running (not support)";
this.musicLabel.Text = "N/A";
}));
return;
}
this.Invoke(new Action(() => rbStatus.Text = rabiver + " Running"));
int addr = StaticData.MusicAddr[rabiver];
byte[] buffer = new byte[4] {0, 0, 0, 0};
int bytesRead = 0;
IntPtr processHandle = OpenProcess(PROCESS_WM_READ, false, process.Id);
ReadProcessMemory((int) processHandle, process.MainModule.BaseAddress.ToInt32() + MapAddress, buffer,
1, ref bytesRead);
int mapid;
if (buffer[0] < MapNames.Length)
ReadProcessMemory((int) processHandle, process.MainModule.BaseAddress.ToInt32() + addr, buffer,
4, ref bytesRead);
if (buffer[0] < StaticData.MusicNames.Length)
{
int musicid = BitConverter.ToInt32(buffer,0);
this.Invoke(new Action(() => this.musicLabel.Text = StaticData.MusicNames[musicid]));
var flag = StaticData.BossMusics.Contains(musicid);
if (flag)
{
this.mapLabel.Text = MapNames[buffer[0]];
mapid = buffer[0];
ReadProcessMemory((int) processHandle, process.MainModule.BaseAddress.ToInt32() + PtrAddr, buffer, 4,
ref bytesRead);
var ptr = BitConverter.ToInt32(buffer, 0) + EnitiyOffset;
List<int> bosses = new List<int>();
for (var i = 0; i < 50; i++)
if (bossmusicid > 0 && bossmusicid != musicid)
{
ptr += 0x6f4;
ReadProcessMemory((int) processHandle, ptr, buffer, buffer.Length, ref bytesRead);
var emyid = BitConverter.ToInt32(buffer, 0);
if (BossNames.ContainsKey(emyid))
//直接换boss曲
if (cbBossStart.Checked || cbBossEnd.Checked)
{
bosses.Add(emyid);
sendsplit();
}
bossbattle = true;
this.Invoke(new Action(() => cbBoss.Checked = bossbattle));
bossmusicid = musicid;
return;
}
//Now checking map
bool flag = false;
this.bossLabel.Text = "";
foreach (var i in MapBoss[mapid])
}
if (flag != bossbattle)
{
if (bosses.Contains(i))
if (flag)
{
flag = true;
this.bossLabel.Text += BossNames[i] + " ";
if (cbBossStart.Checked)
{
sendsplit();
}
bossmusicid = musicid;
}
if (flag != bossbattle)
else
{
if (cbBossEnd.Checked)
{
sendsplit();
}
}
}
bossbattle = flag;
this.Invoke(new Action(() => cbBoss.Checked = bossbattle));
}
else
{
this.mapLabel.Text = "N/A";
this.bossLabel.Text = "";
this.Invoke(new Action(() => this.musicLabel.Text = "N/A"));
}
}
else
{
this.Invoke(new Action(() =>
{
rbStatus.Text = "Not Found";
this.mapLabel.Text = "N/A";
this.bossLabel.Text = "";
this.musicLabel.Text = "N/A";
}));
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,159 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace rabiribi_splitter
{
public static class StaticData
{
public static Dictionary<int, string> BossNames = new Dictionary<int, string>()
{
{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"},
};
public static string[] MapNames = new string[]
{
"Southern Woodland",
"Western Coast",
"Island Core",
"Northern Tundra",
"Eastern Highlands",
"Rabi Rabi Town",
"Plurkwood",
"Subterranean Area",
"Warp Destination",
"System Interior",
};
public static int[][] MapBoss = new int[][]
{
new[] {1011, 1009, 1025, 1014, 1018},
new[] {1036, 1038, 1031, 1022, 1012},
new[] {1032, 1036, 1030, 1033},
new[] {1024, 1023, 1013, 1030},
new[] {1012, 1020,},
new int[0],
new[] {1054},
new[] {1036, 1039},
new[] {1037, 1053, 1035, 1043},
new[] {1021},
};
public static string[] MusicNames = new[]
{
"-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",
"…",
};
public static Dictionary<string, int> MusicAddr = new Dictionary<string, int>()
{
{"1.65", 0xA46294},
{"1.70", 0xA69D98}
};
public static string[] VerNames = new string[] {"1.65", "1.70"};
public static int[] BossMusics = new[]
{
44,
38,
47,
34,
51,
43,
52,
37,
39,
42,
48,
8,
54
};
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

@ -31,6 +31,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>irisu.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
@ -52,6 +55,7 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="StaticData.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
@ -74,6 +78,9 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="irisu.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

Loading…
Cancel
Save