Register - Login
Views: 99862811
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
05-04-22 03:22:25 PM
Jul - Computers and Technology - Visual Basic 2008, Hex mode help? New poll - New thread - New reply
Pages: 1 2Next newer thread | Next older thread
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 9/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-23-10 09:27:53 PM Link | Quote
Does anyone know a correct code to go along with open dialog so you can open a file or program and view it completely in hex (I believe it should have "&H" with it) and then have ways to goto offset, replace value, and such? It would really help if someone could reply.
Sukasa

Level: 123


Posts: 2747/4326
EXP: 20938310
For next: 292956

Since: 07-07-07


Since last post: 1.1 years
Last activity: 1.1 years

Posted on 10-24-10 06:38:27 AM Link | Quote

<Number>.ToString("X") will display a number in hex notation (e.g. 255.ToString("X") = "FF")

The best way to handle what you want is, on the backend, loading the entire file into a Byte array (e.g. Dim FileBytes() as byte) and then working with that.

____________________
* hydrapheetz puts on the kittydunce hat
Rena
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 3771/5390
EXP: 29079180
For next: 255825

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 343 days
Last activity: 343 days

Posted on 10-24-10 10:01:27 AM (last edited by Rena at 10-24-10 07:01 AM) Link | Quote
10-24-10 05:01:27 AM
Post #3771
...are you asking for a complete working hex editor?

____________________



[loading witty comment...]
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 12/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-24-10 01:12:33 PM Link | Quote
Originally posted by Rena
...are you asking for a complete working hex editor?



I'm asking for a code to allow me to view a file or in this case a rom and be able to goto offset button and have it so i can edit it also.
Sukasa

Level: 123


Posts: 2748/4326
EXP: 20938310
For next: 292956

Since: 07-07-07


Since last post: 1.1 years
Last activity: 1.1 years

Posted on 10-24-10 05:32:23 PM Link | Quote

So... in other words, "Yes."

You can write a working hex editor that lets you go to and change an offset in as few as 20 lines of code or so plus what VS2008 auto-generates for you. There's plenty of information available on things like this on the internet, too.

____________________
* hydrapheetz puts on the kittydunce hat
Lyskar
12210
-The Chaos within trumps the Chaos without-
Level: 192


Posts: 6796/12211
EXP: 99333467
For next: 540104

Since: 07-03-07

From: 52-2-88-7

Since last post: 7.4 years
Last activity: 7.3 years

Posted on 10-24-10 07:24:47 PM Link | Quote
Stats
Time/Date
10-24-10 01:24:47 PM
Posts
6796
Days Here
1209
Level
120
Metal_Man88's Post
Yes. As a computer-scientist in training I will have to say that while someone else could do it for you, you won't learn anything useful that way. Use what Sukasa said and then a loop through the array to whatever you want to change, change it, and save it.

The rest is just literally making the VB.net code to do that... ...which I wouldn't know how to do anyway, since I do C++ and Java and PHP only :p

____________________

Eisnaught - SSQ² - Mobius Roleplay - SSS
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 14/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-24-10 11:47:44 PM Link | Quote
Originally posted by Metal_Man88
Yes. As a computer-scientist in training I will have to say that while someone else could do it for you, you won't learn anything useful that way. Use what Sukasa said and then a loop through the array to whatever you want to change, change it, and save it.

The rest is just literally making the VB.net code to do that... ...which I wouldn't know how to do anyway, since I do C++ and Java and PHP only :p



I will learn what the code is and what I can do with it next time =P. But yes I suppose i will try it it out tomorrow and see how it works.
dirbaio
For future reference, "Responsible disclosure" isn't "acting like a douche about an exploit and demanding compensation".
Level: NaN


Posts: 909/-1288
EXP: NaN
For next: 0

Since: 07-28-09

From: Spain

Since last post: 10.8 years
Last activity: 9.9 years

Posted on 10-25-10 03:33:57 PM Link | Quote
I'm not exactly sure of what you're asking, but this might be what you want:
http://sourceforge.net/projects/hexbox/

It's an already made hex editor control which supports lots of things.
It's used in NSMB Editor and it works perfectly. The only problem is that it doesnt work with Mono.
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 17/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-26-10 11:02:11 AM Link | Quote
Originally posted by dirbaio
I'm not exactly sure of what you're asking, but this might be what you want:
http://sourceforge.net/projects/hexbox/

