• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Forum moderator applications are now open! Click here for details.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs.

21
Posts
15
Years
  • Seen Mar 17, 2013
Ah try and run them seperate,
But also try to write 5kb per function each time it runs ;). so 1000x 5kb
 

cooley

///Keepin' it simple
1,148
Posts
17
Years
Darthatron, I need your help with VB 6

1. What is Len, LenB etc. I always see them everywhere, but I never know what they mean.

2. Every time I Write hex back to the ROM then it puts the data one byte ahaed or behind the actual offset. Do you know why? The code is below:


Code:
Option Explicit

Dim sFile As String
___________________________________
Private Sub Command1_Click()
Dim iFileNum As Integer

    iFileNum = FreeFile
    sFile = frmMain.CommonDialog1.FileName

If cmbPoke.Text = "" Then
MsgBox ("Pick a Pokemon please")

Else

Open sFile For Binary As #iFileNum
    Put #iFileNum, &H5FDE, cmbPoke.ListIndex
        
    Close #iFileNum
Unload Me
End If
End Sub

3. I put cmbPoke.ListIndex, how does VB know we're talking about hex? For the pokemon numbers that is. When there aren't any hex values assigned to the Pokemon themselves?

Ex. I click Pikachu(&h19 and no. 25) how does it write 19 back to the rom when it's no. 25 on the list?
 
21
Posts
15
Years
  • Seen Mar 17, 2013
1. What is Len, LenB etc. I always see them everywhere, but I never know what they mean.
Len is used to calculate the lenght of a string, LenB does the same but it seems a bit faster..

2. Every time I Write hex back to the ROM then it puts the data one byte ahaed or behind the actual offset. Do you know why? The code is below:
do +1 by the offset since it begins at 0.

3. I put cmbPoke.ListIndex, how does VB know we're talking about hex? For the pokemon numbers that is. When there aren't any hex values assigned to the Pokemon themselves?
cmbPoke.ListIndex will result in a integer value of the item selected like if you choose the 2e in line it wil result in 2. so nothing to do with hex.

Ex. I click Pikachu(&h19 and no. 25) how does it write 19 back to the rom when it's no. 25 on the list?
And if your talking about the offset here well &H tells it that you are using Hex.
 

cooley

///Keepin' it simple
1,148
Posts
17
Years
Is this correct to write all these bytes next to each other?

Thanks, by the way!

Code:
If opt2.Value = True Then
            Put #iFileNum, &H5AD5, &H2
            Put #iFileNum, &H5AD6, &H0
            Put #iFileNum, &H5AD7, &H1
            Put #iFileNum, &H5AD8, &HFF
        If opt3.Value = True Then
            Put #iFileNum, &H5AD9, &O3
            Put #iFileNum, &H5ADA, &H0
            Put #iFileNum, &H5ADB, &H1
            Put #iFileNum, &H5ADC, &H2
            Put #iFileNum, &H5ADD, &HFF
       If opt4.Value = True Then
            Put #iFileNum, &H5ADE, &H4
            Put #iFileNum, &H5ADF, &H0
            Put #iFileNum, &H5AE0, &H1
            Put #iFileNum, &H5AE1, &H2
            Put #iFileNum, &H5AE2, &H3
            Put #iFileNum, &H5AE3, &HFF
Close #iFileNum
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
Is this correct to write all these bytes next to each other?

Thanks, by the way!

Code:
If opt2.Value = True Then
            Put #iFileNum, &H5AD5, &H2
            Put #iFileNum, &H5AD6, &H0
            Put #iFileNum, &H5AD7, &H1
            Put #iFileNum, &H5AD8, &HFF
        If opt3.Value = True Then
            Put #iFileNum, &H5AD9, &O3
            Put #iFileNum, &H5ADA, &H0
            Put #iFileNum, &H5ADB, &H1
            Put #iFileNum, &H5ADC, &H2
            Put #iFileNum, &H5ADD, &HFF
       If opt4.Value = True Then
            Put #iFileNum, &H5ADE, &H4
            Put #iFileNum, &H5ADF, &H0
            Put #iFileNum, &H5AE0, &H1
            Put #iFileNum, &H5AE1, &H2
            Put #iFileNum, &H5AE2, &H3
            Put #iFileNum, &H5AE3, &HFF
