Difference between revisions of "Save File Format"

From Shield Cat Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 9: Line 9:
  
 
[[Shield Cat]] save files are saved using the following structure:
 
[[Shield Cat]] save files are saved using the following structure:
   OTTSAV00.BIN
+
   /saves/OTTSAV00/
 
where <code>00</code> is the number of the save file. The game will support up to 100 save files, but more can be added later if it is necessary.
 
where <code>00</code> is the number of the save file. The game will support up to 100 save files, but more can be added later if it is necessary.
  
<code>OTTSAVFF.BIN</code> is used for the Autosave file. Save slot <code>0</code> is not used.
+
<code>OTTSAVFF</code> is used for the Autosave file. Save slot <code>0</code> is not used.
  
Save information is stored in blocks, where each block has a certain data associated with it. <b>There <u>cannot</u> be two blocks of the same type.</b> All blocks listed below must be present, or the file will be considered invalid. They must also be in the correct spot, or the file will be invalid.
+
Save information is stored in separate blocks, with each block being stored in it's own file. Details on each file are present below, as well as their expected file sizes.
 
 
The save file is expected to be exactly <code>796</code> bytes in size. If it isn't, then it is considered invalid.
 
  
 
In Gamemaker, it is loaded and saved as a Buffer with type <code>buffer_fixed</code>. It is 1 byte aligned.
 
In Gamemaker, it is loaded and saved as a Buffer with type <code>buffer_fixed</code>. It is 1 byte aligned.
Line 27: Line 25:
 
<b>Please Note</b> this is not a string that is to be read with <code>buffer_string</code> or <code>buffer_text</code>. It is instead read as <code>unsigned bytes</code>, and then the bytes are compared to see if the header is correct or not. The value <code>00</code> is actually ASCII, and will be <code>$3030</code>.
 
<b>Please Note</b> this is not a string that is to be read with <code>buffer_string</code> or <code>buffer_text</code>. It is instead read as <code>unsigned bytes</code>, and then the bytes are compared to see if the header is correct or not. The value <code>00</code> is actually ASCII, and will be <code>$3030</code>.
  
The header is followed <i>immediately</i> by time information. This is <code>6 Bytes</code> that represent the time that this file was saved, as well as how long the player has been playing the game. The format for these 6 bytes is below.
+
== Block Type and Info ==
 +
This is where the data for this particular save file will go. Details about what is stored in each file is available on each file's page.
  
{| class="wikitable"
+
Each file is saved separately in the save sub directory, which will look something like this:
!Bytes
+
  * LINF.BIN
!Bits
+
  * FLGS.BIN
!Usage
+
  * TRSR.BIN
|-
+
  * (etc)
!rowspan=3|2 Bytes
 
!4 Bits
 
|Month (1-12, though 16 months are possible there aren't actually that many months in a year.)
 
|-
 
!5 Bits
 
|Day (up to 31 days)
 
|-
 
!7 Bits
 
|Year (since 2019) Allows up to 128 years. If you're from the year 2148 and are having problems with the game, please see [[Config.ini#BaseTime|config.ini's BaseTime option]] to change the base year this value counts from.
 
|-
 
!rowspan=3|4 Bytes
 
!2 Bits
 
|The first two bits are unused.
 
|-
 
!11 Bits
 
|Time that the player saved the file at, in minutes. There are 1440 minutes in a day.
 
|-
 
!19 Bits
 
|Seconds the player has been playing. Allows for 524,287 seconds, but the clock will only go up to 99 hours, 59 minutes, and 59 seconds (this is 360,000 seconds.)
 
|}
 
  
== LINF ==
+
The contents of the <code>LINF.BIN</code> file would be as follows:
The <code>LINF</code> block contains info about Lance and the abilities he has, max health, max magic, attack, defense, abilities equipped, and others. It is <code>65 Bytes</code> in length.
+
  SC_OTTSAV_V00LINF(data here)OEND
  
