Sonic and Sega Retro Message Board: How to write your first hacking program... - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

How to write your first hacking program... in VB.

#1 User is offline Lostgame 

Posted 05 August 2005 - 12:07 PM

  • 'There are feathers everywhere, but it's fine...'
  • Posts: 3996
  • Joined: 02-December 03
  • Gender:Male
  • Location:Toronto, ON
  • Project:the love orchestra
  • Wiki edits:2
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.

ROMsize = 0
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.

Option Explicit

Dim gcdg As Object
Dim ROMname As String
Dim ROMsize As Long
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...

Dim ROM
Dim name As String
Dim hitcount As String
Dim location As Long

ROM = FreeFile
  With cdlROM
    .Filter = "Binary extension files|*.bin|SMD extention files|*.smd|All Files|*.*"
    .FilterIndex = 1
    .ShowOpen
    If LenB(.FileName) Then
    ROMname = (.FileName)
    Open gcdg.FileName For Binary As #ROM
    
    ROMsize = LOF(ROM)

    If Not ROMsize = "4194304" Then
    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.")
    End If
    End If

    
    Seek #ROM, (56763 + 1)
    Get #ROM, (56763 + 1), hitcount
    hitcount = Input(1, 1)
    Label1.Caption = hitcount
    
  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.
This post has been edited by lostgame: 05 August 2005 - 05:38 PM

#2 User is offline Travelsonic 

Posted 05 August 2005 - 01:22 PM

  • Posts: 701
  • Joined: 01-March 05
Wow...

Good job.

Might want to fix this though:

Quote

2)An UNMODIFIED Sonic 2 ROM. (Don't try this with Sonic 2 Delta, eh?)


and then

Quote

...and that makes you read the hit count of the boss for Green Grove Zone in Sonic 3D Blast, unfourtunately in ASCII format.



If you are hacking Sonic 3D blast, then Sonic 2 isn't really needed now is it?
This post has been edited by Travelsonic: 05 August 2005 - 01:41 PM

#3 User is offline redhotsonic 

Posted 05 August 2005 - 01:58 PM

  • Also known as RHS
  • Posts: 1528
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic Bash!
  • Wiki edits:24
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 User is offline Lostgame 

Posted 05 August 2005 - 02:04 PM

  • 'There are feathers everywhere, but it's fine...'
  • Posts: 3996
  • Joined: 02-December 03
  • Gender:Male
  • Location:Toronto, ON
  • Project:the love orchestra
  • Wiki edits:2
Fixed it, sorry. ^_^

#5 User is offline Heran Bago 

Posted 05 August 2005 - 06:07 PM

  • Ah! It's Puyo battle then.
  • Posts: 2949
  • Joined: 11-May 04
  • Gender:Male
  • Location:Foggy California
  • Project:勉強
  • Wiki edits:4
Hah! I made that program.
It'd be awesome if you continued this, I know I'm learning stuff.

#6 User is offline VGMusicMaster 

Posted 07 August 2005 - 08:47 AM

  • Posts: 60
  • Joined: 17-July 05
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 User is offline Lostgame 

Posted 07 August 2005 - 10:27 AM

  • 'There are feathers everywhere, but it's fine...'
  • Posts: 3996
  • Joined: 02-December 03
  • Gender:Male
  • Location:Toronto, ON
  • Project:the love orchestra
  • Wiki edits:2

Quote

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.


^_^ 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.

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users