Close #iFileNum

Yes, but you never opened the File for Editing...

Also, you didn't end your IF Statements.
 

interdpth

I've seen things, man.
275
Posts
19
Years
  • Seen Jun 8, 2021
I'd like to point out, that while your little HEX module is handing it's easily replaceable.
For dealing with hex values
&H
that reverse hex is just declaring the proper variable
dim byte1 as byte'Handles 1 byte
byte1=&H0C
viewing with a hex editor you'll see 0x
dim integer1 as integer'Handles 2 bytes
integer1=&HFF04
viewing with a hexeditor
04 FF

and the one I guess that reversehex is mainly used for

the long

dim long1 as long'4 bytes usually for a pointer
long1=&h8123456
in a hex editor
56 34 12 08
Get it now?

Readhex is simply reduced to
dim byte1 as byte
open filepath for binary as #1
get #1, offset+1,byte1
or
seek #1, offset+1
get #1, ,byte1
close #1
for integers

just change the byte to integer

for long just change integer or byte to long

to write data to a rom use put instead of get

and to extract the address from a long
just take the 8 off so
offset-&h8000000

make sure if you're pointing a pointer into a rom make sure to add the &H8000000


simple.

And not bloated.
 

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I'd like to point out, that while your little HEX module is handing it's easily replaceable.
For dealing with hex values
&H
that reverse hex is just declaring the proper variable
dim byte1 as byte'Handles 1 byte
byte1=&H0C
viewing with a hex editor you'll see 0x
dim integer1 as integer'Handles 2 bytes
integer1=&HFF04
viewing with a hexeditor
04 FF

and the one I guess that reversehex is mainly used for

the long

dim long1 as long'4 bytes usually for a pointer
long1=&h8123456
in a hex editor
56 34 12 08
Get it now?

Readhex is simply reduced to
dim byte1 as byte
open filepath for binary as #1
get #1, offset+1,byte1
or
seek #1, offset+1
get #1, ,byte1
close #1
for integers

just change the byte to integer

for long just change integer or byte to long

to write data to a rom use put instead of get

and to extract the address from a long
just take the 8 off so
offset-&h8000000

make sure if you're pointing a pointer into a rom make sure to add the &H8000000


simple.

And not bloated.

Simple for you and I, but not for people who don't understand Visual Basic, or who are only just learning, this is for those people. Thanks for the lesson though, I had no idea each Variant was meant to hold a different amount of data... :)
 

interdpth

I've seen things, man.
275
Posts
19
Years
  • Seen Jun 8, 2021
Honestly you shouldn't even try to program if you don't know variables. If anyone wants i'll teach more
 

ℜªℳ