<i><b>Please note</b> that Lance's health, magic, attack, and defense are computed from his base stats + any upgrades that you may have, and are provided for convenience. If you modify these numbers, and then Lance gets a new upgrade, the numbers will be corrected.</i>
+
Please see the details about each block on its associated page:
 +
* [[Save_File_Format/DATE.BIN]]
 +
* [[Save_File_Format/LINF.BIN]]
 +
* [[Save_File_Format/FLGS.BIN]]
 +
* [[Save_File_Format/TRSR.BIN]]
 +
* [[Save_File_Format/ACHV.BIN]]
 +
* [[Save_File_Format/AREA.BIN]]
 +
* [[Save_File_Format/MAPS.BIN]]
  
{| class="wikitable"
+
== Footer ==
!Offset
+
<code>OTTSAV</code> files end with the following footer:
!Bytes
+
  OEND
!Description
+
This is used to prevent the file from being truncated, which can cause issues.
|-
 
!0
 
!2 Bytes
 
|Lance's max health
 
|-
 
!2
 
!2 Bytes
 
|Lance's max magic
 
|-
 
!4
 
!1 Byte
 
|Lance's attack stat
 
|-
 
!5
 
!1 Byte
 
|Lance's defense stat
 
|-
 
!6
 
!1 Byte (packed)
 
|Various flags about Lance's state:
 
* Bit 0: if Lance is allowed to use his equipment or not. If 0, none of his abilities will show.
 
* Bits 2-3: number of health potions Lance has (up to 3)
 
* Bits 4-5: number of magic recovery potions Lance has (up to 3)
 
* Bit 6: Lance has his notebook to keep track of story progress.
 
* Bit 7: Unused
 
|-
 
!7
 
!1 Byte (packed)
 
|Various flags about the game itself:
 
* Bit 0: If this is a randomized mode save or not. A [[Randomized Mode Remap File]] will be required.
 
* Bits 1-3: Game [[Shield_Cat#Difficulty_Modes|difficulty mode]].
 
** Mode 0: Chill Mode
 
** Mode 1: Regular Mode
 
** Mode 2: Cool Mode
 
** Mode 3: Fun Mode
 
** Mode 4: Custom Mode. A [[Custom Difficulty Data File]] will be required.
 
** Modes 5-7: Unused.
 
* Bit 4: If cheats were enabled on this file or not.
 
* Bit 5: If the game has been cleared or not.
 
* Bits 6-7: Unused.
 
|-
 
!8
 
!4 Bytes
 
|How many Pretty Petals Lance has in his possession.
 
|-
 
!12
 
!2 Bytes
 
|Which save location Lance saved at.
 
|-
 
!14
 
!3 Bytes
 
|Lance's Key Items. Lance can have up to 24 key items.
 
|-
 
!colspan=3|Lance's Active Abilities
 
|-
 
|colspan=3|Removed. Bytes reserved for future use.
 
|-
 
!17
 
!24
 
|Reserved for future use.
 
|-
 
!colspan=3|Passive Abilities
 
|-
 
|colspan=3|The format for Lance's abilities is as follows:
 
* <b>Format 1</b>: Bits 0-2 is how many of the <b>first</b> ability shown is owned, and bit 3 shows if Lance has it equipped or not. Bits 4-6 is how many of the <b>second</b> ability shown is owned, and bit 7 shows if Lance has it equipped or not. He can equip <b>1</b> of the ability, and own up to <b>7</b>.
 
* <b>Format 2</b>: Bits 0-3 shows how many Lance owns, and bits 4-7 shows how many Lance has equipped. He can own and equip up to <b>15</b> of this ability.
 
Lance's Passive abilities can be viewed [[Lance's Abilities#Passive Abilities|here]].
 
|-
 
!41
 
!1 Byte
 
(Format 1)
 
|
 
* Bits 0-3: Lantern.
 
* Bits 4-7: Survivor.
 
|-
 
!42
 
!1 Byte
 
(Format 1)
 
|
 
* Bits 0-3: Healer.
 
* Bits 4-7: Double Magic.
 
|-
 
!43
 
!1 Byte
 
(Format 1)
 
|
 
* Bits 0-3: Triple Magic.
 
* Bits 4-7: Distance Traveller.
 
|-
 
!44
 
!1 Byte
 
(Format 1)
 
|
 
*Bits 0-3: Magic Saver.
 
*Bits 4-7: Flame Tail.
 
|-
 
!45
 
!1 Byte
 
(Format 1)
 
|
 
* Bits 0-3: Infinite Spin
 
* Bits 4-7: Double Ability
 
|-
 
!46
 
!1 Byte
 
(Format 2)
 
|Lucky
 
|-
 
!47
 
!1 Byte
 
(Format 2)
 
|Magic Master
 
|-
 
!48
 
!1 Byte
 
(Format 2)
 
|Attack Up
 
|-
 
!49
 
!1 Byte
 
(Format 2)
 
|Defense Up
 
|-
 
!50
 
!1 Byte
 
(Format 2)
 
|HP Up
 
|-
 
!51
 
!1 Byte
 
(Format 2)
 
|Magic Up
 
|-
 
!52
 
!10 Bytes
 
|Reserved for future use.
 
|-
 
!colspan=3|Upgrades
 
|-
 
|colspan=3|Lance can have up to 255 of each upgrade, although if the amount of upgrades would exceed the amount possible, then the result will be capped.
 
|-
 
!62
 
!1 Byte
 
|Attack Increase
 
|-
 
!63
 
!1 Byte
 
|Defense Increase
 
|-
 
!64
 
!1 Byte
 
|Magic Meter Increase
 
|-
 
!65
 
!1 Byte
 
|Health Increase
 
|-
 
!colspan=3|Story Progress (Quests)
 
|-
 
|colspan=3|Lance keeps track of his progress in a notebook. Each entry supports up to 15 steps in the quest, where a value of 0 means that Lance doesn't know about it (and it won't show up in his notebook) and a value of 15 means the quest is complete. The first 4 bits represent the progress of the first quest, and the last 4 bits represents the progress of the last quest.
 
 
 
<b>Special Note:</b> What each bit will represent will be added in while the game is being developed.
 
|-
 
!66
 
!1 Byte
 
|First 4 bits - [[Roo Express]] ([[Parker]])
 
Last 4 bits - [[Underground Forest]] ([[Suzette]])
 
|-
 
!67
 
!1 Byte
 
|First 4 bits - [[Marine Exhibit]] ([[Ruby]])
 
Last 4 bits - [[Mt. Bophades]] ([[Trent]])
 
|-
 
!68
 
!1 Byte
 
|First 4 bits - [[Sky Cat Airship Fleet]] ([[Olivia]])
 
Last 4 bits - [[Cat Castle]] ([[Claire]])
 
|-
 
!69
 
!16 Bytes
 
|Reserved for up to 32 more quests.
 
|}
 
 
 
== FLGS ==
 
These are event flags for different events that happen in the game. It is <code>256</code> bytes in length, with <code>2048</code> possible event flags. If a value is <code>0</code> then it hasn't happened yet, while a value of <code>1</code> means that the event occurred.
 
 
 
Below is a description of the flag offsets, and what each one means when it is set to <code>1</code>.
 
 
 
<i><b>Please note</b> that not all flags are consecutive. This allows me to add more later and group them together.</i>
 
{| class="wikitable"
 
!Bit Offset
 
!Bit description
 
|-
 
!colspan="2"|Boss States
 
|-
 
!0
 
|Parker defeated
 
|-
 
!1
 
|Suzette defeated
 
|-
 
!2
 
|Trent defeated
 
|-
 
!3
 
|Olivia defeated
 
|-
 
!4
 
|Ruby defeated
 
|-
 
!5
 
|Claire defeated
 
|}
 
  
 
== TRSR ==
 
== TRSR ==
Line 341: Line 114:
 
!9
 
!9
 
|Lake Area
 
|Lake Area
|}
 
 
== ARSM ==
 
