Added makefile

Fixed some error on linux system build
This commit is contained in:
JackCarterSmith 2019-07-23 19:39:49 +02:00
parent a2a03f96b6
commit 930310916c
7 changed files with 54 additions and 89 deletions

1
.gitignore vendored
View File

@ -58,3 +58,4 @@ Debug/
Release/
.cproject
.project
*.launch

33
Makefile Normal file
View File

@ -0,0 +1,33 @@
CC=gcc
#CFLAGS= -Wextra -Wall -O0 -g
CFLAGS= -Wall -O3
LDFLAGS= -lz -lpng
TARGET=RogueDE-texture
VERSION=1.0a
SRC_DIR=src
SRC= $(wildcard $(SRC_DIR)/*.c)
INCLUDES=-I$(SRC_DIR)
BUILD_DIR=obj
OBJS= $(subst src,$(BUILD_DIR),$(SRC:%.c=%.o))
.PHONY: $(BUILD_DIR) all clean
all: clean $(BUILD_DIR) $(TARGET)
$(BUILD_DIR)/%.o: src/%.c
$(CC) $(INCLUDES) -DVERSION='"$(VERSION)"' -c -o $@ $< $(CFLAGS)
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
$(TARGET): $(OBJS)
$(CC) -o $@_$(VERSION) $^ $(LDFLAGS)
clean:
@rm -rf $(BUILD_DIR)
@rm -f RogueDE-*

View File

@ -1,6 +1,6 @@
# RogueSquadron Data Extractor - TEXTURE module
Inspired by the work **dpethes** (https://github.com/dpethes/rerogue)
Inspired by the work of **dpethes** (https://github.com/dpethes/rerogue)
This set of git repos are a compilation of tools coded in C to make RS modding far more than a dream!
The collection consist of few independants modules, each of them deals with specific data like sound, textures, heightmaps, etc...
@ -16,8 +16,9 @@ It's extract texture datas from Rogue Squadron 3D (PC) game files (DAT).
This module can do:
- Extract textures inside HMT files to PNG format,
- Extract automatically inside subfolder (usefull when you have a lot of pictures to extract),
- Multiple inputs files,
- Manage transparent textures,
- Fixed some error RGB color encoding.
- Fixed some errored RGB color encoding.
### Using
@ -33,10 +34,14 @@ This module can do:
Necessary libs for running (provided in release) and for compiling.
- zlib (1.2.11)
- libpng (1.6.37)
- zlib
- libpng (recommended: 1.6.37)
### Compiling
You can compile on both Windows or Linux system, you only need to adjust your dependencies.
*Makefile is coming...*
zlib and libpng16 distrib package can be used.
To compile, just type on linux:
`make`

View File

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="gun_turret_HMT"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/Texture-Extractor.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Texture-Extractor"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.cross.exe.debug.305633050"/>
<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${workspace_loc:Texture-Extractor/Debug}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Texture-Extractor"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#13;&#10;"/>
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
</launchConfiguration>

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="gdb"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.EXTERNAL_CONSOLE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=".gdbinit"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE_MODE" value="UseSoftTrace"/>
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_ARGUMENTS" value="gun_turret_HMT"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Release/Texture-Extractor.exe"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Texture-Extractor"/>
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="false"/>
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="cdt.managedbuild.config.gnu.cross.exe.release.400013283"/>
<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="${workspace_loc:Texture-Extractor/Release}"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Texture-Extractor"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
</launchConfiguration>

View File

@ -132,10 +132,12 @@ int getSamplesFromFile(RS_IMAGE *img, FILE *f) {
int sample_bits = img->sampleBits;
int size = div(img->width*img->height*sample_bits, 8).quot;
if (f->_bufsiz >= ftell(f)+size) {
/*
if (f->_bufsize >= ftell(f)+size) { //TODO: Check C equivalent
printf("[ERR] WARNING! Please fix size/sample.");
return EXIT_FAILURE;
}
*/
img->samples = calloc(1, size);
fread(img->samples, size, 1, f);

View File

@ -2,7 +2,6 @@
================================================================================
Name : Texture-Extractor.c
Author : JackCarterSmith
Version : 1.0a
License : GPL-v3.0
Description : DAT textures extractor to PNG format with enhanced function in C
================================================================================
@ -18,10 +17,13 @@ int main(int argc, char *argv[]) {
HMT_FILE *hmt_fdatas = NULL;
int file_index;
printf("\n*** RogueSquadron Data Extractor - TEXTURE module - v%s ***\n", VERSION);
// Check if filenames arguments exist
if (argc < 2) {
printf("\nNo input file/commands specified!\n\nCorrect syntax is:\n$> Texture-Extractor <texture_hmt_file>\n");
return EXCEPTION_NONCONTINUABLE; //TODO: implement own error codes system
printf("\n[ERR] No input file/commands specified!\n");
dispHelp();
return EXIT_FAILURE; //TODO: implement own error codes system
}
_options = checkArgs(argv, argc); // Analyse program arguments
if (_options == -1) return EXIT_SUCCESS;
@ -74,7 +76,7 @@ void createSubDir(char *dirName) {
#ifdef _WIN32
CreateDirectory(_dir, NULL);
#else
mkdir(_dir, 755);
mkdir(_dir, 0755);
#endif
}
@ -120,11 +122,9 @@ int exportTextures(HMT_FILE *hmt_f, char *filename) {
}
void dispHelp() {
printf("\n");
printf("RogueSquadron Data Extractor - TEXTURE module\n");
printf("\n");
printf("Options:\n -h Print this message\n -v Activate verbose console output\n -no-subdir Extract textures inside current folder\n");
printf("\n");
printf("Usage: Texture-Extractor_\"version\" [options] <hmt files...>\n");
printf("Usage: RogueRE-texture_%s [options] <hmt files...>\n", VERSION);
printf("\n");
}