fix grep for non-existent user_settings and add versioning; install via bash instead of C++

This commit is contained in:
Kent Slaney 2024-06-12 21:35:04 -07:00
parent 06224911b5
commit 4df11774cd
2 changed files with 13 additions and 102 deletions

View file

@ -95,32 +95,6 @@ build() {
"$patches/DllInjector.cpp" \
"$srcdir/main.cpp" -o "$srcdir/inject.exe"
fi
# make bakkesmod folder to expand release into and output RL version
cat <<" EOF" > "$srcdir/status.cpp"
#include "BakkesModInstallation.h"
#include <iostream>
int wmain(int argc, wchar_t* argv[]) {
BakkesModInstallation installer;
installer.CreateAppDataFolderIfDoesntExist();
std::cout << installer.GetSteamVersion();
return 0;
}
EOF
if [ -f "$srcdir/status.exe" ]; then
echo "reusing existing status.exe"
else
# too many finicky changes to patch robustly
patch -p0 -N -d "$ref" < "$srcdir/installer.diff" || true
# -luser32 for FOLDERID and -lole for CoTaskMemFree
x86_64-w64-mingw32-g++ "${CXX_FLAGS[@]}" "${CXX_LD[@]}" \
"$patches/WindowsUtils.cpp" \
"$ref/BakkesModInjectorC++/SettingsManager.cpp" \
"$ref/BakkesModInjectorC++/BakkesModInstallation.cpp" \
-luser32 -lole32 "$srcdir/status.cpp" -o "$srcdir/status.exe"
fi
}
package() {
@ -140,25 +114,33 @@ package() {
WINEFSYNC=1 WINEPREFIX="$compat/pfx/" "$proton/bin/wine64" "$@"
EOF
chmod a+x "$srcdir/runner.sh"
RL_version=`"$srcdir/runner.sh" "$srcdir/status.exe" 2>/dev/null`
mkdir -p "$bm_pfx"
RL_version=`grep buildid "$HOME/.steam/steam/steamapps/appmanifest_252950.acf" | sed 's%[^0-9]%%g'`
echo "build version string: $RL_version-$( cat "$srcdir/version.txt" )-$pkgver-$pkgrel"
# expand and patch dll (capitalization changes between latest and explicit version)
compressed=`find "$srcdir" -name "[bB]akkes[Mm]od.zip"`
unzip -oq "$compressed" -d "$bm_pfx/bakkesmod"
# by default, starts with bakkesmod.dll and outputs bakkesmod_promptless.dll
#echo -n "shunted file addresses for DLL patch: "
python "$srcdir/dll_patch.py" "$bm_pfx/bakkesmod/dll" > /dev/null
echo -n "shunted file addresses for DLL patch: "
python "$srcdir/dll_patch.py" "$bm_pfx/bakkesmod/dll"
cp -f "$srcdir/inject.exe" "$srcdir/status.exe" "$bm_pfx"
cp -f "$srcdir/inject.exe" "$bm_pfx"
cp -f "$srcdir/runner.sh" "$srcdir/dll_patch.py" "$bm_pfx"
#echo "direct injection command:" "$bm_pfx/runner.sh $bm_pfx/inject.exe"
echo "direct injection command:" "$bm_pfx/runner.sh $bm_pfx/inject.exe"
cp -f "$srcdir/settings_252950_bakkes.py" "$proton/.."
loader="$srcdir/bakkesmod-steam-user-settings.py"
conf="$proton/../user_settings.py"
sig=`sha256sum "$loader" | sed "s% *[^ ]*$%%"`
others=`grep '^### \+overlaps \+[0-9a-fA-F]\{64\}\( \|$\)' "$loader" | sed 's%^\([^ ]\+ \+\)\{2\}\([^ ]\+\).*%\2%'`
touch "$conf"
matches=`echo $others | xargs -I % grep % "$conf"`
if [ ! -z "${matches}" ]; then
echo "found overlapping user_settings.py setup, aborting"
exit 1
fi
if ! grep "$sig" "$conf" > /dev/null; then
echo "### $sig $( basename "$loader" )" >> "$conf"
cat "$srcdir/bakkesmod-steam-user-settings.py" >> "$conf"

View file

@ -1,71 +0,0 @@
diff --git BakkesModInjectorC++/BakkesModInstallation.cpp BakkesModInjectorC++/BakkesModInstallation.cpp
index df34c31..e7fe871 100644
--- BakkesModInjectorC++/BakkesModInstallation.cpp
+++ BakkesModInjectorC++/BakkesModInstallation.cpp
@@ -1,8 +1,8 @@
#include "BakkesModInstallation.h"
#include <fstream>
#include <string>
-#include <QtWidgets/qfiledialog.h>
-#include <QtWidgets/qmessagebox.h>
+//#include <QtWidgets/qfiledialog.h>
+//#include <QtWidgets/qmessagebox.h>
#include <fstream>
#include <sstream>
#include "logger.h"
@@ -11,6 +11,8 @@
#include <shlobj_core.h>
#include "json.hpp"
//std::string BakkesModInstallation::overrideBakkesModFolder = "";
+#include <initguid.h>
+#include <knownfolders.h>
void BakkesModInstallation::resetBMFolder()
{
@@ -465,7 +467,7 @@ std::vector<std::string> BakkesModInstallation::GetEpicVersion()
try
{
- js = json::parse(std::ifstream(p));
+ js = json::parse(std::ifstream(p.path()));
}
catch (...)
{
@@ -520,7 +522,7 @@ std::vector<std::string> BakkesModInstallation::GetEpicVersion()
LOG_LINE_W(INFO, L"FOUND MANIFEST (Legendary) " << p.path().wstring());
try
{
- js = json::parse(std::ifstream(p));
+ js = json::parse(std::ifstream(p.path()));
}
catch (...)
{
diff --git BakkesModInjectorC++/BakkesModInstallation.h BakkesModInjectorC++/BakkesModInstallation.h
index aa340ef..0742429 100644
--- BakkesModInjectorC++/BakkesModInstallation.h
+++ BakkesModInjectorC++/BakkesModInstallation.h
@@ -2,9 +2,9 @@
#include "stdafx.h"
#include "windowsutils.h"
#include "SettingsManager.h"
-#include <QTWidgets/qwidget.h>
+//#include <QTWidgets/qwidget.h>
#include <filesystem>
-class BakkesModInstallation : public QWidget
+class BakkesModInstallation //: public QWidget
{
private:
std::filesystem::path bakkesModFolder = "";
diff --git BakkesModInjectorC++/vdf_parser.h BakkesModInjectorC++/vdf_parser.h
index ed31ccf..95acf88 100644
--- BakkesModInjectorC++/vdf_parser.h
+++ BakkesModInjectorC++/vdf_parser.h
@@ -111,7 +111,7 @@ namespace tyti
inline std::string string_converter(const std::wstring& w)
{
-#if WIN32
+#ifdef WIN32
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conv1;
#else
std::wstring_convert<std::codecvt_utf8<wchar_t>> conv1;