Skip to content

file_io: Zip file support #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions DiskImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ void TDiskImage::readUDI(int hfile, bool ronly)
}

//-----------------------------------------------------------------------------
void TDiskImage::writeTRD(int hfile)
void TDiskImage::writeTRD(fileTYPE *hfile)
{
VGFIND_SECTOR vgfs;

Expand All @@ -1295,13 +1295,13 @@ void TDiskImage::writeTRD(int hfile)
{
if (FindSector(trk, side, sec + 1, &vgfs))
{
write(hfile, vgfs.SectorPointer, 256);
FileWriteAdv(hfile, vgfs.SectorPointer, 256);
if ((!vgfs.CRCOK) || (!vgfs.vgfa.CRCOK)) printf("Warning: sector %d on track %d, side %d with BAD CRC!\n", sec + 1, trk, side);
if (vgfs.SectorLength != 256) printf("Warning: sector %d on track %d, side %d is non 256 bytes!\n", sec + 1, trk, side);
}
else
{
write(hfile, nullbuf, 256);
FileWriteAdv(hfile, nullbuf, 256);
printf("DANGER! Sector %d on track %d, side %d not found!\n", sec + 1, trk, side);
}
}
Expand Down Expand Up @@ -3014,19 +3014,10 @@ int x2trd(const char *name, fileTYPE *f)
return 0;
}

img->writeTRD(f->fd);
img->writeTRD(f);
delete(img);

struct stat64 st;
int ret = fstat64(f->fd, &st);
if (ret < 0)
{
printf("x2trd(fstat) error: %d.\n", ret);
FileClose(f);
return 0;
}

f->size = st.st_size;
f->size = FileGetSize(f);
FileSeekLBA(f, 0);
printf("x2trd: vtrd size=%llu.\n", f->size);

Expand Down
4 changes: 2 additions & 2 deletions DiskImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class TDiskImage

void Open(const char *filename, bool ReadOnly);

void writeTRD(int hfile);
void writeTRD(fileTYPE *hfile);

void readSCL(int hfile, bool readonly);
void readFDI(int hfile, bool readonly);
Expand Down Expand Up @@ -189,4 +189,4 @@ int x2trd(const char *name, fileTYPE *f);
int x2trd_ext_supp(const char *name);

//-----------------------------------------------------------------------------
#endif
#endif
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ endif
INCLUDE = -I./
INCLUDE += -I./support/minimig
INCLUDE += -I./lib/libco
INCLUDE += -I./lib/miniz

PRJ = MiSTer
SRC = $(wildcard *.c)
Expand All @@ -28,11 +29,12 @@ ST_SRC = $(wildcard ./support/st/*.cpp)
X86_SRC = $(wildcard ./support/x86/*.cpp)
SNES_SRC = $(wildcard ./support/snes/*.cpp)
LIBCO_SRC = lib/libco/arm.c
MINIZ_SRC = $(wildcard ./lib/miniz/*.c)

VPATH = ./:./support/minimig:./support/sharpmz:./support/archie:./support/st:./support/x86:./support/snes

OBJ = $(SRC:.c=.c.o) $(SRC2:.cpp=.cpp.o) $(MINIMIG_SRC:.cpp=.cpp.o) $(SHARPMZ_SRC:.cpp=.cpp.o) $(ARCHIE_SRC:.cpp=.cpp.o) $(ST_SRC:.cpp=.cpp.o) $(X86_SRC:.cpp=.cpp.o) $(SNES_SRC:.cpp=.cpp.o) $(LIBCO_SRC:.c=.c.o)
DEP = $(SRC:.c=.cpp.d) $(SRC2:.cpp=.cpp.d) $(MINIMIG_SRC:.cpp=.cpp.d) $(SHARPMZ_SRC:.cpp=.cpp.d) $(ARCHIE_SRC:.cpp=.cpp.d) $(ST_SRC:.cpp=.cpp.d) $(X86_SRC:.cpp=.cpp.d) $(SNES_SRC:.cpp=.cpp.d) $(LIBCO_SRC:.c=.c.d)
OBJ = $(SRC:.c=.c.o) $(SRC2:.cpp=.cpp.o) $(MINIMIG_SRC:.cpp=.cpp.o) $(SHARPMZ_SRC:.cpp=.cpp.o) $(ARCHIE_SRC:.cpp=.cpp.o) $(ST_SRC:.cpp=.cpp.o) $(X86_SRC:.cpp=.cpp.o) $(SNES_SRC:.cpp=.cpp.o) $(LIBCO_SRC:.c=.c.o) $(MINIZ_SRC:.c=.c.o)
DEP = $(SRC:.c=.cpp.d) $(SRC2:.cpp=.cpp.d) $(MINIMIG_SRC:.cpp=.cpp.d) $(SHARPMZ_SRC:.cpp=.cpp.d) $(ARCHIE_SRC:.cpp=.cpp.d) $(ST_SRC:.cpp=.cpp.d) $(X86_SRC:.cpp=.cpp.d) $(SNES_SRC:.cpp=.cpp.d) $(LIBCO_SRC:.c=.c.d) $(MINIZ_SRC:.c=.c.d)

DFLAGS = $(INCLUDE) -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"
CFLAGS = $(DFLAGS) -Wall -Wextra -Wno-strict-aliasing -c -O3
Expand Down
Loading