It's an already made hex editor control which supports lots of things.
It's used in NSMB Editor and it works perfectly. The only problem is that it doesnt work with Mono.


It's written in C#.
dirbaio
For future reference, "Responsible disclosure" isn't "acting like a douche about an exploit and demanding compensation".
Level: NaN


Posts: 910/-1288
EXP: NaN
For next: 0

Since: 07-28-09

From: Spain

Since last post: 10.8 years
Last activity: 9.9 years

Posted on 10-26-10 02:20:20 PM Link | Quote
But it's a .NET dll
you can use it from any .net language, including VB
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 20/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-27-10 10:24:47 PM Link | Quote
Originally posted by dirbaio
But it's a .NET dll
you can use it from any .net language, including VB


Still doesn't work. I'm tired of trying to get the program to directly patch to rom. If someone is too ignorant to open a extended m64 rom with a hex editor and go to offset and replace next two bytes with the value then They don't deserve to be called a Mario64 hacker. I'm just trying to make the program work both ways.


This code - Hex$(CLng("&H" & TextBox2.Text) - &H245000) is the math for the program. No matter how i put the &H245000 to be in front it always gives me a error. Because I need it to be infront so it can do the same math for addresses that are lower then 24500. I'm going to make another release but not a big one till i can fix this problem.
paulguy

Green Birdo
Level: 93


Posts: 1053/2294
EXP: 8033378
For next: 19432

Since: 09-14-07

From: Buffalo, NY

Since last post: 9.7 years
Last activity: 9.7 years

Posted on 10-28-10 06:28:23 AM Link | Quote
Paulguy's Post configuration
uh, you just need to convert the text to a number. The hexadecimal notation there is just used by the compiler, it translates to the same thing as if you expressed it in decimal.

So it'd just be like TextBox2.Text.whateverMethodMakesItANumber() - &H245000 to get the actual offset based on the user input. To be honest, though, You REALLY should validate the contents of TextBox2.Text to make sure the user has actually entered a number, and whether it's in a sane range. There's probably also a callback or something you can use that's called whenever the user presses something while the text box is focused, so you can check if it's a digit and append it only if it is, and also not allow numbers entered that are too high and stuff, if you want to be fancy. There might even be a specific control for entering numbers in, specifically, like a spinner that you can type in to.

____________________
Rena
I had one (1) message in Discord deleted and proceeded to make a huge, huge mess about how it was a violation of free speech and how moderators are supposed to be spam janitors and nobody should have the right to tell me not to talk about school shootings
Level: 135


Posts: 3815/5390
EXP: 29079180
For next: 255825

Since: 07-22-07

Pronouns: he/him/whatever
From: RSP Segment 6

Since last post: 343 days
Last activity: 343 days

Posted on 10-28-10 07:34:15 PM Link | Quote
10-28-10 02:34:14 PM
Post #3815
Well I haven't used VB in a while, but I remember that it does treat input as hex if you add &h in front of it. Sounds like he wants to add that in code so the user is only typing a hex number (without any prefix). Otherwise the input would be in Decimal which is a bit silly for such applications.

____________________



[loading witty comment...]
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 21/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-28-10 08:52:09 PM Link | Quote
Originally posted by Rena
Well I haven't used VB in a while, but I remember that it does treat input as hex if you add &h in front of it. Sounds like he wants to add that in code so the user is only typing a hex number (without any prefix). Otherwise the input would be in Decimal which is a bit silly for such applications.


Hex$(CLng("&H" & TextBox2.Text) - &H245000)


