-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Commit, no alt. addressing schemes yet but works
- Loading branch information
0 parents
commit e502d03
Showing
16 changed files
with
739 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bin/ | ||
obj/ | ||
/packages/ | ||
riderModule.iml | ||
/_ReSharper.Caches/ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpgradeRemover06", "UpgradeRemover06\UpgradeRemover06.csproj", "{5D6E6648-5290-4122-B81D-5886BCCA833E}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{5D6E6648-5290-4122-B81D-5886BCCA833E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5D6E6648-5290-4122-B81D-5886BCCA833E}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5D6E6648-5290-4122-B81D-5886BCCA833E}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5D6E6648-5290-4122-B81D-5886BCCA833E}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="UpgradeRemover06.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:UpgradeRemover06" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace UpgradeRemover06 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<Window x:Class="UpgradeRemover06.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:UpgradeRemover06" | ||
mc:Ignorable="d" | ||
Title="MainWindow" Height="525" Width="350"> | ||
<Grid> | ||
<Grid.ColumnDefinitions><ColumnDefinition/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="12*"></RowDefinition> | ||
<RowDefinition></RowDefinition> | ||
<RowDefinition></RowDefinition> | ||
</Grid.RowDefinitions> | ||
<TreeView Grid.ColumnSpan="3" Name="MainTreeView" Margin="30px 30px 30px 10px" > | ||
<TreeViewItem IsExpanded="True"><TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Sonic</TextBlock></DockPanel> | ||
</TreeViewItem.Header> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Light Dash</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Antigravity</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Bounce Bracelet</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Green Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Red Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Blue Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>White Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Sky Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Yellow Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Purple Gem</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
</TreeViewItem> | ||
|
||
<TreeViewItem IsExpanded="True"> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Shadow</TextBlock></DockPanel> | ||
</TreeViewItem.Header> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Light Dash</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Blue Memory Chip</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Red Memory Chip</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Black Memory Chip</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
|
||
</TreeViewItem> | ||
|
||
<TreeViewItem IsExpanded="True"> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Silver</TextBlock></DockPanel> | ||
</TreeViewItem.Header> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Single-Layer Extreme</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Power Bracelet</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Heart of Wind</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
<TreeViewItem> | ||
<TreeViewItem.Header> | ||
<DockPanel><CheckBox Click="UpgradeOnClick"/><TextBlock>Shock Bracelet</TextBlock></DockPanel> | ||
|
||
</TreeViewItem.Header> | ||
</TreeViewItem> | ||
|
||
</TreeViewItem> | ||
|
||
|
||
|
||
</TreeView> | ||
<DockPanel HorizontalAlignment="Right" Margin="15px 10px" Grid.Row="1" Grid.Column="2"> | ||
<CheckBox Name="AltCheck"/><TextBlock> Alt. Addressing Scheme</TextBlock> | ||
</DockPanel> | ||
<DockPanel HorizontalAlignment="Right" Margin="15px 10px" Grid.Row="2" Grid.Column="2"> | ||
<CheckBox Name="LegacyCheck"/><TextBlock> Legacy Mode</TextBlock> | ||
</DockPanel> | ||
<Button Click="RefreshBtn_OnClick" Name="RefreshBtn" HorizontalAlignment="Left" Padding="10px 5px" Margin="5px 5px" Grid.Row="2" Grid.Column="0">Refresh</Button> | ||
</Grid> | ||
</Window> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Media; | ||
|
||
namespace UpgradeRemover06 | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
|
||
public partial class MainWindow | ||
{ | ||
private int[][] UPGRADEFLAGS = new[] {new[]{ 6000,6001,6002,6004,6005,6006,6007,6008,6009,6010},new[] {6012,6013,6014}, new[]{ 6016,6017,6018,6019}}; | ||
private static T FindParent<T>(DependencyObject dependencyObject) where T : DependencyObject | ||
{ | ||
var parent = VisualTreeHelper.GetParent(dependencyObject); | ||
|
||
if (parent == null) return null; | ||
|
||
var parentT = parent as T; | ||
return parentT ?? FindParent<T>(parent); | ||
} | ||
|
||
private MemoryUtils mu; | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
mu = new MemoryUtils(); | ||
bool success = mu.tryOpenXenia(); | ||
Debug.WriteLineIf(success, "Process opened!"); | ||
Debug.WriteLine("hello o/"); | ||
|
||
|
||
} | ||
|
||
|
||
|
||
private void UpgradeOnClick(object sender, RoutedEventArgs e) | ||
{ | ||
CheckBox box = sender as CheckBox; | ||
TreeViewItem tvi = FindParent<TreeViewItem>(box); | ||
TreeViewItem chartvi = FindParent<TreeViewItem>(tvi); | ||
int upgradeidx = chartvi.Items.IndexOf(tvi); | ||
int charidx = MainTreeView.Items.IndexOf(chartvi); | ||
Debug.Print($"upgrade index: {upgradeidx}\n char index: {charidx}"); | ||
if (box.IsChecked.Value) | ||
{ | ||
mu.writeFlag(UPGRADEFLAGS[charidx][upgradeidx], 1); | ||
} | ||
else | ||
{ | ||
mu.writeFlag(UPGRADEFLAGS[charidx][upgradeidx], 0); | ||
} | ||
|
||
} | ||
|
||
private void RefreshBtn_OnClick(object sender, RoutedEventArgs e) | ||
{ | ||
TreeViewItem[] charnodes = this.MainTreeView.Items.Cast<TreeViewItem>().ToArray(); | ||
for (int i = 0; i < charnodes.Count(); i++) | ||
{ | ||
TreeViewItem[] upgradenodes = charnodes[i].Items.Cast<TreeViewItem>().ToArray(); | ||
int[] currentflagbatch = UPGRADEFLAGS[i]; | ||
for (var j = 0; j < currentflagbatch.Length; j++) | ||
{ | ||
DockPanel dp = upgradenodes[j].Header as DockPanel; | ||
CheckBox cb = dp.Children[0] as CheckBox; | ||
cb.IsChecked = mu.readFlag(UPGRADEFLAGS[i][j]); | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Data.SqlTypes; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Numerics; | ||
using System.Runtime.InteropServices; | ||
using System.Security.Principal; | ||
using ProcessMemoryUtilities.Managed; | ||
using ProcessMemoryUtilities.Native; | ||
|
||
|
||
namespace UpgradeRemover06 | ||
{ | ||
public class MemoryUtils | ||
{ | ||
[DllImport("kernel32.dll", SetLastError = true)] | ||
static extern bool ReadProcessMemory( | ||
IntPtr hProcess, | ||
ref long lpBaseAddress, | ||
[Out] byte[] lpBuffer, | ||
int dwSize, | ||
out int lpNumberOfBytesRead); | ||
|
||
private Int64 baseaddr; | ||
private Process xeniaProc; | ||
private IntPtr xeniaHandle; | ||
|
||
public MemoryUtils() | ||
{ | ||
baseaddr = 0x1401F2B1C; | ||
} | ||
public bool tryOpenXenia() | ||
{ | ||
Process[] xenias = Process.GetProcessesByName("xenia"); | ||
if (xenias.Length > 0) | ||
{ | ||
xeniaProc = xenias[0]; | ||
xeniaHandle = NativeWrapper.OpenProcess(ProcessAccessFlags.All, false, xeniaProc.Id); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public bool readFlag(int flagnum) | ||
{ | ||
Int64 flagloc =baseaddr + 4 * flagnum + 0x104; | ||
|
||
|
||
byte[] flagbuf = new byte[4]; | ||
NativeWrapper.ReadProcessMemoryArray(xeniaHandle, new IntPtr(flagloc), flagbuf, 0); | ||
Debug.WriteLine(flagbuf[3].ToString()); | ||
return flagbuf[3] != 0; | ||
} | ||
|
||
public void writeFlag(int flagnum, byte val) | ||
{ | ||
Int64 flagloc =baseaddr + 4 * flagnum + 0x104; | ||
|
||
NativeWrapper.WriteProcessMemory(xeniaHandle, new IntPtr(flagloc + 3), ref val); | ||
|
||
} | ||
|
||
} | ||
} |
Oops, something went wrong.