mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-03-03 15:38:22 +00:00
Link zipos into NESEMU1
A regression occurred where LIBC_ZIPOS support wasn't being properly linked into Cosmopolitan NESEMU1. Main modules that link zip support need to have the following declaration to guaranteed zip: polyfills: STATIC_YOINK("zip_uri_support"); Doing that, means system calls such as open(), mmap(), fstat(), etc. will do the right thing when encountering zip: prefixed URLs. Please also note that in the near future we're going to change it to zip:// after more closely examining the relevant URI RFCs. Fixes #28 Closes #29 Thanks @nikhedonia for the report!
This commit is contained in:
parent
9f68d6eee9
commit
58d5cf1c27
1 changed files with 9 additions and 6 deletions
|
@ -47,6 +47,8 @@
|
||||||
#include "third_party/getopt/getopt.h"
|
#include "third_party/getopt/getopt.h"
|
||||||
#include "tool/viz/lib/knobs.h"
|
#include "tool/viz/lib/knobs.h"
|
||||||
|
|
||||||
|
STATIC_YOINK("zip_uri_support");
|
||||||
|
|
||||||
#define USAGE \
|
#define USAGE \
|
||||||
" [ROM] [FMV]\n\
|
" [ROM] [FMV]\n\
|
||||||
\n\
|
\n\
|
||||||
|
@ -1818,12 +1820,13 @@ size_t FindZipGames(void) {
|
||||||
for (i = 0, cf = ZIP_CDIR_OFFSET(zipos->cdir);
|
for (i = 0, cf = ZIP_CDIR_OFFSET(zipos->cdir);
|
||||||
i < ZIP_CDIR_RECORDS(zipos->cdir);
|
i < ZIP_CDIR_RECORDS(zipos->cdir);
|
||||||
++i, cf += ZIP_CFILE_HDRSIZE(zipos->map + cf)) {
|
++i, cf += ZIP_CFILE_HDRSIZE(zipos->map + cf)) {
|
||||||
if ((name = strndup(ZIP_CFILE_NAME(zipos->map + cf),
|
if (ZIP_CFILE_NAMESIZE(zipos->map + cf) > 4 &&
|
||||||
ZIP_CFILE_NAMESIZE(zipos->map + cf))) &&
|
!memcmp((ZIP_CFILE_NAME(zipos->map + cf) +
|
||||||
endswith(name, ".nes")) {
|
ZIP_CFILE_NAMESIZE(zipos->map + cf) - 4),
|
||||||
|
".nes", 4) &&
|
||||||
|
(name = xasprintf("zip:%.*s", ZIP_CFILE_NAMESIZE(zipos->map + cf),
|
||||||
|
ZIP_CFILE_NAME(zipos->map + cf)))) {
|
||||||
APPEND(&zipgames_.p, &zipgames_.i, &zipgames_.n, &name);
|
APPEND(&zipgames_.p, &zipgames_.i, &zipgames_.n, &name);
|
||||||
} else {
|
|
||||||
free(name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1842,7 +1845,7 @@ int SelectGameFromZip(void) {
|
||||||
rc = 0;
|
rc = 0;
|
||||||
if ((line = GetLine())) {
|
if ((line = GetLine())) {
|
||||||
i = MAX(0, MIN(zipgames_.i - 1, atoi(line)));
|
i = MAX(0, MIN(zipgames_.i - 1, atoi(line)));
|
||||||
uri = xasprintf("zip:%s", zipgames_.p[i]);
|
uri = zipgames_.p[i];
|
||||||
rc = PlayGame(uri, NULL);
|
rc = PlayGame(uri, NULL);
|
||||||
free(uri);
|
free(uri);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue