comparison sidinfo.c @ 222:3a01518fffe0

Rename sidlib functions from si_* prefix to sidlib_*.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 27 Dec 2019 11:12:42 +0200
parents 55697860d4a7
children 15a51252b73a
comparison
equal deleted inserted replaced
221:8db9830e5d97 222:3a01518fffe0
925 if (psid->version >= 2) 925 if (psid->version >= 2)
926 PRS((psid->flags & PSF_PLAYSID_TUNE) ? (psid->isRSID ? "C64 BASIC" : "PlaySID") : "C64 compatible", FALSE); 926 PRS((psid->flags & PSF_PLAYSID_TUNE) ? (psid->isRSID ? "C64 BASIC" : "PlaySID") : "C64 compatible", FALSE);
927 break; 927 break;
928 case 5: 928 case 5:
929 if (psid->version >= 2) 929 if (psid->version >= 2)
930 PRS(si_get_sid_clock_str((psid->flags >> 2) & PSF_CLOCK_MASK), FALSE); 930 PRS(sidlib_get_sid_clock_str((psid->flags >> 2) & PSF_CLOCK_MASK), FALSE);
931 break; 931 break;
932 case 6: 932 case 6:
933 if (psid->version >= 2) 933 if (psid->version >= 2)
934 PRS(si_get_sid_model_str((psid->flags >> 4) & PSF_MODEL_MASK), FALSE); 934 PRS(sidlib_get_sid_model_str((psid->flags >> 4) & PSF_MODEL_MASK), FALSE);
935 break; 935 break;
936 936
937 case 7: PRI(psid->dataOffset); break; 937 case 7: PRI(psid->dataOffset); break;
938 case 8: PRI(psid->dataSize); break; 938 case 8: PRI(psid->dataSize); break;
939 case 9: PRI(psid->loadAddress); break; 939 case 9: PRI(psid->loadAddress); break;
947 { 947 {
948 int flags = (psid->flags >> 6) & PSF_MODEL_MASK; 948 int flags = (psid->flags >> 6) & PSF_MODEL_MASK;
949 if (flags == PSF_MODEL_UNKNOWN) 949 if (flags == PSF_MODEL_UNKNOWN)
950 flags = (psid->flags >> 4) & PSF_MODEL_MASK; 950 flags = (psid->flags >> 4) & PSF_MODEL_MASK;
951 951
952 PRS(si_get_sid_model_str(flags), FALSE); 952 PRS(sidlib_get_sid_model_str(flags), FALSE);
953 } 953 }
954 break; 954 break;
955 case 15: 955 case 15:
956 if (psid->version >= 4) 956 if (psid->version >= 4)
957 { 957 {
958 int flags = (psid->flags >> 8) & PSF_MODEL_MASK; 958 int flags = (psid->flags >> 8) & PSF_MODEL_MASK;
959 if (flags == PSF_MODEL_UNKNOWN) 959 if (flags == PSF_MODEL_UNKNOWN)
960 flags = (psid->flags >> 4) & PSF_MODEL_MASK; 960 flags = (psid->flags >> 4) & PSF_MODEL_MASK;
961 961
962 PRS(si_get_sid_model_str(flags), FALSE); 962 PRS(sidlib_get_sid_model_str(flags), FALSE);
963 } 963 }
964 break; 964 break;
965 case 16: 965 case 16:
966 if (psid->version >= 3) 966 if (psid->version >= 3)
967 PRI(0xD000 | (psid->sid2Addr << 4)); 967 PRI(0xD000 | (psid->sid2Addr << 4));
1029 } 1029 }
1030 1030
1031 th_io_set_handlers(inFile, siError, NULL); 1031 th_io_set_handlers(inFile, siError, NULL);
1032 1032
1033 // Read PSID data 1033 // Read PSID data
1034 if (!si_read_sid_file(inFile, &psid, setSLDBNewFormat)) 1034 if (!sidlib_read_sid_file(inFile, &psid, setSLDBNewFormat))
1035 goto error; 1035 goto error;
1036 1036
1037 // Get songlength information, if any 1037 // Get songlength information, if any
1038 if (sidSLDB != NULL) 1038 if (sidSLDB != NULL)
1039 psid->lengths = si_sldb_get_by_hash(sidSLDB, psid->hash); 1039 psid->lengths = sidlib_sldb_get_by_hash(sidSLDB, psid->hash);
1040 1040
1041 // Output 1041 // Output
1042 for (int index = 0; index < optFormat.nitems; index++) 1042 for (int index = 0; index < optFormat.nitems; index++)
1043 { 1043 {
1044 PSFStackItem *item = &optFormat.items[index]; 1044 PSFStackItem *item = &optFormat.items[index];
1063 fprintf(outFile, "\n"); 1063 fprintf(outFile, "\n");
1064 } 1064 }
1065 1065
1066 // Shutdown 1066 // Shutdown
1067 error: 1067 error:
1068 si_free_sid_file(psid); 1068 sidlib_free_sid_file(psid);
1069 th_io_free(inFile); 1069 th_io_free(inFile);
1070 1070
1071 return TRUE; 1071 return TRUE;
1072 } 1072 }
1073 1073
1291 THMSG(1, "Reading SLDB (%s format [%s]): %s\n", 1291 THMSG(1, "Reading SLDB (%s format [%s]): %s\n",
1292 setSLDBNewFormat ? "new" : "old", 1292 setSLDBNewFormat ? "new" : "old",
1293 setSLDBNewFormat ? ".md5" : ".txt", 1293 setSLDBNewFormat ? ".md5" : ".txt",
1294 setSLDBPath); 1294 setSLDBPath);
1295 1295
1296 if ((sidSLDB = si_sldb_new()) == NULL) 1296 if ((sidSLDB = sidlib_sldb_new()) == NULL)
1297 { 1297 {
1298 THERR("Could not allocate SLDB structure!\n"); 1298 THERR("Could not allocate SLDB structure!\n");
1299 goto err; 1299 goto err;
1300 } 1300 }
1301 1301
1302 if ((ret = si_sldb_read(inFile, sidSLDB)) != THERR_OK) 1302 if ((ret = sidlib_sldb_read(inFile, sidSLDB)) != THERR_OK)
1303 { 1303 {
1304 THERR("Error parsing SLDB: %d, %s\n", 1304 THERR("Error parsing SLDB: %d, %s\n",
1305 ret, th_error_str(ret)); 1305 ret, th_error_str(ret));
1306 goto err; 1306 goto err;
1307 } 1307 }
1308 th_io_close(inFile); 1308 th_io_close(inFile);
1309 1309
1310 if ((ret = si_sldb_build_index(sidSLDB)) != THERR_OK) 1310 if ((ret = sidlib_sldb_build_index(sidSLDB)) != THERR_OK)
1311 { 1311 {
1312 THERR("Error building SLDB index: %d, %s.\n", 1312 THERR("Error building SLDB index: %d, %s.\n",
1313 ret, th_error_str(ret)); 1313 ret, th_error_str(ret));
1314 goto err; 1314 goto err;
1315 } 1315 }
1335 iconv_close(setChConv); 1335 iconv_close(setChConv);
1336 #endif 1336 #endif
1337 1337
1338 th_free(setHVSCPath); 1338 th_free(setHVSCPath);
1339 th_free(setSLDBPath); 1339 th_free(setSLDBPath);
1340 si_sldb_free(sidSLDB); 1340 sidlib_sldb_free(sidSLDB);
1341 return 0; 1341 return 0;
1342 } 1342 }