X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=direct.c;h=e022398ca56d8b089bfcd16149097e84b3ca6b26;hp=9070a4165ea8d88e64978f3c10b360141ab3fdf5;hb=1cd9ca4c09a0e744829b3edb127feb1abd41d35c;hpb=07781922aefc9551dfb3c9f3e957962dcaef92ff diff --git a/direct.c b/direct.c index 9070a41..e022398 100644 --- a/direct.c +++ b/direct.c @@ -559,7 +559,7 @@ int d_noclear(void) // -// Include binary file +// Include binary file (can add addition size & position params, comma separated) // int d_incbin(void) { @@ -586,6 +586,7 @@ int d_incbin(void) // failed) try list of include files passed in the enviroment string or by // the "-d" option. TOKEN filename = tok[1]; + if ((fd = open(string[filename], _OPEN_INC)) < 0) { for(i=0; nthpath("RMACPATH", i, buf1)!=0; i++) @@ -608,6 +609,7 @@ int d_incbin(void) allright: tok += 2; + if (*tok != EOL) { // Check size parameter (can be omitted) @@ -637,6 +639,7 @@ allright: close(fd); return ERROR; } + lseek(fd, pos, SEEK_SET); size -= pos; } @@ -658,6 +661,7 @@ allright: size = lseek(fd, 0L, SEEK_END); pos = lseek(fd, 0L, SEEK_SET); } + chcheck(size); DEBUG { printf("INCBIN: File '%s' is %li bytes.\n", string[filename], size); }