gbdk-2020 | GameBoy Development Kit |
| download: https://git.y1.nz/archives/gbdk.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 6fecbfc9391c6d38355d6b8a2a72987549493e97 parent e203fb90beb1c4f9d26c859da91628b89687b2aa Author: Toxa <56631470+untoxa@users.noreply.github.com> Date: Mon, 9 Nov 2020 14:23:05 +0300 Merge pull request #80 from bbbbbr/develop_lcc_ihx_output_2 LCC: fix output not working if target is -o <filename>.ihx Diffstat:
| M | gbdk-support/lcc/gb.c | 2 | +- |
| M | gbdk-support/lcc/lcc.c | 24 | ++++++++++++++++++------ |
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/gbdk-support/lcc/gb.c b/gbdk-support/lcc/gb.c @@ -219,7 +219,7 @@ static void buildArgs(char **args, const char *template) *last = NULL; } -char *suffixes[] = { ".c", ".i", ".asm;.s", ".o;.obj", ".ihx.gb", 0 }; +char *suffixes[] = { ".c", ".i", ".asm;.s", ".o;.obj", ".ihx;.gb", 0 }; char inputs[256] = ""; char *cpp[256]; diff --git a/gbdk-support/lcc/lcc.c b/gbdk-support/lcc/lcc.c @@ -180,25 +180,37 @@ int main(int argc, char *argv[]) { if(!outfile) outfile = concat("a", first(suffixes[4])); - //file.gb to file.ihx (don't use tmpfile becuase maps and other stuffs are created there) + //file.gb to file.ihx (don't use tmpfile because maps and other stuffs are created there) + + // Check to see if output is a .ihx file + char * ihx_suffix[1] = {".ihx"}; + int target_is_ihx = (suffix(outfile, ihx_suffix, 1) == 0); + char ihxFile[255]; int lastP = strrchr(outfile, '.') - outfile; strncpy(ihxFile, outfile, lastP); ihxFile[lastP] = '\0'; strcat(ihxFile, ".ihx"); - append(ihxFile, rmlist); + + // Only remove .ihx if it's not the final target + if (!target_is_ihx) + append(ihxFile, rmlist); Fixllist(); compose(ld, llist[0], llist[1], append(ihxFile, 0)); if (callsys(av)) errcnt++; - if(errcnt == 0) + // No need to makebin (.ihx -> .gb) if .ihx is final target + if (!target_is_ihx) { - //makebin - compose(mkbin, mkbinlist, append(ihxFile, 0), append(outfile, 0)); - if (callsys(av)) + if(errcnt == 0) + { + //makebin + compose(mkbin, mkbinlist, append(ihxFile, 0), append(outfile, 0)); + if (callsys(av)) errcnt++; + } } } rm(rmlist);
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.