added README and more docs
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
Amazed 2022-01-12 23:38:01 +01:00
parent ac388c97c1
commit 22e5b5898e
3 changed files with 25 additions and 2 deletions

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

@ -87,6 +87,8 @@ def start_giants_with_wdefs_bytes(wdefs_bytes: bytes, wdefs_path: Path, giantsma
if sys.platform == "win32": if sys.platform == "win32":
process.start(str(giantsmain_path), ["-launcher"]) process.start(str(giantsmain_path), ["-launcher"])
else: 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"]) 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 # copy and append _original to filename
# if file already exists, skip # if file already exists, skip
dst = str(file_path.parent / file_path.stem) + "_original" + file_path.suffix dst = str(file_path.parent / file_path.stem) + "_original" + file_path.suffix
print(dst)
if os.path.exists(dst): if os.path.exists(dst):
return return
shutil.copy(file_path, dst) 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) index = content.find(CHECKSUM_1_502_0_1)
if index < 0: 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: else:
content = bytearray(content) content = bytearray(content)
wdefs_crc = struct.pack("<L", crc(wdefs_bytes)) wdefs_crc = struct.pack("<L", crc(wdefs_bytes))

BIN
readme-img/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB