DC Forums

We have moved our forums:
http://www.dcforums.co.cc/forum/

Please re-register there, thank you.
GKS


Join the forum, it's quick and easy

DC Forums

We have moved our forums:
http://www.dcforums.co.cc/forum/

Please re-register there, thank you.
GKS

DC Forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
There are many new features available. Some of them include: the advanced profile, reputation system, and the point system. Thank you for waiting patiently, enjoy the update. Plus we are still working on fixing a lot of bugs and stuff that are wrong with the theme.

    Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs.

    G.K.S.
    G.K.S.
    Founder
    Founder


    Male Number of posts : 1718
    Age : 31
    Location : Calfornia, United States
    Status : Updating the forum.
    Warning :
    Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs. Left_bar_bleue90 / 10090 / 100Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs. Right_bar_bleue

    Reputation : 0
    Points : 25
    Registration date : 2008-09-20

    Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs. Empty Visual Basic 6.0 HEX Editing Functions - For Hacking ROMs.

    Post by G.K.S. Sat Sep 20, 2008 10:22 pm

    By: Darthatron


    Before we start:
    Today I'm going to teach you how to make a basic program to Hack Diamond/Pearl in Visual Basic 6.0. Please, before reading on make sure you learn the very basics of Visual Basic 6.0 from somewhere, Google it or something. I'd give you links, but I do believe that is against the rules. Also, be sure you already own a Copy of VB6, you cannot download it from Microsoft anymore. You will have to find other ways of locating it.

    Now, I'm going to show you how to make a Starter Editor for D/P.
    _______________

    Before you start coding... Step 1:
    Before you even think of beginning to code you will need several Functions and of course the remarkable 'clsCommonDialog' Class Module.

    First off, let's get you the Class Module, it is very helpful. And it stops people from getting the annoying "Component 'comdlg32.ocx' or one of its dependencies not correctly registered: a file is missing or invalid." Error. You can get it here. Please note, I have no idea who wrote it, but whoever they were they were truly a genius.

    Also, you will need the HEX Editing Module, with all Functions made by me. You can get that here.

    Add those 2 files into your project, and then we can continue.
    _______________

    Now, let's begin. Step 2:
    Now, you will want to make 2 Buttons.
    1 Named "cmdOpen" and the Caption "Open"
    1 Named "cmdSave" and the Caption "Save"

    And also, make 3 ComboBoxes. (These will hold which Pokemon will be in the PokeBalls.)
    1 Named "cmbPoke1" and the Style set to 2.
    1 Named "cmbPoke2" and the Style set to 2.
    1 Named "cmbPoke3" and the Style set to 2.

    You also have to make the List Property of all the ComboBoxes to this:
    Code:
    ??????????
    Bulbasaur
    Ivysaur
    Venusaur
    Charmander
    Charmeleon
    Charizard
    Squirtle
    Wartortle
    Blastoise
    Caterpie
    Metapod
    Butterfree
    Weedle
    Kakuna
    Beedrill
    Pidgey
    Pidgeotto
    Pidgeot
    Rattata
    Raticate
    Spearow
    Fearow
    Ekans
    Arbok
    Pikachu
    Raichu
    Sandshrew
    Sandslash
    Nidoran-F
    Nidorina
    Nidoqueen
    Nidoran-M
    Nidorino
    Nidoking
    Clefairy
    Clefable
    Vulpix
    Ninetales
    Jigglypuff
    Wigglytuff
    Zubat
    Golbat
    Oddish
    Gloom
    Vileplume
    Paras
    Parasect
    Venonat
    Venomoth
    Diglett
    Dugtrio
    Meowth
    Persian
    Psyduck
    Golduck
    Mankey
    Primeape
    Growlithe
    Arcanine
    Poliwag
    Poliwhirl
    Poliwrath
    Abra
    Kadabra
    Alakazam
    Machop
    Machoke
    Machamp
    Bellsprout
    Weepinbell
    Victreebel
    Tentacool
    Tentacruel
    Geodude
    Graveler
    Golem
    Ponyta
    Rapidash
    Slowpoke
    Slowbro
    Magnemite
    Magneton
    Farfetch'd
    Doduo
    Dodrio
    Seel
    Dewgong
    Grimer
    Muk
    Shellder
    Cloyster
    Gastly
    Haunter
    Gengar
    Onix
    Drowzee
    Hypno
    Krabby
    Kingler
    Voltorb
    Electrode
    Exeggcute
    Exeggutor
    Cubone
    Marowak
    Hitmonlee
    Hitmonchan
    Lickitung
    Koffing
    Weezing
    Rhyhorn
    Rhydon
    Chansey
    Tangela
    Kangaskhan
    Horsea
    Seadra
    Goldeen
    Seaking
    Staryu
    Starmie
    Mr.Mime
    Scyther
    Jynx
    Electabuzz
    Magmar
    Pinsir
    Tauros
    Magikarp
    Gyarados
    Lapras
    Ditto
    Eevee
    Vaporeon
    Jolteon
    Flareon
    Porygon
    Omanyte
    Omastar
    Kabuto
    Kabutops
    Aerodactyl
    Snorlax
    Articuno
    Zapdos
    Moltres
    Dratini
    Dragonair
    Dragonite
    Mewtwo
    Mew
    Chikorita
    Bayleef
    Meganium
    Cyndaquil
    Quilava
    Typhlosion
    Totodile
    Croconaw
    Feraligatr
    Sentret
    Furret
    Hoothoot
    Noctowl
    Ledyba
    Ledian
    Spinarak
    Ariados
    Crobat
    Chinchou
    Lanturn
    Pichu
    Cleffa
    Igglybuff
    Togepi
    Togetic
    Natu
    Xatu
    Mareep
    Flaaffy
    Ampharos
    Bellossom
    Marill
    Azumarill
    Sudowoodo
    Politoed
    Hoppip
    Skiploom
    Jumpluff
    Aipom
    Sunkern
    Sunflora
    Yanma
    Wooper
    Quagsire
    Espeon
    Umbreon
    Murkrow
    Slowking
    Misdreavus
    Unown
    Wobbuffet
    Girafarig
    Pineco
    Forretress
    Dunsparce
    Gligar
    Steelix
    Snubbull
    Granbull
    Qwilfish
    Scizor
    Shuckle
    Heracross
    Sneasel
    Teddiursa
    Ursaring
    Slugma
    Magcargo
    Swinub
    Piloswine
    Corsola
    Remoraid
    Octillery
    Delibird
    Mantine
    Skarmory
    Houndour
    Houndoom
    Kingdra
    Phanpy
    Donphan
    Porygon 2
    Stantler
    Smeargle
    Tyrogue
    Hitmontop
    Smoochum
    Elekid
    Magby
    Miltank
    Blissey
    Raikou
    Entei
    Suicune
    Larvitar
    Pupitar
    Tyranitar
    Lugia
    Ho-oh
    Celebi
    Treecko
    Grovyle
    Sceptile
    Torchic
    Combusken
    Blaziken
    Mudkip
    Marshtomp
    Swampert
    Poochyena
    Mightyena
    Zigzagoon
    Linoone
    Wurmple
    Silcoon
    Beautifly
    Cascoon
    Dustox
    Lotad
    Lombre
    Ludicolo
    Seedot
    Nuzleaf
    Shiftry
    Taillow
    Swellow
    Wingull
    Pelipper
    Ralts
    Kirlia
    Gardevoir
    Surskit
    Masquerain
    Shroomish
    Breloom
    Slakoth
    Vigoroth
    Slaking
    Nincada
    Ninjask
    Shedinja
    Whismur
    Loudred
    Exploud
    Makuhita
    Hariyama
    Azurill
    Nosepass
    Skitty
    Delcatty
    Sableye
    Mawile
    Aron
    Lairon
    Aggron
    Meditite
    Medicham
    Electrike
    Manectric
    Plusle
    Minun
    Volbeat
    Illumise
    Roselia
    Gulpin
    Swalot
    Carvanha
    Sharpedo
    Wailmer
    Wailord
    Numel
    Camerupt
    Torkoal
    Spoink
    Grumpig
    Spinda
    Trapinch
    Vibrava
    Flygon
    Cacnea
    Cacturne
    Swablu
    Altaria
    Zangoose
    Seviper
    Lunatone
    Solrock
    Barboach
    Whiscash
    Corphish
    Crawdaunt
    Baltoy
    Claydol
    Lileep
    Cradily
    Anorith
    Armaldo
    Feebas
    Milotic
    Castform
    Kecleon
    Shuppet
    Banette
    Duskull
    Dusclops
    Tropius
    Chimecho
    Absol
    Wynaut
    Snorunt
    Glalie
    Spheal
    Sealeo
    Walrein
    Clamperl
    Huntail
    Gorebyss
    Relicanth
    Luvdisc
    Bagon
    Shellgon
    Salamence
    Beldum
    Metang
    Metagross
    Regirock
    Regice
    Registeel
    Latias
    Latios
    Kyogre
    Groudon
    Rayquaza
    Jirachi
    Deoxys
    Turtwig
    Grotle
    Torterra
    Chimchar
    Monferno
    Infernape
    Piplup
    Prinplup
    Empoleon
    Starly
    Staravia
    Staraptor
    Bidoof
    Bibarel
    Kricketot
    Kricketune
    Shinx
    Luxio
    Luxray
    Budew
    Roserade
    Cranidos
    Rampardos
    Shieldon
    Bastiodon
    Burmy
    Wormadam
    Mothim
    Combee
    Vespiquen
    Pachirisu
    Buizel
    Floatzel
    Cherubi
    Cherrim
    Shellos
    Gastrodon
    Ambipom
    Drifloon
    Drifblim
    Buneary
    Lopunny
    Mismagius
    Honchkrow
    Glameow
    Purugly
    Chingling
    Stunky
    Skuntank
    Bronzor
    Bronzong
    Bonsly
    Mime Jr.
    Happiny
    Chatot
    Spiritomb
    Gible
    Gabite
    Garchomp
    Munchlax
    Riolu
    Lucario
    Hippopotas
    Hippowdon
    Skorupi
    Drapion
    Croagunk
    Toxicroak
    Carnivine
    Finneon
    Lumineon
    Mantyke
    Snover
    Abomasnow
    Weavile
    Magnezone
    Lickilicky
    Rhyperior
    Tangrowth
    Electivire
    Magmortar
    Togekiss
    Yanmega
    Leafeon
    Glaceon
    Gliscor
    Mamoswine
    Porygon-Z
    Gallade
    Probopass
    Dusknoir
    Froslass
    Rotom
    Uxie
    Mesprit
    Azelf
    Dialga
    Palkia
    Heatran
    Regigigas
    Giratina
    Cresselia
    Phione
    Manaphy
    Darkrai
    Shaymin
    ArceusThat is just a list of Pokemon so the User can easily select which Pokemon they want to be in each PokeBall.
    _______________

    Now, let's begin coding. Step 3:
    Ok. After reading the basic I'm sure you'll know what this line of code does.

    Code:
    Dim LoadedROM As StringFor those of you who 'forgot' what that line does I shall explain, in very little detail. That line basicly just enabled you to use the Variant "ROMLocation" to store the location of the ROM you let the User select.

    Alright, so put that code at the very start of your Code. That way you can use it all through-out the current Form.
    _______________

    Making and decoding the 'Open' Button. Step 4:
    Ok, in the 'View Object' Mode, double click your Open Button. Now, you should get something that looks like this in your code window:
    Code:
    Private Sub cmdOpen_Click()

    End SubWhat we want to do inside there is make the actual 'Open Dialog', and allow the User to choose which ROM they would like to edit. So... In the blank space there put the following code.
    Code:
    Dim cdgOpen As clsCommonDialog
    Set cdgOpen = New clsCommonDialog
    LoadedROM = cdgOpen.ShowOpen(Me.hwnd, "Open Pokemon NDS ROM...", , "NDS ROMs (*.nds)|*.nds")
    cmbPoke1.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855304, 2)))
    cmbPoke2.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855308, 2)))
    cmbPoke3.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855312, 2)))In the spoiler I will explain what each line does in as much detail as I can be bothered.
    Content hidden:
    Click here to view.
    Code:
    Dim cdgOpen As clsCommonDialogThat line just makes a new Variant called "cdgOpen" and will let you set it as a CommonDialog Control.


    Code:
    Set cdgOpen = New clsCommonDialogAlirght, that part let's you "Set" the cdgOpen Variant to be the same use as a Normal CommonDialog Control, well mostly anyway.


    Code:
    LoadedROM = cdgOpen.ShowOpen(Me.hwnd, "Open Pokemon NDS ROM...", , "NDS ROMs (*.nds)|*.nds")Now... That line is probably the most important so far. It actually shows the Open Dialog, and set's the "LoadedROM" Variant to the returned String. (I'll try and dim that sentence down a bit tomorrow, when I'm not so tired.)


    Code:
    cmbPoke1.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855304, 2)))Ok, this may very well be the most important HEX Editing you will ever learn. Infact, we have to break this down a little more to completely understand some of the functions...

    Quote:
    Code:
    CInt() is a function that is used to convert a HEX String into an Integer. You ALWAYS have to have a "&H" before the actual HEX number, otherwise it will return errors. Very annoying errors. :(Code:
    ReverseHEX() is a Function made by yours truely. It is helpful in ROM Hacking due to the fact it will automaticly flip any HEX String you give it. This is good because data like Pokemon Numbers, Item Numbers and Offsets can be stored as Reversed HEX Numbers.Code:
    ReadHEX() is another Function made by me which is used to read specific Hexadecimal Data from a ROM, or another File. This is the most important HEX Editing Function you will ever come across. You will almost always need this in making a ROM Hacking Tool.Ok... So, basically we have gone through all the Functions there and now we just need to get them to work.

    Code:
    cmbPoke2.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855308, 2)))As above.

    Code:
    cmbPoke3.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855312, 2)))As above.

    _______________

    How to make a 'Save' Button. Step 5:
    Ok, we are nearly there. We just have to make this Save Button, then we are basically finished.

    Once again go into 'Design Mode' and double click your Save Button. You should get some code that looks like this:
    Code:
    Private Sub cmdSave_Click()

    End SubWhat we want to do is add some code in there and to write the Data from the Combo Boxes to the ROM.

    Ok... So, in the blank area there, put this code in.
    Code:
    WriteHEX LoadedROM, 2855304, ReverseHEX(Right("0000" & Hex(cmbPoke1.ListIndex), 4))What that code does is, it writes the data back into the ROM as the Flipped HEX String. But ofcourse, I will go into detail about what each Function does.
    Content hidden:
    Click here to view.
    Code:
    WriteHEX() is yet another Function made by me which is used to save data into a Files Binary Data (aka it saves the HEX), this is incredibly helpful for any programmer who is in the HEX Editing Industry. :PCode:
    ReverseHEX() was explained before. Read up for more details.Code:
    Right() is a function used to right a string from the right for a certain amount of characters. For example Right("Darth Is Cool", 7) would return the String "Is Cool". This is great for fixing up the length of a string, so it is never too long. :)Code:
    Hex() is a another VB6 Function used to convert an Integer(Number) to a Hexadecimal Number. Example: Hex(99) would return "63", because 99 as an integer = 63 as Hex. Smile
    Woot! Nearly finished now... All you have to do is add the other 2 ComboBoxes, with the fixed offsets to write to and you are done. I'll let you do that, to see if you've learned anything.
    _______________

    Pretty your program up a little. Step 6:
    All you got to do here is make your program look nice, add some picture or something. Just something to make it look original, and to help make using your tool more enjoyable.
    _______________

    FINISHED!. Step 7:
    Finally, you are done. Your code should now look like this:
    Code:
    Dim LoadedROM As String

    Private Sub cmdOpen_Click()
    Dim cdgOpen As clsCommonDialog
    Set cdgOpen = New clsCommonDialog
    LoadedROM = cdgOpen.ShowOpen(Me.hwnd, "Open Pokemon NDS ROM...", , "NDS ROMs (*.nds)|*.nds")
    cmbPoke1.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855304, 2)))
    cmbPoke2.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855308, 2)))
    cmbPoke3.ListIndex = CInt("&H" & ReverseHEX(ReadHEX(LoadedROM, 2855312, 2)))
    End Sub

    Private Sub cmdSave_Click()
    WriteHEX LoadedROM, 2855304, ReverseHEX(Right("0000" & Hex(cmbPoke1.ListIndex), 4))
    WriteHEX LoadedROM, 2855308, ReverseHEX(Right("0000" & Hex(cmbPoke2.ListIndex), 4))
    WriteHEX LoadedROM, 2855312, ReverseHEX(Right("0000" & Hex(cmbPoke3.ListIndex), 4))
    End SubIf it doesn't look something like that, you didn't follow my guise properly. Just try again and read carefully. Good luck making some cool Pokemon Hacking Tools!

      Current date/time is Wed Nov 20, 2024 8:28 am