Skip to content

Instantly share code, notes, and snippets.

@AAGaming00
Created December 25, 2022 17:36
Show Gist options
  • Save AAGaming00/e9c926ccf2ac939834bdd9965c09d7d1 to your computer and use it in GitHub Desktop.
Save AAGaming00/e9c926ccf2ac939834bdd9965c09d7d1 to your computer and use it in GitHub Desktop.
fix crosscode linux
#!/bin/sh
STEAMWORKS_FILE=steamworks_sdk_153a.zip
STEAMWORKS_URL=https://partner.steamgames.com/downloads/$STEAMWORKS_FILE
GREENWORKS_DIR=assets/modules/greenworks-nw-0.35/linux64
if [ ! -f $STEAMWORKS_FILE ];then
echo "Please download the Steamworks SDK from $STEAMWORKS_URL and place it in this directory. By downloading the Steamworks SDK, you are agreeing to the Steamworks SDK Access Agreement found at https://partner.steamgames.com/documentation/sdk_access_agreement"
exit 1
fi
cat > ./findVersion.js <<- EOF
console.log("ABIVERSION:" + process.versions.modules);
nw.App.quit();
EOF
mv $GREENWORKS_DIR/greenworks-linux64.node.old $GREENWORKS_DIR/greenworks-linux64.node
mv $GREENWORKS_DIR/libsteam_api.so.old $GREENWORKS_DIR/libsteam_api.so
mv $GREENWORKS_DIR/libsdkencryptedappticket.so.old $GREENWORKS_DIR/libsdkencryptedappticket.so
mv ./package.json ./package.json.bak
cat > ./package.json <<- EOF
{
"name": "CrossCode",
"version" : "1.0.0",
"main": "findVersion.js",
"chromium-args" : "--ignore-gpu-blacklist --ignore-gpu-blocklist --disable-direct-composition --disable-background-networking --in-process-gpu --disable-features=Vulkan --disable-transparency --password-store=basic"
}
EOF
VERSION=$(./CrossCode --enable-logging=stderr 2>&1 | grep -oP ".*ABIVERSION:\K\d*")
mv ./package.json.bak ./package.json
rm ./findVersion.js
echo Found NW.js ABI version $VERSION
URL=https://github.com/ElectronForConstruct/greenworks-prebuilds/releases/download/v0.6.0/greenworks-nw.js-v$VERSION-linux-x64.node
echo Downloading Greenworks from $URL
curl -L $URL -o ./greenworks-linux64.node
echo Replacing Greenworks
mv $GREENWORKS_DIR/greenworks-linux64.node $GREENWORKS_DIR/greenworks-linux64.node.old
mv $GREENWORKS_DIR/libsteam_api.so $GREENWORKS_DIR/libsteam_api.so.old
mv $GREENWORKS_DIR/libsdkencryptedappticket.so $GREENWORKS_DIR/libsdkencryptedappticket.so.old
mv greenworks-linux64.node $GREENWORKS_DIR/greenworks-linux64.node
echo Replacing Steamworks
unzip -d $GREENWORKS_DIR -j $STEAMWORKS_FILE sdk/redistributable_bin/linux64/libsteam_api.so sdk/public/steam/lib/linux64/libsdkencryptedappticket.so
# rm $STEAMWORKS_FILE
echo Done! Your achievements should work now!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment