CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011
    Posts
    1

    I need help with a way to have Hex based templates > modifiable in ASCII > export Hex

    Okay, I know only the very basics of VB, so bare with me please. I'm not here begging for others to do the work for me, but it would be fantastic if some of you could point me in the right directions. I'm a graphics guy, so this is fairly new territory for me.

    I've been modifying a game (Star Wars Galaxies and yes, it's legal) over the past few years and in the recent days, after looking at terrain files, I've figured out a way frankenstein a really simple 'ghetto' terrain builder. The only problem, even though I know exactly what I need, I'm not sure how to exactly do it in VB.

    To cut a long story short, this is what I'd like to do:

    The game .trn files I can edit right now manually with a hex editor and an .iff file type editor that can display the contents of the .trn in a .iff like FORM/chunk node structure. The contents are displayed as hex.

    Here are 2 examples of the two:

    In a hex editor: http://i.imgur.com/SreJTj9.png
    In the .iff type editor: http://i.imgur.com/xqhX109.png

    Basically the terrain is generated in a procedural way (url=http://www.google.com/patents/US20050264567]Patent about it, if anyone is curious[/url]), so really in the end, it's a bunch of the same file structures used over and over again, slightly modified depending on what it does, Boundary chunk structures for example have a DATA chunk that stores coordinates.

    Now, here is the part I need to be able to create. I want to create a fairly simple program, where I can save these 'templates' in for each specific chunk structure (Shader Filter, Flora Constant, Boundary Constant, etc, but they all have the identical structure with a different DATA chunk and 2 of the FORM's are different), which I can pull from a drop down menu, that then lets me modify a couple of the key values, (like if you look in the hex editor screenshot, after the DATA chunk, you have 00 00 00 14 and then a 0D, which is 13, which is the flora ID) in a textbox as a regular decimal number, so instead of having to enter the correct hex value, if I wanted to change 0D, I'd type in 12, instead of 0C. There are also a couple of float values (that are in reverse, inside the file) that I would also want to have a modifier for.

    After I'd be done editing the template, I'd be able to export it either directly at the end of the .trn, or simply a new file where I can copy the hex values from and add them in manually.

    I hope this isn't too confusing and it is doable.

    Basically summarize it shortly: Have a set of stored templates that I pulled from the hex values inside of my .trn inside of the program, be able to select a template, have modifiers for specific locations of the template, be able to export it as copyable hex values.



    Could you guys point me in the right directions for something like this? I wouldn't ask if I wasn't under time pressure, I got a project coming up unrelated to this and wouldn't be able to do this/learn VB fully for a couple of months.



    A more advanced version of that, would be to have a treeview of the chunk structures that you've created from the templates in the side, that let you rearrange the nodes, like in the .iff like editor in the screenshot.

    Thanks so much in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: I need help with a way to have Hex based templates > modifiable in ASCII > export

    You would have to know the format for each type that you want to use. Then, a Hex to Decimal Function can be used to create one byte at a time (or multiples). It wouldn't really be that hard. Take a look at some of the VB.Net Samples
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured