# HG changeset patch # User Matti Hamalainen # Date 1645639795 -7200 # Node ID c96448875797a9f70b308291fafe5fe9b039c506 # Parent 51d6e86aa196d17cc0a3a7d0d8ccf22a039e6309 Change "new SLDB" boolean to a flags int. diff -r 51d6e86aa196 -r c96448875797 sidinfo.c --- a/sidinfo.c Sat Jan 01 16:27:28 2022 +0200 +++ b/sidinfo.c Wed Feb 23 20:09:55 2022 +0200 @@ -101,8 +101,7 @@ char *setHVSCPath = NULL, *setSLDBPath = NULL, *setSTILDBPath = NULL; -BOOL setSLDBNewFormat = FALSE, - optParsable = FALSE, +BOOL optParsable = FALSE, optFieldNamePrefix = TRUE, optHexadecimal = FALSE, optFieldOutput = TRUE, @@ -110,7 +109,9 @@ optShowHelp = FALSE; char *optOneLineFieldSep = NULL, *optEscapeChars = NULL; -int optNFiles = 0; +int optNFiles = 0, + setSIDLibFlags = 0; + PSFStack optFormat; @@ -1014,7 +1015,7 @@ th_io_set_handlers(infh, siPSIDError, NULL); // Read PSID data - if ((res = sidlib_read_sid_file_alloc(infh, &psid, setSLDBNewFormat, NULL)) != THERR_OK) + if ((res = sidlib_read_sid_file_alloc(infh, &psid, setSIDLibFlags, NULL)) != THERR_OK) goto error; // Get songlength information, if any @@ -1255,11 +1256,12 @@ // Read SLDB and STILDB if (setSLDBPath != NULL) { - setSLDBNewFormat = th_strrcasecmp(setSLDBPath, ".md5") != NULL; + if (th_strrcasecmp(setSLDBPath, ".md5") != NULL) + setSIDLibFlags |= SIDLIB_FLG_NEW_SLDB; THMSG(1, "Reading SLDB (%s format [%s]): %s\n", - setSLDBNewFormat ? "new" : "old", - setSLDBNewFormat ? ".md5" : ".txt", + (setSIDLibFlags & SIDLIB_FLG_NEW_SLDB) ? "new" : "old", + (setSIDLibFlags & SIDLIB_FLG_NEW_SLDB) ? ".md5" : ".txt", setSLDBPath); if ((res = sidutil_read_sldb_file(setSLDBPath, &sidSLDB)) != THERR_OK) diff -r 51d6e86aa196 -r c96448875797 sidlib.c --- a/sidlib.c Sat Jan 01 16:27:28 2022 +0200 +++ b/sidlib.c Wed Feb 23 20:09:55 2022 +0200 @@ -110,7 +110,7 @@ int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, - const BOOL newSLDB, SIDLibChConvCtx *chconv) + const int flags, SIDLibChConvCtx *chconv) { int ret = THERR_OK; th_md5state_t state; @@ -203,7 +203,7 @@ // Initialize MD5-hash calculation th_md5_init(&state); - if (newSLDB) + if (flags & SIDLIB_FLG_NEW_SLDB) { // New Songlengths.md5 style hash calculation: // We just hash the whole file, so seek back to beginning .. @@ -266,14 +266,14 @@ int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, - const BOOL newSLDB, SIDLibChConvCtx *chconv) + const int flags, SIDLibChConvCtx *chconv) { if ((*ppsid = th_malloc0(sizeof(SIDLibPSIDHeader))) == NULL) return THERR_MALLOC; (*ppsid)->allocated = TRUE; - return sidlib_read_sid_file(ctx, *ppsid, newSLDB, chconv); + return sidlib_read_sid_file(ctx, *ppsid, flags, chconv); } diff -r 51d6e86aa196 -r c96448875797 sidlib.h --- a/sidlib.h Sat Jan 01 16:27:28 2022 +0200 +++ b/sidlib.h Wed Feb 23 20:09:55 2022 +0200 @@ -27,6 +27,12 @@ enum { + SIDLIB_FLG_NEW_SLDB = 0x01, // Using 'new' Songlengths.md5 style SLDB +}; + + +enum +{ // Player flags PSF_PLAYER_TYPE = 0x01, // 0 = built-in, 1 = Compute! SIDPlayer MUS PSF_PLAYSID_TUNE = 0x02, // 0 = Real C64-compatible, 1 = PlaySID specific (v2NG) @@ -168,8 +174,8 @@ // // Functions // -int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, const BOOL newSLDB, SIDLibChConvCtx *chconv); -int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, const BOOL newSLDB, SIDLibChConvCtx *chconv); +int sidlib_read_sid_file(th_ioctx *ctx, SIDLibPSIDHeader *psid, const int flags, SIDLibChConvCtx *chconv); +int sidlib_read_sid_file_alloc(th_ioctx *ctx, SIDLibPSIDHeader **ppsid, const int flags, SIDLibChConvCtx *chconv); void sidlib_free_sid_file(SIDLibPSIDHeader *psid); int sidlib_write_sid_header(th_ioctx *ctx, const SIDLibPSIDHeader *psid);