Hexing map

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Hexing map

Post by spikes122 »

hey

ive made alot of apps that run by side a game and edit it(trainers like 3rd person)

but i want to make a app that would hex a map file
so when the user presses a button at ofset 0x00000 it would be 01

jus a example

so where would i start?
i use vb 6
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

do you want to do it during runtime? if so, i dont think that's possible

otherwise, do something like this:

Code: Select all

Dim bw As New IO.BinaryWriter(New IO.FileStream(p, IO.FileMode.Open, IO.FileAccess.Write))
bw.BaseStream.Position = 0 (for dec) or &H0 (for hex) <- the offset at which to write
bw.BaseStream.WriteByte(1) <- the value you write at that byte
bw.close()
correct me if I'm wrong

to get the map path do something like this:

Code: Select all

 Dim map_path As String
Dim ofd As New OpenFileDialog
        ofd.Filter = "Halo Map Files (*.map)|*.map"

        If ofd.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            map_path = ofd.FileName
End If
Thats .net but should be easy to understand
once again im a noob programming so feel free to point out my mistakes
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

Could u explain some more please

Thanks alot
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

Code: Select all

Dim bw As New IO.BinaryWriter(New IO.FileStream(map_path, IO.FileMode.Open, IO.FileAccess.Write))
bw.BaseStream.Position = 0 (for dec) or &H0 (for hex) <- the offset at which to write
bw.BaseStream.WriteByte(1) <- the value you write at that byte
bw.close()
Dim bw As New IO.BinaryWriter(New IO.FileStream(p, IO.FileMode.Open, IO.FileAccess.Write)) is creting a new binary writer object that will open a file at location "map_path" which is a string you'll recieve below.
bw.BaseStream.Position = 0 means that you are setting the binary writer to a position at the offset 0. You can also use &H0 for hex offsets.
bw.BaseStream.WriteByte(1) This writes a value of 1 to the position you are at. writing 255 would put FF at that byte, and writing 1 would put 01.
bw.close() that's just a good idea to do when done with the binary writer


now this opens the map and recieves its location map_path

Code: Select all

 Dim map_path As String
Dim ofd As New OpenFileDialog
        ofd.Filter = "Halo Map Files (*.map)|*.map"

        If ofd.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            map_path = ofd.FileName
End If
[/quote]

First you create your map_path string variable
Then You create an Open File Dialog, naming it ofd
Then you set it's filter to only view/open halo maps

Then, you show the dialog, and say that if it doesn't return cancel, then set map_path to equal the location of the file you opened. That's it. So as practice instead of writing at offset 0, try writing at bytes 4 and 5, and make a simple ce/pc header converter.

to CE:

Code: Select all

bw.BaseStream.Seek(&H4, SeekOrigin.Begin)
bw.Write(&H61)
bw.BaseStream.Seek(&H5, SeekOrigin.Begin)
bw.Write(&H2)
^^^please critique my post if necessary
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

ok thanks alot im starting to get it

i can do the opening map file

but when i try and do ur example
bw.BaseStream.Seek(&H4, SeekOrigin.Begin)
bw.Write(&H61)
bw.BaseStream.Seek(&H5, SeekOrigin.Begin)
bw.Write(&H2)
i get lots of delcarations errors

Ive always used vb mostly for mem edit

but if u could help me do this ill be very grateful

thanks patrickH
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

spikes122 wrote:ok thanks alot im starting to get it

i can do the opening map file

but when i try and do ur example
bw.BaseStream.Seek(&H4, SeekOrigin.Begin)
bw.Write(&H61)
bw.BaseStream.Seek(&H5, SeekOrigin.Begin)
bw.Write(&H2)
i get lots of delcarations errors

Ive always used vb mostly for mem edit

but if u could help me do this ill be very grateful

thanks patrickH
did you declare the binary writer?

Dim bw As New IO.BinaryWriter(New IO.FileStream(map_path, IO.FileMode.Open, IO.FileAccess.Write))
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

yes i still need help with this
ur never on xfire lol
Post Reply