midway-arcade-origins-extract.sh cant find offzip?
I've wanted to use this script to extract files from my 360 digital copy with "midway-arcade-origins-extract.sh", but in my efforts it always just tells me,
Please compile and place the offzip program in the current directory, alongside your SR files.
offzip can be downloaded from: http://aluigi.altervista.org/mytoolz/offzip.zip
I've already followed the link and extracted its contents to the game folder with all the .SR files, but it insists that offzip isn't in there. I don't know if I'm supposed to compile it if it already has a .exe for offzip that seems like it should work already, or if what i downloaded isn't actually fully compiled so i have to somehow compile it myself (which never fucking works lmao), or there's something obscenely simple I missed that reflects my awful proficiency with instructions. This specific script has little documentation itself, not even a wiki entry or guide to run it, so if anyone can help to explain or help me out, that would be huge. You have NO idea how frustrating it is to figure out some of these niche scripts by myself.
Edit: forgot to mention this is on windows running the script with wsl. If this is due to offzip having to also be the linux version and THATS why it has to be compiled, I'ma be M A D. If so, please tell me how to get the linux version proper, because I can barely find any documentation on offzip's source code or even if anyone has compiled it.
I think I had encountered the same issue as I also didn't know how to compile offzip. If I remember correctly, I used Ubuntu and installed Wine, which allows you to run Windows executables in Linux without having to compile the C code (I do think someone posted how to compile offzip somewhere).
I then commented out the check for offzip in the following code, and updated the calls to offzip to point to the Windows offzip.exe file
https://github.com/farmerbb/RED-Project/blob/master/ROM%20Extraction/decompress-sr-files.sh
Hopefully that will point you in the right direction. I believe I still have my modified shell scripts somewhere which I can dig out if required.
Hopefully that will point you in the right direction. I believe i still have my modified shell scripts somewhere which I can dig out if required.
Yea, if you can link that modified script, that would be awesome. I don’t know how to properly comment out the check or replace the calls myself, so I absolutely would want to see that script so I can finally be done with this adventure of mine…
I am new to Linux, and obviously none of this code is mine, but hopefully this will help.
An inline comment in Linux is a line that has a "#" at the beginning, and stops any code after the # in the line from running. So in the code below I commented out the check that looks for the installation of offzip and which stops the program from running if it can't be found. To change the way we run offzip from the compiled version to the Windows version, just replace ./offzip with wine offzip.exe.
So, when I installed Ubuntu, this created a file structure that I could view in File Explorer in Windows:
-
Inside the "home" folder will be your username. Inside your username folder, create a folder e.g. MidwaySRFiles.
-
Copy all the .SR Files that you've extracted from Midway Arcade Origins into MidwaySRFiles. Also copy "midway-arcade-origins-extract.sh", "decompress-sr-files.sh" and "offzip.exe" into MidwaySRFiles. Your folder should look something like this:
- Open up "decompress-sr-files.sh" in a text editor, replace it all with the following, then save. I've included all of farmerbb's code here for ease of comparison (thanks for the script by the way), but all that has been changed is that the check for offzip has been commented out, which would have exited the program early, and I've also changed how offzip.exe is called, by using "wine offzip.exe" instead:
#!/bin/bash
#Check for offzip removed
#[[ ! -f offzip ]] && \
# echo "Please compile and place the offzip program in the current directory, alongside your SR files." && \
# echo "offzip can be downloaded from: http://aluigi.altervista.org/mytoolz/offzip.zip" && \
# exit 1
#chmod +x ./offzip
for i in *.SR *.sr; do
[[ ! -f $i ]] && continue
echo "Decompressing $i..."
DIR=$(echo $i | sed -e "s/.SR//" -e "s/.sr//")
mkdir -p $DIR
rm -rf $DIR/*
NUM_OF_ENTRIES=$(strings $i | head -n1 | cut -d' ' -f1)
INITIAL_OFFSET=$(strings $i | head -n1 | cut -d' ' -f3)
FILENAMES=($(strings $i | tail -n +2 | head -n $NUM_OF_ENTRIES | awk '{$1=$1};1' | cut -d' ' -f6))
OFFSETS=($(strings $i | tail -n +2 | head -n $NUM_OF_ENTRIES | awk '{$1=$1};1' | cut -d' ' -f1))
SIZES=($(strings $i | tail -n +2 | head -n $NUM_OF_ENTRIES | awk '{$1=$1};1' | cut -d' ' -f2))
for n in $(seq 0 $(($NUM_OF_ENTRIES - 1))); do
dd if=$i of=$DIR/${FILENAMES[$n]} skip=$(($INITIAL_OFFSET + ${OFFSETS[$n]})) count=${SIZES[$n]} status=none iflag=skip_bytes,count_bytes
done
for ext in qz QZ; do
[[ -n "$(find $DIR -maxdepth 1 -type f -name "*.$ext" -print -quit)" ]] || continue
for qz in $(ls -1 $DIR/*.$ext); do
#Changed how offzip is called
wine offzip.exe -Q -o -a $qz $DIR 0 > /dev/null
mv $DIR/00000004.* $(echo $qz | sed "s/.$ext//") >/dev/null 2>&1 && rm $qz
done
done
done
- Now open up a Ubuntu terminal, and navigate to the Ubuntu\home[username]\MidwaySRFiles folder that has been created e.g.
cd MidwaySRFiles
- If you haven't already, install Wine onto Ubuntu as this will allow you to run Windows executables. I'm a bit hazy on the installation, but it's something along the lines of
sudo apt install wine64 for 64 bit machines or sudo apt install wine32 for 32 bit machines.
You may need to run sudo apt update first.
You can check it has installed by running
wine --version
My version was 6.0.3 but this may be out of date.
-
Give "midway-arcade-origins-extract.sh" executable permissions by running
chmod +x midway-arcade-origins-extract.sh -
Lastly, run the shell by using
./midway-arcade-origins-extract.sh. The zip files should now hopefully appear in the MidwaySRFiles folder.
Hope this helps!
Oh my god, that worked! I had to do some modifications so wine would work and installed binutils, but it works! Most of the games work through RetroArch! Thank you so much!
Awesome - no problem at all!
I found the script which might help with compiling offzip. If you look at line 15 here it gives a command to compile files, so hopefully using something like that should work if you need to use it in the future. Thanks lioneltrs for adding in the compile instructions:
https://github.com/lioneltrs/goNCommand/blob/main/goMS4h
I think the PS2 (and probably the XBOX and PC) arcade collections from Midway use the .SR compression. Maybe this script can be modified to to work on those as well.