Asset Modularization
Reporter: RobertBColton | Status: closed | Last Modified: December 30, 2020, 11:15:08 pmlibAssets
to house this code.
Output/Logging
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 CompilerSource
yet, 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
- Added
plugin_CompileEGMRaw
which functions the same as the oldplugin_CompileEGM
except 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 ofplugin_CompileEGM
would break LateralGM binary compatibility, which we're not ready to do yet. - Changed the signature of
EnigmaPlugin::BuildGame
to 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, theworking_directory
in 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::BuildGame
for when the exe path is the same as the project path (e.g, empty game because there is no project file). - Moved the
OptionsParser
instance from emake main to the global scope so that it can be accessed byEnigmaPlugin::BuildGame
to determine when the--run
option has been specified. - Removed emake's double linkage of
libEGM
because I didn't see any reasoning for it and it may also have been bloating the size of it. - Added linkage of
libAssets
to emake so it can use it to write assets to the game and launch the game. - Disabled the code in
Proto2ES
that loads, converts, and compresses the data files for sounds, sprites, and backgrounds because it is no longer needed. BecauselibAssets
has new code to write the assets, I changed the logic for it to do the loading. - Created
libAssets
with a makefile and a CMakeLists so it can be built in MSYS2 and by RGM's AppVeyor. It contains a new methodgame_write_assets
which is based on Josh's code I extracted fromCompilerSource
but it's slightly different in that it accepts the new proto instead of the old EnigmaStruct. The library also has agame_launch
method which was extracted fromCompilerSource
and is used by emake and LGM to launch the game consistently. - Tweaked the
libEGM
makefile to renameSHARED_SOURCES
toSHARED_SRC_DIR
which is more consistent with the other makefiles we have that use the shared code. The directory variable is supposed to beSHARED_SRC_DIR
andSHARED_SOURCES
is supposed to be a list of the actual sources to compile. - Moved
bettersystem
to theshared/
folder so that it can be compiled intolibAssets
so thatgame_launch
is able to calle_execs
. - Cleaned up a few redundant
string_replace_all
implementations by moving it tobettersystem
in the shared folder. - Extracted
compile_write_assets
andcompile_run_game
incompile.cpp
so I could easily copy it tolibAssets
and so I could makeplugin_CompileEGMRaw
not call it. - Updated the main makefile to include rules for
libAssets
so it gets built bymake all
. At this point, emake now depends onlibAssets
to write assets to and launch games that are protos. - Updated the AppVeyor job to include
libAssets.dll
in the blobs zip since emake now depends on it. - Moved the includes of
windows.h
andunistd.h
to the top ofbettersystem.cpp
before theusing namespace std;
since the using causes issues when compiling with MSVC and C++17.
Codecov Report
Merging #1432 into master will not change coverage.
The diff coverage isn/a
.
@@ Coverage Diff @@
## master #1432 +/- ##
=======================================
Coverage 17.19% 17.19%
=======================================
Files 164 164
Lines 17103 17103
=======================================
Hits 2941 2941
Misses 14162 14162
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update c622812...dbd36a4. Read the comment docs.