From b65c0f76818edca2681664da8315f44442f1cdba Mon Sep 17 00:00:00 2001 From: Geek_Joystick Date: Sun, 28 Jan 2024 13:14:40 +0100 Subject: [PATCH] v0.2 Updated reamde and help, made pattern direction lowercase --- README.md | 34 +++++++++++++++++++++------------- src/args.c | 11 ++++++----- src/logger.c | 12 ++++++------ src/main.c | 2 +- src/ripper.c | 6 +++--- 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 953272a..b597911 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,12 @@ Pre-built binaries can be downloaded from the [GitHub Releases section](https:// ``` nesrip.exe file [arguments] Arguments: --S {start address} {end address} Directly rip graphics from specified memory in ROM. --o {filename} Output filename (without file extension) when using -S. --d {filename} Graphics database filename. --c {compression type, raw} Graphics decompression algorithm. --p {pattern size, 1/2/4/8} Set or override tile block size. --i {4 letter combination of b/o/t/w} Set or override palette order for rendering. + -S {start address} {end address} Directly rip graphics from specified memory in ROM. + -o {filename} Output filename (without file extension) when using -S. + -d {filename} Graphics database filename. + -c {compression type, raw} Graphics decompression algorithm. + -p {pattern size, 1/2/4/8/16} {direction, h/v} Set or override tile block size and direction. + -i {4 letter combination of b/o/t/w} Set or override palette order for rendering. ``` ### Graphics database file @@ -54,7 +54,7 @@ The file contains a number of **description blocks**, each of them containing a Hash {ROM SHA-256 hash} EndHash Section {Start address} {End address} -Pattern {Pattern size, 1/2/4/8} +Pattern {Pattern size, 1/2/4/8/16} {Direction, h/v} Palette {4 letter combination of b/o/t/w} Compression {compression type, raw} ``` @@ -72,17 +72,17 @@ Compression {compression type, raw} ``` //Spacegulls Hash B69BD1809E26400336AF288BC04403C00D77030B931BC31875594C9A0AE92F67 -Pattern 1 +Pattern 1 h Palette botw -Section bg 00010 1000F +Section bg 00000 FFFFF EndHash //Micro Mages Hash A4B5B736A84B260314C18783381FE2DCA7B803F7C29E78FB403A0F9087A7E570 -Pattern 1 +Pattern 1 v Palette btow -Section spr 8010 900F -Section bg 9010 A00F +Section spr 8000 8FFF +Section bg 9000 9FFF EndHash ... @@ -94,8 +94,16 @@ EndHash ## Version History +* 0.2 + * Made ROM headers be ignored from any operation. + * Hashes are now case insensitive. + * Made output files go into a folder named after the input ROM. + * Added batch files for processing multiple ROMs. + * Added pattern directionnality. + * Sheets will now extend vertically instead of splitting in multiple sheets. + * Added a pattern size of 16 to allow for fully vertical 128x128 sections. * 0.1 - * Initial Release + * Initial Release. ## License diff --git a/src/args.c b/src/args.c index 8524c86..1549b2e 100644 --- a/src/args.c +++ b/src/args.c @@ -68,18 +68,19 @@ int handleOutputArg(int pass, int* argc, char*** argv) { return 0; } -int handlePatternSizeArg(int pass, int* argc, char*** argv) { - CHECK_ARGC("-p", 2); +int handlePatternArg(int pass, int* argc, char*** argv) { + CHECK_ARGC("-p", 3); if (pass != 0) { - INC(2); + INC(3); return 0; } patternSize = (*argv)[1]; + patternDirection = (*argv)[2]; patternOverride = true; - INC(2); + INC(3); return 0; } @@ -154,7 +155,7 @@ int handleAdditionnalArgs(int pass, int argc, char** argv) { CHECK_ARG("-S", handleDirectSectionRipArg); CHECK_ARG("-o", handleOutputArg); - CHECK_ARG("-p", handlePatternSizeArg); + CHECK_ARG("-p", handlePatternArg); CHECK_ARG("-c", handleCompressionArg); CHECK_ARG("-i", handlePaletteDescriptionArg); CHECK_ARG("-d", handleDescriptorFilenameArg); diff --git a/src/logger.c b/src/logger.c index 9bba252..21eb9e6 100644 --- a/src/logger.c +++ b/src/logger.c @@ -11,12 +11,12 @@ void printHelp() { printProgamName(); printf(" file [arguments]\n"); printf("Arguments:\n"); - printf(" -S {start address} {end address} Directly rip graphics from specified memory in ROM.\n"); - printf(" -o {filename} Output filename (without file extension) when using -S.\n"); - printf(" -d {filename} Graphics database filename.\n"); - printf(" -c {compression type, raw} Graphics decompression algorithm.\n"); - printf(" -p {pattern size, 1/2/4/8} Set or override tile block size.\n"); - printf(" -i {4 letter combination of b/o/t/w} Set or override palette order for rendering.\n"); + printf(" -S {start address} {end address} Directly rip graphics from specified memory in ROM.\n"); + printf(" -o {filename} Output filename (without file extension) when using -S.\n"); + printf(" -d {filename} Graphics database filename.\n"); + printf(" -c {compression type, raw} Graphics decompression algorithm.\n"); + printf(" -p {pattern size, 1/2/4/8/16} {direction, h/v} Set or override tile block size and direction.\n"); + printf(" -i {4 letter combination of b/o/t/w} Set or override palette order for rendering.\n"); } void printNoInput() { diff --git a/src/main.c b/src/main.c index cd0838f..d3c519c 100644 --- a/src/main.c +++ b/src/main.c @@ -17,7 +17,7 @@ char* outputFolder; char* outputFilename = NULL; char* compressionType = "raw"; char* patternSize = "1"; -char* patternDirection = "H"; +char* patternDirection = "h"; char* paletteDescription = "bwot"; char* descriptorFilename = "nes_gfxdb.txt"; int patternOverride = false; diff --git a/src/ripper.c b/src/ripper.c index 565911d..2fdf8e9 100644 --- a/src/ripper.c +++ b/src/ripper.c @@ -193,14 +193,14 @@ int getSectionDetails(Rom* rom, ExtractionContext* context) { return 0; } - if (strcmp(args->patternDirectionString, "H") == 0) { + if (strcmp(args->patternDirectionString, "h") == 0) { context->patternDirection = false; } - else if (strcmp(args->patternDirectionString, "V") == 0) { + else if (strcmp(args->patternDirectionString, "v") == 0) { context->patternDirection = true; } else { - printf("Error: Invalid pattern direction. Use \"H\" or \"V\".\n"); + printf("Error: Invalid pattern direction. Use \"h\" or \"v\".\n"); } return 1;