RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    How are .fs files created?

    Scheduled Pinned Locked Moved Help and Support
    highscoresfs file
    7 Posts 3 Posters 869 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      r3dstar
      last edited by r3dstar

      Hi all,

      I've been working on a Python GameList generator and I've been reading in .hi and .nv files to create high score information in each game's description for my ES theme. I've had reasonable success so far https://r3dstar.co.uk/ .I've been trying to figure out .fs files and through a single post on one site I found it looks like the file is compressed, with the compressed data starting from byte 76.
      c6646dc4-09ee-46dd-8239-379f70555e2a-image.png
      The byte in yellow is the length of the data and the block within borders is the compressed data. The blue bytes is ccastles in ASCII.

      In Python I've extracted the bytes in the range and decompressed using zlib.

      
      filepath = 'Z:/roms/arcade/fbneo/ccastles.fs'
      file = open(filepath,"rb") 
      bArray = file.read() 
      dataLength = bArray[24]
      decompressed = zlib.decompress(bArray[76:76+dataLength])
      print(decompressed)
      f = open("Z:/roms/arcade/fbneo/ccastles.txt","wb",) 
      f.write(bytearray(decompressed)) 
      f.close() 
      

      What I've ended up with are bytes I can't identify a high score in. It's as if the decompression has messed something up. I should be able to see a highscore for Crystal Castles of
      33822 DAZ.

      db3a0dc9-2fc6-4c81-b682-892f34270c5b-image.png
      Any ideas where I'm going wrong?

      B 1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by

        Why not look in the source ?

        R 1 Reply Last reply Reply Quote 0
        • R
          r3dstar @mitu
          last edited by

          @mitu Thanks for the link. I did start to look into the source code but couldn't find the script that dealt with this specific point. Not a C++ person so this is giving me a good reason to get my head around this before I start a summer project in Unreal Engine 5.
          Even having a quick look, .fs = Full Scan! So it includes more than just scores which is good to know.

          1 Reply Last reply Reply Quote 0
          • B
            barbudreadmon @r3dstar
            last edited by

            @r3dstar said in How are .fs files created?:

            It's as if the decompression has messed something up. I should be able to see a highscore for Crystal Castles of
            33822 DAZ

            does it work using mame cores ? mame uses uncompressed nvrams, so if it doesn't appear there either, i guess that would mean that data is encrypted and not something you can easily extract.

            FBNeo developer - github - forum

            R 1 Reply Last reply Reply Quote 0
            • R
              r3dstar @barbudreadmon
              last edited by

              @barbudreadmon Not sure, I'll try later. fbneo does also create .nv and .hi files, but for some Atari games, a .fs file is created. Tempest, Gauntlet and Crystal Castles all kicked out a .fs file

              B 1 Reply Last reply Reply Quote 0
              • B
                barbudreadmon @r3dstar
                last edited by barbudreadmon

                @r3dstar nv files are handled by an eeprom device which i think is saving the bytes sequentially (which might make them more readable in some way, assuming that eeprom is not encrypted), while fs are a direct memcpy of a memory pointer, meaning they are probably endianized in some way (could be big or little depending on the emulated board). Normaly those fs files only contain the required memory pointers, in the case of ccastles it would be the 2 eerom pointers associated with the 2 x2212 chips of that board.

                FBNeo developer - github - forum

                R 1 Reply Last reply Reply Quote 0
                • R
                  r3dstar @barbudreadmon
                  last edited by r3dstar

                  @barbudreadmon Interesting. Following from earlier, I've just switched to mame2003 and it kicked out a .nv which I've opened and I've been able to identify the first three scores 32199, 30000 and 30000.
                  bb39eeb6-d385-45a1-b04a-af38d1f37740-image.png
                  The daft thing is, the bytes look very similar to the decompressed bytes I got from the .fs file, if I took half the preceding zeros off. I think I was nearly there. Here's the decompressed bytes from the fbeno .fs file on the left and the .nv file from mame2003 on the right
                  3f3fbcba-b6ca-4a41-82e5-b2ca80cdf1b3-image.png
                  Rather enjoying this, but this image keeps popping into my head.
                  544926ae-fa15-4687-901e-2123f8706994-image.png

                  /////////////////////EDIT///////////////////

                  Re: How are .fs files created?

                  OK, so I've nailed the .nv that mame2003 created, but going to try and nail how the data I've decompressed form the .fs file is structured... so close I can taste it.

                  b54e7b77-4938-4a07-99bf-d0b55a7d985b-image.png

                  	<game>
                  		<name>118 : Crystal Castles</name>
                  		<video>/mnt/usbhd/videos/ccastles.mp4</video>
                  		<path>/mnt/usbhd/roms/arcade\ccastles.zip</path>
                  		<image>/mnt/usbhd/images/arcade\ccastles.png</image>
                  		<marquee>~/.emulationstation/themes/carbon-2022/art/systems/arcade.svg</marquee>
                  		<releasedate>19700101T001720</releasedate>
                  		<favorite>true</favorite>
                  		<desc>Crystal Castles
                  (Atari, 1983)
                  Arcade
                  DAZ  32199
                  FXL  30000
                  FXL  30000
                  </desc>
                  	</game>
                  
                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post

                  Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                  Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.