mpqcli version
0.10.0
Host OS
Linux
Installation method
Prebuilt binary
mpqcli command
mpqcli add --game starcraft1 --update --overwrite temp.mpq mpq
Expected behaviour
I'm downgrading the Starcraft mod Cosmonarchy to a previous version, that deletes some files in mpq dir and modifies others.
I'm checking git diff to see which files have been touched.
If I delete everything from that diff list, then mpqcli add will only have to add and things are working well.
If I delete only files with a D marker and let the M files being overwritten, then the mod errors.
Actual behaviour / error output
Screenshot above:
"Data File Error"
The problem occured while trying to load a file
> unit\
> File not found.
Additional context
You may install Cosmonarchy using the Fraud Launcher with a Wine wrapper. I like to use Faugus Launcher for that. There is more than one way to do it, so let me know if you need more info.
update_mpq() {
target=${1:-origin/HEAD}
mpq=${2:-temp.mpq}
dir=${3:-mpq}
git fetch # in case target is origin/HEAD
# this part uses tempfiles to make it easier to understand
# pipes can be used instead:
#git diff --name-status "HEAD..$target" | grep '^[DR]' | cut -f2 | grep "^$dir" | sed "s,$dir,," | tr / \\\\ | mpqcli remove "$mpq" -
git diff --name-status "HEAD..$target" > gitdiff1.txt # list of diff files with status
grep '^[DR]' gitdiff1.txt > gitdiff2.txt # get Deleted and Renamed files only
cut -f2 gitdiff2.txt > gitdiff3.txt # get current path to file
grep "^${dir%/}/" gitdiff3.txt > gitdiff4.txt # get files only from the mpq dir
sed "s,${dir%/}/,," gitdiff4.txt > gitdiff5.txt # remove mpq dir from path
tr / \\\\ < gitdiff5.txt > gitdiff6.txt # "unix2dos" slash 2 backslash
mpqcli remove "$mpq" - < gitdiff6.txt
#rm gitdiff*.txt # remove tempfiles or keep as logs
git restore . # making sure switch will not complain
git switch --detach "$target" # checking out files from target commit
mpqcli add -g sc --update --overwrite "$mpq" "$dir" | grep -v ^.~ # hide [~] messages
if [[ $? -ne 0 ]]; then # if mpqcli add failed is probably because archive needs to be created first
mpqcli create --game starcraft1 --output "$mpq" "$dir" | grep -v ^.+ # hide [+] messages
fi
}
COSMONARCHY=~/Faugus/default/drive_c/Cosmonarchy # Make sure you modify this according to your setup
UPGRADE=dc02de47bef61e82f7cbe7e17255ab4c7ee6b877
DOWNGRADE=f1ff5a71017a9498ac5d2b5a5df0ace78400b9bd
# Assuming you are doing this in a Wine prefix with StarCraft 1.16.1 already installed
# If not, download and unzip the following, then update the registry using the .bat file included
# https://mikamika.top/cm/dl/bw-lite.zip
mkdir -p "$COSMONARCHY"
git clone --filter=blob:none --no-checkout https://gitlab.com/the-no-frauds-club/cosmonarchy-bw-prerelease.git "$COSMONARCHY/Prerelease"
cd "$COSMONARCHY/Prerelease" || exit
# The following will create the archive since it does not exist yet
update_mpq $UPGRADE
# Launching the mod now would work fine
update_mpq $DOWNGRADE
# Launching after a downgrade would error
update_mpq $UPGRADE
# Going back to when the archive was created will work again
# Now let's try the opposite
rm temp.mpq
# Create an older archive works
update_mpq $DOWNGRADE
# Update it with newer version works
update_mpq $UPGRADE
# Downgrade back to when created works too
update_mpq $DOWNGRADE
I mentioned that deleting all files and then adding them instead of overwriting would work.
You can change the code above from grep '^[DR]' to grep '^[DRM]' to delete those Modified files and fix the script. Doing UPGRADE -> DOWNGRADE would work that way, but I'm highlighting the problem with --overwrite that I do not quite understand, only that it's giving different result.
Sorry again for a lengthy report. I hope the example will be clear enough. Thanks!
mpqcli version
0.10.0
Host OS
Linux
Installation method
Prebuilt binary
mpqcli command
mpqcli add --game starcraft1 --update --overwrite temp.mpq mpq
Expected behaviour
I'm downgrading the Starcraft mod Cosmonarchy to a previous version, that deletes some files in mpq dir and modifies others.
I'm checking git diff to see which files have been touched.
If I delete everything from that diff list, then
mpqcli addwill only have to add and things are working well.If I delete only files with a D marker and let the M files being overwritten, then the mod errors.
Actual behaviour / error output
Additional context
You may install Cosmonarchy using the Fraud Launcher with a Wine wrapper. I like to use Faugus Launcher for that. There is more than one way to do it, so let me know if you need more info.
I mentioned that deleting all files and then adding them instead of overwriting would work.
You can change the code above from
grep '^[DR]'togrep '^[DRM]'to delete those Modified files and fix the script. Doing UPGRADE -> DOWNGRADE would work that way, but I'm highlighting the problem with--overwritethat I do not quite understand, only that it's giving different result.Sorry again for a lengthy report. I hope the example will be clear enough. Thanks!