Redesign dusk.dsk into a dual-archive DSK2 format
Splits the asset archive into a compressed (DEFLATE) zip and an uncompressed (STORED) zip back to back behind a small header, instead of one plain zip. DEFLATE-compressed zip entries aren't reliably seekable in libzip, which caused locale string lookups (repeated rewind/reopen of the same entry) to silently skip content on Dolphin specifically. Uncompressed entries don't have that problem, so locale files now go in the stored archive without needing to buffer the whole thing in memory. Adds tools/asset/pack as the new packer (replacing the plain `tar --format=zip`), a shared assetdsk.h/.c opener used by all platforms, and a second ASSET.zipStored handle with fallback lookup in assetfile.c. Confirmed working: Linux, PSP (PPSSPP), and Dolphin-FAT (Wii DOL under -a LLE) - the original Dolphin locale lookup failure no longer reproduces.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "asset/asset.h"
|
||||
#include "asset/assetdsk.h"
|
||||
#include "assert/assert.h"
|
||||
#include "util/memory.h"
|
||||
#include "util/math.h"
|
||||
@@ -109,24 +110,15 @@ errorret_t assetInitPBP(const char_t *pbpPath) {
|
||||
fclose(ASSET.platform.pbpFile);
|
||||
ASSET.platform.pbpFile = NULL;
|
||||
|
||||
zip_source_t *psarSource = zip_source_buffer_create(
|
||||
psarData, (zip_uint64_t)psarSize, 1, NULL
|
||||
errorret_t ret = assetDskOpenFromBuffer(
|
||||
psarData, psarSize, &ASSET.zip, &ASSET.zipStored
|
||||
);
|
||||
if(psarSource == NULL) {
|
||||
if(errorIsNotOk(ret)) {
|
||||
free(psarData);
|
||||
errorThrow("Failed to create zip source in PBP file: %s", pbpPath);
|
||||
}
|
||||
|
||||
ASSET.zip = zip_open_from_source(
|
||||
psarSource,
|
||||
ZIP_RDONLY,
|
||||
NULL
|
||||
);
|
||||
if(ASSET.zip == NULL) {
|
||||
zip_source_free(psarSource);
|
||||
errorThrow("Failed to open zip from PBP file: %s", pbpPath);
|
||||
errorChain(ret);
|
||||
}
|
||||
|
||||
ASSET.platform.dskData = psarData;
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -136,5 +128,10 @@ errorret_t assetDisposePBP(void) {
|
||||
ASSET.platform.pbpFile = NULL;
|
||||
}
|
||||
|
||||
if(ASSET.platform.dskData != NULL) {
|
||||
free(ASSET.platform.dskData);
|
||||
ASSET.platform.dskData = NULL;
|
||||
}
|
||||
|
||||
errorOk();
|
||||
}
|
||||
@@ -30,6 +30,11 @@ typedef struct {
|
||||
typedef struct {
|
||||
FILE *pbpFile;
|
||||
assetpbpheader_t pbpHeader;
|
||||
|
||||
// Whole dusk.dsk (PSAR) blob, kept alive for as long as ASSET.zip/
|
||||
// ASSET.zipStored are open since they're non-owning windows into it (see
|
||||
// assetDskOpenFromBuffer). Freed in assetDisposePBP.
|
||||
uint8_t *dskData;
|
||||
} assetpbp_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user