Tidy up zip handling a bit

This commit is contained in:
Barry Harris 2012-02-13 14:03:22 +00:00
parent 9afc3e2bd0
commit c7b2291c90
7 changed files with 9 additions and 10 deletions

View File

@ -137,7 +137,6 @@ INT32 BurnGetZipName(char** pszName, UINT32 i)
}
strcpy(szFilename, pszGameName);
strcat(szFilename, ".zip");
*pszName = szFilename;

View File

@ -172,7 +172,6 @@ INT32 MegadriveGetZipName(char** pszName, UINT32 i)
for (UINT32 j = 0; j < strlen(pszGameName); j++) {
szFilename[j] = pszGameName[j + 3];
}
strcat(szFilename, ".zip");
*pszName = szFilename;

View File

@ -190,7 +190,6 @@ static INT32 PceGetZipName(char** pszName, UINT32 i)
for (UINT32 j = 0; j < strlen(pszGameName); j++) {
szFilename[j] = pszGameName[j + 4];
}
strcat(szFilename, ".zip");
*pszName = szFilename;

View File

@ -220,7 +220,7 @@ void BurnSampleReset()
}
}
extern INT32 __cdecl ZipLoadOneFile(const char* arcName, const char* fileName, void** Dest, INT32* pnWrote);
INT32 __cdecl ZipLoadOneFile(char* arcName, const char* fileName, void** Dest, INT32* pnWrote);
char* TCHARToANSI(const TCHAR* pszInString, char* pszOutString, INT32 nOutSize);
#define _TtoA(a) TCHARToANSI(a, NULL, 0)
@ -269,11 +269,11 @@ void BurnSampleInit(INT32 nGain /*volume percentage!*/, INT32 bAdd /*add sample
if (si.nFlags == 0) break;
sprintf (path, "%s%s.zip", szTempPath, setname);
sprintf (path, "%s%s", szTempPath, setname);
destination = NULL;
length = 0;
ZipLoadOneFile((const char*)path, (const char*)szSampleName, &destination, &length);
ZipLoadOneFile((char*)path, (const char*)szSampleName, &destination, &length);
if (length) {
make_raw((UINT8*)destination, length);

View File

@ -157,10 +157,11 @@ INT32 BurnStateDecompress(UINT8* Def, INT32 nDefLen, INT32 bAll);
// zipfn.cpp
struct ZipEntry { char* szName; UINT32 nLen; UINT32 nCrc; };
INT32 ZipOpen(const char* szZip);
INT32 ZipOpen(char* szZip);
INT32 ZipClose();
INT32 ZipGetList(struct ZipEntry** pList, INT32* pnListCount);
INT32 ZipLoadFile(UINT8* Dest, INT32 nLen, INT32* pnWrote, INT32 nEntry);
INT32 __cdecl ZipLoadOneFile(char* arcName, const char* fileName, void** Dest, INT32* pnWrote);
// bzip.cpp

View File

@ -444,7 +444,6 @@ void IpsPatchExit();
// Misc
#define _TtoA(a) TCHARToANSI(a, NULL, 0)
#define _AtoT(a) ANSIToTCHAR(a, NULL, 0)
int __cdecl ZipLoadOneFile(const char* arcName, const char* fileName, void** Dest, int* pnWrote);
// numpluscommas.cpp
TCHAR* FormatCommasNumber(__int64);

View File

@ -5,9 +5,11 @@
static unzFile Zip=NULL;
static INT32 nCurrFile=0; // The current file we are pointing to
INT32 ZipOpen(const char* szZip)
INT32 ZipOpen(char* szZip)
{
if (szZip == NULL) return 1;
strcat(szZip, ".zip");
Zip = unzOpen(szZip);
if (Zip == NULL) return 1;
@ -114,7 +116,7 @@ INT32 ZipLoadFile(UINT8* Dest, INT32 nLen, INT32* pnWrote, INT32 nEntry)
}
// Load one file directly, added by regret
INT32 __cdecl ZipLoadOneFile(const char* arcName, const char* fileName, void** Dest, INT32* pnWrote)
INT32 __cdecl ZipLoadOneFile(char* arcName, const char* fileName, void** Dest, INT32* pnWrote)
{
if (ZipOpen(arcName)) {
return 1;