Mercurial > hg > dmlib
comparison tools/gfxconv.c @ 2126:cffadb745484
Fix character ROM data handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 May 2019 10:47:46 +0300 |
parents | 56d4dc81774b |
children | 903effcd616b |
comparison
equal
deleted
inserted
replaced
2125:56d4dc81774b | 2126:cffadb745484 |
---|---|
1943 | 1943 |
1944 if (!dmArgsProcess(argc, argv, optList, optListN, | 1944 if (!dmArgsProcess(argc, argv, optList, optListN, |
1945 argHandleOpt, argHandleFile, OPTH_BAILOUT)) | 1945 argHandleOpt, argHandleFile, OPTH_BAILOUT)) |
1946 exit(1); | 1946 exit(1); |
1947 | 1947 |
1948 // Check character ROM filename | |
1949 if (optCharROMFilename == NULL) | |
1950 optCharROMFilename = DM_DEF_CHARGEN; | |
1951 | |
1952 // Determine input format, if not specified | 1948 // Determine input format, if not specified |
1953 if (optInType == FFMT_AUTO && optInFilename != NULL) | 1949 if (optInType == FFMT_AUTO && optInFilename != NULL) |
1954 { | 1950 { |
1955 char *dext = strrchr(optInFilename, '.'); | 1951 char *dext = strrchr(optInFilename, '.'); |
1956 if (dext) | 1952 if (dext) |
2150 case FFMT_IMAGE: | 2146 case FFMT_IMAGE: |
2151 case FFMT_CHAR: | 2147 case FFMT_CHAR: |
2152 case FFMT_SPRITE: | 2148 case FFMT_SPRITE: |
2153 // Set character data if required | 2149 // Set character data if required |
2154 if ((inC64Fmt->format->type & D64_FMT_CHAR) && | 2150 if ((inC64Fmt->format->type & D64_FMT_CHAR) && |
2155 inC64Image->charData->data == NULL) | 2151 inC64Image->charData[0].data == NULL) |
2156 { | 2152 { |
2153 // Check character ROM filename | |
2154 if (optCharROMFilename == NULL) | |
2155 optCharROMFilename = DM_DEF_CHARGEN; | |
2156 | |
2157 // Attempt to read character ROM | 2157 // Attempt to read character ROM |
2158 dmMsg(1, "Using character ROM file '%s'.\n", | 2158 dmMsg(1, "Using character ROM file '%s'.\n", |
2159 optCharROMFilename); | 2159 optCharROMFilename); |
2160 | 2160 |
2161 if ((res = dmReadDataFile(NULL, optCharROMFilename, | 2161 if ((res = dmReadDataFile(NULL, optCharROMFilename, |
2162 &inC64Image->charData->data, | 2162 &inC64Image->charData[0].data, |
2163 &inC64Image->charData->size)) != DMERR_OK) | 2163 &inC64Image->charData[0].size)) != DMERR_OK) |
2164 { | 2164 { |
2165 dmErrorMsg("Could not read character ROM from '%s'.\n", | 2165 dmErrorMsg("Could not read character ROM from '%s'.\n", |
2166 optCharROMFilename); | 2166 optCharROMFilename); |
2167 goto error; | 2167 goto error; |
2168 } | 2168 } |