7z support

Zophar’s Domain is one such popular SPC site that distributes its SPC packages in 7z archives. I love the support I’ve added into SPC Tracker that can load RSN/RAR files, so I would love to go all the way with 7z support. I’ve looked into and made some discoveries quickly:

can use http://www.7-zip.org/sdk.html 15.05 beta package’s 7zDec, a simplified 7z extractor and file lister.

To compile
There are some additions needed to be made to the lzma1505/C/Util/7z/makefile.gcc
I am unsure whether these changes are necessary because I run OS X Yosemite.

makefile.gcc.patch

--- makefile.gcc.old	2015-07-16 18:18:19.000000000 -0400
+++ makefile.gcc	2015-07-16 18:18:27.000000000 -0400
@@ -4,13 +4,17 @@ LIB =
 RM = rm -f
 CFLAGS = -c -O2 -Wall
 
-OBJS = 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o
+OBJS = BraIA64.o Delta.o 7zMain.o 7zAlloc.o 7zArcIn.o 7zBuf.o 7zBuf2.o 7zCrc.o 7zCrcOpt.o 7zDec.o CpuArch.o LzmaDec.o Lzma2Dec.o Bra.o Bra86.o Bcj2.o Ppmd7.o Ppmd7Dec.o 7zFile.o 7zStream.o
 
 all: $(PROG)
 
 $(PROG): $(OBJS)
 	$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB)
 
+BraIA64.o: ../../BraIA64.c
+	$(CXX) $(CFLAGS) ../../BraIA64.c
+Delta.o: ../../Delta.c
+	$(CXX) $(CFLAGS) ../../Delta.c
 7zMain.o: 7zMain.c
 	$(CXX) $(CFLAGS) 7zMain.c

We can first inspect the archive for SPC files. If there’s none, don’t load. Then perform similar RSN/RAR duties. (RSN/RAR should perform similar safety check).

Part II

OK 7z support is implemented. In hindsight, additional functionality to 7zDec was required — ability to specify an output directory — and also NFD (NativeFileDialog) had a bug where file extensions < 3 chars were not parsing correctly. That was fixed 🙂 , although no pull request was submitted, I did submit an issue with an explanation and clear solution. Relevant links:

NFD < 3 char file extension bugfix:

Add ability for 7zDec to output extraction to a separate directory

[debugger] Add support for 7z archives loading

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s