diff --git a/Makefile.mak b/Makefile.mak index 25706b6b..4d611ad8 100644 --- a/Makefile.mak +++ b/Makefile.mak @@ -4,15 +4,17 @@ CFLAGS = -ls -Ilibs\master.lib\ -I. -Lbin\ -O -a2 +PIPELINE = \grzview.com TH01 = \zunsoft.com \op.exe \reiiden.exe \fuuin.exe TH02 = \zuninit.com \zun_res.com \op.exe \main.exe \maine.exe \zun.com TH03 = \zunsp.com \res_yume.com \op.exe \main.exe \mainl.exe \zun.com TH04 = \res_huma.com \op.exe \main.exe \maine.exe TH05 = \res_kso.com \op.exe \main.exe \maine.exe -all: th01 th02 th03 th04 th05 +all: pipeline th01 th02 th03 th04 th05 @echo Done. Find the executables in the bin\ subdirectory. +pipeline:: $(PIPELINE:\=bin\Pipeline\) th01:: $(TH01:\=bin\th01\) th02:: $(TH02:\=bin\th02\) th03:: $(TH03:\=bin\th03\) @@ -38,6 +40,10 @@ th05:: $(TH05:\=bin\th05\) .obj.com: tlink /t /3 $** +bin\Pipeline\grzview.com: Pipeline\grzview.cpp th01\formats\grz.cpp + mkdir bin\Pipeline + $(CC) $(CFLAGS) -Z -mt -lt -nbin\Pipeline\ $** masters.lib + bin\th01\zunsoft.com: th01\zunsoft.c $(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib diff --git a/Pipeline/grzview.cpp b/Pipeline/grzview.cpp new file mode 100644 index 00000000..62db4bf2 --- /dev/null +++ b/Pipeline/grzview.cpp @@ -0,0 +1,96 @@ +extern "C" +{ + #include + #include "ReC98.h" + #include "th01/formats/grz.h" + + void grcg_setcolor_rmw(int col) + { + grcg_setcolor(GC_RMW, col); + } + + void grcg_off_func(void) + { + grcg_off(); + } + + // Temporary declarations for local GRZ data + // ----------------------------------------- + // TODO: These will cause duplicate symbol errors once those are defined + // in th01/formats/grz.cpp; remove this section once that is the case. + + // `const` would prevent them from being exported?! + char HGRZ_MAGIC[4] = "HGRZ"; + char HGRX_MAGIC[4] = "HGRX"; + + char planar_stream_id; + char grx_col; + uint8_t* rle_streams[GRX_COUNT]; + dots8_t* planar_streams[GRX_COUNT][PLANAR_STREAM_PER_GRX_COUNT]; + unsigned char planar_stream_count[GRX_COUNT]; + // ----------------------------------------- +} + +void z_palette_set_all_show(const Palette4& pal) +{ + for(int i = 0; i < COLOR_COUNT; i++) { + outportb(0xA8, i); + outportb(0xAA, pal[i].c.g); + outportb(0xAC, pal[i].c.r); + outportb(0xAE, pal[i].c.b); + } +} + +const Palette4 boss8_grz_pal = { + 0x0, 0x0, 0x0, + 0x5, 0x5, 0x5, + 0xC, 0x2, 0x2, + 0x1, 0x0, 0x6, + 0x6, 0x5, 0x9, + 0x8, 0x8, 0xA, + 0xC, 0xB, 0xC, + 0xF, 0xF, 0xF, + 0x1, 0x3, 0xA, + 0x0, 0x8, 0x9, + 0xF, 0x0, 0x0, + 0xA, 0x0, 0x0, + 0x0, 0x0, 0x0, + 0xF, 0xF, 0x0, + 0xE, 0xB, 0xA, + 0x9, 0x9, 0x9, +}; + +int main(int argc, const char **argv) +{ + if((get_machine() & PC9801) == 0) { + printf("This program must be run on a PC-98.\n"); + return -1; + } + if(argc != 3) { + printf( + ".GRZ viewer\n" + "Usage: %s filename.grz subimage\n", + argv[0] + ); + return 1; + } + unsigned int subimage = atoi(argv[2]); + if(subimage >= GRZ_IMAGE_COUNT) { + printf("subimage must be between 0 and %u\n", GRZ_IMAGE_COUNT - 1); + return 3; + } + if(grz_load_single(0, argv[1], subimage)) { + printf("Error loading %s\n", argv[1]); + return 2; + } + text_hide(); + graph_start(); + z_palette_set_all_show(boss8_grz_pal); + + grx_put(0); + dos_getch(); + + text_show(); + grx_free(0); + return 0; +}