Skip to content

Commit

Permalink
Merge pull request #2 from CJBok/enum-commands
Browse files Browse the repository at this point in the history
Created Enum for Noexs commands
  • Loading branch information
tomvita authored Nov 30, 2020
2 parents 07f604a + 4510360 commit 5b87029
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 64 deletions.
1 change: 0 additions & 1 deletion PointerSearcher/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 51 additions & 63 deletions PointerSearcher/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ private void buttonCancel_Click_1( object sender, EventArgs e )
private void OnApplicationExit( object sender, EventArgs e )
{
//byte[] msg = { 0x1D }; //_dmnt_resume
//int a = s.Send(msg);
//int a = SendMessage(msg);
}

private void Export_to_SE_Click( object sender, EventArgs e )
Expand Down Expand Up @@ -858,8 +858,7 @@ private void getstatus_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x10 }; // _list_pids
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.ListPids );
byte[] k = new byte[4];
int c = s.Receive( k );
int count = BitConverter.ToInt32( k, 0 );
Expand All @@ -873,8 +872,7 @@ private void getstatus_Click( object sender, EventArgs e )
pidBox.Text = Convert.ToString( pid );
pid0Box.Text = Convert.ToString( pid0 );

msg[0] = 0x01; // _status
a = s.Send( msg );
a = SendMessage( NoexsCommands.Status );
b = new byte[4];
while ( s.Available < 4 )
{
Expand All @@ -894,8 +892,7 @@ private void getstatus_Click( object sender, EventArgs e )
b = new byte[f];
s.Receive( b );

msg[0] = 0x0E; //_current_pid
a = s.Send( msg );
a = SendMessage( NoexsCommands.CurrentPid );
k = new byte[8];
while ( s.Available < 8 )
{
Expand All @@ -915,11 +912,12 @@ private void getstatus_Click( object sender, EventArgs e )
showerror( b );
return;

/*
msg[0] = 0x11; //_get_titleid
a = s.Send( msg );
a = SendMessage( msg );
k = new byte[8];
k = BitConverter.GetBytes( pid );
a = s.Send( k );
a = SendMessage( k );
while ( s.Available < 8 )
{
;
Expand All @@ -937,10 +935,10 @@ private void getstatus_Click( object sender, EventArgs e )
s.Receive( b );
msg[0] = 0x11; //_get_titleid
a = s.Send( msg );
a = SendMessage( msg );
k = new byte[8];
k = BitConverter.GetBytes( pid0 );
a = s.Send( k );
a = SendMessage( k );
while ( s.Available < 8 )
{
;
Expand All @@ -959,17 +957,17 @@ private void getstatus_Click( object sender, EventArgs e )
msg[0] = 0x0A; //_attach
a = s.Send( msg );
a = SendMessage( msg );
k = BitConverter.GetBytes( curpid );
a = s.Send( k );
a = SendMessage( k );
while ( s.Available < 4 )
{
;
}
b = new byte[s.Available];
s.Receive( b );

*/

}

Expand All @@ -980,10 +978,9 @@ private void button2_Click_1( object sender, EventArgs e )
return;
}

byte[] msg = { 0x0B }; //_detatch
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.detach );
//k = BitConverter.GetBytes(curpid);
//a = s.Send(k);
//a = SendMessage(k);
while ( s.Available < 4 )
{
;
Expand Down Expand Up @@ -1030,17 +1027,25 @@ private int LZ_Uncompress( byte[] inbuf, ref byte[] outbuf, int insize )
return (int)outpos;
}

private int SendMessage( NoexsCommands cmd )
{
return s.Send( new byte[] { (byte)cmd } );
}

private int SendData( byte[] data )
{
return s.Send( data );
}

