Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


vC# or VB for my trainer

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Mon Oct 12, 2009 2:38 pm    Post subject: vC# or VB for my trainer Reply with quote

I again Very Happy
Look guys, i want to made TRAINER for one game now. Look i am good in VB.net but but C# i beggin learning.
So, when i use cheat engine i use HEX, Aray of byte, ASROM and VALUE :
0F 00 00 00 07 00 01 00 05 00
than cheat engine find only one value for that game and i change it manualy to:
0F 00 00 00 07 00 01 00 09 00

Ok, can i do it with VB.net programing and how (any example with aray of byte), if i cant do it in VB than how to do it in C# ???
I need to auto select process, than scan for that value and when click button change it.


How pls help!!!
Thanks
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Oct 12, 2009 4:56 pm    Post subject: Reply with quote

VB is useless outside of taking care of a legacy code base

I can't think of another way outside of just looping through the characters in the string. The convert class lets you specify the base, so you can just use base 16 as you go along.
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Mon Oct 12, 2009 6:47 pm    Post subject: Reply with quote

Example pls
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Oct 12, 2009 7:59 pm    Post subject: Reply with quote

You can handle the byte array conversions like this if you're trying to mimic CE. When it's done, temp will have the bytes to entered as a string in actual byte array format. You can use it to read / write / do whatever with then.

It doesn't handle spaces though.

Code:
byte[] temp = new byte[string.Length / 2]; //since we're working in chunks of 2 chars.
for(int i = 0; i < string.Length; i += 2)
{
   temp[i / 2] = Convert.ToByte(string.Substring(i, 2), 16); //convert each chunk to hex
}
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Tue Oct 13, 2009 8:05 pm    Post subject: Reply with quote

Thank you very much
Can you convert it to VB.net if it can work in VB?


PS. 'string.Length' dont work in my VC# 2008
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 13, 2009 8:39 pm    Post subject: Reply with quote

post the error.

and just use an online converter.
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Tue Oct 13, 2009 8:49 pm    Post subject: Reply with quote

I try online converter but again in my VB not decect command string.Length

ERROR LIST:

Code:
Error   1   An object reference is required for the non-static field, method, or property 'string.Length.get'   C:\Users\stefanACM\Documents\Visual Studio 2008\Projects\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs   21   36   WindowsFormsApplication4

Error   2   An object reference is required for the non-static field, method, or property 'string.Length.get'   C:\Users\stefanACM\Documents\Visual Studio 2008\Projects\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs   22   33   WindowsFormsApplication4

Error   3   An object reference is required for the non-static field, method, or property 'string.Substring(int, int)'   C:\Users\stefanACM\Documents\Visual Studio 2008\Projects\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs   24   46   WindowsFormsApplication4
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Oct 13, 2009 10:40 pm    Post subject: Reply with quote

Because you just copy / pasted it without thinking, you have to get the string from somewhere

make a function:
Code:
           public static byte[] awesome_function(string s)
            {
                byte[] temp = new byte[s.Length / 2]; //since we're working in chunks of 2 chars.
                for (int i = 0; i < s.Length; i += 2)
                {
                    temp[i / 2] = Convert.ToByte(s.Substring(i, 2), 16); //convert each chunk to hex
                }
                return temp;
            }
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Wed Oct 14, 2009 7:32 am    Post subject: Reply with quote

O great now work with VB.net Very Happy
Ok, now how scan memory with this number, and how select process by window title. I never work with memory edit in VB, but i want to learn it Very Happy


Thank you very much
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Oct 14, 2009 11:41 am    Post subject: Reply with quote

Call ReadProcessMemory()
http://www.pinvoke.net/default.aspx/kernel32/ReadProcessMemory.html
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Wed Oct 14, 2009 12:54 pm    Post subject: Reply with quote

I am really confused now. I can read and write to process memory..... but when i try to call function for converting array of byte dont work. Pls can you type how call that function for TextBox1 value and result to TextBox2. I am try 100 000 time but every time dont work :S


Thanks
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Oct 14, 2009 1:51 pm    Post subject: Reply with quote

stefanACM wrote:
I am really confused now. I can read and write to process memory..... but when i try to call function for converting array of byte dont work. Pls can you type how call that function for TextBox1 value and result to TextBox2. I am try 100 000 time but every time dont work :S


Thanks


the BitConverter class has a method for converting a byte array to a string
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Wed Oct 14, 2009 2:45 pm    Post subject: Reply with quote

Can you write example for Button1, textbox1,textbox2 (textbox1 with array byte convert to textbox2 for your function in VB.net )


Thanks
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Oct 14, 2009 3:38 pm    Post subject: Reply with quote

Code:
           
byte[] text = awesome_function(textBox1.Text);
textBox2.Text = System.BitConverter.ToString(text);
Back to top
View user's profile Send private message
stefanACM
Newbie cheater
Reputation: 0

Joined: 01 Oct 2009
Posts: 14

PostPosted: Wed Oct 14, 2009 3:53 pm    Post subject: Reply with quote

Thank you very much now work.
I trying with it befor i made your code ass function Very Happy
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites