#include "../unzip/unzip.h"\r
#include "../unzip/unzip_stream.h"\r
\r
+\r
static char *rom_exts[] = { "bin", "gen", "smd", "iso" };\r
\r
\r
f = fopen(path, "rb");\r
if (f == NULL) return NULL;\r
\r
+ /* we use our own buffering */\r
+ setvbuf(f, NULL, _IONBF, 0);\r
+\r
file = malloc(sizeof(*file));\r
if (file == NULL) {\r
fclose(f);\r
{\r
if (stream->type == PMT_UNCOMPRESSED)\r
{\r
- return fseek(stream->file, offset, whence);\r
+ fseek(stream->file, offset, whence);\r
+ return ftell(stream->file);\r
}\r
else if (stream->type == PMT_ZIP)\r
{\r
\r
// Allocate space for the rom plus padding\r
rom=PicoCartAlloc(size);\r
- if (rom==NULL) return 1; // { fclose(f); return 1; }\r
+ if (rom==NULL) {\r
+ printf("out of memory (wanted %i)\n", size);\r
+ return 1;\r
+ }\r
\r
pm_read(rom,size,f); // Load up the rom\r
\r