Finish add all options
Update readme with news info
This commit is contained in:
parent
f70f4a698b
commit
a2a03f96b6
16
README.md
16
README.md
@ -5,8 +5,6 @@ Inspired by the work **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!
|
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...
|
The collection consist of few independants modules, each of them deals with specific data like sound, textures, heightmaps, etc...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All modules are independants. This is the **'TEXTURE'** module.
|
All modules are independants. This is the **'TEXTURE'** module.
|
||||||
|
|
||||||
**CAUTION! Master branch is hugely buggy and should not be used, please take only released versions.**
|
**CAUTION! Master branch is hugely buggy and should not be used, please take only released versions.**
|
||||||
@ -15,9 +13,21 @@ All modules are independants. This is the **'TEXTURE'** module.
|
|||||||
|
|
||||||
It's extract texture datas from Rogue Squadron 3D (PC) game files (DAT).
|
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),
|
||||||
|
- Manage transparent textures,
|
||||||
|
- Fixed some error RGB color encoding.
|
||||||
|
|
||||||
### Using
|
### Using
|
||||||
|
|
||||||
*TODO...*
|
`Texture-Extractor_"version" [options] <hmt files...>`
|
||||||
|
|
||||||
|
### Options
|
||||||
|
|
||||||
|
- -h Print this message
|
||||||
|
- -v Activate verbose output
|
||||||
|
- -no-subdir Extract textures directly inside current folder
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "Image_Exporter.h"
|
#include "Image_Exporter.h"
|
||||||
|
|
||||||
|
|
||||||
//extern int _options; // Global options settings variable
|
extern int _options; // Global options settings variable
|
||||||
|
|
||||||
int saveToPNG(RS_IMAGE *img, char *tex_path, char *hmt_fileName) {
|
int saveToPNG(RS_IMAGE *img, char *tex_path, char *hmt_fileName) {
|
||||||
if (tex_path == NULL || img == NULL) return EXIT_FAILURE;
|
if (tex_path == NULL || img == NULL) return EXIT_FAILURE;
|
||||||
@ -15,13 +15,17 @@ int saveToPNG(RS_IMAGE *img, char *tex_path, char *hmt_fileName) {
|
|||||||
//int pixel_size = 3;
|
//int pixel_size = 3;
|
||||||
//int depth = 8; //bit par color channel (RGB)
|
//int depth = 8; //bit par color channel (RGB)
|
||||||
|
|
||||||
strcpy(export_path, hmt_fileName);
|
if (_options & OUTPUT_DIR) {
|
||||||
#ifdef _WIN32
|
strcpy(export_path, hmt_fileName);
|
||||||
strcat(export_path, "-out\\");
|
#ifdef _WIN32
|
||||||
#else
|
strcat(export_path, "-out\\");
|
||||||
strcat(export_path, "-out/");
|
#else
|
||||||
#endif
|
strcat(export_path, "-out/");
|
||||||
strcat(export_path, tex_path);
|
#endif
|
||||||
|
strcat(export_path, tex_path);
|
||||||
|
} else {
|
||||||
|
strcpy(export_path, tex_path);
|
||||||
|
}
|
||||||
strcat(export_path, ".png");
|
strcat(export_path, ".png");
|
||||||
_png_f = fopen(export_path, "wb");
|
_png_f = fopen(export_path, "wb");
|
||||||
if (_png_f == NULL) return EXIT_FAILURE;
|
if (_png_f == NULL) return EXIT_FAILURE;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef IMAGE_EXPORTER_H_
|
#ifndef IMAGE_EXPORTER_H_
|
||||||
#define IMAGE_EXPORTER_H_
|
#define IMAGE_EXPORTER_H_
|
||||||
|
|
||||||
//#include "options.h"
|
#include "options.h"
|
||||||
#include "RS_images.h"
|
#include "RS_images.h"
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <png.h>
|
#include <png.h>
|
||||||
|
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Check if filenames arguments exist
|
// Check if filenames arguments exist
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("\nNo input file/commands specified!\n\nCorrect syntax is:\n$> Texture-Extractor <texture_hmt_file>\n"); //TODO: add help function
|
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
|
return EXCEPTION_NONCONTINUABLE; //TODO: implement own error codes system
|
||||||
}
|
}
|
||||||
_options = checkArgs(argv, argc); // Analyse program arguments
|
_options = checkArgs(argv, argc); // Analyse program arguments
|
||||||
@ -38,7 +38,7 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int checkArgs(char *args[], int arg_nbr) {
|
int checkArgs(char *args[], int arg_nbr) {
|
||||||
int _o = 0x0000;
|
int _o = 0x0002; // Default options parameters
|
||||||
char test[256];
|
char test[256];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ int checkArgs(char *args[], int arg_nbr) {
|
|||||||
_o |= VERBOSE_ENABLED;
|
_o |= VERBOSE_ENABLED;
|
||||||
printf("[INFO] Verbose enabled.\n");
|
printf("[INFO] Verbose enabled.\n");
|
||||||
} else if (strcmp(args[i], "-no-subdir") == 0) {
|
} else if (strcmp(args[i], "-no-subdir") == 0) {
|
||||||
_o |= NO_OUTPUT_DIR;
|
_o &= ~OUTPUT_DIR;
|
||||||
printf("[INFO] Extract to current directory.\n");
|
printf("[INFO] Extract to current directory.\n");
|
||||||
} else {
|
} else {
|
||||||
printf("[INFO] Unknown option: %s\n", args[i]);
|
printf("[INFO] Unknown option: %s\n", args[i]);
|
||||||
@ -99,7 +99,7 @@ int exportTextures(HMT_FILE *hmt_f, char *filename) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(hmt_f->texture_count > 0) {
|
if(hmt_f->texture_count > 0) {
|
||||||
createSubDir(filename);
|
if (_options & OUTPUT_DIR) createSubDir(filename);
|
||||||
for (i=0; i<hmt_f->texture_count; i++) {
|
for (i=0; i<hmt_f->texture_count; i++) {
|
||||||
switch (hmt_f->textures_list[i].image.type_) {
|
switch (hmt_f->textures_list[i].image.type_) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -123,7 +123,7 @@ void dispHelp() {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
printf("RogueSquadron Data Extractor - TEXTURE module\n");
|
printf("RogueSquadron Data Extractor - TEXTURE module\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Options:\n -h Print this message\n -v Activate verbose output\n -no-subdir Extract textures directly inside current folder\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("\n");
|
||||||
printf("Usage: Texture-Extractor_\"version\" [options] <hmt files...>\n");
|
printf("Usage: Texture-Extractor_\"version\" [options] <hmt files...>\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define OPTIONS_H_
|
#define OPTIONS_H_
|
||||||
|
|
||||||
#define VERBOSE_ENABLED 0x0001
|
#define VERBOSE_ENABLED 0x0001
|
||||||
#define NO_OUTPUT_DIR 0x0002
|
#define OUTPUT_DIR 0x0002
|
||||||
|
|
||||||
int _options;
|
int _options;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user