saf extractor

Post anything about MX Simulator here. Please. I'm begging you.
WellsMX524
Posts: 2106
Joined: Sun Feb 05, 2012 7:23 am
Team: Aspect Visual Co.
Location: Illinois/Wisconsin

Re: saf extractor

Post by WellsMX524 »

MX PRODIGY 17 wrote:It's funny cause it's JLV
gd1911
Crushed Dissenter
Posts: 153
Joined: Tue Sep 24, 2013 7:30 pm

Re: saf extractor

Post by gd1911 »

jlv wrote:Here you go:

Code: Select all

#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
	shift
	find "$@" -maxdepth 0 -printf '%s %p\n'
	echo -
	cat "$@"
elif test "_$1_" = _x_
then
	shift
	count=0

	while read size name && test "_${size##[^0-9]}_" = "_${size}_"
	do
		sizes[count]=$((size))
		names[count]=${name}
		count=$((count+1))
	done

	if test "_${size}_" != "_-_"
	then
		echo "Bad dir"
		exit
	fi

	i=0
	while let 'i<count'
	do
		echo ${names[i]} ${sizes[i]}
		if test "_${names[i]##*/}_" != "_${names[i]}_"
		then
			install -d "${names[i]%/*}"
		fi
		dd bs=${sizes[i]} count=1 >"${names[i]}" 2>/dev/null
		i=$((i+1))
	done

else
	echo "To create an archive use: saf.sf c files..."
	echo "To extract an archive use: saf.sf x"
fi
Image
I am not designed to come second or third. I am designed to win. - Ayrton Senna
wheels1758
Posts: 4132
Joined: Tue Oct 21, 2008 5:20 pm
Location: Washington, USA
Contact:

Re: saf extractor

Post by wheels1758 »

jlv wrote:If you don't use Linux then FU!
isacult
Posts: 305
Joined: Sun May 27, 2012 10:34 pm
Team: BakerMX.com
Location: Charlotte, NC
Contact:

Re: saf extractor

Post by isacult »

wheels1758 wrote:
jlv wrote:If you don't use Linux then FU!
Ooooh no Unix love.. just Linux..?
It is possible to run this in windows, with cygwin.

jlv I am jealous of your bash knowledge.
Justin Baker | BakerMX.com #51
Image
AWood wrote:WOOO BAKER
AWood wrote:Your excuses are about as shitty as mike Alessi on pulp MX show
jlv
Site Admin
Posts: 14912
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: saf extractor

Post by jlv »

There might be some line ending issues in Cygwin. If there's a way to force it to binary mode it should work fine.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
ty casey
Posts: 395
Joined: Tue Jul 30, 2013 7:29 pm
Team: OGP Racing

Re: saf extractor

Post by ty casey »

someone shoot me a link.
https://www.youtube.com/user/TC132MX
^^Subcribe to my channel^^
Image
byrd55621
Crushed Dissenter
Posts: 525
Joined: Sat Mar 07, 2015 6:41 pm
Team: Quality designs
Location: ohio
Contact:

Re: saf extractor

Post by byrd55621 »

Just search puremxs saf extracter
Do skins cheap!!!!
If you enjoy my content please donate https://www.paypal.me/ByrdGreen
Feel free to visit my facebook: https://www.facebook.com/556Designs/
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: saf extractor

Post by Wahlamt »

ty casey wrote:someone shoot me a link.
You have the code on page 1, why would you need a link?
ty casey
Posts: 395
Joined: Tue Jul 30, 2013 7:29 pm
Team: OGP Racing

Re: saf extractor

Post by ty casey »

how do i use it
https://www.youtube.com/user/TC132MX
^^Subcribe to my channel^^
Image
ty casey
Posts: 395
Joined: Tue Jul 30, 2013 7:29 pm
Team: OGP Racing

Re: saf extractor

Post by ty casey »

do i just turn that into a .exe?
https://www.youtube.com/user/TC132MX
^^Subcribe to my channel^^
Image
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: saf extractor

Post by Wahlamt »

Make it a shell script that you run.
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: saf extractor

Post by Wahlamt »

jlv wrote:Here you go:

[code]#!/bin/bash
#
# Simple Archive Format
#


#set -C

if test "_$1_" = _c_
then
shift
find "$@" -maxdepth 0 -printf '%s %p\n'
echo -
cat "$@"
elif test "_$1_" = _x_
then
shift
count=0

while read size name && test "_${size##[^0-9]}_" = "_${size}_"
do
sizes[count]=$((size))
names[count]=${name}
count=$((count+1))
done

if test "_${size}_" != "_-_"
then
echo "Bad dir"
exit
fi

i=0
while let 'i<count'
do
echo ${names} ${sizes}
if test "_${names##*/}_" != "_${names}_"
then
install -d "${names%/*}"
fi
dd bs=${sizes} count=1 >"${names}" 2>/dev/null
i=$((i+1))
done

else
echo "To create an archive use: saf.sf c files..."
echo "To extract an archive use: saf.sf x"
fi
[/code]

Sitting here doing this for fun. For some reason when I try to open an older .saf archive (from the old "needed object packs") I get the error message "Bad Dir" after trying:
./saf.sf x
NewTreespack.saf

Saf.sf is the script and NewTreespack.saf is what I am trying to open... Any clues?
jlv
Site Admin
Posts: 14912
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: saf extractor

Post by jlv »

You have to redirect the saf as the standard input:

./saf.sf x <NewTreespack.saf

Without the redirect op < it should have just hung waiting for input until you pressed ctrl-c or ctrl-d.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Wahlamt
Posts: 7934
Joined: Mon Sep 13, 2010 3:15 pm
Team: MLG Compton
Location: Sweden
Contact:

Re: saf extractor

Post by Wahlamt »

jlv wrote:You have to redirect the saf as the standard input:

./saf.sf x <NewTreespack.saf

Without the redirect op < it should have just hung waiting for input until you pressed ctrl-c or ctrl-d.
Thanks! That worked. I though the new line after "./saf.sf x" was enough to insert "NewTreespack.saf" on, but apparently it wasn't. Thanks again!
Edo
Posts: 12
Joined: Mon Jan 28, 2019 1:26 pm
Team: Privateer

Re: saf extractor

Post by Edo »

sorry, can anyone explain me how should i run it? i really can't get it :(
Post Reply