yoni0505 Posted July 25, 2009 Share Posted July 25, 2009 hi guysim 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:http://i204.photobucket.com/albums/bb106/yoni0593/Elerium-115editorpic-2.jpglink:http://yoni0505.blogspot.com/2009/07/x-com...um-155-v11.html maybe later ill make a bigger editor, i still got some stuff to learn before i can... Link to comment Share on other sites More sharing options...
Zombie Posted July 25, 2009 Share Posted July 25, 2009 Nice job yoni! - Zombie Link to comment Share on other sites More sharing options...
yoni0505 Posted July 26, 2009 Author Share Posted July 26, 2009 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 Link to comment Share on other sites More sharing options...
[NKF] Posted July 26, 2009 Share Posted July 26, 2009 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 Link to comment Share on other sites More sharing options...
yoni0505 Posted July 26, 2009 Author Share Posted July 26, 2009 (edited) 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 July 26, 2009 by yoni0505 Link to comment Share on other sites More sharing options...
[NKF] Posted July 26, 2009 Share Posted July 26, 2009 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 Link to comment Share on other sites More sharing options...
yoni0505 Posted July 26, 2009 Author Share Posted July 26, 2009 i still dunno what tables means XDif you will explain it i might know if i need it :Ooh and so far it seems i got all the "tools" i need to edit everything , 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 XDhttp://i204.photobucket.com/albums/bb106/yoni0593/weaponeditordemo.jpg Link to comment Share on other sites More sharing options...
[NKF] Posted July 27, 2009 Share Posted July 27, 2009 (edited) 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 July 27, 2009 by NKF Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now