neogeo: support for Metal Slug 5 Plus banking.

This commit is contained in:
Sorgelig
2023-08-01 05:27:03 +08:00
parent aa5d78309a
commit 575673577c

View File

@@ -746,7 +746,7 @@ static int xml_load_files(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, co
static unsigned char file_index = 0;
static char file_type = 0;
static unsigned long int file_offset = 0, file_size = 0, vromb_offset = 0;
static uint32_t hw_type = 0, use_pcm = 0, pvc = 0, sma = 0, cmc = 0, rom_wait = 0, p_wait = 0, xram = 0;
static uint32_t hw_type = 0, use_pcm = 0, pvc = 0, sma = 0, cmc = 0, rom_wait = 0, p_wait = 0, xram = 0, ms5p = 0;
static int file_cnt = 0;
static int vrom_mirror = 1;
@@ -769,6 +769,7 @@ static int xml_load_files(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, co
rom_wait = 0;
p_wait = 0;
xram = 0;
ms5p = 0;
if (!romsets) in_correct_romset = 1;
for (int i = 0; i < node->n_attributes; i++) {
@@ -814,6 +815,9 @@ static int xml_load_files(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, co
else if (!strcasecmp(node->attributes[i].name, "xram")) {
xram = atoi(node->attributes[i].value);
}
else if (!strcasecmp(node->attributes[i].name, "ms5p")) {
ms5p = atoi(node->attributes[i].value);
}
}
}
if (in_correct_romset) {
@@ -909,6 +913,9 @@ static int xml_load_files(XMLEvent evt, const XMLNode* node, SXML_CHAR* text, co
}
}
printf("Setting cart ms5p to %u\n", ms5p);
set_config((ms5p & 1) << 17, 1 << 17);
printf("Setting cart extra RAM to %u\n", xram);
set_config((xram & 1) << 18, 1 << 18);
@@ -1003,25 +1010,27 @@ void load_neo(char *path)
FileClose(&f);
if(res)
{
uint32_t hw_type = 0, use_pcm = 0, pvc = 0, sma = 0, cmc = 0, mir = 1, rom_wait = 0, p_wait = 0, xram = 0;
uint32_t hw_type = 0, use_pcm = 0, pvc = 0, sma = 0, cmc = 0, mir = 1, rom_wait = 0, p_wait = 0, xram = 0, ms5p = 0;
for (uint32_t i = 0; i < sizeof(neo_quirks) / sizeof(neo_quirks[0]); i++)
{
if (neo_quirks[i].id == hdr.NGH)
{
bool found = false;
bool skip = false;
switch (hdr.NGH) {
case 0x0251: if (hdr.PSize != 9437184) found = true; break; // (kof99 prototype vs final)
case 0x0253: if (hdr.PSize != 9437184) found = true; // (garou prototype vs the different SMA chip versions) garouh needs SMA=3
case 0x0251: if (hdr.PSize != 9437184) skip = true; break; // (kof99 prototype vs final)
case 0x0253: if (hdr.PSize != 9437184) skip = true; // (garou prototype vs the different SMA chip versions) garouh needs SMA=3
if (hdr.Name[27] == 'A')
{sma = 3; cmc = 1; mir = 0; found = true;} // (Not ideal, but their headers are otherwise identical)
{sma = 3; cmc = 1; mir = 0; skip = true;} // (Not ideal, but their headers are otherwise identical)
break;
case 0x0256: if (hdr.PSize != 9437184) found = true; break; // (mslug3 using SMA vs normal banking)
case 0x0263: if (hdr.SSize != 524288) found = true; break; // (mslug4 bootlegs vs original)
case 0x0268: if (hdr.PSize != 8388608) found = true; break; // (mslug5 bootlegs vs original)
case 0x0269: if (hdr.SSize != 524288) found = true;break; // (svc bootlegs vs original)
case 0x0271: if (hdr.PSize != 9437184) found = true;break; // (kof2003 bootlegs vs original)
case 0x0256: if (hdr.PSize != 9437184) skip = true; break; // (mslug3 using SMA vs normal banking)
case 0x0263: if (hdr.SSize != 524288) skip = true; break; // (mslug4 bootlegs vs original)
case 0x0268: if (hdr.PSize == 5242880) ms5p = 1; // (mslug5 bootlegs vs original)
if (hdr.PSize != 8388608) skip = true;
break;
case 0x0269: if (hdr.SSize != 524288) skip = true; break; // (svc bootlegs vs original)
case 0x0271: if (hdr.PSize != 9437184) skip = true; break; // (kof2003 bootlegs vs original)
}
if (found) break;
if (skip) break;
hw_type = neo_quirks[i].hw;
cmc = neo_quirks[i].cmc;
@@ -1061,6 +1070,9 @@ void load_neo(char *path)
neogeo_tx(path, p, NEO_FILE_SPR, 15, off, hdr.CSize, 0, 1);
printf("Setting cart ms5p to %u\n", ms5p);
set_config((ms5p & 1) << 17, 1 << 17);
printf("Setting cart extra RAM to %u\n", xram);
set_config((xram & 1) << 18, 1 << 18);