don't click here

How to write your first hacking program...

Discussion in 'Engineering & Reverse Engineering' started by Lostgame, Aug 5, 2005.

  1. Lostgame

    Lostgame

    producer/turnablist. homebrew dev. cosplayer. Oldbie
    4,134
    58
    28
    Toronto, ON
    The O.I.C.
    Alright, by request, I'm making a tutorial on how to write your own hacking program, just to change a simple value, in Visual Basic 6.0.

    This might work on previous/newer versions of VB, but I don't have, so I can't check.

    What you'll need?

    1)Microsoft Visual Basic 6.0
    2)An UNMODIFIED Sonic 3D Blast ROM. (Don't try this with a hack, eh?)
    3)A knowledge of how hex works. A good knowledge.
    4)A scientific calculator capable of conversion between hex and decimal (Windows calc. works just fine.)
    5)A basic knowledge of Visual Basic will definitely help.

    Ready?

    Start a "New Standard EXE Project."

    Make the form a decent size, it doesn't matter how big, really.

    Make a button on the form called "btnOpenROM". It needs to be called this (without the quotation marks) so we can refer to it later in code. It's caption/size/color/etc. doesn't matter. It can say "Die!" for all I care.

    Now-a very important step before you put any code in-go to the toolbar. Right-click and add the "Microsoft Common Dialog Control 6.0". Then, you'll see a new button on the toolbar, and create one of those objects in the form, naming it "cdlROM".

    Now let's add some code.

    Double click on the form, and it will open up a "code" window.

    Type in the following. It will not function yet.

    Code (Text):
    1. ROMsize = 0
    2. Set gcdg = cdlROM
    Now, in General Declarations, (you can select this at the top, it might take a little fooling around) type the following code.

    Code (Text):
    1. Option Explicit
    2.  
    3. Dim gcdg As Object
    4. Dim ROMname As String
    5. Dim ROMsize As Long
    6. Dim offSetPos As String
    This is declaring the variables we'll use later. You can already see that we've given ROMsize a value of zero. Obviously, this is because there is no ROM loaded.

    Before we do anything else, I want to make a blank label called "Label1". Make sure it's visible and a decent size.

    Now, let's get onto that button.

    In the code for the button, type the following...

    Code (Text):
    1. Dim ROM
    2. Dim name As String
    3. Dim hitcount As String
    4. Dim location As Long
    5.  
    6. ROM = FreeFile
    7.   With cdlROM
    8.     .Filter = "Binary extension files|*.bin|SMD extention files|*.smd|All Files|*.*"
    9.     .FilterIndex = 1
    10.     .ShowOpen
    11.     If LenB(.FileName) Then
    12.     ROMname = (.FileName)
    13.     Open gcdg.FileName For Binary As #ROM
    14.     
    15.     ROMsize = LOF(ROM)
    16.  
    17.     If Not ROMsize = "4194304" Then
    18.     MsgBox ("Um, this isn't a Sonic 3D Blast ROM, or you patched some stuff on the end of it that makes it the wrong size. Just warning you, it MAY NOT WORK.")
    19.     End If
    20.     End If
    21.  
    22.     
    23.     Seek #ROM, (56763 + 1)
    24.     Get #ROM, (56763 + 1), hitcount
    25.     hitcount = Input(1, 1)
    26.     Label1.Caption = hitcount
    27.     
    28.   End With
    ...and that makes you read the hit count of the boss for Green Grove Zone in Sonic 3D Blast, unfourtunately in ASCII format.

    If there's any demand, I'll give a tutorial for converting between ASCII and Hex, or Decimal, and how to save. I figured this would get people going, at least.

    If you want the tutorial in a little zip file, here it is.

    Comments are appreciated!

    END OF STEP 1, STEP 2 COMING SOON.
     
  2. Travelsonic

    Travelsonic

    Member
    822
    17
    18
    Wow...

    Good job.

    Might want to fix this though:

    and then


    If you are hacking Sonic 3D blast, then Sonic 2 isn't really needed now is it?
     
  3. redhotsonic

    redhotsonic

    Also known as RHS Tech Member
    1,587
    10
    18
    United Kingdom
    YouTuber
    If you're making a utility for Sonic 2, then get a unmodified Sonic2 rom. If you're gonna make a utility for Sonic3D, then you use the Sonic3D rom. That is what lostgame means I beleive.
     
  4. Lostgame

    Lostgame

    producer/turnablist. homebrew dev. cosplayer. Oldbie
    4,134
    58
    28
    Toronto, ON
    The O.I.C.
    Fixed it, sorry. ^_^
     
  5. Heran Bago

    Heran Bago

    Ah! It's Puyo battle then. Tech Member
    Hah! I made that program.
    It'd be awesome if you continued this, I know I'm learning stuff.
     
  6. VGMusicMaster

    VGMusicMaster

    Member
    60
    0
    0
    Oh, this is great! (Considering I'm into this kinda thing. My friend has been teaching me VB, so this is a great new thing for me to learn!)

    Awesome, man.
     
  7. Lostgame

    Lostgame

    producer/turnablist. homebrew dev. cosplayer. Oldbie
    4,134
    58
    28
    Toronto, ON
    The O.I.C.
    ^_^ Glad I could help. I know at least one person who is using the stuff here for a project, so even just that makes it worthwhile.