.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Air Command 3.0- Save $12.00
War Plan Pacific- Save $7.00

   







Go Back   .com.unity Forums > The Camo Workshop > WinSPWW2
Notices


Reply
 
Thread Tools Display Modes
  #1  
Old April 6th, 2019, 06:57 PM
MarkSheppard's Avatar

MarkSheppard MarkSheppard is offline
Lieutenant Colonel
 
Join Date: Jun 2005
Posts: 1,413
Thanks: 103
Thanked 648 Times in 432 Posts
MarkSheppard is on a distinguished road
Default Re: OT: looking for zovs66

Question for ErikCumps:

How does SP store the scenario data; I know it's very compressed; are there areas of compressed data, followed by uncompressed "Pointer" data?

Reason I ask is that I have the code for Fred Chlanda's old SP1 to WW2 conversion program and it may be possible to make a conversion program to convert old SP1 and SP2 stuff (eventually) to modern format.

Last edited by MarkSheppard; April 6th, 2019 at 08:42 PM..
Reply With Quote
  #2  
Old April 8th, 2019, 05:08 PM
ErikCumps's Avatar

ErikCumps ErikCumps is offline
Corporal
 
Join Date: Jan 2019
Location: Leuven, Belgium
Posts: 70
Thanks: 27
Thanked 89 Times in 29 Posts
ErikCumps is on a distinguished road
Post Re: OT: looking for zovs66

Hi Mark,

The savegame data is stored in multiple blocks, some compressed and some not.

This comment from my source code explains it quite well, I think:
Code:
/* This is the SPWaW/winSPWW2 savegame file format:
 *
 * A savegame is a contiguous set of several data blocks.
 *
 * The first data block is the game info section.
 * This is a fixed-size data block containing the savegame marker.
 * (which is currently "SPWAW_SAVE_V101"/"SPCTS_SAVE_V100" for SPWaW/winSPWW2)
 *
 * The other data blocks contain the savegame section data.
 *
 * Each data block consists of:
 *	 a data block header
 *	 the section data.
 *
 * The fixed-size data block header describes the section data that follows:
 *	the identification number of the section
 *	the size of the section data
 *	a flag indicating if the section data is compressed or not
 *
 * Uncompressed section data can be loaded as-is.
 *
 * Compressed section data must be decompressed after loading.
 * The actual size of the section data will be larger than the size of the section data in the file.
 */

/* This is the SPWaW/winSPWW2 section data compression format:
 *
 * Compressed section data is a contiguous set of run-length coded data blocks.
 *
 * There are two types of run-length coded data blocks:
 *	uncompressed run-length coded data (URLC)
 *	compressed run-length coded data (CRLC)
 *
 * Each run-length coded data block consists of:
 *	a run-length coding byte (RLB)
 *	one or more data bytes
 *
 * A compressed run-length coded data block is used to for sequences of identical data bytes:
 *	the RLB indicates the number of identical data bytes (N)
 *	the RLB is followed by a single data byte (B)
 *	the decompressed data is the sequence of N times the data byte B
 *
 * An uncompressed run-length coded data block is used for sequences of data bytes with mixed values:
 *	the RLB indicates the number of data bytes that follow (N)
 *	there is at least 1 and maximum 127 data bytes
 *	the N data bytes can be copied as-is
 */
The concrete block header layout for winSPWW2 is this:
Code:
#pragma pack(push, r1, 1)
typedef struct s_BLOCKHEAD_WINSPWW2 {
	unsigned int	section;
	unsigned int	size;
	unsigned char	flag;
} BLOCKHEAD_WINSPWW2;
#pragma pack(pop, r1)
If the 'flag' value is 0, the section data is NOT compressed.
If the 'flag' value is 1, the section data IS compressed.

Note: the two #pragma's you see are not part of the actual data layout, they are just hints to the compiler that it should respect the data layout as is and not insert additional padding between fields.

Hope this helps,
Erik
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 06:58 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.