Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Extensions » xy modification after game has started
Re: xy modification after game has started Sat, 19 July 2014 02:18 Go to previous messageGo to previous message
raptor is currently offline raptor

 
Chief Warrant Officer 1
Creator of StarsWine
Created StarsWine

Messages: 138
Registered: June 2014
I think I have settled on an optimal way of reading the byte stream. The data I'm after usually comes in 1, 2, or 4 byte chunks (before bit-twiddling to get higher packed data points). Here are the rules I follow:

1. If a single byte, read the byte
2. If two bytes, read them in swapped (little-endian)
3. If four bytes, read them in swapped

You can see how I implement it here:

https://github.com/raptor/stars/blob/master/python/decryptor .py#L253

So basically, instead of bonkers structures that are parsed directly from the byte stream, without swapping, that look like this:

XXXXXXXX YYYYYYXX NNYYYYYY NNNNNNNN

(This is a 4 byte planet chunk from the XY file)

X = X coordinate offset
Y = Y coordinate
N = Planet Name ID

The byte stream now looks like this:

NNNNNNNN NNYYYYYY YYYYYYXX XXXXXXXX

Everything lines up! This makes the decoding code much simpler and easier to follow.

On another note - I find I'm enjoying writing python,so I'm not sure I'll continue with the Java. Also, my time is very limited and porting code like this from decompiled C# is slow-going. Honestly, it's slightly demoralizing that there is source code out there that has most of my work done already, but it was never released (XyliGUN's tools in particular interest me, but they were not written in a language that's easily decompilable).

I encourage anyone who wants to add to my work by either forking the project in github or even sending me other code to merge. Smile

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: NSA Helping to Decompile Stars!?
Next Topic: Utility to clean .m files
Goto Forum:
  


Current Time: Sun Apr 28 01:24:54 EDT 2024