Add management files
Some checks failed
JCS-Prod/RSE-Model/pipeline/head There was a failure building this commit

Conan + libs
This commit is contained in:
JackCarterSmith 2021-08-24 20:58:21 +02:00
parent 371224ac08
commit fb7ea87b01
Signed by: JackCarterSmith
GPG Key ID: DB362B740828F843
8 changed files with 146 additions and 6 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src/rlk"]
path = src/rlk
url = https://github.com/rlk/obj.git

View File

@ -5,8 +5,10 @@
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
# define project
add_definitions(-DCONF_NO_GL)
if(DEFINED ENV{CI})
project(rse-model VERSION 1.0.0.$ENV{CI_BUILD_NUMBER} DESCRIPTION "RogueSquadron Extractor - Model" LANGUAGES C)
set(RSE_MOD_NAME $ENV{CI_OUTPUT_NAME}-${PROJECT_VERSION})
@ -21,17 +23,17 @@ include(CheckCSourceCompiles)
# needed packages
#find_package(ZLIB REQUIRED)
#include_directories(${ZLIB_INCLUDE_DIR})
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIR})
# define src/headers files
FILE(GLOB RSE_MOD_SRCS src/*.c)
FILE(GLOB RSE_MOD_HRDS src/*.h)
FILE(GLOB_RECURSE RSE_MOD_SRCS src/*.c)
FILE(GLOB_RECURSE RSE_MOD_HRDS src/*.h)
SOURCE_GROUP("Source Files" FILES ${RSE_MOD_SRCS})
SOURCE_GROUP("Header Files" FILES ${RSE_MOD_HRDS})
# begin building RSE-Map
# begin building RSE-Model
#set(CMAKE_BUILD_TYPE Debug)
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
@ -43,7 +45,7 @@ if(MSVC)
set_target_properties(rse-model PROPERTIES PREFIX "lib")
set_target_properties(rse-model PROPERTIES IMPORT_PREFIX "lib")
endif()
#target_link_libraries(rse-model ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
target_link_libraries(rse-model ${GLEW_LIBRARIES})
# add GPG signature command
#add_custom_command(

11
conanfile.txt Normal file
View File

@ -0,0 +1,11 @@
[requires]
glew/2.2.0
[generators]
cmake
cmake_find_package
[options]
glew:shared=True
[imports]

91
src/Model-Extractor.c Normal file
View File

@ -0,0 +1,91 @@
/*
================================================================================
Name : Map-Extractor.c
Author : JackCarterSmith
License : GPL-v3.0
Description : DAT textures extractor to PNG format with enhanced function in C
================================================================================
*/
#include "Model-Extractor.h"
#include "rlk/obj.h"
int _options; // Global options settings variable
int main(int argc, char *argv[]) {
// Init buffer vars
int file_index;
printf("\n*** RogueSquadron Extractor (RSE) - MAP module - v%s ***\n", VERSION);
// Check if filenames arguments exist
if (argc < 2) {
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;
// Do the work
for (file_index=(_options >> 8) & 0xFF; file_index<argc; file_index++) { // Manage multiple inputs files
/*
hmt_fdatas = extractDatasFromHMT(argv[file_index]);
if (hmt_fdatas == NULL) return EXIT_FAILURE;
if (exportTextures(hmt_fdatas, argv[file_index]) == EXIT_FAILURE) return EXIT_FAILURE;
purgeHMTFromMemory(hmt_fdatas); // Clean up memory (because I'm a good boy)
*/
}
return EXIT_SUCCESS;
}
int checkArgs(char *args[], int arg_nbr) {
int _o = 0x0002; // Default options parameters
char test[256];
int i;
if (arg_nbr > 1) {
for (i=1; i<arg_nbr; i++) {
strcpy(test, args[i]);
if (args[i][0] != '-') break;
if (strcmp(args[i], "-h") == 0) {
dispHelp();
return -1;
} else if (strcmp(args[i], "-v") == 0) {
_o |= VERBOSE_ENABLED;
printf("[OPTN] Verbose enabled.\n");
} else if (strcmp(args[i], "-no-subdir") == 0) {
_o &= ~OUTPUT_DIR;
printf("[OPTN] Extract to current directory.\n");
} else {
printf("[ERR] Unknown option: %s\n", args[i]);
}
}
_o = (i << 8) | (_o & 0x00FF);
}
return _o;
}
void createSubDir(char *dirName) {
if (dirName == NULL) return;
char _dir[260]; //TODO: Change directory management
strcpy(_dir, dirName);
strcat(_dir, "-out");
#ifdef _WIN32
CreateDirectory(_dir, NULL);
#else
mkdir(_dir, 0755);
#endif
}
void dispHelp() {
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: RSE-Texture_%s [options] <hmt files...>\n", VERSION);
printf("\n");
}

22
src/Model-Extractor.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef MAP_EXTRACTOR_H_
#define MAP_EXTRACTOR_H_
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#if defined(_WIN32)
#include <windows.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include "config.h"
#include "options.h"
void createSubDir(char *dirName);
int checkArgs(char *args[], int arg_nbr);
//int exportTextures(HMT_FILE *hmt_f, char *filename);
void dispHelp();
#endif

1
src/config.h.in Normal file
View File

@ -0,0 +1 @@
#define VERSION "@PROJECT_VERSION@"

9
src/options.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef OPTIONS_H_
#define OPTIONS_H_
#define VERBOSE_ENABLED 0x0001
#define OUTPUT_DIR 0x0002
extern int _options;
#endif

1
src/rlk Submodule

@ -0,0 +1 @@
Subproject commit 48a6916526d043691bb3f9e38676fbc99995da10