From fd5535d88f396035945994791e71de8edd6f11ce Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Thu, 21 Oct 2021 22:43:20 -0400 Subject: [PATCH] Maybe went overboard with make colours, but it's all colourful now! --- Makefile | 2 +- tools/n64crc.c | 41 +++++++++++++++++++++++-------------- tools/python/generate_ld.py | 4 ++-- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 72ba3028..fea23ee5 100755 --- a/Makefile +++ b/Makefile @@ -485,7 +485,7 @@ $(BUILD_DIR)/$(TARGET).z64: $(BUILD_DIR)/$(TARGET).bin | $(ALL_ASSETS_BUILT) $(V)$(FIXCHECKSUMS) $(V)$(N64CRC) $@ ifeq ($(NON_MATCHING),0) - sha1sum -c sha1/dkr.$(VERSION).sha1 + $(V)sha1sum -c --quiet sha1/dkr.$(VERSION).sha1 else @echo "Build complete!" endif diff --git a/tools/n64crc.c b/tools/n64crc.c index a3dc6ce8..39cd69cd 100755 --- a/tools/n64crc.c +++ b/tools/n64crc.c @@ -26,6 +26,13 @@ #include #include + +#define NO_COL "\x1B[0m" +#define RED "\x1B[31m" +#define GREEN "\x1B[32m" +#define BLUE "\x1B[34m" +#define YELLOW "\x1B[33m" + #define ROL(i, b) (((i) << (b)) | ((i) >> (32 - (b)))) #define BYTES2LONG(b) ( (b)[0] << 24 | \ (b)[1] << 16 | \ @@ -191,34 +198,38 @@ int main(int argc, char **argv) { //Check CIC BootChip cic = N64GetCIC(buffer); - printf("BootChip: "); - printf((cic ? "CIC-NUS-%d\n" : "Unknown\n"), cic); + printf(GREEN "BootChip: " NO_COL); + printf((cic ? YELLOW "CIC-NUS-%d\n" NO_COL : RED "Unknown\n" NO_COL), cic); //Calculate CRC if (N64CalcCRC(crc, buffer)) { - printf("Unable to calculate CRC\n"); + printf(RED "Unable to calculate CRC\n" NO_COL); } else { - printf("CRC 1: 0x%08X ", BYTES2LONG(&buffer[N64_CRC1])); - printf("Calculated: 0x%08X ", crc[0]); - if (crc[0] == BYTES2LONG(&buffer[N64_CRC1])) - printf("(Good)\n"); - else{ + printf(GREEN "CRC 1: %s0x%08X " NO_COL, YELLOW, BYTES2LONG(&buffer[N64_CRC1])); + if (crc[0] == BYTES2LONG(&buffer[N64_CRC1])) { + printf(GREEN "Calculated: %s0x%08X " NO_COL, YELLOW, crc[0]); + printf(BLUE "(Good)\n" NO_COL); + } + else { + printf(GREEN "Calculated: %s0x%08X " NO_COL, RED, crc[0]); Write32(buffer, N64_CRC1, crc[0]); fseek(fin, N64_CRC1, SEEK_SET); fwrite(&buffer[N64_CRC1], 1, 4, fin); - printf("(Bad, fixed)\n"); + printf(RED "(Bad, fixed)\n" NO_COL); } - printf("CRC 2: 0x%08X ", BYTES2LONG(&buffer[N64_CRC2])); - printf("Calculated: 0x%08X ", crc[1]); - if (crc[1] == BYTES2LONG(&buffer[N64_CRC2])) - printf("(Good)\n"); - else{ + printf(GREEN "CRC 2: %s0x%08X " NO_COL, YELLOW, BYTES2LONG(&buffer[N64_CRC2])); + if (crc[1] == BYTES2LONG(&buffer[N64_CRC2])) { + printf(GREEN "Calculated: %s0x%08X " NO_COL, YELLOW, crc[1]); + printf(BLUE "(Good)\n" NO_COL); + } + else { + printf(GREEN "Calculated: %s0x%08X " NO_COL, RED, crc[1]); Write32(buffer, N64_CRC2, crc[1]); fseek(fin, N64_CRC2, SEEK_SET); fwrite(&buffer[N64_CRC2], 1, 4, fin); - printf("(Bad, fixed)\n"); + printf(RED "(Bad, fixed)\n" NO_COL); } } diff --git a/tools/python/generate_ld.py b/tools/python/generate_ld.py index 9a4430b1..e27fc40f 100644 --- a/tools/python/generate_ld.py +++ b/tools/python/generate_ld.py @@ -36,7 +36,7 @@ BSS_LIB_ORDER_FILES = [ class GenerateLD: def __init__(self, file): - print('Generating linker file...') + print('\x1B[32mGenerating linker file: \x1B[0m', end='') self.assets = GenerateAssets(ROOT_DIR, VERSION) self.files = self.get_code_files() self.indentLevel = 0 @@ -47,7 +47,7 @@ class GenerateLD: self.gen_line('OUTPUT_ARCH (mips)') self.gen_newline() self.gen_sections() - print('New linker file created!') + print('\x1B[33m New linker file created!\x1B[0m') def gen_sections(self): self.gen_line('SECTIONS')