# HG changeset patch # User Matti Hamalainen # Date 1646256185 -7200 # Node ID bb44c48cffac284f0d4d7d64b7b0a9fbd50f0959 # Parent 1559011d749f716e82b286c803efba96dddcda1d Add helper function for getting C64 chargen ROM path from environment variable 'CHARGEN_ROM' and use it instead of the compile-time hardcoded value. diff -r 1559011d749f -r bb44c48cffac tools/64vw.c --- a/tools/64vw.c Wed Mar 02 00:31:27 2022 +0200 +++ b/tools/64vw.c Wed Mar 02 23:23:05 2022 +0200 @@ -25,7 +25,7 @@ optListOnly = FALSE; size_t noptFilenames1 = 0, noptFilenames2 = 0; char **optFilenames = NULL; -char *optCharROMFilename = NULL; +const char *optCharROMFilename = NULL; DMC64Palette *optC64Palette = NULL; char *optC64PaletteFile = NULL; @@ -78,7 +78,7 @@ "Default character ROM file for this build is:\n" " %s\n", SET_SKIP_AMOUNT, - DM_DEF_CHARGEN + dmGetChargenROMPath() ); } @@ -392,7 +392,7 @@ // Check character ROM filename if (optCharROMFilename == NULL) - optCharROMFilename = DM_DEF_CHARGEN; + optCharROMFilename = dmGetChargenROMPath(); // Attempt to read character ROM dmMsg(1, "Using character ROM file '%s'.\n", diff -r 1559011d749f -r bb44c48cffac tools/gfxconv.c --- a/tools/gfxconv.c Wed Mar 02 00:31:27 2022 +0200 +++ b/tools/gfxconv.c Wed Mar 02 23:23:05 2022 +0200 @@ -154,7 +154,7 @@ int optRemapNoMatchColor = -1; DMMapValue optRemapTable[DM_MAX_COLORS]; int optColorMap[D64_NCOLORS]; -char *optCharROMFilename = NULL; +const char *optCharROMFilename = NULL; DMC64Palette *optC64Palette = NULL; char *optPaletteFile = NULL; DMPalette *optPaletteData = NULL; @@ -248,7 +248,7 @@ "Default C64 character ROM file for this build is:\n" "%s\n" "\n", - DM_DEF_CHARGEN + dmGetChargenROMPath() ); } @@ -3010,7 +3010,7 @@ { // Check character ROM filename if (optCharROMFilename == NULL) - optCharROMFilename = DM_DEF_CHARGEN; + optCharROMFilename = dmGetChargenROMPath(); // Attempt to read character ROM dmMsg(1, "Using character ROM file '%s'.\n", diff -r 1559011d749f -r bb44c48cffac tools/lib64util.c --- a/tools/lib64util.c Wed Mar 02 00:31:27 2022 +0200 +++ b/tools/lib64util.c Wed Mar 02 23:23:05 2022 +0200 @@ -8,6 +8,11 @@ #include "lib64util.h" #include "dmfile.h" +// Default character file ROM path, if not defined yet +#ifndef DM_DEF_CHARGEN +#define DM_DEF_CHARGEN "/usr/local/lib64/vice/C64/chargen" +#endif + // // Some common C64 palettes @@ -428,3 +433,14 @@ return res; } + + +const char *dmGetChargenROMPath() +{ + const char *path = getenv("CHARGEN_ROM"); + if (path != NULL) + return path; + else + return DM_DEF_CHARGEN; +} + diff -r 1559011d749f -r bb44c48cffac tools/lib64util.h --- a/tools/lib64util.h Wed Mar 02 00:31:27 2022 +0200 +++ b/tools/lib64util.h Wed Mar 02 23:23:05 2022 +0200 @@ -15,12 +15,6 @@ #endif -// Default character file ROM path, if not defined yet -#ifndef DM_DEF_CHARGEN -#define DM_DEF_CHARGEN "/usr/local/lib64/vice/C64/chargen" -#endif - - // // Global variables // @@ -42,6 +36,8 @@ int dmHandleExternalPalette(const char *filename, DMPalette **ppal); +const char *dmGetChargenROMPath(); + #ifdef __cplusplus }