Skip to content

Commit

Permalink
Merge pull request #2515 from ericoporto/add-agfexport
Browse files Browse the repository at this point in the history
Tool: agfexport - export miscellaneous data from the game source
  • Loading branch information
ivan-mogilko authored Aug 31, 2024
2 parents 6c73862 + e1e78f6 commit 6ce71b4
Show file tree
Hide file tree
Showing 8 changed files with 664 additions and 1 deletion.
159 changes: 159 additions & 0 deletions Solutions/Tools.App/agfexport.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Common\debug\debugmanager.cpp" />
<ClCompile Include="..\..\Common\util\bufferedstream.cpp" />
<ClCompile Include="..\..\Common\util\cmdlineopts.cpp" />
<ClCompile Include="..\..\Common\util\file.cpp" />
<ClCompile Include="..\..\Common\util\filestream.cpp" />
<ClCompile Include="..\..\Common\util\path.cpp" />
<ClCompile Include="..\..\Common\util\stdio_compat.c" />
<ClCompile Include="..\..\Common\util\stream.cpp" />
<ClCompile Include="..\..\Common\util\string.cpp" />
<ClCompile Include="..\..\Common\util\string_compat.c" />
<ClCompile Include="..\..\Common\util\string_utils.cpp" />
<ClCompile Include="..\..\Common\util\textstreamreader.cpp" />
<ClCompile Include="..\..\libsrc\tinyxml2\tinyxml2.cpp" />
<ClCompile Include="..\..\Tools\agfexport\main.cpp" />
<ClCompile Include="..\..\Tools\data\agfreader.cpp" />
<ClCompile Include="..\..\Tools\data\scriptgen.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\libsrc\tinyxml2\tinyxml2.h" />
<ClInclude Include="..\..\Tools\data\agfreader.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{776E38BA-D6A4-431E-8053-299310D85301}</ProjectGuid>
<RootNamespace>MakeRoomHeader</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<ProjectName>agfexport</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\.build\$(Configuration)\</OutDir>
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\.build\$(Configuration)\</OutDir>
<IntDir>$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\Tools;..\..\Common;..\..\libsrc\tinyxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>..\..\Tools;..\..\Common;..\..\libsrc\tinyxml2;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
79 changes: 79 additions & 0 deletions Solutions/Tools.App/agfexport.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
<Filter Include="Common">
<UniqueIdentifier>{eadadb9c-903a-4a50-8db9-a82dbf36b434}</UniqueIdentifier>
</Filter>
<Filter Include="tinyxml2">
<UniqueIdentifier>{46208ff5-d822-4f9b-8208-d51993dbec22}</UniqueIdentifier>
</Filter>
<Filter Include="data">
<UniqueIdentifier>{bdb62516-d050-4c05-81b5-4bedb3b8da0b}</UniqueIdentifier>
</Filter>
<Filter Include="agfexport">
<UniqueIdentifier>{731e5dde-24bd-46ed-ae96-82f7baf41d3d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\Common\util\bufferedstream.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\cmdlineopts.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\file.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\filestream.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\stream.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\string.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\textstreamreader.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\stdio_compat.c">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\debug\debugmanager.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\string_utils.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\libsrc\tinyxml2\tinyxml2.cpp">
<Filter>tinyxml2</Filter>
</ClCompile>
<ClCompile Include="..\..\Tools\data\agfreader.cpp">
<Filter>data</Filter>
</ClCompile>
<ClCompile Include="..\..\Tools\data\scriptgen.cpp">
<Filter>data</Filter>
</ClCompile>
<ClCompile Include="..\..\Tools\agfexport\main.cpp">
<Filter>agfexport</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\path.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="..\..\Common\util\string_compat.c">
<Filter>Common</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\libsrc\tinyxml2\tinyxml2.h">
<Filter>tinyxml2</Filter>
</ClInclude>
<ClInclude Include="..\..\Tools\data\agfreader.h">
<Filter>data</Filter>
</ClInclude>
</ItemGroup>
</Project>
10 changes: 10 additions & 0 deletions Solutions/Tools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agsunpak", "Tools.App\agsun
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "crmpak", "Tools.App\crmpak.vcxproj", "{20F0B521-1E8C-4F96-9C35-8CF244CA6947}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "agfexport", "Tools.App\agfexport.vcxproj", "{776E38BA-D6A4-431E-8053-299310D85301}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -91,6 +93,14 @@ Global
{20F0B521-1E8C-4F96-9C35-8CF244CA6947}.Release|x64.Build.0 = Release|x64
{20F0B521-1E8C-4F96-9C35-8CF244CA6947}.Release|x86.ActiveCfg = Release|Win32
{20F0B521-1E8C-4F96-9C35-8CF244CA6947}.Release|x86.Build.0 = Release|Win32
{776E38BA-D6A4-431E-8053-299310D85301}.Debug|x64.ActiveCfg = Debug|x64
{776E38BA-D6A4-431E-8053-299310D85301}.Debug|x64.Build.0 = Debug|x64
{776E38BA-D6A4-431E-8053-299310D85301}.Debug|x86.ActiveCfg = Debug|Win32
{776E38BA-D6A4-431E-8053-299310D85301}.Debug|x86.Build.0 = Debug|Win32
{776E38BA-D6A4-431E-8053-299310D85301}.Release|x64.ActiveCfg = Release|x64
{776E38BA-D6A4-431E-8053-299310D85301}.Release|x64.Build.0 = Release|x64
{776E38BA-D6A4-431E-8053-299310D85301}.Release|x86.ActiveCfg = Release|Win32
{776E38BA-D6A4-431E-8053-299310D85301}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
10 changes: 9 additions & 1 deletion Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ set_target_properties(agf2glvar PROPERTIES
)
target_link_libraries(agf2glvar PUBLIC libtools)

#----- agfexport -----------------------------------------------
add_executable(agfexport agfexport/main.cpp)
set_target_properties(agfexport PROPERTIES
CXX_STANDARD 11
CXX_EXTENSIONS NO
)
target_link_libraries(agfexport PUBLIC libtools)

#----- agspak -------------------------------------------------
add_executable(agspak agspak/main.cpp)
set_target_properties(agspak PROPERTIES
Expand Down Expand Up @@ -124,7 +132,7 @@ set_target_properties(trac PROPERTIES
)
target_link_libraries(trac PUBLIC libtools)

list(APPEND TOOLS_TARGETS agf2autoash agf2dlgasc agf2glvar agspak agsunpak crm2ash crmpak trac)
list(APPEND TOOLS_TARGETS agf2autoash agf2dlgasc agf2glvar agfexport agspak agsunpak crm2ash crmpak trac)

# Bundle-like target to build all tools
add_custom_target(Tools)
Expand Down
97 changes: 97 additions & 0 deletions Tools/agfexport/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
INCDIR = ../../Common ../../Tools ../../libsrc/tinyxml2
LIBDIR =

CFLAGS := -O2 -g \
-fsigned-char -fno-strict-aliasing -fwrapv \
-Wunused-result \
-Wno-unused-value \
-Werror=write-strings -Werror=format -Werror=format-security \
-DNDEBUG \
-D_FILE_OFFSET_BITS=64 -DRTLD_NEXT \
$(CFLAGS)

CXXFLAGS := -std=c++11 -Werror=delete-non-virtual-dtor $(CXXFLAGS)

PREFIX ?= /usr/local
CC ?= gcc
CXX ?= g++
AR ?= ar
CFLAGS += $(addprefix -I,$(INCDIR))
CXXFLAGS += $(CFLAGS)
ASFLAGS += $(CFLAGS)
LDFLAGS += -rdynamic -Wl,--as-needed $(addprefix -L,$(LIBDIR))
CFLAGS += -Werror=implicit-function-declaration

COMMON_OBJS = \
../../Common/debug/debugmanager.cpp \
../../Common/util/bufferedstream.cpp \
../../Common/util/cmdlineopts.cpp \
../../Common/util/file.cpp \
../../Common/util/filestream.cpp \
../../Common/util/path.cpp \
../../Common/util/stdio_compat.c \
../../Common/util/stream.cpp \
../../Common/util/string.cpp \
../../Common/util/string_compat.c \
../../Common/util/string_utils.cpp \
../../Common/util/textstreamreader.cpp

TOOL_OBJS = \
../../Tools/data/agfreader.cpp \
../../Tools/data/scriptgen.cpp

TINYXML2 = \
../../libsrc/tinyxml2/tinyxml2.cpp

OBJS := main.cpp \
$(COMMON_OBJS) \
$(TOOL_OBJS) \
$(TINYXML2)
OBJS := $(OBJS:.cpp=.o)
OBJS := $(OBJS:.c=.o)

DEPFILES = $(OBJS:.o=.d)

-include config.mak

.PHONY: printflags clean install uninstall rebuild

all: printflags agfexport

agfexport: $(OBJS)
@echo "Linking..."
$(CXX) -o $@ $^ $(CXXFLAGS) $(LDFLAGS) $(LIBS)

debug: CXXFLAGS += -UNDEBUG -D_DEBUG -Og -g -pg
debug: CFLAGS += -UNDEBUG -D_DEBUG -Og -g -pg
debug: LDFLAGS += -pg
debug: printflags agfexport

-include $(DEPFILES)

%.o: %.c
@echo $@
$(CMD_PREFIX) $(CC) $(CFLAGS) -MD -c -o $@ $<

%.o: %.cpp
@echo $@
$(CMD_PREFIX) $(CXX) $(CXXFLAGS) -MD -c -o $@ $<

printflags:
@echo "CFLAGS =" $(CFLAGS) "\n"
@echo "CXXFLAGS =" $(CXXFLAGS) "\n"
@echo "LDFLAGS =" $(LDFLAGS) "\n"
@echo "LIBS =" $(LIBS) "\n"

rebuild: clean all

clean:
@echo "Cleaning..."
$(CMD_PREFIX) rm -f agfexport $(OBJS) $(DEPFILES)

install: agfexport
mkdir -p $(PREFIX)/bin
cp -t $(PREFIX)/bin agfexport

uninstall:
rm -f $(PREFIX)/bin/agfexport
Loading

0 comments on commit 6ce71b4

Please sign in to comment.