mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-13 11:30:44 +00:00
Build tools: Whitespace cleanup and tab stop replacement.
git-svn-id: https://svn.eduke32.com/eduke32@2473 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a9fc470258
commit
67f946bdd8
14 changed files with 2662 additions and 2662 deletions
|
@ -12,145 +12,145 @@ FILE *output = NULL;
|
||||||
|
|
||||||
void usage(void)
|
void usage(void)
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"enumdisplay by Jonathon Fowler (jf@jonof.id.au)\n"
|
"enumdisplay by Jonathon Fowler (jf@jonof.id.au)\n"
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -h, -?, --help This message\n"
|
" -h, -?, --help This message\n"
|
||||||
" -o <filename> Use different output file (default: "
|
" -o <filename> Use different output file (default: "
|
||||||
DEFAULT_OUTPUT_FILE ", use - for stdout)\n"
|
DEFAULT_OUTPUT_FILE ", use - for stdout)\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpdevmode(DEVMODE *devmode)
|
void dumpdevmode(DEVMODE *devmode)
|
||||||
{
|
{
|
||||||
fprintf(output, "\tdmFields has");
|
fprintf(output, "\tdmFields has");
|
||||||
if (devmode->dmFields & DM_PELSWIDTH) fprintf(output, " DM_PELSWIDTH");
|
if (devmode->dmFields & DM_PELSWIDTH) fprintf(output, " DM_PELSWIDTH");
|
||||||
if (devmode->dmFields & DM_PELSHEIGHT) fprintf(output, " DM_PELSHEIGHT");
|
if (devmode->dmFields & DM_PELSHEIGHT) fprintf(output, " DM_PELSHEIGHT");
|
||||||
if (devmode->dmFields & DM_BITSPERPEL) fprintf(output, " DM_BITSPERPEL");
|
if (devmode->dmFields & DM_BITSPERPEL) fprintf(output, " DM_BITSPERPEL");
|
||||||
fprintf(output, "\n\tdmPelsWidth = %d\n", devmode->dmPelsWidth);
|
fprintf(output, "\n\tdmPelsWidth = %d\n", devmode->dmPelsWidth);
|
||||||
fprintf(output, "\tdmPelsHeight = %d\n", devmode->dmPelsHeight);
|
fprintf(output, "\tdmPelsHeight = %d\n", devmode->dmPelsHeight);
|
||||||
fprintf(output, "\tdmBitsPerPel = %d\n", devmode->dmBitsPerPel);
|
fprintf(output, "\tdmBitsPerPel = %d\n", devmode->dmBitsPerPel);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI ddenum(DDSURFACEDESC *ddsd, VOID *udata)
|
HRESULT WINAPI ddenum(DDSURFACEDESC *ddsd, VOID *udata)
|
||||||
{
|
{
|
||||||
fprintf(output, "\tdwFlags has");
|
fprintf(output, "\tdwFlags has");
|
||||||
if (ddsd->dwFlags & DDSD_WIDTH) fprintf(output, " DDSD_WIDTH");
|
if (ddsd->dwFlags & DDSD_WIDTH) fprintf(output, " DDSD_WIDTH");
|
||||||
if (ddsd->dwFlags & DDSD_HEIGHT) fprintf(output, " DDSD_HEIGHT");
|
if (ddsd->dwFlags & DDSD_HEIGHT) fprintf(output, " DDSD_HEIGHT");
|
||||||
if (ddsd->dwFlags & DDSD_PIXELFORMAT) fprintf(output, " DDSD_PIXELFORMAT");
|
if (ddsd->dwFlags & DDSD_PIXELFORMAT) fprintf(output, " DDSD_PIXELFORMAT");
|
||||||
fprintf(output, "\n\tdwWidth = %d\n", ddsd->dwWidth);
|
fprintf(output, "\n\tdwWidth = %d\n", ddsd->dwWidth);
|
||||||
fprintf(output, "\tdwHeight = %d\n", ddsd->dwHeight);
|
fprintf(output, "\tdwHeight = %d\n", ddsd->dwHeight);
|
||||||
fprintf(output, "\tddpfPixelFormat.dwFlags has");
|
fprintf(output, "\tddpfPixelFormat.dwFlags has");
|
||||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED1) fprintf(output, " DDPF_PALETTEINDEXED1");
|
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED1) fprintf(output, " DDPF_PALETTEINDEXED1");
|
||||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED2) fprintf(output, " DDPF_PALETTEINDEXED2");
|
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED2) fprintf(output, " DDPF_PALETTEINDEXED2");
|
||||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) fprintf(output, " DDPF_PALETTEINDEXED4");
|
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED4) fprintf(output, " DDPF_PALETTEINDEXED4");
|
||||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) fprintf(output, " DDPF_PALETTEINDEXED8");
|
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) fprintf(output, " DDPF_PALETTEINDEXED8");
|
||||||
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_RGB) fprintf(output, " DDPF_RGB");
|
if (ddsd->ddpfPixelFormat.dwFlags & DDPF_RGB) fprintf(output, " DDPF_RGB");
|
||||||
fprintf(output, "\n\tddpfPixelFormat.dwRGBBitCount = %d\n", ddsd->ddpfPixelFormat.dwRGBBitCount);
|
fprintf(output, "\n\tddpfPixelFormat.dwRGBBitCount = %d\n", ddsd->ddpfPixelFormat.dwRGBBitCount);
|
||||||
fprintf(output, "\n");
|
fprintf(output, "\n");
|
||||||
|
|
||||||
return(DDENUMRET_OK);
|
return(DDENUMRET_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InitDirectDraw(void)
|
int InitDirectDraw(void)
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
HRESULT (WINAPI *aDirectDrawCreate)(GUID *, LPDIRECTDRAW *, IUnknown *);
|
HRESULT (WINAPI *aDirectDrawCreate)(GUID *, LPDIRECTDRAW *, IUnknown *);
|
||||||
HRESULT (WINAPI *aDirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID);
|
HRESULT (WINAPI *aDirectDrawEnumerate)(LPDDENUMCALLBACK, LPVOID);
|
||||||
DDCAPS ddcaps;
|
DDCAPS ddcaps;
|
||||||
|
|
||||||
hDDrawDLL = LoadLibrary("DDRAW.DLL");
|
hDDrawDLL = LoadLibrary("DDRAW.DLL");
|
||||||
if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; }
|
if (!hDDrawDLL) { fprintf(output, "Failed loading DDRAW.DLL\n"); return -1; }
|
||||||
|
|
||||||
aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
|
aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
|
||||||
if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; }
|
if (!aDirectDrawEnumerate) { fprintf(output, "Error fetching DirectDrawEnumerate\n"); return -1; }
|
||||||
|
|
||||||
aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate");
|
aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate");
|
||||||
if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; }
|
if (!aDirectDrawCreate) { fprintf(output, "Error fetching DirectDrawCreate\n"); return -1; }
|
||||||
|
|
||||||
result = aDirectDrawCreate(NULL, &lpDD, NULL);
|
result = aDirectDrawCreate(NULL, &lpDD, NULL);
|
||||||
if (result != DD_OK) { fprintf(output, "DirectDrawCreate() failed (%d)\n", result); return -1; }
|
if (result != DD_OK) { fprintf(output, "DirectDrawCreate() failed (%d)\n", result); return -1; }
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UninitDirectDraw(void)
|
void UninitDirectDraw(void)
|
||||||
{
|
{
|
||||||
if (lpDD) IDirectDraw_Release(lpDD);
|
if (lpDD) IDirectDraw_Release(lpDD);
|
||||||
lpDD = NULL;
|
lpDD = NULL;
|
||||||
if (hDDrawDLL) FreeLibrary(hDDrawDLL);
|
if (hDDrawDLL) FreeLibrary(hDDrawDLL);
|
||||||
hDDrawDLL = NULL;
|
hDDrawDLL = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
DEVMODE devmode;
|
DEVMODE devmode;
|
||||||
HRESULT hresult;
|
HRESULT hresult;
|
||||||
|
|
||||||
for (i=1; i<argc; i++) {
|
for (i=1; i<argc; i++) {
|
||||||
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "--help")) {
|
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "-?") || !strcmp(argv[i], "--help")) {
|
||||||
usage();
|
usage();
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!strcmp(argv[i], "-o")) {
|
} else if (!strcmp(argv[i], "-o")) {
|
||||||
outputfile = argv[++i];
|
outputfile = argv[++i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(outputfile, "-")) {
|
if (!strcmp(outputfile, "-")) {
|
||||||
output = fdopen(1, "wt");
|
output = fdopen(1, "wt");
|
||||||
outputfile = NULL;
|
outputfile = NULL;
|
||||||
} else {
|
} else {
|
||||||
output = fopen(outputfile, "wt");
|
output = fopen(outputfile, "wt");
|
||||||
if (!output) {
|
if (!output) {
|
||||||
fprintf(stderr, "enumdisplay: failed to open %s for output\n", outputfile);
|
fprintf(stderr, "enumdisplay: failed to open %s for output\n", outputfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(output,
|
fprintf(output,
|
||||||
"enumdisplay results\n"
|
"enumdisplay results\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Display settings:\n"
|
"Display settings:\n"
|
||||||
);
|
);
|
||||||
ZeroMemory(&devmode, sizeof(devmode));
|
ZeroMemory(&devmode, sizeof(devmode));
|
||||||
devmode.dmSize = sizeof(DEVMODE);
|
devmode.dmSize = sizeof(DEVMODE);
|
||||||
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode)) {
|
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode)) {
|
||||||
fprintf(output, "\tEnumDisplaySettings() FAILED!\n");
|
fprintf(output, "\tEnumDisplaySettings() FAILED!\n");
|
||||||
} else {
|
} else {
|
||||||
dumpdevmode(&devmode);
|
dumpdevmode(&devmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(output,
|
fprintf(output,
|
||||||
"\n"
|
"\n"
|
||||||
"All modes from EnumDisplaySettings:\n"
|
"All modes from EnumDisplaySettings:\n"
|
||||||
);
|
);
|
||||||
ZeroMemory(&devmode, sizeof(devmode));
|
ZeroMemory(&devmode, sizeof(devmode));
|
||||||
devmode.dmSize = sizeof(DEVMODE);
|
devmode.dmSize = sizeof(DEVMODE);
|
||||||
i = 0;
|
i = 0;
|
||||||
while (EnumDisplaySettings(NULL, i, &devmode)) {
|
while (EnumDisplaySettings(NULL, i, &devmode)) {
|
||||||
dumpdevmode(&devmode);
|
dumpdevmode(&devmode);
|
||||||
fprintf(output, "\n");
|
fprintf(output, "\n");
|
||||||
ZeroMemory(&devmode, sizeof(devmode));
|
ZeroMemory(&devmode, sizeof(devmode));
|
||||||
devmode.dmSize = sizeof(DEVMODE);
|
devmode.dmSize = sizeof(DEVMODE);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!InitDirectDraw()) {
|
if (!InitDirectDraw()) {
|
||||||
fprintf(output,
|
fprintf(output,
|
||||||
"\n"
|
"\n"
|
||||||
"All modes from IDirectDraw::EnumDisplayModes:\n"
|
"All modes from IDirectDraw::EnumDisplayModes:\n"
|
||||||
);
|
);
|
||||||
hresult = IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, (LPVOID)0, ddenum);
|
hresult = IDirectDraw_EnumDisplayModes(lpDD, 0, NULL, (LPVOID)0, ddenum);
|
||||||
if (hresult != DD_OK) {
|
if (hresult != DD_OK) {
|
||||||
fprintf(output, "\tIDirectDraw::EnumDisplayModes() FAILED! (%d)\n", hresult);
|
fprintf(output, "\tIDirectDraw::EnumDisplayModes() FAILED! (%d)\n", hresult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UninitDirectDraw();
|
UninitDirectDraw();
|
||||||
|
|
||||||
if (outputfile) fclose(output);
|
if (outputfile) fclose(output);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,120 +10,120 @@
|
||||||
|
|
||||||
char *WhatGUID(const GUID *guid)
|
char *WhatGUID(const GUID *guid)
|
||||||
{
|
{
|
||||||
if (guid == &GUID_XAxis) return "&GUID_XAxis";
|
if (guid == &GUID_XAxis) return "&GUID_XAxis";
|
||||||
if (guid == &GUID_YAxis) return "&GUID_YAxis";
|
if (guid == &GUID_YAxis) return "&GUID_YAxis";
|
||||||
if (guid == &GUID_ZAxis) return "&GUID_ZAxis";
|
if (guid == &GUID_ZAxis) return "&GUID_ZAxis";
|
||||||
if (guid == &GUID_RxAxis) return "&GUID_RxAxis";
|
if (guid == &GUID_RxAxis) return "&GUID_RxAxis";
|
||||||
if (guid == &GUID_RyAxis) return "&GUID_RyAxis";
|
if (guid == &GUID_RyAxis) return "&GUID_RyAxis";
|
||||||
if (guid == &GUID_RzAxis) return "&GUID_RzAxis";
|
if (guid == &GUID_RzAxis) return "&GUID_RzAxis";
|
||||||
if (guid == &GUID_Slider) return "&GUID_Slider";
|
if (guid == &GUID_Slider) return "&GUID_Slider";
|
||||||
|
|
||||||
if (guid == &GUID_Button) return "&GUID_Button";
|
if (guid == &GUID_Button) return "&GUID_Button";
|
||||||
if (guid == &GUID_Key) return "&GUID_Key";
|
if (guid == &GUID_Key) return "&GUID_Key";
|
||||||
|
|
||||||
if (guid == &GUID_POV) return "&GUID_POV";
|
if (guid == &GUID_POV) return "&GUID_POV";
|
||||||
|
|
||||||
if (guid == &GUID_Unknown) return "&GUID_Unknown";
|
if (guid == &GUID_Unknown) return "&GUID_Unknown";
|
||||||
|
|
||||||
return "NULL";
|
return "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
fp = fopen("didf.txt", "w");
|
fp = fopen("didf.txt", "w");
|
||||||
if (!fp) return -1;
|
if (!fp) return -1;
|
||||||
setvbuf(fp, NULL, _IONBF, 0);
|
setvbuf(fp, NULL, _IONBF, 0);
|
||||||
|
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"// Keyboard\n"
|
"// Keyboard\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {\n"
|
"static DIOBJECTDATAFORMAT c_dfDIKeyboard_odf[] = {\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (i=0; i<c_dfDIKeyboard.dwNumObjs; i++) {
|
for (i=0; i<c_dfDIKeyboard.dwNumObjs; i++) {
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||||
WhatGUID(c_dfDIKeyboard.rgodf[i].pguid),
|
WhatGUID(c_dfDIKeyboard.rgodf[i].pguid),
|
||||||
c_dfDIKeyboard.rgodf[i].dwOfs,
|
c_dfDIKeyboard.rgodf[i].dwOfs,
|
||||||
c_dfDIKeyboard.rgodf[i].dwType,
|
c_dfDIKeyboard.rgodf[i].dwType,
|
||||||
c_dfDIKeyboard.rgodf[i].dwFlags
|
c_dfDIKeyboard.rgodf[i].dwFlags
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"const DIDATAFORMAT c_dfDIKeyboard = { %d, %d, 0x%08X, %d, %d, c_dfDIKeyboard_odf };\n\n",
|
"const DIDATAFORMAT c_dfDIKeyboard = { %d, %d, 0x%08X, %d, %d, c_dfDIKeyboard_odf };\n\n",
|
||||||
c_dfDIKeyboard.dwSize,
|
c_dfDIKeyboard.dwSize,
|
||||||
c_dfDIKeyboard.dwObjSize,
|
c_dfDIKeyboard.dwObjSize,
|
||||||
c_dfDIKeyboard.dwFlags,
|
c_dfDIKeyboard.dwFlags,
|
||||||
c_dfDIKeyboard.dwDataSize,
|
c_dfDIKeyboard.dwDataSize,
|
||||||
c_dfDIKeyboard.dwNumObjs
|
c_dfDIKeyboard.dwNumObjs
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"// Mouse\n"
|
"// Mouse\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {\n"
|
"static DIOBJECTDATAFORMAT c_dfDIMouse_odf[] = {\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (i=0; i<c_dfDIMouse.dwNumObjs; i++) {
|
for (i=0; i<c_dfDIMouse.dwNumObjs; i++) {
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||||
WhatGUID(c_dfDIMouse.rgodf[i].pguid),
|
WhatGUID(c_dfDIMouse.rgodf[i].pguid),
|
||||||
c_dfDIMouse.rgodf[i].dwOfs,
|
c_dfDIMouse.rgodf[i].dwOfs,
|
||||||
c_dfDIMouse.rgodf[i].dwType,
|
c_dfDIMouse.rgodf[i].dwType,
|
||||||
c_dfDIMouse.rgodf[i].dwFlags
|
c_dfDIMouse.rgodf[i].dwFlags
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"const DIDATAFORMAT c_dfDIMouse = { %d, %d, 0x%08X, %d, %d, c_dfDIMouse_odf };\n\n",
|
"const DIDATAFORMAT c_dfDIMouse = { %d, %d, 0x%08X, %d, %d, c_dfDIMouse_odf };\n\n",
|
||||||
c_dfDIMouse.dwSize,
|
c_dfDIMouse.dwSize,
|
||||||
c_dfDIMouse.dwObjSize,
|
c_dfDIMouse.dwObjSize,
|
||||||
c_dfDIMouse.dwFlags,
|
c_dfDIMouse.dwFlags,
|
||||||
c_dfDIMouse.dwDataSize,
|
c_dfDIMouse.dwDataSize,
|
||||||
c_dfDIMouse.dwNumObjs
|
c_dfDIMouse.dwNumObjs
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"// Joystick\n"
|
"// Joystick\n"
|
||||||
"\n"
|
"\n"
|
||||||
"static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = {\n"
|
"static DIOBJECTDATAFORMAT c_dfDIJoystick_odf[] = {\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
for (i=0; i<c_dfDIJoystick.dwNumObjs; i++) {
|
for (i=0; i<c_dfDIJoystick.dwNumObjs; i++) {
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
"\t{ %s, %d, 0x%08X, 0x%08X },\n",
|
||||||
WhatGUID(c_dfDIJoystick.rgodf[i].pguid),
|
WhatGUID(c_dfDIJoystick.rgodf[i].pguid),
|
||||||
c_dfDIJoystick.rgodf[i].dwOfs,
|
c_dfDIJoystick.rgodf[i].dwOfs,
|
||||||
c_dfDIJoystick.rgodf[i].dwType,
|
c_dfDIJoystick.rgodf[i].dwType,
|
||||||
c_dfDIJoystick.rgodf[i].dwFlags
|
c_dfDIJoystick.rgodf[i].dwFlags
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n"
|
"\n"
|
||||||
"const DIDATAFORMAT c_dfDIJoystick = { %d, %d, 0x%08X, %d, %d, c_dfDIJoystick_odf };\n\n",
|
"const DIDATAFORMAT c_dfDIJoystick = { %d, %d, 0x%08X, %d, %d, c_dfDIJoystick_odf };\n\n",
|
||||||
c_dfDIJoystick.dwSize,
|
c_dfDIJoystick.dwSize,
|
||||||
c_dfDIJoystick.dwObjSize,
|
c_dfDIJoystick.dwObjSize,
|
||||||
c_dfDIJoystick.dwFlags,
|
c_dfDIJoystick.dwFlags,
|
||||||
c_dfDIJoystick.dwDataSize,
|
c_dfDIJoystick.dwDataSize,
|
||||||
c_dfDIJoystick.dwNumObjs
|
c_dfDIJoystick.dwNumObjs
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,156 +8,156 @@ char *keysyms[SDLK_LAST];
|
||||||
|
|
||||||
static int buildkeytranslationtable(void)
|
static int buildkeytranslationtable(void)
|
||||||
{
|
{
|
||||||
memset(keytranslation,0,sizeof(keytranslation));
|
memset(keytranslation,0,sizeof(keytranslation));
|
||||||
memset(keysyms,0,sizeof(keysyms));
|
memset(keysyms,0,sizeof(keysyms));
|
||||||
|
|
||||||
#define MAP(x,y) { \
|
#define MAP(x,y) { \
|
||||||
keytranslation[x] = y; \
|
keytranslation[x] = y; \
|
||||||
keysyms[x] = #x ; \
|
keysyms[x] = #x ; \
|
||||||
}
|
}
|
||||||
MAP(SDLK_BACKSPACE, 0xe);
|
MAP(SDLK_BACKSPACE, 0xe);
|
||||||
MAP(SDLK_TAB, 0xf);
|
MAP(SDLK_TAB, 0xf);
|
||||||
MAP(SDLK_RETURN, 0x1c);
|
MAP(SDLK_RETURN, 0x1c);
|
||||||
MAP(SDLK_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5
|
MAP(SDLK_PAUSE, 0x59); // 0x1d + 0x45 + 0x9d + 0xc5
|
||||||
MAP(SDLK_ESCAPE, 0x1);
|
MAP(SDLK_ESCAPE, 0x1);
|
||||||
MAP(SDLK_SPACE, 0x39);
|
MAP(SDLK_SPACE, 0x39);
|
||||||
MAP(SDLK_EXCLAIM, 0x2); // '1'
|
MAP(SDLK_EXCLAIM, 0x2); // '1'
|
||||||
MAP(SDLK_QUOTEDBL, 0x28); // '''
|
MAP(SDLK_QUOTEDBL, 0x28); // '''
|
||||||
MAP(SDLK_HASH, 0x4); // '3'
|
MAP(SDLK_HASH, 0x4); // '3'
|
||||||
MAP(SDLK_DOLLAR, 0x5); // '4'
|
MAP(SDLK_DOLLAR, 0x5); // '4'
|
||||||
MAP(37, 0x6); // '5' <-- where's the keysym SDL guys?
|
MAP(37, 0x6); // '5' <-- where's the keysym SDL guys?
|
||||||
MAP(SDLK_AMPERSAND, 0x8); // '7'
|
MAP(SDLK_AMPERSAND, 0x8); // '7'
|
||||||
MAP(SDLK_QUOTE, 0x28); // '''
|
MAP(SDLK_QUOTE, 0x28); // '''
|
||||||
MAP(SDLK_LEFTPAREN, 0xa); // '9'
|
MAP(SDLK_LEFTPAREN, 0xa); // '9'
|
||||||
MAP(SDLK_RIGHTPAREN, 0xb); // '0'
|
MAP(SDLK_RIGHTPAREN, 0xb); // '0'
|
||||||
MAP(SDLK_ASTERISK, 0x9); // '8'
|
MAP(SDLK_ASTERISK, 0x9); // '8'
|
||||||
MAP(SDLK_PLUS, 0xd); // '='
|
MAP(SDLK_PLUS, 0xd); // '='
|
||||||
MAP(SDLK_COMMA, 0x33);
|
MAP(SDLK_COMMA, 0x33);
|
||||||
MAP(SDLK_MINUS, 0xc);
|
MAP(SDLK_MINUS, 0xc);
|
||||||
MAP(SDLK_PERIOD, 0x34);
|
MAP(SDLK_PERIOD, 0x34);
|
||||||
MAP(SDLK_SLASH, 0x35);
|
MAP(SDLK_SLASH, 0x35);
|
||||||
MAP(SDLK_0, 0xb);
|
MAP(SDLK_0, 0xb);
|
||||||
MAP(SDLK_1, 0x2);
|
MAP(SDLK_1, 0x2);
|
||||||
MAP(SDLK_2, 0x3);
|
MAP(SDLK_2, 0x3);
|
||||||
MAP(SDLK_3, 0x4);
|
MAP(SDLK_3, 0x4);
|
||||||
MAP(SDLK_4, 0x5);
|
MAP(SDLK_4, 0x5);
|
||||||
MAP(SDLK_5, 0x6);
|
MAP(SDLK_5, 0x6);
|
||||||
MAP(SDLK_6, 0x7);
|
MAP(SDLK_6, 0x7);
|
||||||
MAP(SDLK_7, 0x8);
|
MAP(SDLK_7, 0x8);
|
||||||
MAP(SDLK_8, 0x9);
|
MAP(SDLK_8, 0x9);
|
||||||
MAP(SDLK_9, 0xa);
|
MAP(SDLK_9, 0xa);
|
||||||
MAP(SDLK_COLON, 0x27);
|
MAP(SDLK_COLON, 0x27);
|
||||||
MAP(SDLK_SEMICOLON, 0x27);
|
MAP(SDLK_SEMICOLON, 0x27);
|
||||||
MAP(SDLK_LESS, 0x33);
|
MAP(SDLK_LESS, 0x33);
|
||||||
MAP(SDLK_EQUALS, 0xd);
|
MAP(SDLK_EQUALS, 0xd);
|
||||||
MAP(SDLK_GREATER, 0x34);
|
MAP(SDLK_GREATER, 0x34);
|
||||||
MAP(SDLK_QUESTION, 0x35);
|
MAP(SDLK_QUESTION, 0x35);
|
||||||
MAP(SDLK_AT, 0x3); // '2'
|
MAP(SDLK_AT, 0x3); // '2'
|
||||||
MAP(SDLK_LEFTBRACKET, 0x1a);
|
MAP(SDLK_LEFTBRACKET, 0x1a);
|
||||||
MAP(SDLK_BACKSLASH, 0x2b);
|
MAP(SDLK_BACKSLASH, 0x2b);
|
||||||
MAP(SDLK_RIGHTBRACKET, 0x1b);
|
MAP(SDLK_RIGHTBRACKET, 0x1b);
|
||||||
MAP(SDLK_CARET, 0x7); // '7'
|
MAP(SDLK_CARET, 0x7); // '7'
|
||||||
MAP(SDLK_UNDERSCORE, 0xc);
|
MAP(SDLK_UNDERSCORE, 0xc);
|
||||||
MAP(SDLK_BACKQUOTE, 0x29);
|
MAP(SDLK_BACKQUOTE, 0x29);
|
||||||
MAP(SDLK_a, 0x1e);
|
MAP(SDLK_a, 0x1e);
|
||||||
MAP(SDLK_b, 0x30);
|
MAP(SDLK_b, 0x30);
|
||||||
MAP(SDLK_c, 0x2e);
|
MAP(SDLK_c, 0x2e);
|
||||||
MAP(SDLK_d, 0x20);
|
MAP(SDLK_d, 0x20);
|
||||||
MAP(SDLK_e, 0x12);
|
MAP(SDLK_e, 0x12);
|
||||||
MAP(SDLK_f, 0x21);
|
MAP(SDLK_f, 0x21);
|
||||||
MAP(SDLK_g, 0x22);
|
MAP(SDLK_g, 0x22);
|
||||||
MAP(SDLK_h, 0x23);
|
MAP(SDLK_h, 0x23);
|
||||||
MAP(SDLK_i, 0x17);
|
MAP(SDLK_i, 0x17);
|
||||||
MAP(SDLK_j, 0x24);
|
MAP(SDLK_j, 0x24);
|
||||||
MAP(SDLK_k, 0x25);
|
MAP(SDLK_k, 0x25);
|
||||||
MAP(SDLK_l, 0x26);
|
MAP(SDLK_l, 0x26);
|
||||||
MAP(SDLK_m, 0x32);
|
MAP(SDLK_m, 0x32);
|
||||||
MAP(SDLK_n, 0x31);
|
MAP(SDLK_n, 0x31);
|
||||||
MAP(SDLK_o, 0x18);
|
MAP(SDLK_o, 0x18);
|
||||||
MAP(SDLK_p, 0x19);
|
MAP(SDLK_p, 0x19);
|
||||||
MAP(SDLK_q, 0x10);
|
MAP(SDLK_q, 0x10);
|
||||||
MAP(SDLK_r, 0x13);
|
MAP(SDLK_r, 0x13);
|
||||||
MAP(SDLK_s, 0x1f);
|
MAP(SDLK_s, 0x1f);
|
||||||
MAP(SDLK_t, 0x14);
|
MAP(SDLK_t, 0x14);
|
||||||
MAP(SDLK_u, 0x16);
|
MAP(SDLK_u, 0x16);
|
||||||
MAP(SDLK_v, 0x2f);
|
MAP(SDLK_v, 0x2f);
|
||||||
MAP(SDLK_w, 0x11);
|
MAP(SDLK_w, 0x11);
|
||||||
MAP(SDLK_x, 0x2d);
|
MAP(SDLK_x, 0x2d);
|
||||||
MAP(SDLK_y, 0x15);
|
MAP(SDLK_y, 0x15);
|
||||||
MAP(SDLK_z, 0x2c);
|
MAP(SDLK_z, 0x2c);
|
||||||
MAP(SDLK_DELETE, 0xd3);
|
MAP(SDLK_DELETE, 0xd3);
|
||||||
MAP(SDLK_KP0, 0x52);
|
MAP(SDLK_KP0, 0x52);
|
||||||
MAP(SDLK_KP1, 0x4f);
|
MAP(SDLK_KP1, 0x4f);
|
||||||
MAP(SDLK_KP2, 0x50);
|
MAP(SDLK_KP2, 0x50);
|
||||||
MAP(SDLK_KP3, 0x51);
|
MAP(SDLK_KP3, 0x51);
|
||||||
MAP(SDLK_KP4, 0x4b);
|
MAP(SDLK_KP4, 0x4b);
|
||||||
MAP(SDLK_KP5, 0x4c);
|
MAP(SDLK_KP5, 0x4c);
|
||||||
MAP(SDLK_KP6, 0x4d);
|
MAP(SDLK_KP6, 0x4d);
|
||||||
MAP(SDLK_KP7, 0x47);
|
MAP(SDLK_KP7, 0x47);
|
||||||
MAP(SDLK_KP8, 0x48);
|
MAP(SDLK_KP8, 0x48);
|
||||||
MAP(SDLK_KP9, 0x49);
|
MAP(SDLK_KP9, 0x49);
|
||||||
MAP(SDLK_KP_PERIOD, 0x53);
|
MAP(SDLK_KP_PERIOD, 0x53);
|
||||||
MAP(SDLK_KP_DIVIDE, 0xb5);
|
MAP(SDLK_KP_DIVIDE, 0xb5);
|
||||||
MAP(SDLK_KP_MULTIPLY, 0x37);
|
MAP(SDLK_KP_MULTIPLY, 0x37);
|
||||||
MAP(SDLK_KP_MINUS, 0x4a);
|
MAP(SDLK_KP_MINUS, 0x4a);
|
||||||
MAP(SDLK_KP_PLUS, 0x4e);
|
MAP(SDLK_KP_PLUS, 0x4e);
|
||||||
MAP(SDLK_KP_ENTER, 0x9c);
|
MAP(SDLK_KP_ENTER, 0x9c);
|
||||||
//MAP(SDLK_KP_EQUALS, );
|
//MAP(SDLK_KP_EQUALS, );
|
||||||
MAP(SDLK_UP, 0xc8);
|
MAP(SDLK_UP, 0xc8);
|
||||||
MAP(SDLK_DOWN, 0xd0);
|
MAP(SDLK_DOWN, 0xd0);
|
||||||
MAP(SDLK_RIGHT, 0xcd);
|
MAP(SDLK_RIGHT, 0xcd);
|
||||||
MAP(SDLK_LEFT, 0xcb);
|
MAP(SDLK_LEFT, 0xcb);
|
||||||
MAP(SDLK_INSERT, 0xd2);
|
MAP(SDLK_INSERT, 0xd2);
|
||||||
MAP(SDLK_HOME, 0xc7);
|
MAP(SDLK_HOME, 0xc7);
|
||||||
MAP(SDLK_END, 0xcf);
|
MAP(SDLK_END, 0xcf);
|
||||||
MAP(SDLK_PAGEUP, 0xc9);
|
MAP(SDLK_PAGEUP, 0xc9);
|
||||||
MAP(SDLK_PAGEDOWN, 0xd1);
|
MAP(SDLK_PAGEDOWN, 0xd1);
|
||||||
MAP(SDLK_F1, 0x3b);
|
MAP(SDLK_F1, 0x3b);
|
||||||
MAP(SDLK_F2, 0x3c);
|
MAP(SDLK_F2, 0x3c);
|
||||||
MAP(SDLK_F3, 0x3d);
|
MAP(SDLK_F3, 0x3d);
|
||||||
MAP(SDLK_F4, 0x3e);
|
MAP(SDLK_F4, 0x3e);
|
||||||
MAP(SDLK_F5, 0x3f);
|
MAP(SDLK_F5, 0x3f);
|
||||||
MAP(SDLK_F6, 0x40);
|
MAP(SDLK_F6, 0x40);
|
||||||
MAP(SDLK_F7, 0x41);
|
MAP(SDLK_F7, 0x41);
|
||||||
MAP(SDLK_F8, 0x42);
|
MAP(SDLK_F8, 0x42);
|
||||||
MAP(SDLK_F9, 0x43);
|
MAP(SDLK_F9, 0x43);
|
||||||
MAP(SDLK_F10, 0x44);
|
MAP(SDLK_F10, 0x44);
|
||||||
MAP(SDLK_F11, 0x57);
|
MAP(SDLK_F11, 0x57);
|
||||||
MAP(SDLK_F12, 0x58);
|
MAP(SDLK_F12, 0x58);
|
||||||
MAP(SDLK_NUMLOCK, 0x45);
|
MAP(SDLK_NUMLOCK, 0x45);
|
||||||
MAP(SDLK_CAPSLOCK, 0x3a);
|
MAP(SDLK_CAPSLOCK, 0x3a);
|
||||||
MAP(SDLK_SCROLLOCK, 0x46);
|
MAP(SDLK_SCROLLOCK, 0x46);
|
||||||
MAP(SDLK_RSHIFT, 0x36);
|
MAP(SDLK_RSHIFT, 0x36);
|
||||||
MAP(SDLK_LSHIFT, 0x2a);
|
MAP(SDLK_LSHIFT, 0x2a);
|
||||||
MAP(SDLK_RCTRL, 0x9d);
|
MAP(SDLK_RCTRL, 0x9d);
|
||||||
MAP(SDLK_LCTRL, 0x1d);
|
MAP(SDLK_LCTRL, 0x1d);
|
||||||
MAP(SDLK_RALT, 0xb8);
|
MAP(SDLK_RALT, 0xb8);
|
||||||
MAP(SDLK_LALT, 0x38);
|
MAP(SDLK_LALT, 0x38);
|
||||||
MAP(SDLK_LSUPER, 0xdb); // win l
|
MAP(SDLK_LSUPER, 0xdb); // win l
|
||||||
MAP(SDLK_RSUPER, 0xdc); // win r
|
MAP(SDLK_RSUPER, 0xdc); // win r
|
||||||
MAP(SDLK_PRINT, -2); // 0xaa + 0xb7
|
MAP(SDLK_PRINT, -2); // 0xaa + 0xb7
|
||||||
MAP(SDLK_SYSREQ, 0x54); // alt+printscr
|
MAP(SDLK_SYSREQ, 0x54); // alt+printscr
|
||||||
MAP(SDLK_BREAK, 0xb7); // ctrl+pause
|
MAP(SDLK_BREAK, 0xb7); // ctrl+pause
|
||||||
MAP(SDLK_MENU, 0xdd); // win menu?
|
MAP(SDLK_MENU, 0xdd); // win menu?
|
||||||
#undef MAP
|
#undef MAP
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef main
|
#undef main
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
buildkeytranslationtable();
|
buildkeytranslationtable();
|
||||||
|
|
||||||
for (i=0;i<SDLK_LAST;i++) {
|
for (i=0;i<SDLK_LAST;i++) {
|
||||||
if (i>0) printf(", ");
|
if (i>0) printf(", ");
|
||||||
if (i%8 == 7) printf("\n");
|
if (i%8 == 7) printf("\n");
|
||||||
printf("%d",keytranslation[i]);
|
printf("%d",keytranslation[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,115 +24,115 @@ int PathAddExt(char *path, char *ext);
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("BIN2C - Binary to C data converter\n"
|
printf("BIN2C - Binary to C data converter\n"
|
||||||
"Copyright (c) 1999 Jonathon Fowler\n\n");
|
"Copyright (c) 1999 Jonathon Fowler\n\n");
|
||||||
|
|
||||||
if (argc < 4)
|
if (argc < 4)
|
||||||
{
|
{
|
||||||
printf("Usage:\n"
|
printf("Usage:\n"
|
||||||
" BIN2C source<.DAT> output<.C> b|w\n\n"
|
" BIN2C source<.DAT> output<.C> b|w\n\n"
|
||||||
" source<.DAT> Binary source file\n"
|
" source<.DAT> Binary source file\n"
|
||||||
" output<.C> Output C code file\n"
|
" output<.C> Output C code file\n"
|
||||||
" b|w Byte or word-sized data\n\n");
|
" b|w Byte or word-sized data\n\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int arg;
|
int arg;
|
||||||
FILE *in, *out;
|
FILE *in, *out;
|
||||||
char datab1, datab2;
|
char datab1, datab2;
|
||||||
int across=0, maxacross;
|
int across=0, maxacross;
|
||||||
int length, written=0;
|
int length, written=0;
|
||||||
|
|
||||||
|
|
||||||
// get the source file
|
// get the source file
|
||||||
strcpy(source, argv[1]);
|
strcpy(source, argv[1]);
|
||||||
strupr(source);
|
strupr(source);
|
||||||
PathAddExt(source, defsrcext);
|
PathAddExt(source, defsrcext);
|
||||||
printf("þ Source file: %s\n", source);
|
printf("þ Source file: %s\n", source);
|
||||||
|
|
||||||
// get the output file
|
// get the output file
|
||||||
strcpy(output, argv[2]);
|
strcpy(output, argv[2]);
|
||||||
strupr(output);
|
strupr(output);
|
||||||
PathAddExt(output, defoutext);
|
PathAddExt(output, defoutext);
|
||||||
printf("þ Output file: %s\n", output);
|
printf("þ Output file: %s\n", output);
|
||||||
|
|
||||||
// get byte/word data
|
// get byte/word data
|
||||||
switch (tolower(argv[3][0]))
|
switch (tolower(argv[3][0]))
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
printf("þ Byte data.\n");
|
printf("þ Byte data.\n");
|
||||||
bytesize=1;
|
bytesize=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
printf("þ Word data.\n");
|
printf("þ Word data.\n");
|
||||||
bytesize=0;
|
bytesize=0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf("þ Unknown data size specified. Defaulting to byte.\n");
|
printf("þ Unknown data size specified. Defaulting to byte.\n");
|
||||||
bytesize=1;
|
bytesize=1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the input file
|
// open the input file
|
||||||
in = fopen(source, "rb");
|
in = fopen(source, "rb");
|
||||||
if (!in)
|
if (!in)
|
||||||
{
|
{
|
||||||
printf("Error opening %s\n", source);
|
printf("Error opening %s\n", source);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// open the output file
|
// open the output file
|
||||||
out = fopen(output, "w+t");
|
out = fopen(output, "w+t");
|
||||||
if (!out)
|
if (!out)
|
||||||
{
|
{
|
||||||
printf("Error creating %s\n", output);
|
printf("Error creating %s\n", output);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
length = filelength(fileno(in));
|
length = filelength(fileno(in));
|
||||||
|
|
||||||
// write a header out to the output file
|
// write a header out to the output file
|
||||||
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
|
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
|
||||||
|
|
||||||
// start a data block
|
// start a data block
|
||||||
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
|
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
|
||||||
|
|
||||||
if (bytesize)
|
if (bytesize)
|
||||||
maxacross = 12;
|
maxacross = 12;
|
||||||
else
|
else
|
||||||
maxacross = 9;
|
maxacross = 9;
|
||||||
across = maxacross;
|
across = maxacross;
|
||||||
|
|
||||||
// convert the data
|
// convert the data
|
||||||
for (written=0; written<length; written++) {
|
for (written=0; written<length; written++) {
|
||||||
if (across == maxacross)
|
if (across == maxacross)
|
||||||
{
|
{
|
||||||
fprintf(out, "\n ");
|
fprintf(out, "\n ");
|
||||||
across = 0;
|
across = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytesize)
|
if (bytesize)
|
||||||
{
|
{
|
||||||
datab1 = fgetc(in);
|
datab1 = fgetc(in);
|
||||||
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
|
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
|
||||||
} else {
|
} else {
|
||||||
datab1 = fgetc(in);
|
datab1 = fgetc(in);
|
||||||
datab2 = fgetc(in);
|
datab2 = fgetc(in);
|
||||||
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
|
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
across++;
|
across++;
|
||||||
|
|
||||||
if (!bytesize) written++;
|
if (!bytesize) written++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fprintf(out, " };");
|
fprintf(out, " };");
|
||||||
|
|
||||||
fclose(out);
|
fclose(out);
|
||||||
fclose(in);
|
fclose(in);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -141,13 +141,13 @@ int main(int argc, char *argv[])
|
||||||
// Add an extention to a path if one doesn't exist
|
// Add an extention to a path if one doesn't exist
|
||||||
int PathAddExt(char *path, char *ext)
|
int PathAddExt(char *path, char *ext)
|
||||||
{
|
{
|
||||||
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
|
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
flags = fnsplit(path, drive, dir, name, extn);
|
flags = fnsplit(path, drive, dir, name, extn);
|
||||||
|
|
||||||
if (!(flags & EXTENSION)) // tack on an extension
|
if (!(flags & EXTENSION)) // tack on an extension
|
||||||
strcat(path, ext);
|
strcat(path, ext);
|
||||||
|
|
||||||
return ((flags & EXTENSION) == 0);
|
return ((flags & EXTENSION) == 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,81 +10,81 @@
|
||||||
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char magic[8]; // 'Polymost'
|
char magic[8]; // 'Polymost'
|
||||||
int xdim, ydim; // of image, unpadded
|
int xdim, ydim; // of image, unpadded
|
||||||
int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed
|
int flags; // 1 = !2^x, 2 = has alpha, 4 = lzw compressed
|
||||||
} texcacheheader;
|
} texcacheheader;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int size;
|
int size;
|
||||||
int format;
|
int format;
|
||||||
int xdim, ydim; // of mipmap (possibly padded)
|
int xdim, ydim; // of mipmap (possibly padded)
|
||||||
int border, depth;
|
int border, depth;
|
||||||
} texcachepicture;
|
} texcachepicture;
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *dirent;
|
struct dirent *dirent;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
texcacheheader head;
|
texcacheheader head;
|
||||||
texcachepicture mip;
|
texcachepicture mip;
|
||||||
|
|
||||||
dir = opendir(".");
|
dir = opendir(".");
|
||||||
while ((dirent = readdir(dir))) {
|
while ((dirent = readdir(dir))) {
|
||||||
if (stat(dirent->d_name, &st)) {
|
if (stat(dirent->d_name, &st)) {
|
||||||
printf("%s: failed to stat\n", dirent->d_name);
|
printf("%s: failed to stat\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!(st.st_mode&S_IFREG)) {
|
if (!(st.st_mode&S_IFREG)) {
|
||||||
printf("%s: not a regular file\n", dirent->d_name);
|
printf("%s: not a regular file\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fp = fopen(dirent->d_name,"rb");
|
fp = fopen(dirent->d_name,"rb");
|
||||||
if (!fp) {
|
if (!fp) {
|
||||||
printf("%s: failed to open\n", dirent->d_name);
|
printf("%s: failed to open\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fread(&head, sizeof(head), 1, fp) != 1) {
|
if (fread(&head, sizeof(head), 1, fp) != 1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
printf("%s: failed to read header\n", dirent->d_name);
|
printf("%s: failed to read header\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
head.xdim = B_LITTLE32(head.xdim);
|
head.xdim = B_LITTLE32(head.xdim);
|
||||||
head.ydim = B_LITTLE32(head.ydim);
|
head.ydim = B_LITTLE32(head.ydim);
|
||||||
head.flags = B_LITTLE32(head.flags);
|
head.flags = B_LITTLE32(head.flags);
|
||||||
if (fread(&mip, sizeof(mip), 1, fp) != 1) {
|
if (fread(&mip, sizeof(mip), 1, fp) != 1) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
printf("%s: failed to read mipmap header\n", dirent->d_name);
|
printf("%s: failed to read mipmap header\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mip.format = B_LITTLE32(mip.format);
|
mip.format = B_LITTLE32(mip.format);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
if (memcmp(head.magic, "Polymost", 8)) {
|
if (memcmp(head.magic, "Polymost", 8)) {
|
||||||
printf("%s: bad signature\n", dirent->d_name);
|
printf("%s: bad signature\n", dirent->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *format;
|
char *format;
|
||||||
char flags[4] = "", flagsc = 0;
|
char flags[4] = "", flagsc = 0;
|
||||||
switch (mip.format) {
|
switch (mip.format) {
|
||||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: format = "RGB DXT1"; break;
|
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: format = "RGB DXT1"; break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: format = "RGBA DXT1"; break;
|
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: format = "RGBA DXT1"; break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: format = "RGBA DXT3"; break;
|
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: format = "RGBA DXT3"; break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: format = "RGBA DXT5"; break;
|
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: format = "RGBA DXT5"; break;
|
||||||
default: format = "Unknown"; break;
|
default: format = "Unknown"; break;
|
||||||
}
|
}
|
||||||
if (head.flags&1) flags[flagsc++] = '2';
|
if (head.flags&1) flags[flagsc++] = '2';
|
||||||
if (head.flags&2) flags[flagsc++] = 'A';
|
if (head.flags&2) flags[flagsc++] = 'A';
|
||||||
if (head.flags&4) flags[flagsc++] = 'L';
|
if (head.flags&4) flags[flagsc++] = 'L';
|
||||||
flags[flagsc++] = 0;
|
flags[flagsc++] = 0;
|
||||||
|
|
||||||
printf("%s: flags=%s format=%s\n", dirent->d_name, flags, format);
|
printf("%s: flags=%s format=%s\n", dirent->d_name, flags, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -3,109 +3,109 @@
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
struct icon {
|
struct icon {
|
||||||
int width,height;
|
int width,height;
|
||||||
unsigned int *pixels;
|
unsigned int *pixels;
|
||||||
unsigned char *mask;
|
unsigned char *mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
int writeicon(FILE *fp, struct icon *ico)
|
int writeicon(FILE *fp, struct icon *ico)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"#include \"sdlayer.h\"\n"
|
"#include \"sdlayer.h\"\n"
|
||||||
"\n"
|
"\n"
|
||||||
);
|
);
|
||||||
fprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n");
|
fprintf(fp,"static unsigned int sdlappicon_pixels[] = {\n");
|
||||||
for (i=0;i<ico->width*ico->height;i++) {
|
for (i=0;i<ico->width*ico->height;i++) {
|
||||||
if ((i%6) == 0) fprintf(fp,"\t");
|
if ((i%6) == 0) fprintf(fp,"\t");
|
||||||
else fprintf(fp," ");
|
else fprintf(fp," ");
|
||||||
fprintf(fp, "0x%08x,", B_LITTLE32(ico->pixels[i]));
|
fprintf(fp, "0x%08x,", B_LITTLE32(ico->pixels[i]));
|
||||||
if ((i%6) == 5) fprintf(fp,"\n");
|
if ((i%6) == 5) fprintf(fp,"\n");
|
||||||
}
|
}
|
||||||
if ((i%16) > 0) fprintf(fp, "\n");
|
if ((i%16) > 0) fprintf(fp, "\n");
|
||||||
fprintf(fp, "};\n\n");
|
fprintf(fp, "};\n\n");
|
||||||
|
|
||||||
fprintf(fp,"static unsigned char sdlappicon_mask[] = {\n");
|
fprintf(fp,"static unsigned char sdlappicon_mask[] = {\n");
|
||||||
for (i=0;i<((ico->width+7)/8)*ico->height;i++) {
|
for (i=0;i<((ico->width+7)/8)*ico->height;i++) {
|
||||||
if ((i%14) == 0) fprintf(fp,"\t");
|
if ((i%14) == 0) fprintf(fp,"\t");
|
||||||
else fprintf(fp," ");
|
else fprintf(fp," ");
|
||||||
fprintf(fp, "%3d,", ico->mask[i]);
|
fprintf(fp, "%3d,", ico->mask[i]);
|
||||||
if ((i%14) == 13) fprintf(fp,"\n");
|
if ((i%14) == 13) fprintf(fp,"\n");
|
||||||
}
|
}
|
||||||
if ((i%16) > 0) fprintf(fp, "\n");
|
if ((i%16) > 0) fprintf(fp, "\n");
|
||||||
fprintf(fp, "};\n\n");
|
fprintf(fp, "};\n\n");
|
||||||
|
|
||||||
fprintf(fp,
|
fprintf(fp,
|
||||||
"struct sdlappicon sdlappicon = {\n"
|
"struct sdlappicon sdlappicon = {\n"
|
||||||
" %d,%d, // width,height\n"
|
" %d,%d, // width,height\n"
|
||||||
" sdlappicon_pixels,\n"
|
" sdlappicon_pixels,\n"
|
||||||
" sdlappicon_mask\n"
|
" sdlappicon_mask\n"
|
||||||
"};\n",
|
"};\n",
|
||||||
ico->width, ico->height
|
ico->width, ico->height
|
||||||
);
|
);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct icon icon;
|
struct icon icon;
|
||||||
int bpl;
|
int bpl;
|
||||||
int i;
|
int i;
|
||||||
unsigned char *maskp, bm, *pp;
|
unsigned char *maskp, bm, *pp;
|
||||||
|
|
||||||
if (argc<2) {
|
if (argc<2) {
|
||||||
fprintf(stderr, "generateicon <picture file>\n");
|
fprintf(stderr, "generateicon <picture file>\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&icon, 0, sizeof(icon));
|
memset(&icon, 0, sizeof(icon));
|
||||||
|
|
||||||
kpzload(argv[1], (int*)&icon.pixels, &bpl, (int*)&icon.width, (int*)&icon.height);
|
kpzload(argv[1], (int*)&icon.pixels, &bpl, (int*)&icon.width, (int*)&icon.height);
|
||||||
if (!icon.pixels) {
|
if (!icon.pixels) {
|
||||||
fprintf(stderr, "Failure loading %s\n", argv[1]);
|
fprintf(stderr, "Failure loading %s\n", argv[1]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bpl != icon.width * 4) {
|
if (bpl != icon.width * 4) {
|
||||||
fprintf(stderr, "bpl != icon.width * 4\n");
|
fprintf(stderr, "bpl != icon.width * 4\n");
|
||||||
free(icon.pixels);
|
free(icon.pixels);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
icon.mask = (unsigned char *)calloc(icon.height, (icon.width+7)/8);
|
icon.mask = (unsigned char *)calloc(icon.height, (icon.width+7)/8);
|
||||||
if (!icon.mask) {
|
if (!icon.mask) {
|
||||||
fprintf(stderr, "Out of memory\n");
|
fprintf(stderr, "Out of memory\n");
|
||||||
free(icon.pixels);
|
free(icon.pixels);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
maskp = icon.mask;
|
maskp = icon.mask;
|
||||||
bm = 1;
|
bm = 1;
|
||||||
pp = (unsigned char *)icon.pixels;
|
pp = (unsigned char *)icon.pixels;
|
||||||
for (i=0; i<icon.height*icon.width; i++) {
|
for (i=0; i<icon.height*icon.width; i++) {
|
||||||
if (bm == 0) {
|
if (bm == 0) {
|
||||||
bm = 1;
|
bm = 1;
|
||||||
maskp++;
|
maskp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned char c = pp[0];
|
unsigned char c = pp[0];
|
||||||
pp[0] = pp[2];
|
pp[0] = pp[2];
|
||||||
pp[2] = c;
|
pp[2] = c;
|
||||||
}
|
}
|
||||||
if (pp[3] > 0) *maskp |= bm;
|
if (pp[3] > 0) *maskp |= bm;
|
||||||
|
|
||||||
bm <<= 1;
|
bm <<= 1;
|
||||||
pp += 4;
|
pp += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
writeicon(stdout, &icon);
|
writeicon(stdout, &icon);
|
||||||
|
|
||||||
free(icon.pixels);
|
free(icon.pixels);
|
||||||
free(icon.mask);
|
free(icon.mask);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,68 +18,68 @@ static int fileoffs[MAXFILES+1], fileleng[MAXFILES];
|
||||||
|
|
||||||
void findfiles(const char *dafilespec)
|
void findfiles(const char *dafilespec)
|
||||||
{
|
{
|
||||||
char t[13];
|
char t[13];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=numfiles-1;i>=0;i--)
|
for(i=numfiles-1;i>=0;i--)
|
||||||
{
|
{
|
||||||
memcpy(t,filelist[i],12);
|
memcpy(t,filelist[i],12);
|
||||||
t[12] = 0;
|
t[12] = 0;
|
||||||
|
|
||||||
if (Bwildmatch(t,dafilespec)) {
|
if (Bwildmatch(t,dafilespec)) {
|
||||||
marked4extraction[i] = 1;
|
marked4extraction[i] = 1;
|
||||||
anyfiles4extraction = 1;
|
anyfiles4extraction = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, j, k, l, fil, fil2;
|
int i, j, k, l, fil, fil2;
|
||||||
|
|
||||||
int onlylist = (argc==2);
|
int onlylist = (argc==2);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
printf("KEXTRACT <groupfile.grp> [@file or filespec...] by Kenneth Silverman\n");
|
printf("KEXTRACT <groupfile.grp> [@file or filespec...] by Kenneth Silverman\n");
|
||||||
printf(" This program extracts files from a previously grouped group file.\n");
|
printf(" This program extracts files from a previously grouped group file.\n");
|
||||||
printf(" You can extract files using the ? and * wildcards.\n");
|
printf(" You can extract files using the ? and * wildcards.\n");
|
||||||
printf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n");
|
printf(" Ex: kextract stuff.dat tiles000.art nukeland.map palette.dat\n");
|
||||||
printf(" (stuff.dat is the group file, the rest are the files to extract)\n");
|
printf(" (stuff.dat is the group file, the rest are the files to extract)\n");
|
||||||
printf(" kextract stuff.grp\n");
|
printf(" kextract stuff.grp\n");
|
||||||
printf(" (simply lists the contents of stuff.grp)\n");
|
printf(" (simply lists the contents of stuff.grp)\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
if ((fil = Bopen(argv[1],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||||
{
|
{
|
||||||
printf("Error: %s could not be opened\n",argv[1]);
|
printf("Error: %s could not be opened\n",argv[1]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bread(fil,buf,16);
|
Bread(fil,buf,16);
|
||||||
if ((buf[0] != 'K') || (buf[1] != 'e') || (buf[2] != 'n') ||
|
if ((buf[0] != 'K') || (buf[1] != 'e') || (buf[2] != 'n') ||
|
||||||
(buf[3] != 'S') || (buf[4] != 'i') || (buf[5] != 'l') ||
|
(buf[3] != 'S') || (buf[4] != 'i') || (buf[5] != 'l') ||
|
||||||
(buf[6] != 'v') || (buf[7] != 'e') || (buf[8] != 'r') ||
|
(buf[6] != 'v') || (buf[7] != 'e') || (buf[8] != 'r') ||
|
||||||
(buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n'))
|
(buf[9] != 'm') || (buf[10] != 'a') || (buf[11] != 'n'))
|
||||||
{
|
{
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("Error: %s not a valid group file\n",argv[1]);
|
printf("Error: %s not a valid group file\n",argv[1]);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
numfiles = *((int*)&buf[12]); numfiles = B_LITTLE32(numfiles);
|
numfiles = *((int*)&buf[12]); numfiles = B_LITTLE32(numfiles);
|
||||||
|
|
||||||
Bread(fil,filelist,numfiles<<4);
|
Bread(fil,filelist,numfiles<<4);
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for(i=0;i<numfiles;i++)
|
for(i=0;i<numfiles;i++)
|
||||||
{
|
{
|
||||||
k = *((int*)&filelist[i][12]); k = B_LITTLE32(k);
|
k = *((int*)&filelist[i][12]); k = B_LITTLE32(k);
|
||||||
filelist[i][12] = 0;
|
filelist[i][12] = 0;
|
||||||
fileoffs[i] = j;
|
fileoffs[i] = j;
|
||||||
j += k;
|
j += k;
|
||||||
}
|
}
|
||||||
fileoffs[numfiles] = j;
|
fileoffs[numfiles] = j;
|
||||||
|
|
||||||
if (onlylist)
|
if (onlylist)
|
||||||
{
|
{
|
||||||
|
@ -89,72 +89,72 @@ int main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<numfiles;i++) marked4extraction[i] = 0;
|
for(i=0;i<numfiles;i++) marked4extraction[i] = 0;
|
||||||
|
|
||||||
anyfiles4extraction = 0;
|
anyfiles4extraction = 0;
|
||||||
for(i=argc-1;i>1;i--)
|
for(i=argc-1;i>1;i--)
|
||||||
{
|
{
|
||||||
if (argv[i][0] == '@')
|
if (argv[i][0] == '@')
|
||||||
{
|
{
|
||||||
if ((fil2 = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
if ((fil2 = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||||
{
|
{
|
||||||
l = Bread(fil2,buf,65536);
|
l = Bread(fil2,buf,65536);
|
||||||
j = 0;
|
j = 0;
|
||||||
while ((j < l) && (buf[j] <= 32)) j++;
|
while ((j < l) && (buf[j] <= 32)) j++;
|
||||||
while (j < l)
|
while (j < l)
|
||||||
{
|
{
|
||||||
k = j;
|
k = j;
|
||||||
while ((k < l) && (buf[k] > 32)) k++;
|
while ((k < l) && (buf[k] > 32)) k++;
|
||||||
|
|
||||||
buf[k] = 0;
|
buf[k] = 0;
|
||||||
findfiles(&buf[j]);
|
findfiles(&buf[j]);
|
||||||
j = k+1;
|
j = k+1;
|
||||||
|
|
||||||
while ((j < l) && (buf[j] <= 32)) j++;
|
while ((j < l) && (buf[j] <= 32)) j++;
|
||||||
}
|
}
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
findfiles(argv[i]);
|
findfiles(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anyfiles4extraction == 0)
|
if (anyfiles4extraction == 0)
|
||||||
{
|
{
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("No files found in group file with those names\n");
|
printf("No files found in group file with those names\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<numfiles;i++)
|
for(i=0;i<numfiles;i++)
|
||||||
{
|
{
|
||||||
if (marked4extraction[i] == 0) continue;
|
if (marked4extraction[i] == 0) continue;
|
||||||
|
|
||||||
fileleng[i] = fileoffs[i+1]-fileoffs[i];
|
fileleng[i] = fileoffs[i+1]-fileoffs[i];
|
||||||
|
|
||||||
if ((fil2 = Bopen(filelist[i],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil2 = Bopen(filelist[i],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{
|
{
|
||||||
printf("Error: Could not write to %s\n",filelist[i]);
|
printf("Error: Could not write to %s\n",filelist[i]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("Extracting %s...\n",filelist[i]);
|
printf("Extracting %s...\n",filelist[i]);
|
||||||
Blseek(fil,fileoffs[i]+((numfiles+1)<<4),SEEK_SET);
|
Blseek(fil,fileoffs[i]+((numfiles+1)<<4),SEEK_SET);
|
||||||
for(j=0;j<fileleng[i];j+=65536)
|
for(j=0;j<fileleng[i];j+=65536)
|
||||||
{
|
{
|
||||||
k = min(fileleng[i]-j,65536);
|
k = min(fileleng[i]-j,65536);
|
||||||
Bread(fil,buf,k);
|
Bread(fil,buf,k);
|
||||||
if (Bwrite(fil2,buf,k) < k)
|
if (Bwrite(fil2,buf,k) < k)
|
||||||
{
|
{
|
||||||
printf("Write error (drive full?)\n");
|
printf("Write error (drive full?)\n");
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
}
|
}
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } }
|
||||||
|
|
||||||
#define MAXFILES 4096
|
#define MAXFILES 4096
|
||||||
|
|
||||||
static char buf[65536]; // These limits should be abolished one day
|
static char buf[65536]; // These limits should be abolished one day
|
||||||
|
|
||||||
static int numfiles;
|
static int numfiles;
|
||||||
static char filespec[MAXFILES][128], filelist[MAXFILES][16];
|
static char filespec[MAXFILES][128], filelist[MAXFILES][16];
|
||||||
|
@ -23,149 +23,149 @@ static int fileleng[MAXFILES];
|
||||||
static char *matchstr = "*.*";
|
static char *matchstr = "*.*";
|
||||||
int checkmatch(const struct Bdirent *a)
|
int checkmatch(const struct Bdirent *a)
|
||||||
{
|
{
|
||||||
if (a->mode & BS_IFDIR) return 0; // is a directory
|
if (a->mode & BS_IFDIR) return 0; // is a directory
|
||||||
if (a->namlen > 12) return 0; // name too long
|
if (a->namlen > 12) return 0; // name too long
|
||||||
return Bwildmatch(a->name, matchstr);
|
return Bwildmatch(a->name, matchstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int filesize(const char *path, const char *name)
|
int filesize(const char *path, const char *name)
|
||||||
{
|
{
|
||||||
char p[BMAX_PATH];
|
char p[BMAX_PATH];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
strcpy(p, path);
|
strcpy(p, path);
|
||||||
strcat(p, "/");
|
strcat(p, "/");
|
||||||
strcat(p, name);
|
strcat(p, name);
|
||||||
|
|
||||||
if (!stat(p, &st)) return st.st_size;
|
if (!stat(p, &st)) return st.st_size;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findfiles(const char *dafilespec)
|
void findfiles(const char *dafilespec)
|
||||||
{
|
{
|
||||||
struct Bdirent *name;
|
struct Bdirent *name;
|
||||||
int daspeclen;
|
int daspeclen;
|
||||||
char daspec[128], *dir;
|
char daspec[128], *dir;
|
||||||
BDIR *di;
|
BDIR *di;
|
||||||
|
|
||||||
strcpy(daspec,dafilespec);
|
strcpy(daspec,dafilespec);
|
||||||
daspeclen=strlen(daspec);
|
daspeclen=strlen(daspec);
|
||||||
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
|
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
|
||||||
if (daspeclen > 0) {
|
if (daspeclen > 0) {
|
||||||
daspec[daspeclen]=0;
|
daspec[daspeclen]=0;
|
||||||
dir = daspec;
|
dir = daspec;
|
||||||
matchstr = &daspec[daspeclen+1];
|
matchstr = &daspec[daspeclen+1];
|
||||||
} else {
|
} else {
|
||||||
dir = ".";
|
dir = ".";
|
||||||
matchstr = daspec;
|
matchstr = daspec;
|
||||||
}
|
}
|
||||||
|
|
||||||
di = Bopendir(dir);
|
di = Bopendir(dir);
|
||||||
if (!di) return;
|
if (!di) return;
|
||||||
|
|
||||||
while ((name = Breaddir(di))) {
|
while ((name = Breaddir(di))) {
|
||||||
if (!checkmatch(name)) continue;
|
if (!checkmatch(name)) continue;
|
||||||
|
|
||||||
strcpy(&filelist[numfiles][0],name->name);
|
strcpy(&filelist[numfiles][0],name->name);
|
||||||
jstrupr(&filelist[numfiles][0]);
|
jstrupr(&filelist[numfiles][0]);
|
||||||
fileleng[numfiles] = name->size;
|
fileleng[numfiles] = name->size;
|
||||||
filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
|
filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
|
||||||
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
|
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
|
||||||
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
|
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
|
||||||
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
|
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
|
||||||
|
|
||||||
strcpy(filespec[numfiles],dir);
|
strcpy(filespec[numfiles],dir);
|
||||||
strcat(filespec[numfiles], "/");
|
strcat(filespec[numfiles], "/");
|
||||||
strcat(filespec[numfiles],name->name);
|
strcat(filespec[numfiles],name->name);
|
||||||
|
|
||||||
numfiles++;
|
numfiles++;
|
||||||
if (numfiles > MAXFILES)
|
if (numfiles > MAXFILES)
|
||||||
{
|
{
|
||||||
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bclosedir(di);
|
Bclosedir(di);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, j, k, l, fil, fil2;
|
int i, j, k, l, fil, fil2;
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
{
|
{
|
||||||
printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n");
|
printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n");
|
||||||
printf(" This program collects many files into 1 big uncompressed file called a\n");
|
printf(" This program collects many files into 1 big uncompressed file called a\n");
|
||||||
printf(" group file\n");
|
printf(" group file\n");
|
||||||
printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
|
printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
|
||||||
printf(" (stuff.dat is the group file, the rest are the files to add)\n");
|
printf(" (stuff.dat is the group file, the rest are the files to add)\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
numfiles = 0;
|
numfiles = 0;
|
||||||
for(i=argc-1;i>1;i--)
|
for(i=argc-1;i>1;i--)
|
||||||
{
|
{
|
||||||
if (argv[i][0] == '@')
|
if (argv[i][0] == '@')
|
||||||
{
|
{
|
||||||
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||||
{
|
{
|
||||||
l = Bread(fil,buf,65536);
|
l = Bread(fil,buf,65536);
|
||||||
j = 0;
|
j = 0;
|
||||||
while ((j < l) && (buf[j] <= 32)) j++;
|
while ((j < l) && (buf[j] <= 32)) j++;
|
||||||
while (j < l)
|
while (j < l)
|
||||||
{
|
{
|
||||||
k = j;
|
k = j;
|
||||||
while ((k < l) && (buf[k] > 32)) k++;
|
while ((k < l) && (buf[k] > 32)) k++;
|
||||||
|
|
||||||
buf[k] = 0;
|
buf[k] = 0;
|
||||||
findfiles(&buf[j]);
|
findfiles(&buf[j]);
|
||||||
j = k+1;
|
j = k+1;
|
||||||
|
|
||||||
while ((j < l) && (buf[j] <= 32)) j++;
|
while ((j < l) && (buf[j] <= 32)) j++;
|
||||||
}
|
}
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
findfiles(argv[i]);
|
findfiles(argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{
|
{
|
||||||
printf("Error: %s could not be opened\n",argv[1]);
|
printf("Error: %s could not be opened\n",argv[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
Bwrite(fil,"KenSilverman",12);
|
Bwrite(fil,"KenSilverman",12);
|
||||||
Bwrite(fil,&numfiles,4);
|
Bwrite(fil,&numfiles,4);
|
||||||
Bwrite(fil,filelist,numfiles<<4);
|
Bwrite(fil,filelist,numfiles<<4);
|
||||||
|
|
||||||
for(i=0;i<numfiles;i++)
|
for(i=0;i<numfiles;i++)
|
||||||
{
|
{
|
||||||
printf("Adding %s...\n",filespec[i]);
|
printf("Adding %s...\n",filespec[i]);
|
||||||
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||||
{
|
{
|
||||||
printf("Error: %s not found\n",filespec[i]);
|
printf("Error: %s not found\n",filespec[i]);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
for(j=0;j<fileleng[i];j+=65536)
|
for(j=0;j<fileleng[i];j+=65536)
|
||||||
{
|
{
|
||||||
k = min(fileleng[i]-j,65536);
|
k = min(fileleng[i]-j,65536);
|
||||||
Bread(fil2,buf,k);
|
Bread(fil2,buf,k);
|
||||||
if (Bwrite(fil,buf,k) < k)
|
if (Bwrite(fil,buf,k) < k)
|
||||||
{
|
{
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("OUT OF HD SPACE!\n");
|
printf("OUT OF HD SPACE!\n");
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
}
|
}
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("Saved to %s.\n",argv[1]);
|
printf("Saved to %s.\n",argv[1]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#if 0
|
#if 0
|
||||||
kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
|
kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
|
||||||
del kmd2tool.obj
|
del kmd2tool.obj
|
||||||
!if 0
|
!if 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -12,45 +12,45 @@ typedef struct { float x, y, z; } point3d;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||||
} md2typ;
|
} md2typ;
|
||||||
|
|
||||||
typedef struct { point3d mul, add; } frametyp;
|
typedef struct { point3d mul, add; } frametyp;
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
FILE *fil;
|
FILE *fil;
|
||||||
int i, leng;
|
int i, leng;
|
||||||
char *fbuf;
|
char *fbuf;
|
||||||
md2typ *head;
|
md2typ *head;
|
||||||
frametyp *fptr;
|
frametyp *fptr;
|
||||||
|
|
||||||
if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); }
|
if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); }
|
||||||
if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); }
|
if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); }
|
||||||
|
|
||||||
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
|
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
|
||||||
leng = filelength(_fileno(fil));
|
leng = filelength(_fileno(fil));
|
||||||
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
|
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
|
||||||
fread(fbuf,leng,1,fil);
|
fread(fbuf,leng,1,fil);
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
|
|
||||||
head = (md2typ *)fbuf;
|
head = (md2typ *)fbuf;
|
||||||
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
|
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
|
||||||
for(i=0;i<head->numframes;i++)
|
for(i=0;i<head->numframes;i++)
|
||||||
{
|
{
|
||||||
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
|
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
|
||||||
printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
|
printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
|
||||||
fptr->add.z += atof(argv[3]);
|
fptr->add.z += atof(argv[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
|
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
|
||||||
fwrite(fbuf,leng,1,fil);
|
fwrite(fbuf,leng,1,fil);
|
||||||
fclose(fil);
|
fclose(fil);
|
||||||
|
|
||||||
free(fbuf);
|
free(fbuf);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -27,244 +27,244 @@ static int colscan[27];
|
||||||
|
|
||||||
char getclosestcol(int r, int g, int b)
|
char getclosestcol(int r, int g, int b)
|
||||||
{
|
{
|
||||||
int i, j, k, dist, mindist, retcol;
|
int i, j, k, dist, mindist, retcol;
|
||||||
int *rlookup, *glookup, *blookup;
|
int *rlookup, *glookup, *blookup;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
if (closestcol[r][g][b] != 255) return(closestcol[r][g][b]);
|
if (closestcol[r][g][b] != 255) return(closestcol[r][g][b]);
|
||||||
|
|
||||||
j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
|
j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
|
||||||
mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]);
|
mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]);
|
||||||
mindist = min(mindist,bdist[coldist[b&7]+64+8]);
|
mindist = min(mindist,bdist[coldist[b&7]+64+8]);
|
||||||
mindist++;
|
mindist++;
|
||||||
|
|
||||||
rlookup = (int *)&rdist[64-r];
|
rlookup = (int *)&rdist[64-r];
|
||||||
glookup = (int *)&gdist[64-g];
|
glookup = (int *)&gdist[64-g];
|
||||||
blookup = (int *)&bdist[64-b];
|
blookup = (int *)&bdist[64-b];
|
||||||
|
|
||||||
retcol = -1;
|
retcol = -1;
|
||||||
for(k=26;k>=0;k--)
|
for(k=26;k>=0;k--)
|
||||||
{
|
{
|
||||||
i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue;
|
i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue;
|
||||||
for(i=colhead[i];i>=0;i=colnext[i])
|
for(i=colhead[i];i>=0;i=colnext[i])
|
||||||
{
|
{
|
||||||
ptr = (char *)&palette[i*3];
|
ptr = (char *)&palette[i*3];
|
||||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||||
mindist = dist; retcol = i;
|
mindist = dist; retcol = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (retcol < 0)
|
if (retcol < 0)
|
||||||
{
|
{
|
||||||
mindist = 0x7fffffff;
|
mindist = 0x7fffffff;
|
||||||
ptr = (char *)&palette[768-3];
|
ptr = (char *)&palette[768-3];
|
||||||
for(i=255;i>=0;i--,ptr-=3)
|
for(i=255;i>=0;i--,ptr-=3)
|
||||||
{
|
{
|
||||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||||
mindist = dist; retcol = i;
|
mindist = dist; retcol = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ptr = (char *)&closestcol[r][g][b];
|
ptr = (char *)&closestcol[r][g][b];
|
||||||
*ptr = retcol;
|
*ptr = retcol;
|
||||||
if ((r >= 4) && (ptr[(-2)<<12] == retcol)) ptr[(-3)<<12] = retcol, ptr[(-2)<<12] = retcol, ptr[(-1)<<12] = retcol;
|
if ((r >= 4) && (ptr[(-2)<<12] == retcol)) ptr[(-3)<<12] = retcol, ptr[(-2)<<12] = retcol, ptr[(-1)<<12] = retcol;
|
||||||
if ((g >= 4) && (ptr[(-2)<<6] == retcol)) ptr[(-3)<<6] = retcol, ptr[(-2)<<6] = retcol, ptr[(-1)<<6] = retcol;
|
if ((g >= 4) && (ptr[(-2)<<6] == retcol)) ptr[(-3)<<6] = retcol, ptr[(-2)<<6] = retcol, ptr[(-1)<<6] = retcol;
|
||||||
if ((b >= 4) && (ptr[(-2)] == retcol)) ptr[(-3)] = retcol, ptr[(-2)] = retcol, ptr[(-1)] = retcol;
|
if ((b >= 4) && (ptr[(-2)] == retcol)) ptr[(-3)] = retcol, ptr[(-2)] = retcol, ptr[(-1)] = retcol;
|
||||||
if ((r < 64-4) && (ptr[(2)<<12] == retcol)) ptr[(3)<<12] = retcol, ptr[(2)<<12] = retcol, ptr[(1)<<12] = retcol;
|
if ((r < 64-4) && (ptr[(2)<<12] == retcol)) ptr[(3)<<12] = retcol, ptr[(2)<<12] = retcol, ptr[(1)<<12] = retcol;
|
||||||
if ((g < 64-4) && (ptr[(2)<<6] == retcol)) ptr[(3)<<6] = retcol, ptr[(2)<<6] = retcol, ptr[(1)<<6] = retcol;
|
if ((g < 64-4) && (ptr[(2)<<6] == retcol)) ptr[(3)<<6] = retcol, ptr[(2)<<6] = retcol, ptr[(1)<<6] = retcol;
|
||||||
if ((b < 64-4) && (ptr[(2)] == retcol)) ptr[(3)] = retcol, ptr[(2)] = retcol, ptr[(1)] = retcol;
|
if ((b < 64-4) && (ptr[(2)] == retcol)) ptr[(3)] = retcol, ptr[(2)] = retcol, ptr[(1)] = retcol;
|
||||||
if ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol;
|
if ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol;
|
||||||
if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol;
|
if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol;
|
||||||
if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = retcol;
|
if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = retcol;
|
||||||
if ((r < 64-2) && (ptr[(1)<<12] == retcol)) ptr[(1)<<12] = retcol;
|
if ((r < 64-2) && (ptr[(1)<<12] == retcol)) ptr[(1)<<12] = retcol;
|
||||||
if ((g < 64-2) && (ptr[(1)<<6] == retcol)) ptr[(1)<<6] = retcol;
|
if ((g < 64-2) && (ptr[(1)<<6] == retcol)) ptr[(1)<<6] = retcol;
|
||||||
if ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol;
|
if ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol;
|
||||||
return(retcol);
|
return(retcol);
|
||||||
}
|
}
|
||||||
|
|
||||||
char getpalookup(char dashade, char dacol)
|
char getpalookup(char dashade, char dacol)
|
||||||
{
|
{
|
||||||
int r, g, b, t;
|
int r, g, b, t;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
ptr = (char *)&palette[dacol*3];
|
ptr = (char *)&palette[dacol*3];
|
||||||
t = divscale16(numpalookups-dashade,numpalookups);
|
t = divscale16(numpalookups-dashade,numpalookups);
|
||||||
r = ((ptr[0]*t+32768)>>16);
|
r = ((ptr[0]*t+32768)>>16);
|
||||||
g = ((ptr[1]*t+32768)>>16);
|
g = ((ptr[1]*t+32768)>>16);
|
||||||
b = ((ptr[2]*t+32768)>>16);
|
b = ((ptr[2]*t+32768)>>16);
|
||||||
return(getclosestcol(r,g,b));
|
return(getclosestcol(r,g,b));
|
||||||
}
|
}
|
||||||
|
|
||||||
char gettrans(char dat1, char dat2, int datransratio)
|
char gettrans(char dat1, char dat2, int datransratio)
|
||||||
{
|
{
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
char *ptr, *ptr2;
|
char *ptr, *ptr2;
|
||||||
|
|
||||||
ptr = (char *)&palette[dat1*3];
|
ptr = (char *)&palette[dat1*3];
|
||||||
ptr2 = (char *)&palette[dat2*3];
|
ptr2 = (char *)&palette[dat2*3];
|
||||||
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
|
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
|
||||||
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
|
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
|
||||||
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
|
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
|
||||||
return(getclosestcol(r,g,b));
|
return(getclosestcol(r,g,b));
|
||||||
}
|
}
|
||||||
|
|
||||||
void initfastcolorlookup(int rscale, int gscale, int bscale)
|
void initfastcolorlookup(int rscale, int gscale, int bscale)
|
||||||
{
|
{
|
||||||
int i, j, x, y, z;
|
int i, j, x, y, z;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for(i=64;i>=0;i--)
|
for(i=64;i>=0;i--)
|
||||||
{
|
{
|
||||||
//j = (i-64)*(i-64);
|
//j = (i-64)*(i-64);
|
||||||
rdist[i] = rdist[128-i] = j*rscale;
|
rdist[i] = rdist[128-i] = j*rscale;
|
||||||
gdist[i] = gdist[128-i] = j*gscale;
|
gdist[i] = gdist[128-i] = j*gscale;
|
||||||
bdist[i] = bdist[128-i] = j*bscale;
|
bdist[i] = bdist[128-i] = j*bscale;
|
||||||
j += 129-(i<<1);
|
j += 129-(i<<1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bmemset(colhere, 0, sizeof(colhere));
|
Bmemset(colhere, 0, sizeof(colhere));
|
||||||
Bmemset(colhead, 0, sizeof(colhead));
|
Bmemset(colhead, 0, sizeof(colhead));
|
||||||
|
|
||||||
ptr = (char *)&palette[768-3];
|
ptr = (char *)&palette[768-3];
|
||||||
for(i=255;i>=0;i--,ptr-=3)
|
for(i=255;i>=0;i--,ptr-=3)
|
||||||
{
|
{
|
||||||
j = (ptr[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(ptr[1]>>3)*FASTPALGRIDSIZ+(ptr[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
|
j = (ptr[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(ptr[1]>>3)*FASTPALGRIDSIZ+(ptr[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
|
||||||
if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1;
|
if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1;
|
||||||
colhead[j] = i;
|
colhead[j] = i;
|
||||||
colhere[j>>3] |= (1<<(j&7));
|
colhere[j>>3] |= (1<<(j&7));
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ)
|
for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ)
|
||||||
for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ)
|
for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ)
|
||||||
for(z=-1;z<=1;z++)
|
for(z=-1;z<=1;z++)
|
||||||
colscan[i++] = x+y+z;
|
colscan[i++] = x+y+z;
|
||||||
i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i;
|
i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char col, ch;
|
char col, ch;
|
||||||
short orignumpalookups;
|
short orignumpalookups;
|
||||||
int fil, i, j, rscale, gscale, bscale;
|
int fil, i, j, rscale, gscale, bscale;
|
||||||
char buf[65536];
|
char buf[65536];
|
||||||
|
|
||||||
ch = 13;
|
ch = 13;
|
||||||
if (argc>1) {
|
if (argc>1) {
|
||||||
if (argv[1][0] == '-') {
|
if (argv[1][0] == '-') {
|
||||||
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
|
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
|
||||||
argc--;
|
argc--;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((argc != 3) && (argc != 6))
|
if ((argc != 3) && (argc != 6))
|
||||||
{
|
{
|
||||||
printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n");
|
printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n");
|
||||||
printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
|
printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
|
||||||
printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
||||||
printf(" Ex #2: transpal 64 160\n\n");
|
printf(" Ex #2: transpal 64 160\n\n");
|
||||||
printf("Once tables are generated, the optional -t switch determines what to save:\n");
|
printf("Once tables are generated, the optional -t switch determines what to save:\n");
|
||||||
printf(" Exclude -t to update both the shade table and transluscent table\n");
|
printf(" Exclude -t to update both the shade table and transluscent table\n");
|
||||||
printf(" Include -t to update the transluscent table ONLY\n");
|
printf(" Include -t to update the transluscent table ONLY\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(palettefilename,"palette.dat");
|
strcpy(palettefilename,"palette.dat");
|
||||||
numpalookups = atol(argv[1]);
|
numpalookups = atol(argv[1]);
|
||||||
transratio = atol(argv[2]);
|
transratio = atol(argv[2]);
|
||||||
|
|
||||||
if (argc == 6)
|
if (argc == 6)
|
||||||
{
|
{
|
||||||
rscale = atol(argv[3]);
|
rscale = atol(argv[3]);
|
||||||
gscale = atol(argv[4]);
|
gscale = atol(argv[4]);
|
||||||
bscale = atol(argv[5]);
|
bscale = atol(argv[5]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rscale = 30;
|
rscale = 30;
|
||||||
gscale = 59;
|
gscale = 59;
|
||||||
bscale = 11;
|
bscale = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((numpalookups < 1) || (numpalookups > 256))
|
if ((numpalookups < 1) || (numpalookups > 256))
|
||||||
{ printf("Invalid number of shades\n"); exit(0); }
|
{ printf("Invalid number of shades\n"); exit(0); }
|
||||||
if ((transratio < 0) || (transratio > 256))
|
if ((transratio < 0) || (transratio > 256))
|
||||||
{ printf("Invalid transluscent ratio\n"); exit(0); }
|
{ printf("Invalid transluscent ratio\n"); exit(0); }
|
||||||
|
|
||||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||||
{
|
{
|
||||||
printf("%s not found",palettefilename);
|
printf("%s not found",palettefilename);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
Bread(fil,palette,768);
|
Bread(fil,palette,768);
|
||||||
Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups);
|
Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups);
|
||||||
orignumpalookups = min(max(orignumpalookups,1),256);
|
orignumpalookups = min(max(orignumpalookups,1),256);
|
||||||
Bread(fil,origpalookup,(int)orignumpalookups<<8);
|
Bread(fil,origpalookup,(int)orignumpalookups<<8);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
|
|
||||||
clearbuf(buf,65536>>2,0L);
|
clearbuf(buf,65536>>2,0L);
|
||||||
|
|
||||||
initfastcolorlookup(rscale,gscale,bscale);
|
initfastcolorlookup(rscale,gscale,bscale);
|
||||||
clearbuf(closestcol,262144>>2,0xffffffff);
|
clearbuf(closestcol,262144>>2,0xffffffff);
|
||||||
|
|
||||||
for(i=0;i<numpalookups;i++)
|
for(i=0;i<numpalookups;i++)
|
||||||
for(j=0;j<256;j++)
|
for(j=0;j<256;j++)
|
||||||
{
|
{
|
||||||
col = getpalookup((char)i,(char)j);
|
col = getpalookup((char)i,(char)j);
|
||||||
palookup[(i<<8)+j] = col;
|
palookup[(i<<8)+j] = col;
|
||||||
|
|
||||||
drawpixel(((((i<<1)+0)*320+(j+8))>>2)+buf,(int)col);
|
drawpixel(((((i<<1)+0)*320+(j+8))>>2)+buf,(int)col);
|
||||||
drawpixel(((((i<<1)+1)*320+(j+8))>>2)+buf,(int)col);
|
drawpixel(((((i<<1)+1)*320+(j+8))>>2)+buf,(int)col);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<256;i++)
|
for(i=0;i<256;i++)
|
||||||
for(j=0;j<6;j++)
|
for(j=0;j<6;j++)
|
||||||
{
|
{
|
||||||
drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i);
|
drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i);
|
||||||
|
|
||||||
drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i);
|
drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;i<256;i++)
|
for(i=0;i<256;i++)
|
||||||
for(j=0;j<256;j++)
|
for(j=0;j<256;j++)
|
||||||
{
|
{
|
||||||
col = gettrans((char)i,(char)j,transratio);
|
col = gettrans((char)i,(char)j,transratio);
|
||||||
transluc[(i<<8)+j] = col;
|
transluc[(i<<8)+j] = col;
|
||||||
|
|
||||||
drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col);
|
drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch == 13)
|
if (ch == 13)
|
||||||
{
|
{
|
||||||
short s;
|
short s;
|
||||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
||||||
Bwrite(fil,palette,768);
|
Bwrite(fil,palette,768);
|
||||||
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
|
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
|
||||||
Bwrite(fil,palookup,numpalookups<<8);
|
Bwrite(fil,palookup,numpalookups<<8);
|
||||||
Bwrite(fil,transluc,65536);
|
Bwrite(fil,transluc,65536);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("Shade table AND transluscent table updated\n");
|
printf("Shade table AND transluscent table updated\n");
|
||||||
}
|
}
|
||||||
else if (ch == 32)
|
else if (ch == 32)
|
||||||
{
|
{
|
||||||
short s;
|
short s;
|
||||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
{ printf("Couldn't save file %s",palettefilename); return(0); }
|
||||||
Bwrite(fil,palette,768);
|
Bwrite(fil,palette,768);
|
||||||
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
|
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
|
||||||
Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
|
Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
|
||||||
Bwrite(fil,transluc,65536);
|
Bwrite(fil,transluc,65536);
|
||||||
Bclose(fil);
|
Bclose(fil);
|
||||||
printf("Transluscent table updated\n");
|
printf("Transluscent table updated\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printf("Palette file wasn't touched\n");
|
printf("Palette file wasn't touched\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,133 +8,133 @@
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int font, width, height, numchars;
|
int font, width, height, numchars;
|
||||||
struct REGPACK r;
|
struct REGPACK r;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
printf("VGA Font Grabber\n"
|
printf("VGA Font Grabber\n"
|
||||||
"Copyright (c) 1997 Jonathon Fowler\n");
|
"Copyright (c) 1997 Jonathon Fowler\n");
|
||||||
|
|
||||||
do {
|
do {
|
||||||
printf("\nSelect which font to grab:\n"
|
printf("\nSelect which font to grab:\n"
|
||||||
" 1. 8-by-8 ROM\n"
|
" 1. 8-by-8 ROM\n"
|
||||||
" 2. 8-by-14 ROM\n"
|
" 2. 8-by-14 ROM\n"
|
||||||
" 3. 8-by-16 ROM\n"
|
" 3. 8-by-16 ROM\n"
|
||||||
" 4. 9-by-16 ROM\n"
|
" 4. 9-by-16 ROM\n"
|
||||||
" 5. 9-by-14 ROM\n"
|
" 5. 9-by-14 ROM\n"
|
||||||
" 6. Quit\n"
|
" 6. Quit\n"
|
||||||
" > ");
|
" > ");
|
||||||
scanf("%d",&font);
|
scanf("%d",&font);
|
||||||
|
|
||||||
switch (font) {
|
switch (font) {
|
||||||
case 1:
|
case 1:
|
||||||
printf("Getting 8-by-8 ROM font...");
|
printf("Getting 8-by-8 ROM font...");
|
||||||
|
|
||||||
if ((fp = fopen("88vga.dat", "wb")) != NULL) {
|
if ((fp = fopen("88vga.dat", "wb")) != NULL) {
|
||||||
width = 8;
|
width = 8;
|
||||||
height = 8;
|
height = 8;
|
||||||
numchars = 256;
|
numchars = 256;
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font (1st half)
|
r.r_ax = 0x1130; // locate the font (1st half)
|
||||||
r.r_bx = 0x0300;
|
r.r_bx = 0x0300;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font (2nd half)
|
r.r_ax = 0x1130; // locate the font (2nd half)
|
||||||
r.r_bx = 0x0400;
|
r.r_bx = 0x0400;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
printf("Getting 8-by-14 ROM font...");
|
printf("Getting 8-by-14 ROM font...");
|
||||||
|
|
||||||
if ((fp = fopen("814vga.dat", "wb")) != NULL) {
|
if ((fp = fopen("814vga.dat", "wb")) != NULL) {
|
||||||
width = 8;
|
width = 8;
|
||||||
height = 14;
|
height = 14;
|
||||||
numchars = 256;
|
numchars = 256;
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font
|
r.r_ax = 0x1130; // locate the font
|
||||||
r.r_bx = 0x0200;
|
r.r_bx = 0x0200;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
printf("Getting 8-by-16 ROM font...");
|
printf("Getting 8-by-16 ROM font...");
|
||||||
|
|
||||||
if ((fp = fopen("816vga.dat", "wb")) != NULL) {
|
if ((fp = fopen("816vga.dat", "wb")) != NULL) {
|
||||||
width = 8;
|
width = 8;
|
||||||
height = 16;
|
height = 16;
|
||||||
numchars = 256;
|
numchars = 256;
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font
|
r.r_ax = 0x1130; // locate the font
|
||||||
r.r_bx = 0x0600;
|
r.r_bx = 0x0600;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
printf("Getting 9-by-16 ROM font...");
|
printf("Getting 9-by-16 ROM font...");
|
||||||
|
|
||||||
if ((fp = fopen("916vga.dat", "wb")) != NULL) {
|
if ((fp = fopen("916vga.dat", "wb")) != NULL) {
|
||||||
width = 9;
|
width = 9;
|
||||||
height = 16;
|
height = 16;
|
||||||
numchars = 256;
|
numchars = 256;
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font
|
r.r_ax = 0x1130; // locate the font
|
||||||
r.r_bx = 0x0700;
|
r.r_bx = 0x0700;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
printf("Getting 9-by-14 ROM font...");
|
printf("Getting 9-by-14 ROM font...");
|
||||||
|
|
||||||
if ((fp = fopen("914vga.dat", "wb")) != NULL) {
|
if ((fp = fopen("914vga.dat", "wb")) != NULL) {
|
||||||
width = 9;
|
width = 9;
|
||||||
height = 16;
|
height = 16;
|
||||||
numchars = 256;
|
numchars = 256;
|
||||||
|
|
||||||
r.r_ax = 0x1130; // locate the font
|
r.r_ax = 0x1130; // locate the font
|
||||||
r.r_bx = 0x0500;
|
r.r_bx = 0x0500;
|
||||||
intr(0x10, &r);
|
intr(0x10, &r);
|
||||||
|
|
||||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
|
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done\n");
|
printf("Done\n");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Please try again\n");
|
printf("Please try again\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (font != 6);
|
} while (font != 6);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,78 +22,78 @@ static char screen[65536], tempbuf[131072];
|
||||||
|
|
||||||
void loadwadheader(void)
|
void loadwadheader(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
Bread(fil1,&tempbuf[0],12);
|
Bread(fil1,&tempbuf[0],12);
|
||||||
numwads = ((int)tempbuf[4])+(((int)tempbuf[5])<<8)+(((int)tempbuf[6])<<16)+(((int)tempbuf[7])<<24);
|
numwads = ((int)tempbuf[4])+(((int)tempbuf[5])<<8)+(((int)tempbuf[6])<<16)+(((int)tempbuf[7])<<24);
|
||||||
i = ((int)tempbuf[8])+(((int)tempbuf[9])<<8)+(((int)tempbuf[10])<<16)+(((int)tempbuf[11])<<24);
|
i = ((int)tempbuf[8])+(((int)tempbuf[9])<<8)+(((int)tempbuf[10])<<16)+(((int)tempbuf[11])<<24);
|
||||||
Blseek(fil1,i,BSEEK_SET);
|
Blseek(fil1,i,BSEEK_SET);
|
||||||
Bread(fil1,&tempbuf[0],numwads*16);
|
Bread(fil1,&tempbuf[0],numwads*16);
|
||||||
j = 0;
|
j = 0;
|
||||||
for(i=0;i<numwads;i++)
|
for(i=0;i<numwads;i++)
|
||||||
{
|
{
|
||||||
wadplc[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
wadplc[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
||||||
j += 4;
|
j += 4;
|
||||||
wadlen[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
wadlen[i] = ((int)tempbuf[j])+(((int)tempbuf[j+1])<<8)+(((int)tempbuf[j+2])<<16)+(((int)tempbuf[j+3])<<24);
|
||||||
j += 4;
|
j += 4;
|
||||||
wadata[i][0] = tempbuf[j+0]; wadata[i][1] = tempbuf[j+1];
|
wadata[i][0] = tempbuf[j+0]; wadata[i][1] = tempbuf[j+1];
|
||||||
wadata[i][2] = tempbuf[j+2]; wadata[i][3] = tempbuf[j+3];
|
wadata[i][2] = tempbuf[j+2]; wadata[i][3] = tempbuf[j+3];
|
||||||
wadata[i][4] = tempbuf[j+4]; wadata[i][5] = tempbuf[j+5];
|
wadata[i][4] = tempbuf[j+4]; wadata[i][5] = tempbuf[j+5];
|
||||||
wadata[i][6] = tempbuf[j+6]; wadata[i][7] = tempbuf[j+7];
|
wadata[i][6] = tempbuf[j+6]; wadata[i][7] = tempbuf[j+7];
|
||||||
j += 8;
|
j += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void convpalette(void)
|
void convpalette(void)
|
||||||
{
|
{
|
||||||
int i, fil3;
|
int i, fil3;
|
||||||
short danumshades;
|
short danumshades;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (Bstrncasecmp(wadata[i],"PLAYPAL",7) != 0) i++;
|
while (Bstrncasecmp(wadata[i],"PLAYPAL",7) != 0) i++;
|
||||||
Blseek(fil1,wadplc[i],BSEEK_SET);
|
Blseek(fil1,wadplc[i],BSEEK_SET);
|
||||||
Bread(fil1,pal,768);
|
Bread(fil1,pal,768);
|
||||||
for(i=0;i<768;i++) pal[i] >>= 2;
|
for(i=0;i<768;i++) pal[i] >>= 2;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (Bstrncasecmp(wadata[i],"COLORMAP",8) != 0) i++;
|
while (Bstrncasecmp(wadata[i],"COLORMAP",8) != 0) i++;
|
||||||
Blseek(fil1,wadplc[i],BSEEK_SET);
|
Blseek(fil1,wadplc[i],BSEEK_SET);
|
||||||
Bread(fil1,palookup,8192);
|
Bread(fil1,palookup,8192);
|
||||||
|
|
||||||
if ((fil3 = Bopen("palette.dat",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil3 = Bopen("palette.dat",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{ printf("Cannot save palette.dat\n"); exit(0); }
|
{ printf("Cannot save palette.dat\n"); exit(0); }
|
||||||
Bwrite(fil3,pal,768);
|
Bwrite(fil3,pal,768);
|
||||||
danumshades = 32;
|
danumshades = 32;
|
||||||
Bwrite(fil3,&danumshades,2);
|
Bwrite(fil3,&danumshades,2);
|
||||||
Bwrite(fil3,palookup,8192);
|
Bwrite(fil3,palookup,8192);
|
||||||
Bclose(fil3);
|
Bclose(fil3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveart (short tilenum, short xlen, short ylen)
|
void saveart (short tilenum, short xlen, short ylen)
|
||||||
{
|
{
|
||||||
int i, x, p, pend;
|
int i, x, p, pend;
|
||||||
|
|
||||||
pend = ylookup[ylen];
|
pend = ylookup[ylen];
|
||||||
|
|
||||||
tilesizx[tilenum] = xlen;
|
tilesizx[tilenum] = xlen;
|
||||||
tilesizy[tilenum] = ylen;
|
tilesizy[tilenum] = ylen;
|
||||||
i = 0;
|
i = 0;
|
||||||
for(x=0;x<xlen;x++)
|
for(x=0;x<xlen;x++)
|
||||||
for(p=x;p<pend;p+=320)
|
for(p=x;p<pend;p+=320)
|
||||||
tempbuf[i++] = screen[p];
|
tempbuf[i++] = screen[p];
|
||||||
if (Bwrite(fil2,&tempbuf[0],i) < 0)
|
if (Bwrite(fil2,&tempbuf[0],i) < 0)
|
||||||
{
|
{
|
||||||
printf("NOT ENOUGH DISK SPACE!\n");
|
printf("NOT ENOUGH DISK SPACE!\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void savenames(void)
|
void savenames(void)
|
||||||
{
|
{
|
||||||
BFILE * fil3;
|
BFILE * fil3;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fil3 = Bfopen("names.h","w");
|
fil3 = Bfopen("names.h","w");
|
||||||
|
|
||||||
if (fil3 != NULL)
|
if (fil3 != NULL)
|
||||||
{
|
{
|
||||||
|
@ -109,159 +109,159 @@ void savenames(void)
|
||||||
|
|
||||||
void showart (char *part)
|
void showart (char *part)
|
||||||
{
|
{
|
||||||
char yoff;
|
char yoff;
|
||||||
short xsiz, ysiz;
|
short xsiz, ysiz;
|
||||||
int i, z, zx, x, p, pend, curplc;
|
int i, z, zx, x, p, pend, curplc;
|
||||||
|
|
||||||
curplc = -1;
|
curplc = -1;
|
||||||
if ((Bstrncasecmp(part,"L_START",7) == 0) || (Bstrncasecmp(part,"S_START",7) == 0) || (Bstrncasecmp(part,"P_START",7) == 0))
|
if ((Bstrncasecmp(part,"L_START",7) == 0) || (Bstrncasecmp(part,"S_START",7) == 0) || (Bstrncasecmp(part,"P_START",7) == 0))
|
||||||
{
|
{
|
||||||
if (Bstrncasecmp(part,"L_START",7) == 0)
|
if (Bstrncasecmp(part,"L_START",7) == 0)
|
||||||
z = 462;
|
z = 462;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = 0;
|
z = 0;
|
||||||
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
||||||
z++;
|
z++;
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (Bstrncasecmp(wadata[z],"P1_START",8) == 0) z++;
|
if (Bstrncasecmp(wadata[z],"P1_START",8) == 0) z++;
|
||||||
if (Bstrncasecmp(wadata[z],"P1_END",6) == 0) z++;
|
if (Bstrncasecmp(wadata[z],"P1_END",6) == 0) z++;
|
||||||
if (Bstrncasecmp(wadata[z],"P2_START",8) == 0) z++;
|
if (Bstrncasecmp(wadata[z],"P2_START",8) == 0) z++;
|
||||||
if (Bstrncasecmp(wadata[z],"S_START",7) == 0) break;
|
if (Bstrncasecmp(wadata[z],"S_START",7) == 0) break;
|
||||||
if (Bstrncasecmp(wadata[z],"S_END",5) == 0) break;
|
if (Bstrncasecmp(wadata[z],"S_END",5) == 0) break;
|
||||||
if (Bstrncasecmp(wadata[z],"P_END",5) == 0) break;
|
if (Bstrncasecmp(wadata[z],"P_END",5) == 0) break;
|
||||||
|
|
||||||
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
||||||
read(fil1,&tempbuf[0],wadlen[z]);
|
read(fil1,&tempbuf[0],wadlen[z]);
|
||||||
curplc = wadplc[z]+wadlen[z];
|
curplc = wadplc[z]+wadlen[z];
|
||||||
|
|
||||||
xsiz = (int)tempbuf[0]+(((int)tempbuf[1])<<8);
|
xsiz = (int)tempbuf[0]+(((int)tempbuf[1])<<8);
|
||||||
ysiz = (int)tempbuf[2]+(((int)tempbuf[3])<<8);
|
ysiz = (int)tempbuf[2]+(((int)tempbuf[3])<<8);
|
||||||
if ((xsiz <= 0) || (ysiz <= 0) || (xsiz > 320) || (ysiz > 200)) goto skipit;
|
if ((xsiz <= 0) || (ysiz <= 0) || (xsiz > 320) || (ysiz > 200)) goto skipit;
|
||||||
i = 8;
|
i = 8;
|
||||||
for(zx=0;zx<xsiz;zx++)
|
for(zx=0;zx<xsiz;zx++)
|
||||||
{
|
{
|
||||||
xoffses[zx] = ((int)tempbuf[i])+(((int)tempbuf[i+1])<<8)+(((int)tempbuf[i+2])<<16)+(((int)tempbuf[i+3])<<24);
|
xoffses[zx] = ((int)tempbuf[i])+(((int)tempbuf[i+1])<<8)+(((int)tempbuf[i+2])<<16)+(((int)tempbuf[i+3])<<24);
|
||||||
i += 4;
|
i += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearbuf(screen,ylookup[ysiz]>>2,0xffffffff);
|
clearbuf(screen,ylookup[ysiz]>>2,0xffffffff);
|
||||||
|
|
||||||
for(x=0;x<xsiz;x++)
|
for(x=0;x<xsiz;x++)
|
||||||
{
|
{
|
||||||
i = xoffses[x];
|
i = xoffses[x];
|
||||||
yoff = tempbuf[i++];
|
yoff = tempbuf[i++];
|
||||||
while (yoff != 255)
|
while (yoff != 255)
|
||||||
{
|
{
|
||||||
p = ylookup[yoff]+x;
|
p = ylookup[yoff]+x;
|
||||||
pend = p+ylookup[tempbuf[i]];
|
pend = p+ylookup[tempbuf[i]];
|
||||||
i += 2;
|
i += 2;
|
||||||
for(;p<pend;p+=320)
|
for(;p<pend;p+=320)
|
||||||
screen[p] = tempbuf[i++];
|
screen[p] = tempbuf[i++];
|
||||||
i++;
|
i++;
|
||||||
yoff = tempbuf[i++];
|
yoff = tempbuf[i++];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveart(z,xsiz,ysiz);
|
saveart(z,xsiz,ysiz);
|
||||||
skipit:
|
skipit:
|
||||||
z++;
|
z++;
|
||||||
} while (z < numwads);
|
} while (z < numwads);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
z = 0;
|
z = 0;
|
||||||
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
while (Bstrncasecmp(wadata[z],part,7) != 0) z++;
|
||||||
z++;
|
z++;
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (Bstrncasecmp(wadata[z],"F1_START",8) == 0) z++;
|
if (Bstrncasecmp(wadata[z],"F1_START",8) == 0) z++;
|
||||||
if (Bstrncasecmp(wadata[z],"F1_END",6) == 0) z++;
|
if (Bstrncasecmp(wadata[z],"F1_END",6) == 0) z++;
|
||||||
if (Bstrncasecmp(wadata[z],"F_END",5) == 0) break;
|
if (Bstrncasecmp(wadata[z],"F_END",5) == 0) break;
|
||||||
|
|
||||||
if (wadlen[z] == 4096)
|
if (wadlen[z] == 4096)
|
||||||
{
|
{
|
||||||
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
if (curplc != wadplc[z]) Blseek(fil1,wadplc[z],BSEEK_SET);
|
||||||
Bread(fil1,&tempbuf[0],4096);
|
Bread(fil1,&tempbuf[0],4096);
|
||||||
curplc = wadplc[z]+4096;
|
curplc = wadplc[z]+4096;
|
||||||
i = 0;
|
i = 0;
|
||||||
for(x=0;x<64;x++)
|
for(x=0;x<64;x++)
|
||||||
for(p=x;p<320*64;p+=320)
|
for(p=x;p<320*64;p+=320)
|
||||||
screen[p] = tempbuf[i++];
|
screen[p] = tempbuf[i++];
|
||||||
|
|
||||||
saveart(z,64,64);
|
saveart(z,64,64);
|
||||||
}
|
}
|
||||||
|
|
||||||
z++;
|
z++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, j, endoffile;
|
int i, j, endoffile;
|
||||||
char wadfile[80];
|
char wadfile[80];
|
||||||
|
|
||||||
printf("Wad2Art! Copyright 1995 by Ken Silverman\n");
|
printf("Wad2Art! Copyright 1995 by Ken Silverman\n");
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
printf("Command line parameters: Wad2Art [Doom IWAD file]\n");
|
printf("Command line parameters: Wad2Art [Doom IWAD file]\n");
|
||||||
printf(" Creates TILES000.ART, PALETTE.DAT, and NAMES.H in current directory.\n");
|
printf(" Creates TILES000.ART, PALETTE.DAT, and NAMES.H in current directory.\n");
|
||||||
printf(" Ex: wad2art c:\\doom\\doom.wad\n");
|
printf(" Ex: wad2art c:\\doom\\doom.wad\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(wadfile,argv[1]);
|
strcpy(wadfile,argv[1]);
|
||||||
if (strchr(wadfile,'.') == 0) strcat(wadfile,".wad");
|
if (strchr(wadfile,'.') == 0) strcat(wadfile,".wad");
|
||||||
if ((fil1 = Bopen(wadfile,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
if ((fil1 = Bopen(wadfile,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||||
{ printf("Wad not found\n"); exit(0); }
|
{ printf("Wad not found\n"); exit(0); }
|
||||||
if ((fil2 = Bopen("tiles000.art",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
if ((fil2 = Bopen("tiles000.art",BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
|
||||||
{ printf("Can't open art file\n"); exit(0); }
|
{ printf("Can't open art file\n"); exit(0); }
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for(i=0;i<256;i++) { ylookup[i] = j; j += 320; }
|
for(i=0;i<256;i++) { ylookup[i] = j; j += 320; }
|
||||||
|
|
||||||
printf("Loading wad header...\n");
|
printf("Loading wad header...\n");
|
||||||
loadwadheader();
|
loadwadheader();
|
||||||
Blseek(fil2,16+(numwads<<3),SEEK_SET);
|
Blseek(fil2,16+(numwads<<3),SEEK_SET);
|
||||||
for(i=0;i<numwads;i++)
|
for(i=0;i<numwads;i++)
|
||||||
{ tilesizx[i] = 0; tilesizy[i] = 0; picanm[i] = 0L; }
|
{ tilesizx[i] = 0; tilesizy[i] = 0; picanm[i] = 0L; }
|
||||||
|
|
||||||
printf("Saving names.h\n");
|
printf("Saving names.h\n");
|
||||||
savenames();
|
savenames();
|
||||||
printf("Converting palette\n");
|
printf("Converting palette\n");
|
||||||
convpalette();
|
convpalette();
|
||||||
|
|
||||||
printf("Saving tiles000.art\n");
|
printf("Saving tiles000.art\n");
|
||||||
showart("L_START");
|
showart("L_START");
|
||||||
showart("S_START");
|
showart("S_START");
|
||||||
showart("P_START");
|
showart("P_START");
|
||||||
showart("F_START");
|
showart("F_START");
|
||||||
|
|
||||||
printf("Saving tiles000.art header\n");
|
printf("Saving tiles000.art header\n");
|
||||||
artversion = 1; localtilestart = 0; localtileend = numwads-1;
|
artversion = 1; localtilestart = 0; localtileend = numwads-1;
|
||||||
|
|
||||||
endoffile = Btell(fil2);
|
endoffile = Btell(fil2);
|
||||||
Blseek(fil2,0,BSEEK_SET);
|
Blseek(fil2,0,BSEEK_SET);
|
||||||
Bwrite(fil2,&artversion,4);
|
Bwrite(fil2,&artversion,4);
|
||||||
Bwrite(fil2,&numwads,4);
|
Bwrite(fil2,&numwads,4);
|
||||||
Bwrite(fil2,&localtilestart,4);
|
Bwrite(fil2,&localtilestart,4);
|
||||||
Bwrite(fil2,&localtileend,4);
|
Bwrite(fil2,&localtileend,4);
|
||||||
Bwrite(fil2,&tilesizx[0],numwads<<1);
|
Bwrite(fil2,&tilesizx[0],numwads<<1);
|
||||||
Bwrite(fil2,&tilesizy[0],numwads<<1);
|
Bwrite(fil2,&tilesizy[0],numwads<<1);
|
||||||
Bwrite(fil2,&picanm[0],numwads<<2);
|
Bwrite(fil2,&picanm[0],numwads<<2);
|
||||||
Blseek(fil2,endoffile,BSEEK_SET);
|
Blseek(fil2,endoffile,BSEEK_SET);
|
||||||
|
|
||||||
Bclose(fil2);
|
Bclose(fil2);
|
||||||
Bclose(fil1);
|
Bclose(fil1);
|
||||||
|
|
||||||
printf("Congratulations! Your disk actually had enough space this time!\n");
|
printf("Congratulations! Your disk actually had enough space this time!\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue