Jump to content


Photo

My first editor


  • Please log in to reply
7 replies to this topic

#1 yoni0505

yoni0505

    Squaddie

  • Forum Members
  • PipPip
  • 3 posts

Posted 25 July 2009 - 08:12 AM

hi guys
im new at programming and i've made my first x-com: ufo defense elerium-155 editor, saved game editor.
it can edit the amount of elerium you got,simply by enetering the amount you want.

pic:
Posted Image
link:
http://yoni0505.blog...um-155-v11.html

maybe later ill make a bigger editor, i still got some stuff to learn before i can...

#2 Zombie

Zombie

    Colonel

  • Xenocide Creative-Text Departmen
  • 2,947 posts

Posted 25 July 2009 - 05:17 PM

Nice job yoni! :)

- Zombie
The Mr. Grognard of X-COM

Zombie: Empirical data's your only man, when formulating a research plan.
A soldier's death is never in vain if it makes the formula more plain.
A few dozen make a better case for refining that third decimal place.
They call me Zombie because I don't sleep, as I slowly struggle to climb this heap,
of corpses, data points, and trials, but from the top - I'll see for miles!


#3 yoni0505

yoni0505

    Squaddie

  • Forum Members
  • PipPip
  • 3 posts

Posted 25 July 2009 - 11:39 PM

thanks zombie!
im working on some more projects, hopefully i'll have time to learn more and finish them, when i will, i'll have enough knowledge to edit all the other stuff...
right now im missing how to read 2 bytes as one integer... noob me :D

#4 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 26 July 2009 - 01:08 AM

What are you using to write your program?

You can easily convert two bytes into a short integer no trouble. The trick to remember is that binary files store their data in little endien format. Or rather, data is stored backwards. If we had an integer with the value 3000, its value in hexadecimal will be 0x0BB8. Since each pair of hexadecimal numbers equate to a single byte, our two bytes will be 0x0B and 0xB8 respectively. The first we call the high end byte, while the second is the low end byte.

The computer however stores it in reverse as 0xB8 and then 0x0B with the low end byte first then the high end byte. To manually convert these two bytes back into its original value, use this formula:

Low end byte + (high end byte * 256)

In this example, 0xB8 is worth 184 in decimal while 0x0B is 11. So 184 + (11 * 256) = 184 + 2816 = 3000.

Seriously though, this is the hard way to do it. There are definitely easier methods to go about it!

- NKF
Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#5 yoni0505

yoni0505

    Squaddie

  • Forum Members
  • PipPip
  • 3 posts

Posted 26 July 2009 - 04:26 AM

wow, thanks NKF! i didnt knew that!
so now i can finally read 2 bytes into an integer!

oh and i write the program with C++

Edited by yoni0505, 26 July 2009 - 04:28 AM.


#6 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 26 July 2009 - 07:07 AM

C++ eh? I just figured out how to load tables from a binary file recently myself (the soldier.dat file in particular). That involved reading an entire class worth of records in at a time. Perhaps something similar might be useful in your case?

- NKF
Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1

#7 yoni0505

yoni0505

    Squaddie

  • Forum Members
  • PipPip
  • 3 posts

Posted 26 July 2009 - 08:08 AM

i still dunno what tables means XD
if you will explain it i might know if i need it :O
oh and so far it seems i got all the "tools" i need to edit everything :D, right now im working on weapon editor, its funny cause everything is text, so far it reads almost everything, later ill add editing ;)

i had to upload a pic XD
Posted Image

#8 NKF

NKF

    Commander

  • [Global Moderators]
  • PipPipPipPipPipPip
  • 4,798 posts

Posted 26 July 2009 - 11:49 PM

What I meant by table was a table of information. Basically an array (or linked list, STL container, whatever you are using) of classes/structs that contain all the information for each item entry in a file. Like the internal name, stats, etc of each item in obdata.dat. You can visualize the data as though it's stored in a spreadsheet.

Files like obdata.dat store all their information in a tabular form anyway, so you can easily grab whole rows of data at a time and put them into an array/linked list/STL container/etc. It would be certainly be faster than grabbing individual bytes and recombining them.

- NKF

Edited by NKF, 26 July 2009 - 11:51 PM.

Lord High Generalissimo Ruler Supreme of Norm's Anti Pedant Society (NAPS).

Number of members: 1