Summary of the collectibles for each area. This chunk is <b>12 bytes</b> in length.
 
 
{| class="wikitable"
 
!Byte Offset
 
!Bytes Used
 
!Usage
 
|-
 
!0
 
!2 Bytes
 
|Total count of all Fish Scales that Lance has
 
|-
 
!2
 
!1 Byte
 
|Total count of all LANCE letters that Lance has
 
|-
 
!3
 
!5 Bytes
 
|Reserved for future use
 
 
|}
 
|}
  

Latest revision as of 18:52, 9 April 2020

Warning! The information detailed on this page may not be in the present available build, and may only be available in an upcoming build! Therefore, all information here is to be considered volatile and could change or be removed without notice.
Warning! The information below is to be considered a draft. This means that the information presented is not final, so don't go running wild with this information.

Shield Cat saves are stored in the /saves directory. This directory is platform specific, please see Installation Instructions for its location on your platform.

Please note, save files can only be easily accessed and modified on Windows, Mac OS, and Linux. It may be possible on other platforms, but it is not supported.

Shield Cat save files are saved using the following structure:

 /saves/OTTSAV00/

where 00 is the number of the save file. The game will support up to 100 save files, but more can be added later if it is necessary.

OTTSAVFF is used for the Autosave file. Save slot 0 is not used.

