mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-15 14:01:25 -07:00
factored parser code out of msf
This commit is contained in:
+29
-39
@@ -7,59 +7,49 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: MSF Format Types
|
||||
|
||||
#define MSF_INVALID_STREAM_NUMBER 0xFFFF
|
||||
#define MSF_UINT_MAX max_U32
|
||||
typedef U32 MSF_UInt;
|
||||
typedef S32 MSF_Int;
|
||||
|
||||
#define MSF_BITS_PER_CHAR 8
|
||||
#define MSF_BITS_PER_WORD (sizeof(MSF_UInt) * MSF_BITS_PER_CHAR)
|
||||
|
||||
#define MSF_PN_MAX MSF_UINT_MAX
|
||||
typedef MSF_UInt MSF_PageNumber;
|
||||
#define MSF_MIN_PAGE_SIZE 512
|
||||
#define MSF_MAX_PAGE_SIZE 32768
|
||||
|
||||
#define MSF_MAX_STREAM_SIZE MSF_INT_MAX
|
||||
#define MSF_DELETED_STREAM_STAMP MSF_UINT_MAX
|
||||
#define MSF_STREAM_NUMBER_MAX max_U16
|
||||
#define MSF_INVALID_STREAM_NUMBER MSF_STREAM_NUMBER_MAX
|
||||
typedef U16 MSF_StreamNumber;
|
||||
|
||||
static char msf_msf20_magic[] = "Microsoft C/C++ program database 2.00\r\n\x1aJG\0\0";
|
||||
static char msf_msf70_magic[] = "Microsoft C/C++ MSF 7.00\r\n\032DS\0\0";
|
||||
|
||||
#define MSF_MSF20_MAGIC_SIZE 44
|
||||
#define MSF_MSF70_MAGIC_SIZE 32
|
||||
#define MSF_MAX_MAGIC_SIZE 44
|
||||
|
||||
typedef struct MSF_Header20 MSF_Header20;
|
||||
struct MSF_Header20
|
||||
{
|
||||
U32 block_size;
|
||||
U16 free_block_map_block;
|
||||
U16 block_count;
|
||||
U32 directory_size;
|
||||
U8 magic[sizeof(msf_msf20_magic)];
|
||||
U32 page_size;
|
||||
U16 active_fpm;
|
||||
U16 page_count;
|
||||
U32 stream_table_size;
|
||||
U32 unknown;
|
||||
U16 directory_map;
|
||||
U16 root_pn;
|
||||
};
|
||||
|
||||
typedef struct MSF_Header70 MSF_Header70;
|
||||
struct MSF_Header70
|
||||
{
|
||||
U32 block_size;
|
||||
U32 free_block_map_block;
|
||||
U32 block_count;
|
||||
U32 directory_size;
|
||||
U32 unknown;
|
||||
U32 directory_super_map;
|
||||
U8 magic[sizeof(msf_msf70_magic)];
|
||||
MSF_UInt page_size;
|
||||
MSF_PageNumber active_fpm;
|
||||
MSF_PageNumber page_count;
|
||||
MSF_UInt stream_table_size;
|
||||
MSF_UInt unknown; // always set to zero (used to be stream table page number, see SI_PERSIST in msf.cpp)
|
||||
MSF_PageNumber root_pn;
|
||||
};
|
||||
|
||||
// magic(20) + header(20) = 44 + 20 = 64
|
||||
// magic(70) + header(70) = 32 + 24 = 56
|
||||
|
||||
#define MSF_MIN_SIZE 64
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: MSF Parser Helper Types
|
||||
|
||||
typedef struct MSF_Parsed MSF_Parsed;
|
||||
struct MSF_Parsed
|
||||
{
|
||||
String8 *streams;
|
||||
U64 stream_count;
|
||||
U64 block_size;
|
||||
U64 block_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: MSF Parser Functions
|
||||
|
||||
internal MSF_Parsed* msf_parsed_from_data(Arena *arena, String8 msf_data);
|
||||
internal String8 msf_data_from_stream(MSF_Parsed *msf, MSF_StreamNumber sn);
|
||||
|
||||
#endif // MSF_H
|
||||
|
||||
Reference in New Issue
Block a user