RAM Corporation |\/| ][ |\/|
214
Posts
16
Years
  • Age 29
  • Seen May 11, 2016
I just got into porgramming 4 days ago so I'm new but I already have C++ down. I'm trying to learn VB and I just have a simple question about your tools(I will ask questions in the future since I'm new in this area). Do I have to use VB6 for this becuz it is very out dated and there has been many recent VBs like VB 2008 which is known as VB9? Also, its not possible for you to give us a free download of VB6 is it? (little infringement won't hurt any1) just joking.

@all- If any1 contacts me via email I can help them get one painlessly (sorry for simple spamming and cheapAd)

I also have another question (sorry for the double post if it shows as so and doesn't merge)...
In the second step when entering the pokeballs I don't see where "style" is to put in the number 2. can any1 help? My tool has index, shortcut, help contextId, and negotiate position (it say none, middle, left, right) and the 4 chk offs. There's no style to writee the number 2 in. Also I have no idea as where I'm supposed to insert the list for the pokemon. Like I said before I just started with visual basic and my friend Akido said its the best for programming so here I am.
 
Last edited:

Darthatron

巨大なトロール。
1,152
Posts
18
Years
I just got into porgramming 4 days ago so I'm new but I already have C++ down. I'm trying to learn VB and I just have a simple question about your tools(I will ask questions in the future since I'm new in this area). Do I have to use VB6 for this becuz it is very out dated and there has been many recent VBs like VB 2008 which is known as VB9? Also, its not possible for you to give us a free download of VB6 is it? (little infringement won't hurt any1) just joking.

@all- If any1 contacts me via email I can help them get one painlessly (sorry for simple spamming and cheapAd)

I also have another question (sorry for the double post if it shows as so and doesn't merge)...
In the second step when entering the pokeballs I don't see where "style" is to put in the number 2. can any1 help? My tool has index, shortcut, help contextId, and negotiate position (it say none, middle, left, right) and the 4 chk offs. There's no style to writee the number 2 in. Also I have no idea as where I'm supposed to insert the list for the pokemon. Like I said before I just started with visual basic and my friend Akido said its the best for programming so here I am.

Hello. First off let me say, if you know C++ stick with it, as you said VB6 is way outdated, and Vista barely supports it anymore. I'd recommend using the built in File Editing resources for C++.

If you really need help with VB6 I'll help,m but I would seriously recommend sticking with one of the newer versions of the Visual Studio family. :)
 
21
Posts
15
Years
  • Seen Mar 17, 2013
I agree with Darthatron,
If you know a higher lvl language then vb6 stick with it.
 

ℜªℳ

RAM Corporation |\/| ][ |\/|
214
Posts
16
Years
  • Age 29
  • Seen May 11, 2016
ok but unfortanutely there isn't any tutorial on how to create a hack tool with it so I chose to learn VB6 since many ppl use it. wat I now need to know is will the new visual basics work with this same tutorial?
 

madarawolf

Espada Cuarta
56
Posts
15
Years
  • Seen Jul 23, 2023
When I try to run the program it says there is sometinhg wrong with this line
"Private Sub cmdOpen_Click()
Dim cdgOpen As clsCommonDialog"
I'm not sure whats wrong tho.
if this question is noobish forgive my impudence for I have just started in a programing class and haven't learned too much yet.
 
Last edited:
1
Posts
13
Years
  • Seen Apr 1, 2012
You don't need to credit me.. Next time just try and read, k?
And, to answer on your question: ReverseHEX(HEXString) will ^^
So ReverseHEX(08123456) will return 56341208

Good Night (2:30AM !!)
how do you add the functions in ?
 

Aljam

[i]Sweepin' ain't easy...[/i]
615
Posts
15
Years
This seems very interesting, but why would I need the comdlg module? There is already one by default in vb6.
 

gamesharkhacker

SupremoHack Entertainment Inc.
47
Posts
14
Years
Does anybody know how to insert a file that has been opened with the program into a rom that has been also opened with the program using WriteHEX? Is it possible?
If not, is there any other ways of doing it? Can you please get back to me soon on this as this is the only thing keeping me back from releasing my program.

Thanks, GSH.
 

ShadowMrk

Intangible
70
Posts
13
Years
  • Age 28
  • Seen Nov 27, 2018
Does anybody know how to insert a file that has been opened with the program into a rom that has been also opened with the program using WriteHEX? Is it possible?
If not, is there any other ways of doing it? Can you please get back to me soon on this as this is the only thing keeping me back from releasing my program.

Thanks, GSH.

Sounds like that is a major part of your program. Anyways, just use a For...Next loop to store the bytes from the source file and then use the writehex function in another For...Next loop to insert the bytes into the target file making sure to use a base address and using your counter variable as an offset of the base address.
 
2
Posts
12
Years
  • Seen May 8, 2012
Have to Edit the Starter Levels

Hey can you give me some code for editing the levels of the selected pokemon?:(

Hey can you tell me the code for the starter levels?
because if i choose a legendary pokemon its weak because it is low level
 
Last edited:
Back
Top