mirror of https://github.com/nmlgc/ReC98.git
[Asset pipeline] Add a .GRZ viewer
… have to hardcode that palette in any stand-alone viewers or converters. Completes P0081, funded by Ember2528.
This commit is contained in:
parent
ac0cbb6dc9
commit
5ac9b301f1
|
@ -4,15 +4,17 @@
|
||||||
|
|
||||||
CFLAGS = -ls -Ilibs\master.lib\ -I. -Lbin\ -O -a2
|
CFLAGS = -ls -Ilibs\master.lib\ -I. -Lbin\ -O -a2
|
||||||
|
|
||||||
|
PIPELINE = \grzview.com
|
||||||
TH01 = \zunsoft.com \op.exe \reiiden.exe \fuuin.exe
|
TH01 = \zunsoft.com \op.exe \reiiden.exe \fuuin.exe
|
||||||
TH02 = \zuninit.com \zun_res.com \op.exe \main.exe \maine.exe \zun.com
|
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
|
TH03 = \zunsp.com \res_yume.com \op.exe \main.exe \mainl.exe \zun.com
|
||||||
TH04 = \res_huma.com \op.exe \main.exe \maine.exe
|
TH04 = \res_huma.com \op.exe \main.exe \maine.exe
|
||||||
TH05 = \res_kso.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.
|
@echo Done. Find the executables in the bin\ subdirectory.
|
||||||
|
|
||||||
|
pipeline:: $(PIPELINE:\=bin\Pipeline\)
|
||||||
th01:: $(TH01:\=bin\th01\)
|
th01:: $(TH01:\=bin\th01\)
|
||||||
th02:: $(TH02:\=bin\th02\)
|
th02:: $(TH02:\=bin\th02\)
|
||||||
th03:: $(TH03:\=bin\th03\)
|
th03:: $(TH03:\=bin\th03\)
|
||||||
|
@ -38,6 +40,10 @@ th05:: $(TH05:\=bin\th05\)
|
||||||
.obj.com:
|
.obj.com:
|
||||||
tlink /t /3 $**
|
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
|
bin\th01\zunsoft.com: th01\zunsoft.c
|
||||||
$(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib
|
$(CC) $(CFLAGS) -mt -lt -nbin\th01\ $** masters.lib
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include <stdio.h>
|
||||||
|
#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;
|
||||||
|
}
|
Loading…
Reference in New Issue