Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » 'magic' entry for stars! files (aka 'starsfile' for unix :-))
'magic' entry for stars! files (aka 'starsfile' for unix :-)) Sat, 08 April 2006 14:17 Go to next message
wumpus

 
Master Chief Petty Officer
Stars! V.I.P
Created tools and utilities to help the Stars! community
Past Weekly Puzzle Master

Messages: 114
Registered: September 2004
I just re-discovered that some time in the dark and dingy past, I'd spent an afternoon learning how to configure the "magic" file for the 'file' command in unix to recognise stars! files and print some of the basic game information.

Probably pretty useless, but hey, maybe someone wants it, so here goes:

0       leshort 0x2010         
>2      string  J3J3    Stars! 
                               
# Version number, an leshort at offset 10
>>10    leshort 0x1281  1.10a, 
>>10    leshort 0x2A2B  2.6/7i?,
>>10    leshort 0x2A60  2.6/7jrc3,
                               
# Unknown version              
>>10    leshort <0x1281 Unknown version %04X,
>>10    leshort >0x1281        
>>>10   leshort <0x2A2B Unknown version %04X,
>>10    leshort >0x2A2B
>>>10   leshort <0x2A60 Unknown version %04X,
>>10    leshort >0x2A60 Unknown version %04X,

>>6     lelong  x       Game id 0x%X,
>>12    leshort x       Turn %d,

# Flags, an leshort at offset 16
>>16    leshort&0x0007  0x0000  xy file,
>>16    leshort&0x0007  0x0001  x file,
>>>16   leshort&0x0100  0x0100  (save&submit),
>>>16   leshort&0x0100  0x0000  (save only),
>>16    leshort&0x0007  0x0002  hst file,
>>16    leshort&0x0007  0x0003  m file,
>>16    leshort&0x0007  0x0004  h file,
>>16    leshort&0x0007  0x0005  r file,
>>16    leshort&0x0007  0x0006  Unknown type %x,
>>16    leshort&0x0007  0x0007  Unknown type %x,

>>16    leshort&0x0400  0x0400  Mutliple turns,
>>16    uleshort&0xFBF8 >0      (Unknown flags 0x%04X)

# Player number and salt, leshort at offset 14
>>14    leshort&0x000F  x       Player %d,


I'll probably put this on Sourceforge or something - improvements definitely welcome Razz I suspect the "magic" formatting is pretty godawful for a start... it was my first and thus far only attempt at writing a "magic" recipe Razz


Yay for random obscure stuff found on the hard drive (actually I knew I had done this once upon a time, but had believed it to be lost in one of my semi-regular hard-drive nukings Very Happy).



Michael "Wumpus" Zinn
» Apply magic glue here «

Report message to a moderator

Re: 'magic' entry for stars! files (aka 'starsfile' for unix :-)) Sat, 08 April 2006 15:46 Go to previous message
wumpus

 
Master Chief Petty Officer
Stars! V.I.P
Created tools and utilities to help the Stars! community
Past Weekly Puzzle Master

Messages: 114
Registered: September 2004
Ok, after chatting with a couple of people on IRC, I gather this is even more obscure than I took it for Smile

"file" is a neat little program that is installed by default on most unix (and linux) systems that identifies what kind of stuff is in any given file - beyond "it's a GIF file" or whatever, it will often tell you thinks like the image dimensions etc. Essentially a really basic file identifier, and a lot more reliable (and detailed) then just looking at the file extension.

"file" recognises files using a set of rules defined in a configuration file called "magic"... there's generally one that comes with the distribution stored somewhere in /usr/share (/usr/share/file/magic in my case), and another one to store system-local changes - locate in /etc/magic in my case (your distribution may vary).

If you whack that bunch of quoted text above into your /etc/magic or equivalent thereof ("man file", section FILES, should tell you where your local configuration file is stored), then 'file' will now know about stars! files and tell you a bit about them.

For example:
****@bregalad 21:42:36 ~ $ file gath.m4
gath.m4: Stars! 2.6/7jrc3, Game id 0x5ED866, Turn 64, m file, Mutliple turns, (Unknown flags 0x2000) Player 3,

(The "Player 3" is not a mistake - it's an artifact of the fact that Stars! counts from 0-15 for player numbers, but displays it as 1-16. I would have liked to be able to add 1 before displaying the player number, but don't know how to do this in a magic recipe... anyone?)

EDIT: Typos


[Updated on: Sat, 08 April 2006 15:48]




Michael "Wumpus" Zinn
» Apply magic glue here «

Report message to a moderator

Previous Topic: M-File splitter, thanks to m.a@stars harassment :-)
Next Topic: A new bug? Ramscoop refusing to coast at free warp.
Goto Forum:
  


Current Time: Fri May 03 17:23:37 EDT 2024