private int receivedata( ref byte[] dataset )
{
if ( !user_abort )
{
byte[] msg = { 0x1 }; // _status; anything other than 0
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Status ); // anything other than 0
}
else
{
byte[] msg = { 0x0 }; // 0 to abort
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Abort );
user_abort2 = true;
}
byte[] k = new byte[4];
Expand Down Expand Up @@ -1094,13 +1099,12 @@ private void button3_Click( object sender, EventArgs e )
stopbutton.Enabled = true;
RecSizeBox.BackColor = System.Drawing.Color.White;
RecSizeBox.Text = "0";
byte[] msg = { 0x19 }; //_dump_ptr
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.DumpPtr );
byte[] b;
a = s.Send( msg );
a = s.Send( msg );
a = s.Send( msg );
a = s.Send( msg );
a = SendMessage( NoexsCommands.DumpPtr );
a = SendMessage( NoexsCommands.DumpPtr );
a = SendMessage( NoexsCommands.DumpPtr );
a = SendMessage( NoexsCommands.DumpPtr );
//while (s.Available < 4) ;
//b = new byte[s.Available];
//s.Receive(b);
Expand Down Expand Up @@ -1281,10 +1285,9 @@ private void attachdmntbutton_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x1A }; //_attach_dmnt
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.AttachDmnt );
//k = BitConverter.GetBytes(curpid);
//a = s.Send(k);
//a = SendMessage(k);
while ( s.Available < 4 )
{
;
Expand Down Expand Up @@ -1312,10 +1315,9 @@ private void button5_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x18 }; //_detach_dmnt
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.DetachDmnt );
//k = BitConverter.GetBytes(curpid);
//a = s.Send(k);
//a = SendMessage(k);
while ( s.Available < 4 )
{
;
Expand All @@ -1337,12 +1339,11 @@ private void button6_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x0A }; //_attach
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Attach );
byte[] k = new byte[8];
long k1 = Convert.ToInt64( pidBox.Text );
k = BitConverter.GetBytes( k1 );
a = s.Send( k );
a = SendData( k );
while ( s.Available < 4 )
{
;
Expand All @@ -1365,12 +1366,11 @@ private void button8_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x0A }; //_attach
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Attach );
byte[] k = new byte[8];
long k1 = Convert.ToInt64( pid0Box.Text );
k = BitConverter.GetBytes( k1 );
a = s.Send( k );
a = SendData( k );
while ( s.Available < 4 )
{
;
Expand All @@ -1388,12 +1388,11 @@ private void button8_Click( object sender, EventArgs e )

private void pidBox_TextChanged( object sender, EventArgs e )
{
byte[] msg = { 0x11 }; //_get_titleid
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.GetTitleId );
byte[] k = new byte[8];
long pid = Convert.ToInt64( pidBox.Text );
k = BitConverter.GetBytes( pid );
a = s.Send( k );
a = SendData( k );
while ( s.Available < 8 )
{
;
Expand All @@ -1414,12 +1413,11 @@ private void pidBox_TextChanged( object sender, EventArgs e )

private void pid0Box_TextChanged( object sender, EventArgs e )
{
byte[] msg = { 0x11 }; //_get_titleid
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.GetTitleId );
byte[] k = new byte[8];
long pid = Convert.ToInt64( pid0Box.Text );
k = BitConverter.GetBytes( pid );
a = s.Send( k );
a = SendData( k );
while ( s.Available < 8 )
{
;
Expand Down Expand Up @@ -1496,13 +1494,12 @@ private void getbookmarkbutton_Click( object sender, EventArgs e )
getbookmarkbutton.Enabled = false;
RecSizeBox.BackColor = System.Drawing.Color.White;
RecSizeBox.Text = "0";
byte[] msg = { 0x1B }; //_getbookmark
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.GetBookmark );
byte[] label = new byte[18];
//byte[] k = new byte[8];
//long k1 = Convert.ToInt64(pid0Box.Text);
//k = BitConverter.GetBytes(k1);
//a = s.Send(k);
//a = SendMessage(k);
int index = 0;
new Thread( () =>
{
Expand Down Expand Up @@ -1682,8 +1679,7 @@ private void pausebutton_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x09 }; //_pause
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Pause );
while ( s.Available < 4 )
{
;
Expand All @@ -1705,8 +1701,7 @@ private void resumebutton_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x08 }; //_resume
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.Resume );
while ( s.Available < 4 )
{
;
Expand Down Expand Up @@ -1752,8 +1747,7 @@ private void testbutton_Click( object sender, EventArgs e )

stopbutton.Enabled = true;
RecSizeBox.BackColor = System.Drawing.Color.White;
byte[] msg = { 0x19 }; //_dump_ptr { 0x16 }; //_search_local
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.DumpPtr );
byte[] b;

//while (s.Available < 4) ;
Expand Down Expand Up @@ -1966,8 +1960,7 @@ private void button9_Click( object sender, EventArgs e )
return;
}

byte[] msg = { 0x1C }; //_putbookmark
int a = s.Send( msg );
int a = SendMessage( NoexsCommands.PutBookmark );
while ( s.Available < 4 )
{
;
Expand All @@ -1978,8 +1971,8 @@ private void button9_Click( object sender, EventArgs e )
if ( !showerror( b ) )
{
byte[] fsize = BitConverter.GetBytes( readSize );
s.Send( fsize );
s.Send( buff );
SendData( fsize );
SendData( buff );
while ( s.Available < 4 )
{
;
Expand All @@ -2000,10 +1993,5 @@ private void button10_Click( object sender, EventArgs e )
{
ExportPath2();
}

private void statusBox_TextChanged( Object sender, EventArgs e )
{

}
}
}
36 changes: 36 additions & 0 deletions PointerSearcher/NoexsCommands.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace PointerSearcher
{
public enum NoexsCommands
{
Abort = 0x00,
Status = 0x01,
Poke8 = 0x02,
Poke16 = 0x03,
Poke32 = 0x04,
Poke64 = 0x05,
ReadMem = 0x06,
WriteMem = 0x07,
Resume = 0x08,
Pause = 0x09,
Attach = 0x0A,
detach = 0x0B,
QueryMemSingle = 0x0C,
QueryMemMulti = 0x0D,
CurrentPid = 0x0E,
AttachedPid = 0x0F,
ListPids = 0x10,
GetTitleId = 0x11,
Disconnect = 0x12,
ReadMemMulti = 0x13,
SetBreakpoint = 0x14,
FreezeAddress = 0x15,
SearchLocal = 0x16,
FetchResult = 0x17,
DetachDmnt = 0x18,
DumpPtr = 0x19,
AttachDmnt = 0x1A,
GetBookmark = 0x1B,
PutBookmark = 0x1C,
DmntResume = 0x1D
}
}
1 change: 1 addition & 0 deletions PointerSearcher/PointerSearcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
</Compile>
<Compile Include="IDumpDataReader.cs" />
<Compile Include="MemoryType.cs" />
<Compile Include="NoexsCommands.cs" />
<Compile Include="NoexsDumpDataReader.cs" />
<Compile Include="NoexsMemoryType.cs" />
<Compile Include="PointedAddress.cs" />
Expand Down

0 comments on commit 5b87029

Please sign in to comment.