Save information is stored in separate blocks, with each block being stored in it's own file. Details on each file are present below, as well as their expected file sizes.

In Gamemaker, it is loaded and saved as a Buffer with type buffer_fixed. It is 1 byte aligned.

Header

OTTSAV files start with the following header string:

 SC_OTTSAV_V00

where 00 is the version of the save format. During the prototype phase, all save files will use format 00. The format may also change a lot.

Please Note this is not a string that is to be read with buffer_string or buffer_text. It is instead read as unsigned bytes, and then the bytes are compared to see if the header is correct or not. The value 00 is actually ASCII, and will be $3030.

Block Type and Info

This is where the data for this particular save file will go. Details about what is stored in each file is available on each file's page.

Each file is saved separately in the save sub directory, which will look something like this:

 * LINF.BIN
 * FLGS.BIN
 * TRSR.BIN
 * (etc)

The contents of the LINF.BIN file would be as follows:

 SC_OTTSAV_V00LINF(data here)OEND

Please see the details about each block on its associated page:

Footer

OTTSAV files end with the following footer:

 OEND

This is used to prevent the file from being truncated, which can cause issues.

TRSR

These are the different treasure locations in the game, and whether you got the treasure at that location or not. This block is 128 bytes in length, allowing for 1024 treasures.

Please Note that not every treasure slot is used. This allows me to add more treasures later and keep them in the same group.

This page is a stub. Roxy will probably come along later and add more to it.

ACHV

These are flags for the different Achievements you can get in the game. It is 16 bytes in length, allowing for 128 achievements. (However, it is unlikely that this many achievements will be in the game.)

This page is a stub. Roxy will probably come along later and add more to it.

AREA

This block contains the collectibles data for the different areas in the game. Each area uses 128 bits / 16 Bytes of data, following the format specified below. There is support for up to 16 areas, meaning that this block is 256 bytes in size. Each chunk of data is followed sequentially, and the area it represents is detailed in the second table.

Byte Offset Bytes Used Usage
0 1 Byte The count of all the Fish Scales in an area that Lance has collected.
1 2 Bytes Reserved for future use
3 13 bytes All of the Fish Scales in the area. There are 99 Fish Scales in each area. The first 5 bits of this are used for the 5 "LANCE" letters the player can find in each area, using the total 104 bits.
Chunk Number Associated Area
0 Forest Area
1 Cat Town
2 Underground Forest
3 Marine Exhibit
4 Mt. Bophades (Exterior)
5 Mt. Bophades (Interior)
6 Sky Cat Airship Fleet
7 Cat Castle
8 Deep Woods
9 Lake Area

OEND

This denotes the end of the file, and prevents the file from being truncated by having some kind of data at the end.