ST second cart now supported (via command line).

This commit is contained in:
n-a-c-h
2005-07-07 11:45:40 +00:00
parent 977be369ca
commit cef2da0234
2 changed files with 50 additions and 19 deletions

View File

@@ -928,6 +928,29 @@ void loadZipFile(char *filename)
}
}
void load_file_fs(char *path)
{
unsigned int pathlen = strlen(path);
const char *ext = path+pathlen-4;
if (pathlen >= 5 && !strcasecmp(ext, ".jma"))
{
load_jma_file(path);
}
else if (pathlen >= 5 && !strcasecmp(ext, ".zip"))
{
loadZipFile(path);
}
else if (pathlen >= 4 && !strcasecmp(ext+1, ".gz"))
{
loadGZipFile(path);
}
else
{
loadFile(path);
}
}
char *STCart2 = 0;
void SplitSetup(char *basepath, char *basefile, unsigned int MirrorSystem)
{
unsigned char *ROM = (unsigned char *)romdata;
@@ -936,30 +959,22 @@ void SplitSetup(char *basepath, char *basefile, unsigned int MirrorSystem)
if (maxromspace < addOnStart+addOnSize) { return; }
memcpy(ROM+addOnStart, ROM, addOnSize);
if (*basepath == 0)
if (STCart2)
{
if (maxromspace < 0x300000) { return; }
curromspace = 0;
load_file_fs(STCart2);
memcpy(ROM+0x200000, ROM, addOnSize);
curromspace = 0;
}
if (!*basepath)
{
loadZipFile(basefile);
}
else
{
unsigned int pathlen = strlen(basepath);
char *ext = basepath+pathlen-4;
if (pathlen >= 5 && !strcasecmp(ext, ".jma"))
{
load_jma_file(basepath);
}
else if (pathlen >= 5 && !strcasecmp(ext, ".zip"))
{
loadZipFile(basepath);
}
else if (pathlen >= 4 && !strcasecmp(ext+1, ".gz"))
{
loadGZipFile(basepath);
}
else
{
loadFile(basepath);
}
load_file_fs(basepath);
}
if ((curromspace & 0x7FFF) == 512)
@@ -984,10 +999,19 @@ void SplitSetup(char *basepath, char *basefile, unsigned int MirrorSystem)
case 3:
memcpy(ROM+0x40000, ROM, 0x40000);
memcpy(ROM+0x80000, ROM, 0x80000);
if (STCart2 && addOnSize < 0x100000)
{
memcpy(ROM+0x180000, ROM+0x100000, 0x80000);
memcpy(ROM+0x280000, ROM+0x200000, 0x80000);
}
break;
}
curromspace = addOnStart+addOnSize;
if (STCart2)
{
curromspace = 0x300000;
}
SplittedROM = true;
}
@@ -1393,6 +1417,9 @@ extern unsigned char cycpl;
void headerhack()
{
char *RomData = (char *)romdata;
return;
disablehdma = 0;
hdmaearlstart = 0;
WindowDisables = 0;

View File

@@ -50,6 +50,8 @@ extern unsigned char Palette0, pl1contrl, pl2contrl, MMXSupport, Force8b, ForceP
showallext, autoloadstate, smallscreenon, autoloadmovie, ZMVZClose,
ZMVRawDump;
extern char *STCart2;
void ConvertJoyMap1(), ConvertJoyMap2(), zstart(), makeextension();
#define put_line(x) \
@@ -549,6 +551,8 @@ static void handle_params(int argc, char *argv[])
fvar[0] = strlen(argv[i]);
strncpy(&fvar[1],argv[i],127);
makeextension();
STCart2 = argv[i+1]; //Sufami Turbo second cart
break;
}
}