comparison tools/gfxconv.c @ 2200:dcd26cdc395e

Replace dmC64InitializeFormats() with dmLib64GFXInit() and dmLib64GFXClose(). Add in sorting of the C64 formats list.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 00:00:27 +0300
parents c26a51ea70be
children 9f3fb4004c20
comparison
equal deleted inserted replaced
2199:f331cc750b37 2200:dcd26cdc395e
202 "------+----+-----------------+-------------------------------------\n" 202 "------+----+-----------------+-------------------------------------\n"
203 ); 203 );
204 204
205 for (int i = 0; i < ndmC64ImageFormats; i++) 205 for (int i = 0; i < ndmC64ImageFormats; i++)
206 { 206 {
207 const DMC64ImageFormat *fmt = &dmC64ImageFormats[i]; 207 const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i];
208 char buf[64]; 208 char buf[64];
209 printf("%-6s| %c%c | %-15s | %s%s\n", 209 printf("%-6s| %c%c | %-15s | %s%s\n",
210 fmt->fext, 210 fmt->fext,
211 (fmt->flags & DM_FMT_RD) ? 'R' : ' ', 211 (fmt->flags & DM_FMT_RD) ? 'R' : ' ',
212 (fmt->flags & DM_FMT_WR) ? 'W' : ' ', 212 (fmt->flags & DM_FMT_WR) ? 'W' : ' ',
1928 1928
1929 // Initialize c64 image conversion spec 1929 // Initialize c64 image conversion spec
1930 memset(&imageSpecC64, 0, sizeof(imageSpecC64)); 1930 memset(&imageSpecC64, 0, sizeof(imageSpecC64));
1931 1931
1932 // Initialize list of additional conversion formats 1932 // Initialize list of additional conversion formats
1933 dmC64InitializeFormats(); 1933 if ((res = dmLib64GFXInit()) != DMERR_OK)
1934 {
1935 dmErrorMsg("Could not initialize lib64gfx: %s\n",
1936 dmErrorStr(res));
1937 goto exit;
1938 }
1939
1934 nconvFormatList = ndmImageFormatList + nbaseFormatList; 1940 nconvFormatList = ndmImageFormatList + nbaseFormatList;
1935 convFormatList = dmCalloc(nconvFormatList, sizeof(DMConvFormat)); 1941 convFormatList = dmCalloc(nconvFormatList, sizeof(DMConvFormat));
1936 1942
1937 for (n = i = 0; i < ndmImageFormatList; i++) 1943 for (n = i = 0; i < ndmImageFormatList; i++)
1938 { 1944 {
2312 dmFree(dataBufOrig); 2318 dmFree(dataBufOrig);
2313 dmC64ImageFree(inC64Image); 2319 dmC64ImageFree(inC64Image);
2314 dmC64ImageFree(outC64Image); 2320 dmC64ImageFree(outC64Image);
2315 dmImageFree(inImage); 2321 dmImageFree(inImage);
2316 dmImageFree(outImage); 2322 dmImageFree(outImage);
2323 dmLib64GFXClose();
2317 2324
2318 return 0; 2325 return 0;
2319 } 2326 }