From 84dcb34a06bc3c02383f29bad652bcc707d18da9 Mon Sep 17 00:00:00 2001 From: Rolel Date: Tue, 31 Dec 2024 13:52:14 +0100 Subject: [PATCH] Improved Lindy color settings. - Celeron speed is correctly reported in model name. - Added Silver, Blue and RedEX. - Color setting is now case insensitive. --- src/lindbergh/config.c | 18 ++++++++++++++++++ src/lindbergh/config.h | 5 ++++- src/lindbergh/hook.c | 7 +++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index a3656e3..b1d93e0 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "config.h" #include "gpuvendor.h" @@ -799,8 +800,25 @@ int readConfig(FILE *configFile, EmulatorConfig *config) { char colour[256]; strcpy(colour, getNextToken(NULL, " ", &saveptr)); + + // Convert colour to uppercase just to avoid case-sensitivity issues + for (char *p = colour; *p; ++p) *p = toupper(*p); + if (strcmp(colour, "RED") == 0) config->lindberghColour = RED; + else if (strcmp(colour, "YELLOW") == 0) + config->lindberghColour = YELLOW; + else if (strcmp(colour, "BLUE") == 0) + config->lindberghColour = BLUE; + else if (strcmp(colour, "SILVER") == 0) + config->lindberghColour = SILVER; + else if (strcmp(colour, "REDEX") == 0) + config->lindberghColour = REDEX; + else + { + // Print a warning and keep the default colour + printf("Warning: Unknown Lindbergh colour '%s'. Keeping default value.\n", colour); + } } else if (strcmp(command, "REGION") == 0) diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 7ef6c31..71e65d4 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -87,7 +87,10 @@ typedef enum { YELLOW, - RED + RED, + BLUE, + SILVER, + REDEX } Colour; typedef enum diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index 492020f..b5f88ed 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -609,13 +609,16 @@ char *fgets(char *str, int n, FILE *stream) { char contents[4][256]; + // Pentium 4 HT 3.0E : Prescott 3.0GHz L2 1Mo (SL8JZ, SL7L4, SL7E4, SL88J, SL79L, SL7KB, SL7PM) strcpy(contents[0], "processor : 0"); strcpy(contents[1], "vendor_id : GenuineIntel"); strcpy(contents[2], "model : 142"); strcpy(contents[3], "model name : Intel(R) Pentium(R) CPU 3.00GHz"); - if (getConfig()->lindberghColour == RED) - strcpy(contents[3], "model name : Intel(R) Celeron(R) CPU 3.00GHz"); + // Celeron D 335 : 2.8GHz NetBurst Prescott-256 (SL8HM, SL7NW, SL7VZ, SL7TJ, SL7DM, SL7L2, SL7C7) si 478 ? + if (getConfig()->lindberghColour == RED || getConfig()->lindberghColour == REDEX) + strcpy(contents[3], "model name : Intel(R) Celeron(R) CPU 2.80GHz"); + if (fileRead[CPUINFO] == 4) return NULL;