TLeonardUK / ZombieGrinder

Zombie Grinder
6 stars 6 forks source link

Correct usage of Builder #3

Open AntonioCS opened 2 years ago

AntonioCS commented 2 years ago

Hey,

So I believe I have everything working ok with the Builder (https://github.com/AntonioCS/ZombieGrinder/tree/master/Source/Builder) It compiles and produces the Builder.exe but when I run it I get the following:

Builder.exe -package ../../../Data/Base/Base.xml -build_cpp_script_interfaces
[00:00:00:000, 0, 0.0mb] Initialising platform singleton.
[00:00:00:000, 0, 0.0mb] --------------------------------------------------------------------------------------
[00:00:00:000, 0, 0.0mb]  XGE Debug              Version 1, Built 1/1/1 1:1
[00:00:00:000, 0, 0.0mb]  Asset Builder
[00:00:00:000, 0, 0.0mb] --------------------------------------------------------------------------------------
[00:00:00:000, 0, 0.0mb]  Copyright (C) 2013-2014 TwinDrills
[00:00:00:000, 0, 0.0mb] --------------------------------------------------------------------------------------
[00:00:00:000, 0, 0.0mb] Setting error mode mask.
[00:00:00:016, 0, 0.0mb] Installing debug symbols.
[00:00:00:016, 0, 0.0mb] Installing unhandled exception filter.
[00:00:00:016, 0, 0.0mb] Instantiating factories.
[00:00:00:016, 0, 0.0mb] Seeding random to 0x1f9b7b8e
[00:00:00:016, 0, 0.0mb] Creating setjmp handle for error recovery.
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb] Command Line Usage:
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Create <Mod_Name>
[00:00:00:016, 0, 0.0mb]                Creates a new mod package with the given name. Will be created under the Data directory in a folder with the packages name.
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Delete <Mod_Name>
[00:00:00:016, 0, 0.0mb]                Deletes a mod package with the given name. Be careful this will erase the mods folder and everything in it!
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Build <Mod_Name>
[00:00:00:016, 0, 0.0mb]                Builds a distributable package file for the mod. Only build mods will be loaded by the game.
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Rebuild <Mod_Name>
[00:00:00:016, 0, 0.0mb]                Rebuilds a distributable package file for the mod. Only build mods will be loaded by the game. This differs from Build as it forces a rebuild of every resources, not just an incremental build. Slow!
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Extract <Mod_Name>
[00:00:00:016, 0, 0.0mb]                Extracts all the resources held in a package. Will not overwrite existing files. This is only possible with mods that keep their sources files intact (using the pak_keep_source flag in the manifest file).
[00:00:00:016, 0, 0.0mb]
[00:00:00:016, 0, 0.0mb]        Builder Upload <Mod_Name> <Change_Note>
[00:00:00:016, 0, 0.0mb]                Uploads the mod to the steam workshop so other users can download it. Make sure you package is signed before you do this, or everyone who uses your mod will have their games restricted!
[00:00:00:031, 0, 0.0mb]
[00:00:00:031, 0, 0.0mb] gl;hf
[00:00:00:031, 0, 0.0mb]

There is not mention of the flags I passed in the usage output but I copied the flags from the .bat file https://github.com/AntonioCS/ZombieGrinder/blob/master/Tools/build_data.bat I also tried without -build_cpp_script_interfaces and got the same thing.

I can try and go over the code, but is it possible to just have an idea of what exactly is the output? What will the builder do with the files specified in the xml.

Thanks!

AntonioCS commented 2 years ago

Well... I followed the command line usage and after some trial and error I went with this command:

Builder.exe build Base

I didn't specify the relative path to the Base folder, as I believe this is being passed in some options file It did give me an error due to a missing sound file in Sounds.xml:

<sound name="sfx_objects_pickups_bag_pickup0"                         group="pickup" looping="False" streaming="False" file="Data/Audio/Sounds/Objects/Pickups/bag_pickup0.wav" />

The bag_pickup0.wav file doesn't exist but bag_pickup.wav does (and it's the line above this one. I re ran the command and after a lot of output I got this:

image

In the command line I got this:

[00:01:53:312, 0, 0.0mb] ~~~~~~~~~~~~ UNHANDLED EXCEPTION OCCURRED ~~~~~~~~~~~
[00:01:53:312, 0, 0.0mb] Attempt to create dump file ...
[00:01:53:312, 0, 0.0mb] Path: D:\Projects\Personal\cpp\Games\ZombieGrinder\Binary\Builder\Debug\.crashes\3.dmp
[00:01:53:609, 0, 0.0mb] Success!
[00:01:53:609, 0, 0.0mb]
[00:01:53:609, 0, 0.0mb] Call Stack:
[00:01:53:687, 0, 0.0mb] [0] <unknown> (0): RaiseException
[00:01:53:687, 0, 0.0mb] [1] <unknown> (0): CxxThrowException
[00:01:53:687, 0, 0.0mb] [2] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\asn.h (49): CryptoPP::BERDecodeError
[00:01:53:687, 0, 0.0mb] [3] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\asn.cpp (394): CryptoPP::BERGeneralDecoder::Init
[00:01:53:687, 0, 0.0mb] [4] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\asn.cpp (380): CryptoPP::BERGeneralDecoder::BERGeneralDecoder
[00:01:53:687, 0, 0.0mb] [5] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\asn.h (181): CryptoPP::BERSequenceDecoder::BERSequenceDecoder
[00:01:53:687, 0, 0.0mb] [6] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\asn.cpp (549): CryptoPP::PKCS8PrivateKey::BERDecode
[00:01:53:687, 0, 0.0mb] [7] D:\Projects\Personal\cpp\Games\ZombieGrinder\ThirdParty\cryptocpp\rsa.h (66): CryptoPP::InvertibleRSAFunction::BERDecode
AntonioCS commented 2 years ago

Seems this is to due with the private keys. All goes crazy at this line:

CryptoStream* crypto_stream = new CryptoStream(CryptoStreamMode::Sign, m_private_key);

which is here: https://github.com/AntonioCS/ZombieGrinder/blob/master/Source/Engine/Resources/PackageFile.cpp#L614

I'll try skipping this somehow.

AntonioCS commented 2 years ago

Yeap, that was the issue. I changed this:

    m_package_file.Set_Keys(m_private_key, CryptoKey::Empty);

to

    m_package_file.Set_Keys(CryptoKey::Empty, CryptoKey::Empty);

and it seems to have worked. I now have a Base.dat in Data\Base folder and it's 121mb in size