Compare commits

...

9 Commits

Author SHA1 Message Date
Amazed dba56f2c62 wrong build again...
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-14 01:10:12 +01:00
Amazed 22e5b5898e added README and more docs
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 23:38:01 +01:00
Amazed ac388c97c1 pls work 2
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 23:17:16 +01:00
Amazed 62fed4bd73 pls work
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 23:05:01 +01:00
Amazed 3fa9738951 fix?
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 22:53:55 +01:00
Amazed 4301e68d3f trying with pyside2
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 22:41:57 +01:00
Amazed 7fb4a4c7db retry with latest version, on build machine
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build was killed Details
2022-01-12 16:10:55 +01:00
Amazed ee9e1593e1 attempt to build with pyinstaller 4.6 to prevent virus false positive detection
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 14:35:29 +01:00
Amazed bc9d67a88e added buildbot
continuous-integration/drone/push Build encountered an error Details
continuous-integration/drone Build was killed Details
continuous-integration/drone/tag Build is passing Details
2022-01-12 12:39:29 +01:00
8 changed files with 53 additions and 26 deletions

2
.drone.yml Normal file
View File

@ -0,0 +1,2 @@
kind: template
load: python-gui.starlark

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# Giants Wdefs Importer
This tool was created to simplify the process of importing custom Wdefs for Giants 1.502.1.
![Image](readme-img/screenshot.png)
## What it does
This tool:
1. Creates a backup of your game.
2. Downloads the requested wdefs file.
3. Modifies GiantsMain.exe to overwrite the expected CRC value (the game won't load if there is a CRC mismatch).
4. Starts modded Giants.
5. Reverts everything to original state after Giants is closed.
## Where to find modded wdefs?
[Check our Discord server](https://discord.gg/Avj4azU)
## What about cheaters?
Starting 1.497, Giants features a built-in anti-cheat. It works by automatically detecting mismatching clients and kicking them if they don't use the same environment as the server.

View File

@ -1,4 +1,4 @@
#!/bin/bash
for ui in *.ui; do
pyside6-uic $ui > ${ui%.*}.py
pyside2-uic $ui > ${ui%.*}.py
done

14
main.py
View File

@ -6,8 +6,8 @@ from pathlib import Path
import shutil
import zlib
import requests
from PySide6.QtCore import QProcess
from PySide6.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QPushButton
from PySide2.QtCore import QProcess
from PySide2.QtWidgets import QApplication, QMainWindow, QFileDialog, QMessageBox, QPushButton
from mainwindow import Ui_MainWindow
@ -87,6 +87,8 @@ def start_giants_with_wdefs_bytes(wdefs_bytes: bytes, wdefs_path: Path, giantsma
if sys.platform == "win32":
process.start(str(giantsmain_path), ["-launcher"])
else:
# Linux only works for me because of this hardcoded value
# if you want to use my tool, feel free to create a PR to make these values parameterized
process.start("/home/tasty/.local/share/lutris/runners/wine/lutris-6.0-x86_64/bin/wine", ["/home/tasty/Jeux/Giants Citizen Kabuto1.498/GiantsMain.exe", "-window", "-launcher"])
@ -100,7 +102,6 @@ def backup_file(file_path: Path) -> None:
# copy and append _original to filename
# if file already exists, skip
dst = str(file_path.parent / file_path.stem) + "_original" + file_path.suffix
print(dst)
if os.path.exists(dst):
return
shutil.copy(file_path, dst)
@ -155,7 +156,7 @@ def new_exe_bytes(wdefs_bytes: bytes, giantsmain_path: Path) -> bytes:
index = content.find(CHECKSUM_1_502_0_1)
if index < 0:
raise Exception("Could not find wdefs checksum in embedded GiantsMain.exe. Report this to Amazed#0001")
raise Exception("Could not find wdefs checksum in embedded GiantsMain.exe. If you are 100% sure this is unmodded Giants 1.502.1 please report this to Amazed#0001 on Discord or create an issue on the Git project.")
else:
content = bytearray(content)
wdefs_crc = struct.pack("<L", crc(wdefs_bytes))
@ -169,6 +170,9 @@ if __name__ == "__main__":
try:
window = MainWindow()
window.show()
sys.exit(app.exec())
sys.exit(app.exec_())
except SystemExit:
sys.exit(0)
except:
traceback.print_exc()
sys.exit(1)

View File

@ -12,7 +12,7 @@ a = Analysis(['main.py'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=['PySide6.QtQml'],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
@ -21,20 +21,24 @@ pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
a.scripts,
[],
exclude_binaries=True,
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
console=True,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None , icon='icon.ico')
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='main')

View File

@ -3,21 +3,15 @@
################################################################################
## Form generated from reading UI file 'mainwindow.ui'
##
## Created by: Qt User Interface Compiler version 6.2.2
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QApplication, QGridLayout, QLabel, QLineEdit,
QMainWindow, QMenuBar, QPushButton, QSizePolicy,
QWidget)
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
@ -39,6 +33,7 @@ class Ui_MainWindow(object):
self.pushButton = QPushButton(self.gridLayoutWidget)
self.pushButton.setObjectName(u"pushButton")
self.pushButton.setEnabled(False)
self.gridLayout.addWidget(self.pushButton, 0, 2, 1, 1)

BIN
readme-img/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -1,3 +1,3 @@
PySide6
PySide2
pyinstaller
requests