I need to get &H245000 to the left of Hex$(CLng("&H" & TextBox2.Text) without the error of double "&H" for some reason. I'm starting to think it's impossible and visual basics is just a crappy programming language and Microsoft sucks at everything. I'm tired of this im about to totally delete the entire project files and just let someone else make it like frauber or VLtone who could do it in 2 seconds without any help or problems.
Sukasa

Level: 123


Posts: 2755/4326
EXP: 20938310
For next: 292956

Since: 07-07-07


Since last post: 1.1 years
Last activity: 1.1 years

Posted on 10-30-10 02:01:16 PM (last edited by Sukasa at 10-30-10 11:05 AM) Link | Quote

Dim Value as Byte = Byte.Parse("&H" & TextBox2.text)

That wasn't so hard. Also, before you go hating on VB and microsoft, you should probably consider that Clng() requires a numeric parameter and you're passing a string (which completely shouldn't work); then, you're subtracting 2379776 from that value before converting it back to a Hexadecimal string!

When Rena said that VB uses "&H" for input, it doesn't mean you still don't have to call the correct parse function.

____________________
* hydrapheetz puts on the kittydunce hat
Lyskar
12210
-The Chaos within trumps the Chaos without-
Level: 192


Posts: 6861/12211
EXP: 99333467
For next: 540104

Since: 07-03-07

From: 52-2-88-7

Since last post: 7.4 years
Last activity: 7.3 years

Posted on 10-30-10 07:50:38 PM (last edited by Metal_Man88 at 10-30-10 04:51 PM) Link | Quote
Stats
Time/Date
10-30-10 01:50:38 PM
Posts
6861
Days Here
1215
Level
121
Metal_Man88's Post
These things with hex stuff and programming are serious computer science topics, Shenox. As I tried to warn you, you're probably in over your head. You're probably better off stopping if you don't understand data structures like arrays, queues, and stacks, and also if you don't understand hex, binary, octal and their relation to decimal... and also object oriented programming.

You're just going to tear your hair out trying to do it otherwise, as it isn't something you just magically type into a box and magically becomes reality. Believe you me, I could potentially make what you're talking about in C++, but it's an undertaking such that Iiiii'm not about to spend hours of my life on that yet, unless I was being paid or something.

____________________
Eisnaught - SSQ² - Mobius Roleplay - SSS
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 23/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-31-10 12:40:39 AM Link | Quote
Originally posted by Metal_Man88
These things with hex stuff and programming are serious computer science topics, Shenox. As I tried to warn you, you're probably in over your head. You're probably better off stopping if you don't understand data structures like arrays, queues, and stacks, and also if you don't understand hex, binary, octal and their relation to decimal... and also object oriented programming.

You're just going to tear your hair out trying to do it otherwise, as it isn't something you just magically type into a box and magically becomes reality. Believe you me, I could potentially make what you're talking about in C++, but it's an undertaking such that Iiiii'm not about to spend hours of my life on that yet, unless I was being paid or something.



I don't think of C++/C/C# and other programming langues as extreme computer science. I don't know what a Array, queues or stacks are. I understand hex and binary very well, not so much as octal sense I did not ever hear about till a while ago. And I don't really understand binary to decimal. Nor what object oriented programming is. I hate seeing people think that you need a fancy collage degree or a one on one teacher to teach you how to program with many langues. I learned everything I knew in past 4 years and with just the help of notes I found, I never really asked people for much help, but here I see I always get people attempting to help which is very nice. I started hacking N64 roms in 06 when I was 11 years old, at time I just did a hack with Renegrade64 and followed a tut on making gameshark codes step by step and I made one to replace the Goomba's behavior with Bob-ombs. Very basic stuff, I felt around with the stuff I was given and came up with more stuff. Then I started making hacks dealing with ROM and RAM data using hex editor and Nemu64. Just years and years of experience with rom hacking =3. I started making programs in 09 starting with VB, then I did my first hack of a N64 rom using C but when I tried to play it, It would go black screen all the time. So I never messed with C++/C that much till 2010 when I helped okaygo with Mupen64plus and my own hack of Pj64 1.4 to support kaillera.

I know there are people like VLtone or frauber or even you or many other people on these forums who could make this program without any problems or anything. That in my opinion is because yall know more about the programming langue. I could spend hours reading information about programming, but I rather figure it out my self with SOME help.



Also thanks for all the information.
Dim Value as Byte = Byte.Parse("&H" & TextBox2.text)

I'm going to see what I can do with that. This is the entire code I had before for both

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If Val(Hex$(CLng("&H" & TextBox2.Text)) < &H245000) Then
TextBox4.Text = "Offset: 0x" + Hex$(CLng("&H" & TextBox2.Text) - &H245000) + Environment.NewLine + "Value: " + TextBox3.Text
MessageBox.Show("Finished!", "(Complete)")
End If

If Val(Hex$(CLng("&H" & TextBox2.Text)) > &H245000) Then

This is where I had problems at.

MessageBox.Show("This Gameshark code can NOT be patched!", "(Error)")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End If

End Sub
ShenoxVII

(in all seriousness, you're a prick)
Level: 24


Posts: 24/111
EXP: 76013
For next: 2112

Since: 10-09-10


Since last post: 9.0 years
Last activity: 9.0 years

Posted on 10-31-10 01:07:40 AM Link | Quote
Originally posted by Sukasa
Dim Value as Byte = Byte.Parse("&H" & TextBox2.text)

That wasn't so hard. Also, before you go hating on VB and microsoft, you should probably consider that Clng() requires a numeric parameter and you're passing a string (which completely shouldn't work); then, you're subtracting 2379776 from that value before converting it back to a Hexadecimal string!

When Rena said that VB uses "&H" for input, it doesn't mean you still don't have to call the correct parse function.



Didn't work at all no matter how I tried to use it even with editing it.

Also I'm trying to do 245000 - ADDRESS (or TextBox2.text). not Address - 245000 , It's easy getting address - 245000 now I can't flip it. No matter what I do. I also don't understand DIm as, I thought you could dim any command as anything. I can't do it. Your code keep saying format wrong.
Sukasa

Level: 123


Posts: 2756/4326
EXP: 20938310
For next: 292956

Since: 07-07-07


Since last post: 1.1 years
Last activity: 1.1 years

Posted on 10-31-10 02:36:07 AM Link | Quote

What's the value of TextBox2.Text?

Are you using the right variable type? Perhaps you need to change Byte to Int32 or Int64.


Dim Address as Int64 = -1

Dim ValidAddress as Boolean = Int64.TryParse("&H" & TextBox2.Text, Address)
If ValidAddress AndAlso Address >= 0 Then
If Address > &H245000 Then
MsgBox("That address cannot be patched!")
Else
'Do something Here
End If
Else
MsgBox("Enter a valid positive hexadecimal number without any pre- or post-fixing")
End If



____________________
* hydrapheetz puts on the kittydunce hat
Lyskar
12210
-The Chaos within trumps the Chaos without-
Level: 192


Posts: 6872/12211
EXP: 99333467
For next: 540104

Since: 07-03-07

From: 52-2-88-7

Since last post: 7.4 years
Last activity: 7.3 years

Posted on 10-31-10 03:40:30 AM Link | Quote
Stats
Time/Date
10-30-10 09:40:30 PM
Posts
6872
Days Here
1215
Level
121
Metal_Man88's Post
Originally posted by ShenoxVII
I don't think of C++/C/C# and other programming langues as extreme computer science. I don't know what a Array, queues or stacks are. I understand hex and binary very well, not so much as octal sense I did not ever hear about till a while ago. And I don't really understand binary to decimal. Nor what object oriented programming is. I hate seeing people think that you need a fancy collage degree or a one on one teacher to teach you how to program with many langues. I learned everything I knew in past 4 years and with just the help of notes I found, I never really asked people for much help, but here I see I always get people attempting to help which is very nice.


It is nice to know that when vaguely questioned as to your ability, you go into a massive passionate response about your life story and how ivory tower intellectuals don't live your life. This was highly necessary to answer a simple hint that your difficulties with programming languages may lie in things you can, in fact, teach yourself.

Assuming that the person who controls the forum your results are posted in is antagonizing you is also a good idea, especially when they are trying to be helpful. It is sure to ensure they do not accidentally delete your topics or otherwise. Why, it is probably the best way to get them on your best side. Besides, passive disagreement is only for college types.

Notes you have found have, after all, helped you very well. Constantly failing to get something to work and struggling to do basic things is how all great people do their work, of course. Only ivory tower intellectuals plan out and execute these sort of things. Looking at a reference book would probably just get in the way of desperately asking people on forums what terms in a programming language mean. That is what good programming is all about, anyway.

Understanding what you are doing is only for people who have gone to colleges, anyway. Why bother reading? It's always easier to blindly try different commands and become extremely frustrated, then ask for help. Figuring out how to do what you want first by looking at a book is just something those worthless college educated people do, since without teachers they cannot open books and are incapable of learning the content within them.

Of course, my greatest assurances are with you, for I do definitely wish for you to complete this project. Although as one who wishes for it to be completed, I might humbly suggest your time is best spent on the program at hand, rather than telling me your life story. I have a bad memory, and have probably forgotten it already, so responding to this post with more words like it would probably be a waste of your time.

So good luck with your program. I am quite sure it will be readily completed anyway, you seem to have the right idea, Sukas--er, Shenox.




____________________

Eisnaught - SSQ² - Mobius Roleplay - SSS
Pages: 1 2Next newer thread | Next older thread
Jul - Computers and Technology - Visual Basic 2008, Hex mode help? New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

29 database queries, 3 query cache hits.
Query execution time: 0.085500 seconds
Script execution time: 0.049001 seconds
Total render time: 0.134500 seconds