diff options
| author | Wiimm <wiimm@wiimm.de> | 2020-11-30 16:16:56 +0100 |
|---|---|---|
| committer | Wiimm <wiimm@wiimm.de> | 2020-11-30 16:16:56 +0100 |
| commit | 9c0078c6b9c1309b48f9ece8b5cad1b9be9a75c5 (patch) | |
| tree | 0abd3b6a244076650e40a07e42adae9c2a6b2d8c /project/src/lib-staticr.c | |
| parent | a0815499b2d9014695e6e261c909476729445360 (diff) | |
SZS v2.21a
Diffstat (limited to '')
| -rw-r--r-- | project/src/lib-staticr.c | 141 |
1 files changed, 135 insertions, 6 deletions
diff --git a/project/src/lib-staticr.c b/project/src/lib-staticr.c index 2125714..bd49760 100644 --- a/project/src/lib-staticr.c +++ b/project/src/lib-staticr.c @@ -1316,6 +1316,115 @@ static BZ2Manager_t * GetLecodeLoader ( str_mode_t mode ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// fix_51420 data /////////////// +/////////////////////////////////////////////////////////////////////////////// + +static const u8 fix_51420_pal_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x8c,0xe4, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x66, + 0x38,0xa5,0x84,0x18, 0x3c,0x80,0x80,0x66, 0x38,0x84,0x84,0x98, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x66, 0x38,0xe7,0x8c,0xe4, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0xf4, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_pal_mgr + = { fix_51420_pal_bz2, sizeof(fix_51420_pal_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_usa_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x48,0x5c, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x65, + 0x38,0xa5,0x3f,0x90, 0x3c,0x80,0x80,0x65, 0x38,0x84,0x40,0x10, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x65, 0x38,0xe7,0x48,0x5c, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0x54, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_usa_mgr + = { fix_51420_usa_bz2, sizeof(fix_51420_usa_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_jap_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x65,0x83,0x50, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x65, + 0x38,0xa5,0x7a,0x84, 0x3c,0x80,0x80,0x65, 0x38,0x84,0x7b,0x04, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x66, 0x38,0xe7,0x83,0x50, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x15,0x14, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_jap_mgr + = { fix_51420_jap_bz2, sizeof(fix_51420_jap_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static const u8 fix_51420_kor_bz2[] = +{ + // decompressed size: 0x88 = 136 bytes + 0x00,0x00,0x00,0x88, + + // raw data + 0x52,0x41,0x57,0x30, 0x00,0xd0,0xc0,0xde, 0x00,0xd0,0xc0,0xde, 0xc2,0x64,0x6f,0xfc, + 0x00,0x00,0x00,0x0f, 0x48,0x00,0x00,0x0d, 0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, + 0x7c,0xc8,0x03,0xa6, 0x80,0x86,0x00,0x00, 0x7c,0x04,0x18,0x00, 0x41,0x82,0x00,0x4c, + 0x80,0xa6,0x00,0x04, 0x38,0xa5,0x00,0x01, 0x2c,0x05,0x00,0x03, 0x41,0x82,0x00,0x3c, + 0x90,0xa6,0x00,0x04, 0x90,0x66,0x00,0x00, 0x38,0x61,0x00,0x10, 0x3c,0xa0,0x80,0x64, + 0x38,0xa5,0x67,0x30, 0x3c,0x80,0x80,0x64, 0x38,0x84,0x67,0xb0, 0x90,0xa1,0x00,0x10, + 0x90,0x81,0x00,0x14, 0x3c,0xe0,0x80,0x64, 0x38,0xe7,0x6f,0xfc, 0x38,0xe7,0xfe,0xf0, + 0x7c,0xe9,0x03,0xa6, 0x4e,0x80,0x04,0x20, 0x3c,0x80,0x80,0x1d, 0x38,0x84,0x19,0x50, + 0x7c,0x88,0x03,0xa6, 0x4e,0x80,0x00,0x21, 0x60,0x00,0x00,0x00, + // 0x88 = 136 data bytes (103%) +}; + +static BZ2Manager_t fix_51420_kor_mgr + = { fix_51420_kor_bz2, sizeof(fix_51420_kor_bz2), 0, 0 }; + +//----------------------------------------------------------------------------- + +static BZ2Manager_t * GetFix51420 ( str_mode_t mode ) +{ + switch (mode) + { + case STR_M_PAL: return &fix_51420_pal_mgr; + case STR_M_USA: return &fix_51420_usa_mgr; + case STR_M_JAP: return &fix_51420_jap_mgr; + case STR_M_KOR: return &fix_51420_kor_mgr; + default: return 0; + } +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// more data /////////////// /////////////////////////////////////////////////////////////////////////////// @@ -5012,21 +5121,24 @@ static enumError AddSectionHelper /////////////////////////////////////////////////////////////////////////////// -static enumError ReadCodeFile ( staticr_t *str, ccp fname, u8 **data, uint *size ) +static enumError ReadCodeFile + ( staticr_t *str, ccp fname, u8 **data, uint *size, bool *alloced ) { DASSERT(str); DASSERT(fname); DASSERT(data); DASSERT(size); + DASSERT(alloced); *data = 0; *size = 0; + *alloced = false; if ( fname && fname[0] == '@' ) { BZ2Manager_t *wcm = 0; if (!strcmp(fname,"@LECODE")) wcm = GetLecodeLoader(str->mode); -// else if (!strcmp(fname,"@XXX")) wcm = GetXXXX(str->mode); + else if (!strcmp(fname,"@FIX51420")) wcm = GetFix51420(str->mode); if (wcm) { @@ -5051,6 +5163,7 @@ static enumError ReadCodeFile ( staticr_t *str, ccp fname, u8 **data, uint *size } } + *alloced = true; return ERR_OK; } @@ -5222,7 +5335,8 @@ enumError AddWCodeFile ( staticr_t *str, ccp fname ) u8 *data; uint size; - enumError err = ReadCodeFile(str,fname,&data,&size); + bool alloced; + enumError err = ReadCodeFile(str,fname,&data,&size,&alloced); if (err) return err; @@ -5237,7 +5351,8 @@ enumError AddWCodeFile ( staticr_t *str, ccp fname ) else err = ERROR0(ERR_WARNING,"Not a GCT file: %s\n",fname); - FREE(data); + if(alloced) + FREE(data); return err; } @@ -5338,12 +5453,14 @@ static uint AddSectionDOL u8 *gh_data = 0; uint gh_size = 0; - enumError err = ReadCodeFile(str,fname,&gh_data,&gh_size); + bool gh_alloced; + enumError err = ReadCodeFile(str,fname,&gh_data,&gh_size,&gh_alloced); if (err) return err; const uint stat = AddSectionGCH(str,gh_data,gh_size,fname,get_min_addr); - FREE(gh_data); + if (gh_alloced) + FREE(gh_data); return stat; } @@ -6872,6 +6989,18 @@ const data_tab_t maindol_data_tab[] = DEF_BZIP(codehandler) DEF_BZIP(codehandleronly) + #if HAVE_WIIMM_EXT + DEF_BZIP(lecode_loader_pal) + DEF_BZIP(lecode_loader_usa) + DEF_BZIP(lecode_loader_jap) + DEF_BZIP(lecode_loader_kor) + + DEF_BZIP(fix_51420_pal) + DEF_BZIP(fix_51420_usa) + DEF_BZIP(fix_51420_jap) + DEF_BZIP(fix_51420_kor) + #endif + {0,0,0} }; |
