Ok, so the goal here is to modularize the code we use for writing assets to the exe and launching the game. In addition, we also want to write the new code to accept a proto instead of the old backend structures. This pull request creates a new library called
libAssetsto house this code.
One thing we should talk about is having output from
libAssets show in the IDE's output window. Because I didn't want to move any of the output/logging stuff from
libAssets has all of its logging code commented out. This is complicated by the fact that currently RGM is only reading output from
CompileReply which is populated from
EnigmaCallback. Since RGM links directly to
libAssets it would need to hook into its log methods directly somehow.
Summary of Changes
plugin_CompileEGMRawwhich functions the same as the old
plugin_CompileEGMexcept it doesn't write the asset data for sprites and sounds onto the exe. For that reason, it also doesn't launch the game when it finishes. I did it this way, because changing the signature of
plugin_CompileEGMwould break LateralGM binary compatibility, which we're not ready to do yet.
- Changed the signature of
EnigmaPlugin::BuildGameto accept the exe and project paths as well as a boolean controlling whether to write the assets. Because the method now accepts the project's file path, the
working_directoryin run and debug mode will be compatible with GM8 again. This is done because emake obviously needs to write the assets and sometimes launch the game, but the GRPC server only needs to build the game and leave these tasks up to the IDE.
- Added an overload for
EnigmaPlugin::BuildGamefor when the exe path is the same as the project path (e.g, empty game because there is no project file).
- Moved the
OptionsParserinstance from emake main to the global scope so that it can be accessed by
EnigmaPlugin::BuildGameto determine when the
--runoption has been specified.
- Removed emake's double linkage of
libEGMbecause I didn't see any reasoning for it and it may also have been bloating the size of it.
- Added linkage of
libAssetsto emake so it can use it to write assets to the game and launch the game.
- Disabled the code in
Proto2ESthat loads, converts, and compresses the data files for sounds, sprites, and backgrounds because it is no longer needed. Because
libAssetshas new code to write the assets, I changed the logic for it to do the loading.
libAssetswith a makefile and a CMakeLists so it can be built in MSYS2 and by RGM's AppVeyor. It contains a new method
game_write_assetswhich is based on Josh's code I extracted from
CompilerSourcebut it's slightly different in that it accepts the new proto instead of the old EnigmaStruct. The library also has a
game_launchmethod which was extracted from
CompilerSourceand is used by emake and LGM to launch the game consistently.
- Tweaked the
libEGMmakefile to rename
SHARED_SRC_DIRwhich is more consistent with the other makefiles we have that use the shared code. The directory variable is supposed to be
SHARED_SOURCESis supposed to be a list of the actual sources to compile.
shared/folder so that it can be compiled into
game_launchis able to call
- Cleaned up a few redundant
string_replace_allimplementations by moving it to
bettersystemin the shared folder.
compile.cppso I could easily copy it to
libAssetsand so I could make
plugin_CompileEGMRawnot call it.
- Updated the main makefile to include rules for
libAssetsso it gets built by
make all. At this point, emake now depends on
libAssetsto write assets to and launch games that are protos.
- Updated the AppVeyor job to include
libAssets.dllin the blobs zip since emake now depends on it.
- Moved the includes of
unistd.hto the top of
using namespace std;since the using causes issues when compiling with MSVC and C++17.
@@ Coverage Diff @@ ## master #1432 +/- ## ======================================= Coverage 17.19% 17.19% ======================================= Files 164 164 Lines 17103 17103 ======================================= Hits 2941 2941 Misses 14162 14162
@JoshDreamland alright, this is ready to go for review!