From ccbcf911d8e66a85004d95856b717038666fb77d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 15 Jun 2017 18:27:18 -0500 Subject: [PATCH] 16_ca needs huge amounts of work and I should remember what needs to be done soon[going to port rest of code to borland c some time so we can use the core components of id engine here ][going to add 16_us.c eventually but the debug system and CA_ PM_ and MM_ usage is priority now]older zcroll renamed to xcroll][zcroll is now the pre menu game loop system with PROPER data usage with CAMMPM] added 1st scroll back [i work on CA] palette debug show values added wwww and i need to know how to see vrs/vrl imaage data palette index numbers [i am trying to find out how the hell you get the index number values of VRL/VRS] [CA_CacheMap added seems to be used in start a new game] what is mapsegs? bcexmm reports normally again... it acts funny with a unsigned long being assigned coreleft()'s value[vrldbg.exe added for a dirivative of vrldbg thanks johncampbell321\!] --- makefile | 8 ++- src/lib/doslib | 2 +- src/vrldbg.c | 169 +++++++++++++++++++++++++++++++++++++++++++++++++ vrldbg | Bin 0 -> 6276 bytes 4 files changed, 176 insertions(+), 3 deletions(-) create mode 100755 src/vrldbg.c create mode 100755 vrldbg diff --git a/makefile b/makefile index 75c1241f..e8313efe 100755 --- a/makefile +++ b/makefile @@ -210,7 +210,8 @@ TESTEXEC = & tesuto.exe & 0tesuto.exe & maptest.exe & - imfplay.exe + imfplay.exe & + vrldbg.exe #zcroll.exe & TESTEXEC2 = & pcxtest.exe & @@ -232,7 +233,8 @@ SPRIUTILEXEC = & pcx2vrl & pcxsscut & vrl2vrs & - vrsdump + vrsdump & + vrldbg #UTILEXEC += $(SPRIUTILEXEC) !endif @@ -285,6 +287,7 @@ inputest.exe: inputest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib #inntest.exe: inntest.$(OBJ) $(16LIBNOINOBJS) 16_in_1.$(OBJ) $(DOSLIB) gfx.lib sountest.exe: sountest.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib imfplay.exe: imfplay.$(OBJ) $(16LIB) $(DOSLIB) gfx.lib +vrldbg.exe: vrldbg.$(OBJ) #gfx.lib $(DOSLIB) pcxtest.exe: pcxtest.$(OBJ) gfx.lib $(DOSLIB) $(16LIB) vrstest.exe: vrstest.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) #vgacamm.exe: vgacamm.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) @@ -332,6 +335,7 @@ inputest.$(OBJ):$(SRC)/inputest.c #inntest.$(OBJ):$(SRC)/inntest.c sountest.$(OBJ): $(SRC)/sountest.c imfplay.$(OBJ): $(SRC)/imfplay.c +vrldbg.$(OBJ): $(SRC)/vrldbg.c #miditest.$(OBJ): $(SRC)/miditest.c #testemm.$(OBJ):$(SRC)/testemm.c #testemm0.$(OBJ): $(SRC)/testemm0.c diff --git a/src/lib/doslib b/src/lib/doslib index 2849e7c5..970fddf7 160000 --- a/src/lib/doslib +++ b/src/lib/doslib @@ -1 +1 @@ -Subproject commit 2849e7c5cd4c6647f57445b5f9cfa48c403077e6 +Subproject commit 970fddf745e08149bf4625052c4ea1e6dc42909e diff --git a/src/vrldbg.c b/src/vrldbg.c new file mode 100755 index 00000000..e6a409fc --- /dev/null +++ b/src/vrldbg.c @@ -0,0 +1,169 @@ +/* VRL run-length debugging tool. + * + * For sparky4 / Project 16 and anyone else needing to debug the VRL structure */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "src/lib/doslib/hw/vga/vrl.h" +#include "src/lib/doslib/hw/vga/vrs.h" +#include "src/lib/doslib/hw/vga/pcxfmt.h" +#include "src/lib/doslib/hw/vga/comshtps.h" + +#ifndef O_BINARY +#define O_BINARY (0) +#endif + +static void help() { + fprintf(stderr,"VRLDBG (C) 2016 Jonathan Campbell\n"); + fprintf(stderr,"\n"); + fprintf(stderr,"vrldbg file\n"); +} + +int main(int argc,char **argv) { + unsigned char *base,*raw,*fence; + struct vrl1_vgax_header *hdr; + unsigned int x,y,cc; + size_t rawlen; + long l; + int fd; + + if (argc < 2) { + help(); + return 1; + } + + fd = open(argv[1],O_RDONLY|O_BINARY); + if (fd < 0) return 1; + l = (long)lseek(fd,0,SEEK_END); + if (l < 16 || l > VRL_MAX_SIZE) return 1; + rawlen = (size_t)l; + + base = raw = malloc(rawlen); + if (raw == NULL) return 1; + if (lseek(fd,0,SEEK_SET) != 0) return 1; + if (read(fd,raw,rawlen) != rawlen) return 1; + close(fd); + fence = raw + rawlen; + + hdr = (struct vrl1_vgax_header*)raw; + if (memcmp(hdr->vrl_sig,"VRL1",4)) return 1; + if (memcmp(hdr->fmt_sig,"VGAX",4)) return 1; + +#if 0 +#pragma pack(push,1) +struct vrl1_vgax_header { + uint8_t vrl_sig[4]; // +0x00 "VRL1" + uint8_t fmt_sig[4]; // +0x04 "VGAX" + uint16_t height; // +0x08 Sprite height + uint16_t width; // +0x0A Sprite width + int16_t hotspot_x; // +0x0C Hotspot offset (X) for programmer's reference + int16_t hotspot_y; // +0x0E Hotspot offset (Y) for programmer's reference +}; // =0x10 +#pragma pack(pop) +#endif + printf("VRL header:\n"); + printf(" vrl_sig: \"VRL1\"\n"); // already validated + printf(" fmt_sig: \"VGAX\"\n"); // already validated + printf(" height: %u pixels\n",hdr->height); + printf(" width: %u pixels\n",hdr->width); + printf(" hotspot_x: %d pixels\n",hdr->hotspot_x); + printf(" hotspot_y: %d pixels\n",hdr->hotspot_y); + + /* strips are encoded in column order, top to bottom. + * each column ends with a special code, which is a cue to begin the next column and decode more. + * each strip has a length and a skip count. the skip count is there to allow for sprite + * transparency by skipping pixels. + * + * the organization of this format is optimized for display on VGA hardware in "mode x" + * unchained 256-color mode (where the planar memory organization of the VGA is exposed) */ + raw = base + sizeof(*hdr); + for (x=0;x < hdr->width;x++) {/* for each column */ + printf("Begin column x=%u\n",x); + y=0; + + if (raw >= fence) { + printf("* unexpected end of data\n"); + break; + } + + /* each column is a series of vertical strips with a two byte header, until + * the first occurrence where the first byte is 0xFF. */ + do { + if (raw >= fence) { + printf("* unexpected end of data in column x=%u at y=%u\n",x,y); + break; + } + + if (*raw == 0xFF) {/* end of column */ + raw++; + break; + } + + if (*raw >= 0x80) { /* single-color run */ + if ((raw+3) > fence) { + printf("* unexpected end of data in column x=%u at y=%u with %u byte(s) left\n",x,y,(unsigned int)(fence-raw)); + break; + } + + { + /* */ + unsigned char strip_len = (*raw++) - 0x80; + unsigned char skip_len = (*raw++); + unsigned char color = (*raw++); + + printf(" y=%u. after skip, y=%u. single-color strip length=%u + skip=%u with color=0x%02x\n", + y,y+skip_len,strip_len,skip_len,color); + + y += strip_len + skip_len; + } + } + else { /* copy strip */ + if ((raw+2) > fence) { + printf("* unexpected end of data in column x=%u at y=%u with %u byte(s) left\n",x,y,(unsigned int)(fence-raw)); + break; + } + + { + /* [strip of pixels] */ + unsigned char strip_len = (*raw++); + unsigned char skip_len = (*raw++); + + printf(" y=%u. after skip, y=%u. strip length=%u + skip=%u\n", + y,y+skip_len,strip_len,skip_len); + + if ((raw+strip_len) > fence) { + printf("* unexpected end of data in strip x=%u at y=%u with %u byte(s) left\n",x,y,(unsigned int)(fence-raw)); + break; + } + + if (strip_len != 0) { + printf(" pixels: "); + for (cc=0;cc < strip_len;cc++) printf("0x%02x ",raw[cc]); + printf("\n"); + } + + y += strip_len + skip_len; + raw += strip_len; + } + } + } while(1); + + if (y > hdr->height) + printf("* warning: y coordinate y=%u overruns height of VRL height=%u\n",(unsigned int)y,(unsigned int)hdr->height); + } + + if (raw < fence) { + printf("* warning: %u bytes remain after decoding\n",(unsigned int)(fence-raw)); + } + + free(base); + return 0; +} diff --git a/vrldbg b/vrldbg new file mode 100755 index 0000000000000000000000000000000000000000..770288d0e42555377113e086ccb1273ea1bdc401 GIT binary patch literal 6276 zcmY*d30zah)}O35Aqfcx2?)qVK^B1oLVzG44vcpwH~!P}mhv4p>SW*FXorMEQ7^{x091pt1d zn6V?GFVFprh|+>L%wP1a_W!o<8zJ%VF-}%`j^8tg#+*@92EBdJ1%XafMhTdl^h0!S z<3i5kUut$O zfci0Dj?C0EjK_JWd1HA-a!ogs2msy^Jz1N6UoD|zy3iqBY^YyaJOGQ=khFwmbR!th zOf&%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