mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 02:30:46 +00:00
1. Removed unneeded the svn:executable proprties. These files aren't actually executable.
2. Added the svn:ignore properties to clean up the output of "svn update" so that it doesn't show some unversioned files anymore sush as compiled binaries and object files(*.a). 3. Converted the end-of-line charapter sequences from Windows(CR LF) to Unix format(LF). It used to be a mixture of both styles that often confuse some programs. If some files have to be in Windows format, you should add the svn:eol-style on them(svn propset svn:eol-style native polymer/eduke32/source/thefile.c). git-svn-id: https://svn.eduke32.com/eduke32@854 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
fb80a8ec28
commit
c660bfb129
72 changed files with 19914 additions and 19914 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
0
polymer/build/include/dynamicgtk.h
Executable file → Normal file
0
polymer/build/include/dynamicgtk.h
Executable file → Normal file
0
polymer/build/include/osxmain.h
Executable file → Normal file
0
polymer/build/include/osxmain.h
Executable file → Normal file
0
polymer/build/include/startwin.editor.h
Executable file → Normal file
0
polymer/build/include/startwin.editor.h
Executable file → Normal file
0
polymer/build/include/watcomhax/cerrno
Executable file → Normal file
0
polymer/build/include/watcomhax/cerrno
Executable file → Normal file
0
polymer/build/include/watcomhax/cmath
Executable file → Normal file
0
polymer/build/include/watcomhax/cmath
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdarg
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdarg
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdio
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdio
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdlib
Executable file → Normal file
0
polymer/build/include/watcomhax/cstdlib
Executable file → Normal file
0
polymer/build/include/watcomhax/cstring
Executable file → Normal file
0
polymer/build/include/watcomhax/cstring
Executable file → Normal file
0
polymer/build/include/watcomhax/ctime
Executable file → Normal file
0
polymer/build/include/watcomhax/ctime
Executable file → Normal file
0
polymer/build/src/StartupWinController.editor.m
Executable file → Normal file
0
polymer/build/src/StartupWinController.editor.m
Executable file → Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
0
polymer/build/src/dynamicgtk.c
Executable file → Normal file
0
polymer/build/src/dynamicgtk.c
Executable file → Normal file
|
@ -1,33 +1,33 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "startwin.editor.h"
|
||||
|
||||
RSRC_ICON ICON "rsrc/build_icon.ico"
|
||||
RSRC_BMP BITMAP "rsrc/build.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "startwin.editor.h"
|
||||
|
||||
RSRC_ICON ICON "rsrc/build_icon.ico"
|
||||
RSRC_BMP BITMAP "rsrc/build.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "startwin.game.h"
|
||||
|
||||
RSRC_ICON ICON "rsrc/game_icon.ico"
|
||||
RSRC_BMP BITMAP "rsrc/game.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include "startwin.game.h"
|
||||
|
||||
RSRC_ICON ICON "rsrc/game_icon.ico"
|
||||
RSRC_BMP BITMAP "rsrc/game.bmp"
|
||||
|
||||
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200
|
||||
STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
|
||||
CAPTION "Startup"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32
|
||||
CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170
|
||||
CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14
|
||||
CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14
|
||||
|
||||
CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8
|
||||
CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56
|
||||
CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
|
||||
|
|
0
polymer/build/src/misc/gtkstartwin/gtkstartwin.glade
Executable file → Normal file
0
polymer/build/src/misc/gtkstartwin/gtkstartwin.glade
Executable file → Normal file
0
polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep
Executable file → Normal file
0
polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep
Executable file → Normal file
0
polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp
Executable file → Normal file
0
polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp
Executable file → Normal file
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
0
polymer/build/src/startgtk.editor.c
Executable file → Normal file
0
polymer/build/src/startgtk.editor.c
Executable file → Normal file
0
polymer/build/src/startwin.editor.c
Executable file → Normal file
0
polymer/build/src/startwin.editor.c
Executable file → Normal file
|
@ -1,151 +1,151 @@
|
|||
// BIN2C.CPP
|
||||
// by Jonathon Fowler (jonof@edgenetwork.org)
|
||||
|
||||
// Converts a binary file to C source
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <dir.h>
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
char defsrcext[] = ".DAT";
|
||||
char defoutext[] = ".C";
|
||||
|
||||
char source[MAXPATH], output[MAXPATH], bytesize;
|
||||
|
||||
|
||||
int PathAddExt(char *path, char *ext);
|
||||
|
||||
|
||||
void main(int argc, char *argv[])
|
||||
{
|
||||
printf("BIN2C - Binary to C data converter\n"
|
||||
"Copyright (c) 1999 Jonathon Fowler\n\n");
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
printf("Usage:\n"
|
||||
" BIN2C source<.DAT> output<.C> b|w\n\n"
|
||||
" source<.DAT> Binary source file\n"
|
||||
" output<.C> Output C code file\n"
|
||||
" b|w Byte or word-sized data\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int arg;
|
||||
FILE *in, *out;
|
||||
char datab1, datab2;
|
||||
int across=0, maxacross;
|
||||
int length, written=0;
|
||||
|
||||
|
||||
// get the source file
|
||||
strcpy(source, argv[1]);
|
||||
strupr(source);
|
||||
PathAddExt(source, defsrcext);
|
||||
printf("þ Source file: %s\n", source);
|
||||
|
||||
// get the output file
|
||||
strcpy(output, argv[2]);
|
||||
strupr(output);
|
||||
PathAddExt(output, defoutext);
|
||||
printf("þ Output file: %s\n", output);
|
||||
|
||||
// get byte/word data
|
||||
switch (tolower(argv[3][0]))
|
||||
{
|
||||
case 'b':
|
||||
printf("þ Byte data.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
printf("þ Word data.\n");
|
||||
bytesize=0;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("þ Unknown data size specified. Defaulting to byte.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
}
|
||||
|
||||
// open the input file
|
||||
in = fopen(source, "rb");
|
||||
if (!in)
|
||||
{
|
||||
printf("Error opening %s\n", source);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// open the output file
|
||||
out = fopen(output, "w+t");
|
||||
if (!out)
|
||||
{
|
||||
printf("Error creating %s\n", output);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
length = filelength(fileno(in));
|
||||
|
||||
// write a header out to the output file
|
||||
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
|
||||
|
||||
// start a data block
|
||||
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
|
||||
|
||||
if (bytesize)
|
||||
maxacross = 12;
|
||||
else
|
||||
maxacross = 9;
|
||||
across = maxacross;
|
||||
|
||||
// convert the data
|
||||
for (written=0; written<length; written++) {
|
||||
if (across == maxacross)
|
||||
{
|
||||
fprintf(out, "\n ");
|
||||
across = 0;
|
||||
}
|
||||
|
||||
if (bytesize)
|
||||
{
|
||||
datab1 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
|
||||
} else {
|
||||
datab1 = fgetc(in);
|
||||
datab2 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
|
||||
}
|
||||
|
||||
across++;
|
||||
|
||||
if (!bytesize) written++;
|
||||
}
|
||||
|
||||
|
||||
fprintf(out, " };");
|
||||
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
// Add an extention to a path if one doesn't exist
|
||||
int PathAddExt(char *path, char *ext)
|
||||
{
|
||||
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
|
||||
int flags;
|
||||
|
||||
flags = fnsplit(path, drive, dir, name, extn);
|
||||
|
||||
if (!(flags & EXTENSION)) // tack on an extension
|
||||
strcat(path, ext);
|
||||
|
||||
return ((flags & EXTENSION) == 0);
|
||||
}
|
||||
// BIN2C.CPP
|
||||
// by Jonathon Fowler (jonof@edgenetwork.org)
|
||||
|
||||
// Converts a binary file to C source
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <dir.h>
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
char defsrcext[] = ".DAT";
|
||||
char defoutext[] = ".C";
|
||||
|
||||
char source[MAXPATH], output[MAXPATH], bytesize;
|
||||
|
||||
|
||||
int PathAddExt(char *path, char *ext);
|
||||
|
||||
|
||||
void main(int argc, char *argv[])
|
||||
{
|
||||
printf("BIN2C - Binary to C data converter\n"
|
||||
"Copyright (c) 1999 Jonathon Fowler\n\n");
|
||||
|
||||
if (argc < 4)
|
||||
{
|
||||
printf("Usage:\n"
|
||||
" BIN2C source<.DAT> output<.C> b|w\n\n"
|
||||
" source<.DAT> Binary source file\n"
|
||||
" output<.C> Output C code file\n"
|
||||
" b|w Byte or word-sized data\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int arg;
|
||||
FILE *in, *out;
|
||||
char datab1, datab2;
|
||||
int across=0, maxacross;
|
||||
int length, written=0;
|
||||
|
||||
|
||||
// get the source file
|
||||
strcpy(source, argv[1]);
|
||||
strupr(source);
|
||||
PathAddExt(source, defsrcext);
|
||||
printf("þ Source file: %s\n", source);
|
||||
|
||||
// get the output file
|
||||
strcpy(output, argv[2]);
|
||||
strupr(output);
|
||||
PathAddExt(output, defoutext);
|
||||
printf("þ Output file: %s\n", output);
|
||||
|
||||
// get byte/word data
|
||||
switch (tolower(argv[3][0]))
|
||||
{
|
||||
case 'b':
|
||||
printf("þ Byte data.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
printf("þ Word data.\n");
|
||||
bytesize=0;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("þ Unknown data size specified. Defaulting to byte.\n");
|
||||
bytesize=1;
|
||||
break;
|
||||
}
|
||||
|
||||
// open the input file
|
||||
in = fopen(source, "rb");
|
||||
if (!in)
|
||||
{
|
||||
printf("Error opening %s\n", source);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// open the output file
|
||||
out = fopen(output, "w+t");
|
||||
if (!out)
|
||||
{
|
||||
printf("Error creating %s\n", output);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
length = filelength(fileno(in));
|
||||
|
||||
// write a header out to the output file
|
||||
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
|
||||
|
||||
// start a data block
|
||||
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
|
||||
|
||||
if (bytesize)
|
||||
maxacross = 12;
|
||||
else
|
||||
maxacross = 9;
|
||||
across = maxacross;
|
||||
|
||||
// convert the data
|
||||
for (written=0; written<length; written++) {
|
||||
if (across == maxacross)
|
||||
{
|
||||
fprintf(out, "\n ");
|
||||
across = 0;
|
||||
}
|
||||
|
||||
if (bytesize)
|
||||
{
|
||||
datab1 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
|
||||
} else {
|
||||
datab1 = fgetc(in);
|
||||
datab2 = fgetc(in);
|
||||
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
|
||||
}
|
||||
|
||||
across++;
|
||||
|
||||
if (!bytesize) written++;
|
||||
}
|
||||
|
||||
|
||||
fprintf(out, " };");
|
||||
|
||||
fclose(out);
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
|
||||
// Add an extention to a path if one doesn't exist
|
||||
int PathAddExt(char *path, char *ext)
|
||||
{
|
||||
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
|
||||
int flags;
|
||||
|
||||
flags = fnsplit(path, drive, dir, name, extn);
|
||||
|
||||
if (!(flags & EXTENSION)) // tack on an extension
|
||||
strcat(path, ext);
|
||||
|
||||
return ((flags & EXTENSION) == 0);
|
||||
}
|
||||
|
|
|
@ -1,171 +1,171 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
// Glibc doesn't provide this function, so for the sake of less ugliess
|
||||
// for all platforms, here's a replacement just for this program.
|
||||
static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } }
|
||||
|
||||
#define MAXFILES 4096
|
||||
|
||||
static char buf[65536]; // These limits should be abolished one day
|
||||
|
||||
static int numfiles;
|
||||
static char filespec[MAXFILES][128], filelist[MAXFILES][16];
|
||||
static int fileleng[MAXFILES];
|
||||
|
||||
|
||||
static char *matchstr = "*.*";
|
||||
int checkmatch(const struct Bdirent *a)
|
||||
{
|
||||
if (a->mode & BS_IFDIR) return 0; // is a directory
|
||||
if (a->namlen > 12) return 0; // name too long
|
||||
return Bwildmatch(a->name, matchstr);
|
||||
}
|
||||
|
||||
int filesize(const char *path, const char *name)
|
||||
{
|
||||
char p[BMAX_PATH];
|
||||
struct stat st;
|
||||
|
||||
strcpy(p, path);
|
||||
strcat(p, "/");
|
||||
strcat(p, name);
|
||||
|
||||
if (!stat(p, &st)) return st.st_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void findfiles(const char *dafilespec)
|
||||
{
|
||||
struct Bdirent *name;
|
||||
int daspeclen;
|
||||
char daspec[128], *dir;
|
||||
BDIR *di;
|
||||
|
||||
strcpy(daspec,dafilespec);
|
||||
daspeclen=strlen(daspec);
|
||||
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
|
||||
if (daspeclen > 0) {
|
||||
daspec[daspeclen]=0;
|
||||
dir = daspec;
|
||||
matchstr = &daspec[daspeclen+1];
|
||||
} else {
|
||||
dir = ".";
|
||||
matchstr = daspec;
|
||||
}
|
||||
|
||||
di = Bopendir(dir);
|
||||
if (!di) return;
|
||||
|
||||
while ((name = Breaddir(di))) {
|
||||
if (!checkmatch(name)) continue;
|
||||
|
||||
strcpy(&filelist[numfiles][0],name->name);
|
||||
jstrupr(&filelist[numfiles][0]);
|
||||
fileleng[numfiles] = name->size;
|
||||
filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
|
||||
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
|
||||
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
|
||||
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
|
||||
|
||||
strcpy(filespec[numfiles],dir);
|
||||
strcat(filespec[numfiles], "/");
|
||||
strcat(filespec[numfiles],name->name);
|
||||
|
||||
numfiles++;
|
||||
if (numfiles > MAXFILES)
|
||||
{
|
||||
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Bclosedir(di);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, l, fil, fil2;
|
||||
|
||||
if (argc < 3)
|
||||
{
|
||||
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(" group file\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");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
numfiles = 0;
|
||||
for(i=argc-1;i>1;i--)
|
||||
{
|
||||
if (argv[i][0] == '@')
|
||||
{
|
||||
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||
{
|
||||
l = Bread(fil,buf,65536);
|
||||
j = 0;
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
while (j < l)
|
||||
{
|
||||
k = j;
|
||||
while ((k < l) && (buf[k] > 32)) k++;
|
||||
|
||||
buf[k] = 0;
|
||||
findfiles(&buf[j]);
|
||||
j = k+1;
|
||||
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
}
|
||||
Bclose(fil);
|
||||
}
|
||||
}
|
||||
else
|
||||
findfiles(argv[i]);
|
||||
}
|
||||
|
||||
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]);
|
||||
exit(0);
|
||||
}
|
||||
Bwrite(fil,"KenSilverman",12);
|
||||
Bwrite(fil,&numfiles,4);
|
||||
Bwrite(fil,filelist,numfiles<<4);
|
||||
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
printf("Adding %s...\n",filespec[i]);
|
||||
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("Error: %s not found\n",filespec[i]);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
}
|
||||
for(j=0;j<fileleng[i];j+=65536)
|
||||
{
|
||||
k = min(fileleng[i]-j,65536);
|
||||
Bread(fil2,buf,k);
|
||||
if (Bwrite(fil,buf,k) < k)
|
||||
{
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
printf("OUT OF HD SPACE!\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
Bclose(fil2);
|
||||
}
|
||||
Bclose(fil);
|
||||
printf("Saved to %s.\n",argv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
// Glibc doesn't provide this function, so for the sake of less ugliess
|
||||
// for all platforms, here's a replacement just for this program.
|
||||
static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } }
|
||||
|
||||
#define MAXFILES 4096
|
||||
|
||||
static char buf[65536]; // These limits should be abolished one day
|
||||
|
||||
static int numfiles;
|
||||
static char filespec[MAXFILES][128], filelist[MAXFILES][16];
|
||||
static int fileleng[MAXFILES];
|
||||
|
||||
|
||||
static char *matchstr = "*.*";
|
||||
int checkmatch(const struct Bdirent *a)
|
||||
{
|
||||
if (a->mode & BS_IFDIR) return 0; // is a directory
|
||||
if (a->namlen > 12) return 0; // name too long
|
||||
return Bwildmatch(a->name, matchstr);
|
||||
}
|
||||
|
||||
int filesize(const char *path, const char *name)
|
||||
{
|
||||
char p[BMAX_PATH];
|
||||
struct stat st;
|
||||
|
||||
strcpy(p, path);
|
||||
strcat(p, "/");
|
||||
strcat(p, name);
|
||||
|
||||
if (!stat(p, &st)) return st.st_size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void findfiles(const char *dafilespec)
|
||||
{
|
||||
struct Bdirent *name;
|
||||
int daspeclen;
|
||||
char daspec[128], *dir;
|
||||
BDIR *di;
|
||||
|
||||
strcpy(daspec,dafilespec);
|
||||
daspeclen=strlen(daspec);
|
||||
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
|
||||
if (daspeclen > 0) {
|
||||
daspec[daspeclen]=0;
|
||||
dir = daspec;
|
||||
matchstr = &daspec[daspeclen+1];
|
||||
} else {
|
||||
dir = ".";
|
||||
matchstr = daspec;
|
||||
}
|
||||
|
||||
di = Bopendir(dir);
|
||||
if (!di) return;
|
||||
|
||||
while ((name = Breaddir(di))) {
|
||||
if (!checkmatch(name)) continue;
|
||||
|
||||
strcpy(&filelist[numfiles][0],name->name);
|
||||
jstrupr(&filelist[numfiles][0]);
|
||||
fileleng[numfiles] = name->size;
|
||||
filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
|
||||
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
|
||||
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
|
||||
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
|
||||
|
||||
strcpy(filespec[numfiles],dir);
|
||||
strcat(filespec[numfiles], "/");
|
||||
strcat(filespec[numfiles],name->name);
|
||||
|
||||
numfiles++;
|
||||
if (numfiles > MAXFILES)
|
||||
{
|
||||
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
Bclosedir(di);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, l, fil, fil2;
|
||||
|
||||
if (argc < 3)
|
||||
{
|
||||
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(" group file\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");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
numfiles = 0;
|
||||
for(i=argc-1;i>1;i--)
|
||||
{
|
||||
if (argv[i][0] == '@')
|
||||
{
|
||||
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
|
||||
{
|
||||
l = Bread(fil,buf,65536);
|
||||
j = 0;
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
while (j < l)
|
||||
{
|
||||
k = j;
|
||||
while ((k < l) && (buf[k] > 32)) k++;
|
||||
|
||||
buf[k] = 0;
|
||||
findfiles(&buf[j]);
|
||||
j = k+1;
|
||||
|
||||
while ((j < l) && (buf[j] <= 32)) j++;
|
||||
}
|
||||
Bclose(fil);
|
||||
}
|
||||
}
|
||||
else
|
||||
findfiles(argv[i]);
|
||||
}
|
||||
|
||||
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]);
|
||||
exit(0);
|
||||
}
|
||||
Bwrite(fil,"KenSilverman",12);
|
||||
Bwrite(fil,&numfiles,4);
|
||||
Bwrite(fil,filelist,numfiles<<4);
|
||||
|
||||
for(i=0;i<numfiles;i++)
|
||||
{
|
||||
printf("Adding %s...\n",filespec[i]);
|
||||
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("Error: %s not found\n",filespec[i]);
|
||||
Bclose(fil);
|
||||
return(0);
|
||||
}
|
||||
for(j=0;j<fileleng[i];j+=65536)
|
||||
{
|
||||
k = min(fileleng[i]-j,65536);
|
||||
Bread(fil2,buf,k);
|
||||
if (Bwrite(fil,buf,k) < k)
|
||||
{
|
||||
Bclose(fil2);
|
||||
Bclose(fil);
|
||||
printf("OUT OF HD SPACE!\n");
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
Bclose(fil2);
|
||||
}
|
||||
Bclose(fil);
|
||||
printf("Saved to %s.\n",argv[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
#if 0
|
||||
kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
|
||||
del kmd2tool.obj
|
||||
!if 0
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||
} md2typ;
|
||||
|
||||
typedef struct { point3d mul, add; } frametyp;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
FILE *fil;
|
||||
int i, leng;
|
||||
char *fbuf;
|
||||
md2typ *head;
|
||||
frametyp *fptr;
|
||||
|
||||
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); }
|
||||
|
||||
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
|
||||
leng = filelength(_fileno(fil));
|
||||
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
|
||||
fread(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
|
||||
head = (md2typ *)fbuf;
|
||||
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
|
||||
for(i=0;i<head->numframes;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);
|
||||
fptr->add.z += atof(argv[3]);
|
||||
}
|
||||
|
||||
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
|
||||
fwrite(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
|
||||
free(fbuf);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
!endif
|
||||
#endif
|
||||
#if 0
|
||||
kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
|
||||
del kmd2tool.obj
|
||||
!if 0
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <math.h>
|
||||
|
||||
typedef struct { float x, y, z; } point3d;
|
||||
|
||||
typedef struct
|
||||
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
|
||||
int numskins, numverts, numuv, numtris, numglcmds, numframes;
|
||||
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
|
||||
} md2typ;
|
||||
|
||||
typedef struct { point3d mul, add; } frametyp;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
FILE *fil;
|
||||
int i, leng;
|
||||
char *fbuf;
|
||||
md2typ *head;
|
||||
frametyp *fptr;
|
||||
|
||||
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); }
|
||||
|
||||
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
|
||||
leng = filelength(_fileno(fil));
|
||||
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
|
||||
fread(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
|
||||
head = (md2typ *)fbuf;
|
||||
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
|
||||
for(i=0;i<head->numframes;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);
|
||||
fptr->add.z += atof(argv[3]);
|
||||
}
|
||||
|
||||
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
|
||||
fwrite(fbuf,leng,1,fil);
|
||||
fclose(fil);
|
||||
|
||||
free(fbuf);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
!endif
|
||||
#endif
|
||||
|
|
|
@ -1,270 +1,270 @@
|
|||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
#define MAXPALOOKUPS 256
|
||||
|
||||
static int numpalookups, transratio;
|
||||
static char palettefilename[13], origpalookup[MAXPALOOKUPS<<8];
|
||||
static char palette[768], palookup[MAXPALOOKUPS<<8], transluc[65536];
|
||||
static char closestcol[64][64][64];
|
||||
|
||||
#define FASTPALGRIDSIZ 8
|
||||
static int rdist[129], gdist[129], bdist[129];
|
||||
static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3];
|
||||
static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)];
|
||||
static int colnext[256];
|
||||
static char coldist[8] = {0,1,2,3,4,3,2,1};
|
||||
static int colscan[27];
|
||||
|
||||
|
||||
|
||||
char getclosestcol(int r, int g, int b)
|
||||
{
|
||||
int i, j, k, dist, mindist, retcol;
|
||||
int *rlookup, *glookup, *blookup;
|
||||
char *ptr;
|
||||
|
||||
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;
|
||||
mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]);
|
||||
mindist = min(mindist,bdist[coldist[b&7]+64+8]);
|
||||
mindist++;
|
||||
|
||||
rlookup = (int *)&rdist[64-r];
|
||||
glookup = (int *)&gdist[64-g];
|
||||
blookup = (int *)&bdist[64-b];
|
||||
|
||||
retcol = -1;
|
||||
for(k=26;k>=0;k--)
|
||||
{
|
||||
i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue;
|
||||
for(i=colhead[i];i>=0;i=colnext[i])
|
||||
{
|
||||
ptr = (char *)&palette[i*3];
|
||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||
mindist = dist; retcol = i;
|
||||
}
|
||||
}
|
||||
if (retcol < 0)
|
||||
{
|
||||
mindist = 0x7fffffff;
|
||||
ptr = (char *)&palette[768-3];
|
||||
for(i=255;i>=0;i--,ptr-=3)
|
||||
{
|
||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||
mindist = dist; retcol = i;
|
||||
}
|
||||
}
|
||||
ptr = (char *)&closestcol[r][g][b];
|
||||
*ptr = 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 ((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 ((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 ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol;
|
||||
if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol;
|
||||
if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = 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 ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol;
|
||||
return(retcol);
|
||||
}
|
||||
|
||||
char getpalookup(char dashade, char dacol)
|
||||
{
|
||||
int r, g, b, t;
|
||||
char *ptr;
|
||||
|
||||
ptr = (char *)&palette[dacol*3];
|
||||
t = divscale16(numpalookups-dashade,numpalookups);
|
||||
r = ((ptr[0]*t+32768)>>16);
|
||||
g = ((ptr[1]*t+32768)>>16);
|
||||
b = ((ptr[2]*t+32768)>>16);
|
||||
return(getclosestcol(r,g,b));
|
||||
}
|
||||
|
||||
char gettrans(char dat1, char dat2, int datransratio)
|
||||
{
|
||||
int r, g, b;
|
||||
char *ptr, *ptr2;
|
||||
|
||||
ptr = (char *)&palette[dat1*3];
|
||||
ptr2 = (char *)&palette[dat2*3];
|
||||
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
|
||||
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
|
||||
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
|
||||
return(getclosestcol(r,g,b));
|
||||
}
|
||||
|
||||
void initfastcolorlookup(int rscale, int gscale, int bscale)
|
||||
{
|
||||
int i, j, x, y, z;
|
||||
char *ptr;
|
||||
|
||||
j = 0;
|
||||
for(i=64;i>=0;i--)
|
||||
{
|
||||
//j = (i-64)*(i-64);
|
||||
rdist[i] = rdist[128-i] = j*rscale;
|
||||
gdist[i] = gdist[128-i] = j*gscale;
|
||||
bdist[i] = bdist[128-i] = j*bscale;
|
||||
j += 129-(i<<1);
|
||||
}
|
||||
|
||||
clearbufbyte(FP_OFF(colhere),sizeof(colhere),0L);
|
||||
clearbufbyte(FP_OFF(colhead),sizeof(colhead),0L);
|
||||
|
||||
ptr = (char *)&palette[768-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;
|
||||
if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1;
|
||||
colhead[j] = i;
|
||||
colhere[j>>3] |= (1<<(j&7));
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ)
|
||||
for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ)
|
||||
for(z=-1;z<=1;z++)
|
||||
colscan[i++] = x+y+z;
|
||||
i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char col, ch;
|
||||
short orignumpalookups;
|
||||
int fil, i, j, rscale, gscale, bscale;
|
||||
char buf[65536];
|
||||
|
||||
ch = 13;
|
||||
if (argc>1) {
|
||||
if (argv[1][0] == '-') {
|
||||
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc != 3) && (argc != 6))
|
||||
{
|
||||
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(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
||||
printf(" Ex #2: transpal 64 160\n\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(" Include -t to update the transluscent table ONLY\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(palettefilename,"palette.dat");
|
||||
numpalookups = atol(argv[1]);
|
||||
transratio = atol(argv[2]);
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
rscale = atol(argv[3]);
|
||||
gscale = atol(argv[4]);
|
||||
bscale = atol(argv[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rscale = 30;
|
||||
gscale = 59;
|
||||
bscale = 11;
|
||||
}
|
||||
|
||||
if ((numpalookups < 1) || (numpalookups > 256))
|
||||
{ printf("Invalid number of shades\n"); exit(0); }
|
||||
if ((transratio < 0) || (transratio > 256))
|
||||
{ printf("Invalid transluscent ratio\n"); exit(0); }
|
||||
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("%s not found",palettefilename);
|
||||
return(0);
|
||||
}
|
||||
Bread(fil,palette,768);
|
||||
Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups);
|
||||
orignumpalookups = min(max(orignumpalookups,1),256);
|
||||
Bread(fil,origpalookup,(int)orignumpalookups<<8);
|
||||
Bclose(fil);
|
||||
|
||||
clearbuf(buf,65536>>2,0L);
|
||||
|
||||
initfastcolorlookup(rscale,gscale,bscale);
|
||||
clearbuf(closestcol,262144>>2,0xffffffff);
|
||||
|
||||
for(i=0;i<numpalookups;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = getpalookup((char)i,(char)j);
|
||||
palookup[(i<<8)+j] = col;
|
||||
|
||||
drawpixel(((((i<<1)+0)*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(j=0;j<6;j++)
|
||||
{
|
||||
drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i);
|
||||
|
||||
drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i);
|
||||
}
|
||||
|
||||
for(i=0;i<256;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = gettrans((char)i,(char)j,transratio);
|
||||
transluc[(i<<8)+j] = col;
|
||||
|
||||
drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col);
|
||||
}
|
||||
|
||||
if (ch == 13)
|
||||
{
|
||||
short s;
|
||||
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); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,palookup,numpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Shade table AND transluscent table updated\n");
|
||||
}
|
||||
else if (ch == 32)
|
||||
{
|
||||
short s;
|
||||
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); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Transluscent table updated\n");
|
||||
}
|
||||
else
|
||||
printf("Palette file wasn't touched\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
|
||||
// Ken Silverman's official web site: "http://www.advsys.net/ken"
|
||||
// See the included license file "BUILDLIC.TXT" for license info.
|
||||
//
|
||||
// This file has been modified from Ken Silverman's original release
|
||||
// by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
#include "compat.h"
|
||||
#include "pragmas.h"
|
||||
|
||||
#define MAXPALOOKUPS 256
|
||||
|
||||
static int numpalookups, transratio;
|
||||
static char palettefilename[13], origpalookup[MAXPALOOKUPS<<8];
|
||||
static char palette[768], palookup[MAXPALOOKUPS<<8], transluc[65536];
|
||||
static char closestcol[64][64][64];
|
||||
|
||||
#define FASTPALGRIDSIZ 8
|
||||
static int rdist[129], gdist[129], bdist[129];
|
||||
static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3];
|
||||
static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)];
|
||||
static int colnext[256];
|
||||
static char coldist[8] = {0,1,2,3,4,3,2,1};
|
||||
static int colscan[27];
|
||||
|
||||
|
||||
|
||||
char getclosestcol(int r, int g, int b)
|
||||
{
|
||||
int i, j, k, dist, mindist, retcol;
|
||||
int *rlookup, *glookup, *blookup;
|
||||
char *ptr;
|
||||
|
||||
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;
|
||||
mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]);
|
||||
mindist = min(mindist,bdist[coldist[b&7]+64+8]);
|
||||
mindist++;
|
||||
|
||||
rlookup = (int *)&rdist[64-r];
|
||||
glookup = (int *)&gdist[64-g];
|
||||
blookup = (int *)&bdist[64-b];
|
||||
|
||||
retcol = -1;
|
||||
for(k=26;k>=0;k--)
|
||||
{
|
||||
i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue;
|
||||
for(i=colhead[i];i>=0;i=colnext[i])
|
||||
{
|
||||
ptr = (char *)&palette[i*3];
|
||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||
mindist = dist; retcol = i;
|
||||
}
|
||||
}
|
||||
if (retcol < 0)
|
||||
{
|
||||
mindist = 0x7fffffff;
|
||||
ptr = (char *)&palette[768-3];
|
||||
for(i=255;i>=0;i--,ptr-=3)
|
||||
{
|
||||
dist = glookup[ptr[1]]; if (dist >= mindist) continue;
|
||||
dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
|
||||
dist += blookup[ptr[2]]; if (dist >= mindist) continue;
|
||||
mindist = dist; retcol = i;
|
||||
}
|
||||
}
|
||||
ptr = (char *)&closestcol[r][g][b];
|
||||
*ptr = 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 ((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 ((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 ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol;
|
||||
if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol;
|
||||
if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = 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 ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol;
|
||||
return(retcol);
|
||||
}
|
||||
|
||||
char getpalookup(char dashade, char dacol)
|
||||
{
|
||||
int r, g, b, t;
|
||||
char *ptr;
|
||||
|
||||
ptr = (char *)&palette[dacol*3];
|
||||
t = divscale16(numpalookups-dashade,numpalookups);
|
||||
r = ((ptr[0]*t+32768)>>16);
|
||||
g = ((ptr[1]*t+32768)>>16);
|
||||
b = ((ptr[2]*t+32768)>>16);
|
||||
return(getclosestcol(r,g,b));
|
||||
}
|
||||
|
||||
char gettrans(char dat1, char dat2, int datransratio)
|
||||
{
|
||||
int r, g, b;
|
||||
char *ptr, *ptr2;
|
||||
|
||||
ptr = (char *)&palette[dat1*3];
|
||||
ptr2 = (char *)&palette[dat2*3];
|
||||
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
|
||||
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
|
||||
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
|
||||
return(getclosestcol(r,g,b));
|
||||
}
|
||||
|
||||
void initfastcolorlookup(int rscale, int gscale, int bscale)
|
||||
{
|
||||
int i, j, x, y, z;
|
||||
char *ptr;
|
||||
|
||||
j = 0;
|
||||
for(i=64;i>=0;i--)
|
||||
{
|
||||
//j = (i-64)*(i-64);
|
||||
rdist[i] = rdist[128-i] = j*rscale;
|
||||
gdist[i] = gdist[128-i] = j*gscale;
|
||||
bdist[i] = bdist[128-i] = j*bscale;
|
||||
j += 129-(i<<1);
|
||||
}
|
||||
|
||||
clearbufbyte(FP_OFF(colhere),sizeof(colhere),0L);
|
||||
clearbufbyte(FP_OFF(colhead),sizeof(colhead),0L);
|
||||
|
||||
ptr = (char *)&palette[768-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;
|
||||
if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1;
|
||||
colhead[j] = i;
|
||||
colhere[j>>3] |= (1<<(j&7));
|
||||
}
|
||||
|
||||
i = 0;
|
||||
for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ)
|
||||
for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ)
|
||||
for(z=-1;z<=1;z++)
|
||||
colscan[i++] = x+y+z;
|
||||
i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char col, ch;
|
||||
short orignumpalookups;
|
||||
int fil, i, j, rscale, gscale, bscale;
|
||||
char buf[65536];
|
||||
|
||||
ch = 13;
|
||||
if (argc>1) {
|
||||
if (argv[1][0] == '-') {
|
||||
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc != 3) && (argc != 6))
|
||||
{
|
||||
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(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
|
||||
printf(" Ex #2: transpal 64 160\n\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(" Include -t to update the transluscent table ONLY\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
strcpy(palettefilename,"palette.dat");
|
||||
numpalookups = atol(argv[1]);
|
||||
transratio = atol(argv[2]);
|
||||
|
||||
if (argc == 6)
|
||||
{
|
||||
rscale = atol(argv[3]);
|
||||
gscale = atol(argv[4]);
|
||||
bscale = atol(argv[5]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rscale = 30;
|
||||
gscale = 59;
|
||||
bscale = 11;
|
||||
}
|
||||
|
||||
if ((numpalookups < 1) || (numpalookups > 256))
|
||||
{ printf("Invalid number of shades\n"); exit(0); }
|
||||
if ((transratio < 0) || (transratio > 256))
|
||||
{ printf("Invalid transluscent ratio\n"); exit(0); }
|
||||
|
||||
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
|
||||
{
|
||||
printf("%s not found",palettefilename);
|
||||
return(0);
|
||||
}
|
||||
Bread(fil,palette,768);
|
||||
Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups);
|
||||
orignumpalookups = min(max(orignumpalookups,1),256);
|
||||
Bread(fil,origpalookup,(int)orignumpalookups<<8);
|
||||
Bclose(fil);
|
||||
|
||||
clearbuf(buf,65536>>2,0L);
|
||||
|
||||
initfastcolorlookup(rscale,gscale,bscale);
|
||||
clearbuf(closestcol,262144>>2,0xffffffff);
|
||||
|
||||
for(i=0;i<numpalookups;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = getpalookup((char)i,(char)j);
|
||||
palookup[(i<<8)+j] = col;
|
||||
|
||||
drawpixel(((((i<<1)+0)*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(j=0;j<6;j++)
|
||||
{
|
||||
drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i);
|
||||
|
||||
drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i);
|
||||
}
|
||||
|
||||
for(i=0;i<256;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
col = gettrans((char)i,(char)j,transratio);
|
||||
transluc[(i<<8)+j] = col;
|
||||
|
||||
drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col);
|
||||
}
|
||||
|
||||
if (ch == 13)
|
||||
{
|
||||
short s;
|
||||
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); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,palookup,numpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Shade table AND transluscent table updated\n");
|
||||
}
|
||||
else if (ch == 32)
|
||||
{
|
||||
short s;
|
||||
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); }
|
||||
Bwrite(fil,palette,768);
|
||||
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
|
||||
Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
|
||||
Bwrite(fil,transluc,65536);
|
||||
Bclose(fil);
|
||||
printf("Transluscent table updated\n");
|
||||
}
|
||||
else
|
||||
printf("Palette file wasn't touched\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,139 +1,139 @@
|
|||
// VGA Font Grabber
|
||||
// Copyright (c) 1997 Jonathon Fowler
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int font, width, height, numchars;
|
||||
struct REGPACK r;
|
||||
FILE *fp;
|
||||
|
||||
printf("VGA Font Grabber\n"
|
||||
"Copyright (c) 1997 Jonathon Fowler\n");
|
||||
|
||||
do {
|
||||
printf("\nSelect which font to grab:\n"
|
||||
" 1. 8-by-8 ROM\n"
|
||||
" 2. 8-by-14 ROM\n"
|
||||
" 3. 8-by-16 ROM\n"
|
||||
" 4. 9-by-16 ROM\n"
|
||||
" 5. 9-by-14 ROM\n"
|
||||
" 6. Quit\n"
|
||||
" > ");
|
||||
scanf("%d",&font);
|
||||
|
||||
switch (font) {
|
||||
case 1:
|
||||
printf("Getting 8-by-8 ROM font...");
|
||||
|
||||
if ((fp = fopen("88vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 8;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (1st half)
|
||||
r.r_bx = 0x0300;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (2nd half)
|
||||
r.r_bx = 0x0400;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Getting 8-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("814vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 14;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0200;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Getting 8-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("816vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0600;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 4:
|
||||
printf("Getting 9-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("916vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0700;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 5:
|
||||
printf("Getting 9-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("914vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0500;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
default:
|
||||
printf("Please try again\n");
|
||||
break;
|
||||
}
|
||||
} while (font != 6);
|
||||
|
||||
}
|
||||
// VGA Font Grabber
|
||||
// Copyright (c) 1997 Jonathon Fowler
|
||||
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
|
||||
|
||||
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int font, width, height, numchars;
|
||||
struct REGPACK r;
|
||||
FILE *fp;
|
||||
|
||||
printf("VGA Font Grabber\n"
|
||||
"Copyright (c) 1997 Jonathon Fowler\n");
|
||||
|
||||
do {
|
||||
printf("\nSelect which font to grab:\n"
|
||||
" 1. 8-by-8 ROM\n"
|
||||
" 2. 8-by-14 ROM\n"
|
||||
" 3. 8-by-16 ROM\n"
|
||||
" 4. 9-by-16 ROM\n"
|
||||
" 5. 9-by-14 ROM\n"
|
||||
" 6. Quit\n"
|
||||
" > ");
|
||||
scanf("%d",&font);
|
||||
|
||||
switch (font) {
|
||||
case 1:
|
||||
printf("Getting 8-by-8 ROM font...");
|
||||
|
||||
if ((fp = fopen("88vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 8;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (1st half)
|
||||
r.r_bx = 0x0300;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
r.r_ax = 0x1130; // locate the font (2nd half)
|
||||
r.r_bx = 0x0400;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 2:
|
||||
printf("Getting 8-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("814vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 14;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0200;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 3:
|
||||
printf("Getting 8-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("816vga.dat", "wb")) != NULL) {
|
||||
width = 8;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0600;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 4:
|
||||
printf("Getting 9-by-16 ROM font...");
|
||||
|
||||
if ((fp = fopen("916vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0700;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 5:
|
||||
printf("Getting 9-by-14 ROM font...");
|
||||
|
||||
if ((fp = fopen("914vga.dat", "wb")) != NULL) {
|
||||
width = 9;
|
||||
height = 16;
|
||||
numchars = 256;
|
||||
|
||||
r.r_ax = 0x1130; // locate the font
|
||||
r.r_bx = 0x0500;
|
||||
intr(0x10, &r);
|
||||
|
||||
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
printf("Done\n");
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
default:
|
||||
printf("Please try again\n");
|
||||
break;
|
||||
}
|
||||
} while (font != 6);
|
||||
|
||||
}
|
||||
|
|
0
polymer/eduke32/buildlic.txt
Executable file → Normal file
0
polymer/eduke32/buildlic.txt
Executable file → Normal file
0
polymer/eduke32/eobj_win/keep.me
Executable file → Normal file
0
polymer/eduke32/eobj_win/keep.me
Executable file → Normal file
0
polymer/eduke32/installer/eduke32.nsi
Executable file → Normal file
0
polymer/eduke32/installer/eduke32.nsi
Executable file → Normal file
0
polymer/eduke32/names.h
Executable file → Normal file
0
polymer/eduke32/names.h
Executable file → Normal file
0
polymer/eduke32/obj_win/keep.me
Executable file → Normal file
0
polymer/eduke32/obj_win/keep.me
Executable file → Normal file
0
polymer/eduke32/rsrc/manifest.build.xml
Executable file → Normal file
0
polymer/eduke32/rsrc/manifest.build.xml
Executable file → Normal file
0
polymer/eduke32/rsrc/manifest.game.xml
Executable file → Normal file
0
polymer/eduke32/rsrc/manifest.game.xml
Executable file → Normal file
0
polymer/eduke32/source/gamevars.c
Executable file → Normal file
0
polymer/eduke32/source/gamevars.c
Executable file → Normal file
0
polymer/eduke32/source/grpscan.c
Executable file → Normal file
0
polymer/eduke32/source/grpscan.c
Executable file → Normal file
0
polymer/eduke32/source/grpscan.h
Executable file → Normal file
0
polymer/eduke32/source/grpscan.h
Executable file → Normal file
File diff suppressed because it is too large
Load diff
0
polymer/eduke32/source/jaudiolib/debugio.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/debugio.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/dsl.c
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/dsl.c
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/dsl.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/dsl.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/interrup.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/interrup.h
Executable file → Normal file
|
@ -1,103 +1,103 @@
|
|||
/*
|
||||
Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
*/
|
||||
/**********************************************************************
|
||||
module: LL_MAN.C
|
||||
|
||||
author: James R. Dose
|
||||
date: January 1, 1994
|
||||
|
||||
Linked list management routines.
|
||||
|
||||
(c) Copyright 1994 James R. Dose. All Rights Reserved.
|
||||
**********************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "ll_man.h"
|
||||
|
||||
#define OFFSET( structure, offset ) \
|
||||
( *( ( char ** )&( structure )[ offset ] ) )
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
Memory locked functions:
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
void LL_AddNode
|
||||
(
|
||||
char *item,
|
||||
char **head,
|
||||
char **tail,
|
||||
int next,
|
||||
int prev
|
||||
)
|
||||
|
||||
{
|
||||
OFFSET(item, prev) = NULL;
|
||||
OFFSET(item, next) = *head;
|
||||
|
||||
if (*head)
|
||||
{
|
||||
OFFSET(*head, prev) = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
*tail = item;
|
||||
}
|
||||
|
||||
*head = item;
|
||||
}
|
||||
|
||||
void LL_RemoveNode
|
||||
(
|
||||
char *item,
|
||||
char **head,
|
||||
char **tail,
|
||||
int next,
|
||||
int prev
|
||||
)
|
||||
|
||||
{
|
||||
if (OFFSET(item, prev) == NULL)
|
||||
{
|
||||
*head = OFFSET(item, next);
|
||||
}
|
||||
else
|
||||
{
|
||||
OFFSET(OFFSET(item, prev), next) = OFFSET(item, next);
|
||||
}
|
||||
|
||||
if (OFFSET(item, next) == NULL)
|
||||
{
|
||||
*tail = OFFSET(item, prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
OFFSET(OFFSET(item, next), prev) = OFFSET(item, prev);
|
||||
}
|
||||
|
||||
OFFSET(item, next) = NULL;
|
||||
OFFSET(item, prev) = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
*/
|
||||
/**********************************************************************
|
||||
module: LL_MAN.C
|
||||
|
||||
author: James R. Dose
|
||||
date: January 1, 1994
|
||||
|
||||
Linked list management routines.
|
||||
|
||||
(c) Copyright 1994 James R. Dose. All Rights Reserved.
|
||||
**********************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include "ll_man.h"
|
||||
|
||||
#define OFFSET( structure, offset ) \
|
||||
( *( ( char ** )&( structure )[ offset ] ) )
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
Memory locked functions:
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
void LL_AddNode
|
||||
(
|
||||
char *item,
|
||||
char **head,
|
||||
char **tail,
|
||||
int next,
|
||||
int prev
|
||||
)
|
||||
|
||||
{
|
||||
OFFSET(item, prev) = NULL;
|
||||
OFFSET(item, next) = *head;
|
||||
|
||||
if (*head)
|
||||
{
|
||||
OFFSET(*head, prev) = item;
|
||||
}
|
||||
else
|
||||
{
|
||||
*tail = item;
|
||||
}
|
||||
|
||||
*head = item;
|
||||
}
|
||||
|
||||
void LL_RemoveNode
|
||||
(
|
||||
char *item,
|
||||
char **head,
|
||||
char **tail,
|
||||
int next,
|
||||
int prev
|
||||
)
|
||||
|
||||
{
|
||||
if (OFFSET(item, prev) == NULL)
|
||||
{
|
||||
*head = OFFSET(item, next);
|
||||
}
|
||||
else
|
||||
{
|
||||
OFFSET(OFFSET(item, prev), next) = OFFSET(item, next);
|
||||
}
|
||||
|
||||
if (OFFSET(item, next) == NULL)
|
||||
{
|
||||
*tail = OFFSET(item, prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
OFFSET(OFFSET(item, next), prev) = OFFSET(item, prev);
|
||||
}
|
||||
|
||||
OFFSET(item, next) = NULL;
|
||||
OFFSET(item, prev) = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,495 +1,495 @@
|
|||
/*
|
||||
Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
*/
|
||||
/**********************************************************************
|
||||
module: MPU401.C
|
||||
|
||||
author: James R. Dose
|
||||
date: January 1, 1994
|
||||
|
||||
Low level routines to support sending of MIDI data to MPU401
|
||||
compatible MIDI interfaces.
|
||||
|
||||
(c) Copyright 1994 James R. Dose. All Rights Reserved.
|
||||
**********************************************************************/
|
||||
|
||||
#include "mpu401.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
static HMIDISTRM hmido = (HMIDISTRM)-1;
|
||||
static MIDIOUTCAPS midicaps;
|
||||
static DWORD mididevice = -1;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int time;
|
||||
int stream;
|
||||
int event;
|
||||
}
|
||||
MIDIEVENTHEAD;
|
||||
#define PAD(x) ((((x)+3)&(~3)))
|
||||
|
||||
#define BUFFERLEN (32*4*4)
|
||||
#define NUMBUFFERS 6
|
||||
static char eventbuf[NUMBUFFERS][BUFFERLEN];
|
||||
static int eventcnt[NUMBUFFERS];
|
||||
static MIDIHDR bufferheaders[NUMBUFFERS];
|
||||
int _MPU_CurrentBuffer = 0;
|
||||
int _MPU_BuffersWaiting = 0;
|
||||
|
||||
extern unsigned int _MIDI_GlobalPositionInTicks;
|
||||
unsigned int _MPU_LastEvent=0;
|
||||
|
||||
#define MIDI_NOTE_OFF 0x80
|
||||
#define MIDI_NOTE_ON 0x90
|
||||
#define MIDI_POLY_AFTER_TCH 0xA0
|
||||
#define MIDI_CONTROL_CHANGE 0xB0
|
||||
#define MIDI_PROGRAM_CHANGE 0xC0
|
||||
#define MIDI_AFTER_TOUCH 0xD0
|
||||
#define MIDI_PITCH_BEND 0xE0
|
||||
#define MIDI_META_EVENT 0xFF
|
||||
#define MIDI_END_OF_TRACK 0x2F
|
||||
#define MIDI_TEMPO_CHANGE 0x51
|
||||
#define MIDI_MONO_MODE_ON 0x7E
|
||||
#define MIDI_ALL_NOTES_OFF 0x7B
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
Memory locked functions:
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
void MPU_FinishBuffer(int buffer)
|
||||
{
|
||||
if (!eventcnt[buffer]) return;
|
||||
ZeroMemory(&bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
bufferheaders[buffer].lpData = eventbuf[buffer];
|
||||
bufferheaders[buffer].dwBufferLength =
|
||||
bufferheaders[buffer].dwBytesRecorded = eventcnt[buffer];
|
||||
midiOutPrepareHeader((HMIDIOUT)hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
midiStreamOut(hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
// printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer);
|
||||
_MPU_BuffersWaiting++;
|
||||
}
|
||||
|
||||
void MPU_BeginPlayback(void)
|
||||
{
|
||||
_MPU_LastEvent = _MIDI_GlobalPositionInTicks;
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
|
||||
}
|
||||
|
||||
void MPU_Pause(void)
|
||||
{
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamPause(hmido);
|
||||
}
|
||||
|
||||
void MPU_Unpause(void)
|
||||
{
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
|
||||
{
|
||||
int i;
|
||||
|
||||
UNREFERENCED_PARAMETER(dwInstance);
|
||||
UNREFERENCED_PARAMETER(dwParam2);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case MOM_DONE:
|
||||
midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR));
|
||||
for (i=0;i<NUMBUFFERS;i++)
|
||||
{
|
||||
if (dwParam1 == (unsigned int)&bufferheaders[i])
|
||||
{
|
||||
eventcnt[i] = 0; // marks the buffer as free
|
||||
// printf("Finished buffer %d\n",i);
|
||||
_MPU_BuffersWaiting--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_SendMidi
|
||||
|
||||
Queues a MIDI message to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_GetNextBuffer(void)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<NUMBUFFERS; i++)
|
||||
{
|
||||
if (eventcnt[i] == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MPU_SendMidi(char *data, int count)
|
||||
{
|
||||
char *p;
|
||||
int padded, nextbuffer;
|
||||
static int masks[3] = { 0x000000ffl, 0x0000ffffl, 0x00ffffffl };
|
||||
|
||||
if (count <= 0) return;
|
||||
if (count <= 3)
|
||||
{
|
||||
if (eventcnt[_MPU_CurrentBuffer] + 12 > BUFFERLEN)
|
||||
{
|
||||
// buffer over-full
|
||||
nextbuffer = MPU_GetNextBuffer();
|
||||
if (nextbuffer < 0)
|
||||
{
|
||||
// printf("All buffers full!\n");
|
||||
return;
|
||||
}
|
||||
MPU_FinishBuffer(_MPU_CurrentBuffer);
|
||||
_MPU_CurrentBuffer = nextbuffer;
|
||||
}
|
||||
|
||||
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
|
||||
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
|
||||
((int*)p)[1] = 0;
|
||||
((int*)p)[2] = (MEVT_SHORTMSG << 24) | ((*((int*)data)) & masks[count-1]);
|
||||
eventcnt[_MPU_CurrentBuffer] += 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
padded = PAD(count);
|
||||
if (eventcnt[_MPU_CurrentBuffer] + 12 + padded > BUFFERLEN)
|
||||
{
|
||||
// buffer over-full
|
||||
nextbuffer = MPU_GetNextBuffer();
|
||||
if (nextbuffer < 0)
|
||||
{
|
||||
// printf("All buffers full!\n");
|
||||
return;
|
||||
}
|
||||
MPU_FinishBuffer(_MPU_CurrentBuffer);
|
||||
_MPU_CurrentBuffer = nextbuffer;
|
||||
}
|
||||
|
||||
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
|
||||
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
|
||||
((int*)p)[1] = 0;
|
||||
((int*)p)[2] = (MEVT_LONGMSG<<24) | (count & 0xffffffl);
|
||||
p+=12; eventcnt[_MPU_CurrentBuffer] += 12;
|
||||
for (; count>0; count--, padded--, eventcnt[_MPU_CurrentBuffer]++)
|
||||
*(p++) = *(data++);
|
||||
for (; padded>0; padded--, eventcnt[_MPU_CurrentBuffer]++)
|
||||
*(p++) = 0;
|
||||
}
|
||||
_MPU_LastEvent = _MIDI_GlobalPositionInTicks;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_SendMidiImmediate
|
||||
|
||||
Sends a MIDI message immediately to the the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
void MPU_SendMidiImmediate(char *data, int count)
|
||||
{
|
||||
MIDIHDR mhdr;
|
||||
static int masks[3] = { 0x00ffffffl, 0x0000ffffl, 0x000000ffl };
|
||||
|
||||
if (!count) return;
|
||||
if (count<=3) midiOutShortMsg((HMIDIOUT)hmido, (*((int*)data)) & masks[count-1]);
|
||||
else
|
||||
{
|
||||
ZeroMemory(&mhdr, sizeof(mhdr));
|
||||
mhdr.lpData = data;
|
||||
mhdr.dwBufferLength = count;
|
||||
midiOutPrepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
midiOutLongMsg((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
while (!(mhdr.dwFlags & MHDR_DONE)) ;
|
||||
midiOutUnprepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_Reset
|
||||
|
||||
Resets the MPU401 card.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_Reset
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
midiStreamStop(hmido);
|
||||
midiStreamClose(hmido);
|
||||
|
||||
return(MPU_Ok);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_Init
|
||||
|
||||
Detects and initializes the MPU401 card.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_Init
|
||||
(
|
||||
int addr
|
||||
)
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<NUMBUFFERS;i++) eventcnt[i]=0;
|
||||
|
||||
mididevice = addr;
|
||||
|
||||
if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error;
|
||||
|
||||
if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error);
|
||||
|
||||
return(MPU_Ok);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_NoteOff
|
||||
|
||||
Sends a full MIDI note off event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_NoteOff
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int velocity
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_NOTE_OFF | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (velocity);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_NoteOn
|
||||
|
||||
Sends a full MIDI note on event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_NoteOn
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int velocity
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_NOTE_ON | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (velocity);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_PolyAftertouch
|
||||
|
||||
Sends a full MIDI polyphonic aftertouch event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_PolyAftertouch
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int pressure
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_POLY_AFTER_TCH | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (pressure);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ControlChange
|
||||
|
||||
Sends a full MIDI control change event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ControlChange
|
||||
(
|
||||
int channel,
|
||||
int number,
|
||||
int value
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_CONTROL_CHANGE | channel);
|
||||
msg[1] = (number);
|
||||
msg[2] = (value);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ProgramChange
|
||||
|
||||
Sends a full MIDI program change event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ProgramChange
|
||||
(
|
||||
int channel,
|
||||
int program
|
||||
)
|
||||
|
||||
{
|
||||
char msg[2];
|
||||
msg[0] = (MIDI_PROGRAM_CHANGE | channel);
|
||||
msg[1] = (program);
|
||||
MPU_SendMidi(msg, 2);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ChannelAftertouch
|
||||
|
||||
Sends a full MIDI channel aftertouch event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ChannelAftertouch
|
||||
(
|
||||
int channel,
|
||||
int pressure
|
||||
)
|
||||
|
||||
{
|
||||
char msg[2];
|
||||
msg[0] = (MIDI_AFTER_TOUCH | channel);
|
||||
msg[1] = (pressure);
|
||||
MPU_SendMidi(msg, 2);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_PitchBend
|
||||
|
||||
Sends a full MIDI pitch bend event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_PitchBend
|
||||
(
|
||||
int channel,
|
||||
int lsb,
|
||||
int msb
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_PITCH_BEND | channel);
|
||||
msg[1] = (lsb);
|
||||
msg[2] = (msb);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MPU_SetTempo(int tempo)
|
||||
{
|
||||
MIDIPROPTEMPO prop;
|
||||
prop.cbStruct = sizeof(MIDIPROPTEMPO);
|
||||
prop.dwTempo = 60000000l/tempo;
|
||||
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TEMPO);
|
||||
}
|
||||
|
||||
void MPU_SetDivision(int division)
|
||||
{
|
||||
MIDIPROPTIMEDIV prop;
|
||||
prop.cbStruct = sizeof(MIDIPROPTIMEDIV);
|
||||
prop.dwTimeDiv = division;
|
||||
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TIMEDIV);
|
||||
}
|
||||
|
||||
void MPU_SetVolume(int volume)
|
||||
{
|
||||
/*
|
||||
HMIXER hmixer;
|
||||
int mixerid;
|
||||
MIXERCONTROLDETAILS mxcd;
|
||||
MIXERCONTROLDETAILS_UNSIGNED mxcdu;
|
||||
MMRESULT mme;
|
||||
|
||||
if (mididevice < 0) return;
|
||||
|
||||
mme = mixerOpen(&hmixer, mididevice, 0,0, MIXER_OBJECTF_MIDIOUT);
|
||||
if (mme) {
|
||||
puts("Failed opening mixer");
|
||||
return;
|
||||
}
|
||||
|
||||
mixerGetID(hmixer, &mixerid, MIXER_OBJECTF_HMIXER);
|
||||
printf("mixerid=%d\n",mixerid);
|
||||
|
||||
ZeroMemory(&mxcd,sizeof(mxcd));
|
||||
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
|
||||
mxcd.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME;
|
||||
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
|
||||
mxcd.paDetails = (LPVOID)&mxcdu;
|
||||
mxcdu.dwValue = (volume << 8) & 0xffff;
|
||||
|
||||
printf("set %d\n",mixerSetControlDetails((HMIXEROBJ)mididevice, &mxcd,
|
||||
MIXER_OBJECTF_MIDIOUT|MIXER_SETCONTROLDETAILSF_VALUE));
|
||||
|
||||
mixerClose(hmixer);
|
||||
*/
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
}
|
||||
|
||||
int MPU_GetVolume(void)
|
||||
{
|
||||
// if (mididevice < 0) return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
*/
|
||||
/**********************************************************************
|
||||
module: MPU401.C
|
||||
|
||||
author: James R. Dose
|
||||
date: January 1, 1994
|
||||
|
||||
Low level routines to support sending of MIDI data to MPU401
|
||||
compatible MIDI interfaces.
|
||||
|
||||
(c) Copyright 1994 James R. Dose. All Rights Reserved.
|
||||
**********************************************************************/
|
||||
|
||||
#include "mpu401.h"
|
||||
#include "compat.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
static HMIDISTRM hmido = (HMIDISTRM)-1;
|
||||
static MIDIOUTCAPS midicaps;
|
||||
static DWORD mididevice = -1;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int time;
|
||||
int stream;
|
||||
int event;
|
||||
}
|
||||
MIDIEVENTHEAD;
|
||||
#define PAD(x) ((((x)+3)&(~3)))
|
||||
|
||||
#define BUFFERLEN (32*4*4)
|
||||
#define NUMBUFFERS 6
|
||||
static char eventbuf[NUMBUFFERS][BUFFERLEN];
|
||||
static int eventcnt[NUMBUFFERS];
|
||||
static MIDIHDR bufferheaders[NUMBUFFERS];
|
||||
int _MPU_CurrentBuffer = 0;
|
||||
int _MPU_BuffersWaiting = 0;
|
||||
|
||||
extern unsigned int _MIDI_GlobalPositionInTicks;
|
||||
unsigned int _MPU_LastEvent=0;
|
||||
|
||||
#define MIDI_NOTE_OFF 0x80
|
||||
#define MIDI_NOTE_ON 0x90
|
||||
#define MIDI_POLY_AFTER_TCH 0xA0
|
||||
#define MIDI_CONTROL_CHANGE 0xB0
|
||||
#define MIDI_PROGRAM_CHANGE 0xC0
|
||||
#define MIDI_AFTER_TOUCH 0xD0
|
||||
#define MIDI_PITCH_BEND 0xE0
|
||||
#define MIDI_META_EVENT 0xFF
|
||||
#define MIDI_END_OF_TRACK 0x2F
|
||||
#define MIDI_TEMPO_CHANGE 0x51
|
||||
#define MIDI_MONO_MODE_ON 0x7E
|
||||
#define MIDI_ALL_NOTES_OFF 0x7B
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
|
||||
Memory locked functions:
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
void MPU_FinishBuffer(int buffer)
|
||||
{
|
||||
if (!eventcnt[buffer]) return;
|
||||
ZeroMemory(&bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
bufferheaders[buffer].lpData = eventbuf[buffer];
|
||||
bufferheaders[buffer].dwBufferLength =
|
||||
bufferheaders[buffer].dwBytesRecorded = eventcnt[buffer];
|
||||
midiOutPrepareHeader((HMIDIOUT)hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
midiStreamOut(hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
|
||||
// printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer);
|
||||
_MPU_BuffersWaiting++;
|
||||
}
|
||||
|
||||
void MPU_BeginPlayback(void)
|
||||
{
|
||||
_MPU_LastEvent = _MIDI_GlobalPositionInTicks;
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
|
||||
}
|
||||
|
||||
void MPU_Pause(void)
|
||||
{
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamPause(hmido);
|
||||
}
|
||||
|
||||
void MPU_Unpause(void)
|
||||
{
|
||||
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
|
||||
}
|
||||
|
||||
|
||||
void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
|
||||
{
|
||||
int i;
|
||||
|
||||
UNREFERENCED_PARAMETER(dwInstance);
|
||||
UNREFERENCED_PARAMETER(dwParam2);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case MOM_DONE:
|
||||
midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR));
|
||||
for (i=0;i<NUMBUFFERS;i++)
|
||||
{
|
||||
if (dwParam1 == (unsigned int)&bufferheaders[i])
|
||||
{
|
||||
eventcnt[i] = 0; // marks the buffer as free
|
||||
// printf("Finished buffer %d\n",i);
|
||||
_MPU_BuffersWaiting--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
default: return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_SendMidi
|
||||
|
||||
Queues a MIDI message to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_GetNextBuffer(void)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<NUMBUFFERS; i++)
|
||||
{
|
||||
if (eventcnt[i] == 0) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MPU_SendMidi(char *data, int count)
|
||||
{
|
||||
char *p;
|
||||
int padded, nextbuffer;
|
||||
static int masks[3] = { 0x000000ffl, 0x0000ffffl, 0x00ffffffl };
|
||||
|
||||
if (count <= 0) return;
|
||||
if (count <= 3)
|
||||
{
|
||||
if (eventcnt[_MPU_CurrentBuffer] + 12 > BUFFERLEN)
|
||||
{
|
||||
// buffer over-full
|
||||
nextbuffer = MPU_GetNextBuffer();
|
||||
if (nextbuffer < 0)
|
||||
{
|
||||
// printf("All buffers full!\n");
|
||||
return;
|
||||
}
|
||||
MPU_FinishBuffer(_MPU_CurrentBuffer);
|
||||
_MPU_CurrentBuffer = nextbuffer;
|
||||
}
|
||||
|
||||
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
|
||||
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
|
||||
((int*)p)[1] = 0;
|
||||
((int*)p)[2] = (MEVT_SHORTMSG << 24) | ((*((int*)data)) & masks[count-1]);
|
||||
eventcnt[_MPU_CurrentBuffer] += 12;
|
||||
}
|
||||
else
|
||||
{
|
||||
padded = PAD(count);
|
||||
if (eventcnt[_MPU_CurrentBuffer] + 12 + padded > BUFFERLEN)
|
||||
{
|
||||
// buffer over-full
|
||||
nextbuffer = MPU_GetNextBuffer();
|
||||
if (nextbuffer < 0)
|
||||
{
|
||||
// printf("All buffers full!\n");
|
||||
return;
|
||||
}
|
||||
MPU_FinishBuffer(_MPU_CurrentBuffer);
|
||||
_MPU_CurrentBuffer = nextbuffer;
|
||||
}
|
||||
|
||||
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
|
||||
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
|
||||
((int*)p)[1] = 0;
|
||||
((int*)p)[2] = (MEVT_LONGMSG<<24) | (count & 0xffffffl);
|
||||
p+=12; eventcnt[_MPU_CurrentBuffer] += 12;
|
||||
for (; count>0; count--, padded--, eventcnt[_MPU_CurrentBuffer]++)
|
||||
*(p++) = *(data++);
|
||||
for (; padded>0; padded--, eventcnt[_MPU_CurrentBuffer]++)
|
||||
*(p++) = 0;
|
||||
}
|
||||
_MPU_LastEvent = _MIDI_GlobalPositionInTicks;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_SendMidiImmediate
|
||||
|
||||
Sends a MIDI message immediately to the the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
void MPU_SendMidiImmediate(char *data, int count)
|
||||
{
|
||||
MIDIHDR mhdr;
|
||||
static int masks[3] = { 0x00ffffffl, 0x0000ffffl, 0x000000ffl };
|
||||
|
||||
if (!count) return;
|
||||
if (count<=3) midiOutShortMsg((HMIDIOUT)hmido, (*((int*)data)) & masks[count-1]);
|
||||
else
|
||||
{
|
||||
ZeroMemory(&mhdr, sizeof(mhdr));
|
||||
mhdr.lpData = data;
|
||||
mhdr.dwBufferLength = count;
|
||||
midiOutPrepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
midiOutLongMsg((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
while (!(mhdr.dwFlags & MHDR_DONE)) ;
|
||||
midiOutUnprepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_Reset
|
||||
|
||||
Resets the MPU401 card.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_Reset
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
midiStreamStop(hmido);
|
||||
midiStreamClose(hmido);
|
||||
|
||||
return(MPU_Ok);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_Init
|
||||
|
||||
Detects and initializes the MPU401 card.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
int MPU_Init
|
||||
(
|
||||
int addr
|
||||
)
|
||||
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<NUMBUFFERS;i++) eventcnt[i]=0;
|
||||
|
||||
mididevice = addr;
|
||||
|
||||
if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error;
|
||||
|
||||
if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error);
|
||||
|
||||
return(MPU_Ok);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_NoteOff
|
||||
|
||||
Sends a full MIDI note off event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_NoteOff
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int velocity
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_NOTE_OFF | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (velocity);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_NoteOn
|
||||
|
||||
Sends a full MIDI note on event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_NoteOn
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int velocity
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_NOTE_ON | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (velocity);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_PolyAftertouch
|
||||
|
||||
Sends a full MIDI polyphonic aftertouch event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_PolyAftertouch
|
||||
(
|
||||
int channel,
|
||||
int key,
|
||||
int pressure
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_POLY_AFTER_TCH | channel);
|
||||
msg[1] = (key);
|
||||
msg[2] = (pressure);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ControlChange
|
||||
|
||||
Sends a full MIDI control change event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ControlChange
|
||||
(
|
||||
int channel,
|
||||
int number,
|
||||
int value
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_CONTROL_CHANGE | channel);
|
||||
msg[1] = (number);
|
||||
msg[2] = (value);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ProgramChange
|
||||
|
||||
Sends a full MIDI program change event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ProgramChange
|
||||
(
|
||||
int channel,
|
||||
int program
|
||||
)
|
||||
|
||||
{
|
||||
char msg[2];
|
||||
msg[0] = (MIDI_PROGRAM_CHANGE | channel);
|
||||
msg[1] = (program);
|
||||
MPU_SendMidi(msg, 2);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_ChannelAftertouch
|
||||
|
||||
Sends a full MIDI channel aftertouch event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_ChannelAftertouch
|
||||
(
|
||||
int channel,
|
||||
int pressure
|
||||
)
|
||||
|
||||
{
|
||||
char msg[2];
|
||||
msg[0] = (MIDI_AFTER_TOUCH | channel);
|
||||
msg[1] = (pressure);
|
||||
MPU_SendMidi(msg, 2);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
Function: MPU_PitchBend
|
||||
|
||||
Sends a full MIDI pitch bend event out to the music device.
|
||||
---------------------------------------------------------------------*/
|
||||
|
||||
void MPU_PitchBend
|
||||
(
|
||||
int channel,
|
||||
int lsb,
|
||||
int msb
|
||||
)
|
||||
|
||||
{
|
||||
char msg[3];
|
||||
msg[0] = (MIDI_PITCH_BEND | channel);
|
||||
msg[1] = (lsb);
|
||||
msg[2] = (msb);
|
||||
MPU_SendMidi(msg, 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void MPU_SetTempo(int tempo)
|
||||
{
|
||||
MIDIPROPTEMPO prop;
|
||||
prop.cbStruct = sizeof(MIDIPROPTEMPO);
|
||||
prop.dwTempo = 60000000l/tempo;
|
||||
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TEMPO);
|
||||
}
|
||||
|
||||
void MPU_SetDivision(int division)
|
||||
{
|
||||
MIDIPROPTIMEDIV prop;
|
||||
prop.cbStruct = sizeof(MIDIPROPTIMEDIV);
|
||||
prop.dwTimeDiv = division;
|
||||
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TIMEDIV);
|
||||
}
|
||||
|
||||
void MPU_SetVolume(int volume)
|
||||
{
|
||||
/*
|
||||
HMIXER hmixer;
|
||||
int mixerid;
|
||||
MIXERCONTROLDETAILS mxcd;
|
||||
MIXERCONTROLDETAILS_UNSIGNED mxcdu;
|
||||
MMRESULT mme;
|
||||
|
||||
if (mididevice < 0) return;
|
||||
|
||||
mme = mixerOpen(&hmixer, mididevice, 0,0, MIXER_OBJECTF_MIDIOUT);
|
||||
if (mme) {
|
||||
puts("Failed opening mixer");
|
||||
return;
|
||||
}
|
||||
|
||||
mixerGetID(hmixer, &mixerid, MIXER_OBJECTF_HMIXER);
|
||||
printf("mixerid=%d\n",mixerid);
|
||||
|
||||
ZeroMemory(&mxcd,sizeof(mxcd));
|
||||
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
|
||||
mxcd.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME;
|
||||
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
|
||||
mxcd.paDetails = (LPVOID)&mxcdu;
|
||||
mxcdu.dwValue = (volume << 8) & 0xffff;
|
||||
|
||||
printf("set %d\n",mixerSetControlDetails((HMIXEROBJ)mididevice, &mxcd,
|
||||
MIXER_OBJECTF_MIDIOUT|MIXER_SETCONTROLDETAILSF_VALUE));
|
||||
|
||||
mixerClose(hmixer);
|
||||
*/
|
||||
UNREFERENCED_PARAMETER(volume);
|
||||
}
|
||||
|
||||
int MPU_GetVolume(void)
|
||||
{
|
||||
// if (mididevice < 0) return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,487 +1,487 @@
|
|||
.586P
|
||||
|
||||
EXTRN _MV_HarshClipTable : dword
|
||||
EXTRN _MV_MixDestination : dword
|
||||
EXTRN _MV_MixPosition : dword
|
||||
EXTRN _MV_LeftVolume : dword
|
||||
EXTRN _MV_RightVolume : dword
|
||||
EXTRN _MV_SampleSize : dword
|
||||
EXTRN _MV_RightChannelOffset : dword
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix8BitMono
|
||||
_MV_Mix8BitMono:
|
||||
; Two at once
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [apatch7+2],bl
|
||||
mov byte ptr [apatch8+2],bl
|
||||
mov byte ptr [apatch9+3],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
|
||||
mov dword ptr [apatch1+4],ebx
|
||||
mov dword ptr [apatch2+4],ebx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx, 128
|
||||
mov dword ptr [apatch3+2],ebx
|
||||
mov dword ptr [apatch4+2],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [apatch5+2],edx
|
||||
mov dword ptr [apatch6+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je short exit8m
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; apatch1 - volume table
|
||||
; apatch2 - volume table
|
||||
; apatch3 - harsh clip table
|
||||
; apatch4 - harsh clip table
|
||||
; apatch5 - sample rate
|
||||
; apatch6 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Mloop:
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
apatch1:
|
||||
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
|
||||
apatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
apatch9:
|
||||
movzx edx, byte ptr [edi + 1] ; get current sample from destination
|
||||
apatch3:
|
||||
mov eax, [eax + 12345678h] ; harsh clip new sample
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], al ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
apatch4:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip new sample
|
||||
apatch5:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
apatch7:
|
||||
add edi, 1 ; move destination to second sample
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
mov [edi], bl ; write new sample to destination
|
||||
apatch6:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
apatch8:
|
||||
add edi, 2 ; move destination to third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit8m:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix8BitStereo
|
||||
_MV_Mix8BitStereo:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [bpatch8+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [bpatch6+3],ebx
|
||||
mov dword ptr [bpatch7+2],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [bpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [bpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [bpatch3+2],edx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx,128
|
||||
mov dword ptr [bpatch4+2],ebx
|
||||
mov dword ptr [bpatch5+2],ebx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je short exit8S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; bpatch1 - left volume table
|
||||
; bpatch2 - right volume table
|
||||
; bpatch3 - sample rate
|
||||
; bpatch4 - harsh clip table
|
||||
; bpatch5 - harsh clip table
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Sloop:
|
||||
bpatch1:
|
||||
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
bpatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
bpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
bpatch6:
|
||||
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
|
||||
bpatch4:
|
||||
mov eax, [eax + 12345678h] ; harsh clip left sample
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], al ; write left sample to destination
|
||||
bpatch5:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip right sample
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
bpatch7:
|
||||
mov [edi+12345678h], bl ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
bpatch8:
|
||||
add edi, 2 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
|
||||
EXIT8S:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix16BitMono
|
||||
_MV_Mix16BitMono:
|
||||
; Two at once
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [cpatch5+3],bl
|
||||
mov byte ptr [cpatch6+3],bl
|
||||
add bl,bl
|
||||
mov byte ptr [cpatch7+2],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [cpatch1+4],ebx
|
||||
mov dword ptr [cpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [cpatch3+2],edx
|
||||
mov dword ptr [cpatch4+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je exit16M
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; cpatch1 - volume table
|
||||
; cpatch2 - volume table
|
||||
; cpatch3 - sample rate
|
||||
; cpatch4 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Mloop:
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
cpatch1:
|
||||
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
|
||||
cpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
cpatch5:
|
||||
movsx edx, word ptr [edi + 2] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short m16skip1
|
||||
mov eax, -32768
|
||||
jmp short m16skip2
|
||||
m16skip1:
|
||||
cmp eax, 32767
|
||||
jle short m16skip2
|
||||
mov eax, 32767
|
||||
m16skip2:
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], ax ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short m16skip3
|
||||
mov ebx, -32768
|
||||
jmp short m16skip4
|
||||
m16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short m16skip4
|
||||
mov ebx, 32767
|
||||
m16skip4:
|
||||
cpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
cpatch6:
|
||||
mov [edi + 2], bx ; write new sample to destination
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
|
||||
cpatch4:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
cpatch7:
|
||||
add edi, 4 ; move destination to third sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
EXIT16M:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix16BitStereo
|
||||
_MV_Mix16BitStereo:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [dpatch6+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [dpatch4+3],ebx
|
||||
mov dword ptr [dpatch5+3],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [dpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [dpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [dpatch3+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je exit16S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; dpatch1 - left volume table
|
||||
; dpatch2 - right volume table
|
||||
; dpatch3 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Sloop:
|
||||
dpatch1:
|
||||
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
dpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
dpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
dpatch4:
|
||||
movsx edx, word ptr [edi+12345678h] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short s16skip1
|
||||
mov eax, -32768
|
||||
jmp short s16skip2
|
||||
s16skip1:
|
||||
cmp eax, 32767
|
||||
jle short s16skip2
|
||||
mov eax, 32767
|
||||
s16skip2:
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], ax ; write left sample to destination
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short s16skip3
|
||||
mov ebx, -32768
|
||||
jmp short s16skip4
|
||||
s16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short s16skip4
|
||||
mov ebx, 32767
|
||||
s16skip4:
|
||||
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
dpatch5:
|
||||
mov [edi+12345678h], bx ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
dpatch6:
|
||||
add edi, 4 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit16S:
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
.586P
|
||||
|
||||
EXTRN _MV_HarshClipTable : dword
|
||||
EXTRN _MV_MixDestination : dword
|
||||
EXTRN _MV_MixPosition : dword
|
||||
EXTRN _MV_LeftVolume : dword
|
||||
EXTRN _MV_RightVolume : dword
|
||||
EXTRN _MV_SampleSize : dword
|
||||
EXTRN _MV_RightChannelOffset : dword
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix8BitMono
|
||||
_MV_Mix8BitMono:
|
||||
; Two at once
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [apatch7+2],bl
|
||||
mov byte ptr [apatch8+2],bl
|
||||
mov byte ptr [apatch9+3],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
|
||||
mov dword ptr [apatch1+4],ebx
|
||||
mov dword ptr [apatch2+4],ebx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx, 128
|
||||
mov dword ptr [apatch3+2],ebx
|
||||
mov dword ptr [apatch4+2],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [apatch5+2],edx
|
||||
mov dword ptr [apatch6+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je short exit8m
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; apatch1 - volume table
|
||||
; apatch2 - volume table
|
||||
; apatch3 - harsh clip table
|
||||
; apatch4 - harsh clip table
|
||||
; apatch5 - sample rate
|
||||
; apatch6 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Mloop:
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
apatch1:
|
||||
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
|
||||
apatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
apatch9:
|
||||
movzx edx, byte ptr [edi + 1] ; get current sample from destination
|
||||
apatch3:
|
||||
mov eax, [eax + 12345678h] ; harsh clip new sample
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], al ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
apatch4:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip new sample
|
||||
apatch5:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
apatch7:
|
||||
add edi, 1 ; move destination to second sample
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
mov [edi], bl ; write new sample to destination
|
||||
apatch6:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
apatch8:
|
||||
add edi, 2 ; move destination to third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit8m:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix8BitStereo
|
||||
_MV_Mix8BitStereo:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [bpatch8+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [bpatch6+3],ebx
|
||||
mov dword ptr [bpatch7+2],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [bpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [bpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [bpatch3+2],edx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx,128
|
||||
mov dword ptr [bpatch4+2],ebx
|
||||
mov dword ptr [bpatch5+2],ebx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je short exit8S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; bpatch1 - left volume table
|
||||
; bpatch2 - right volume table
|
||||
; bpatch3 - sample rate
|
||||
; bpatch4 - harsh clip table
|
||||
; bpatch5 - harsh clip table
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Sloop:
|
||||
bpatch1:
|
||||
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
bpatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
bpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
bpatch6:
|
||||
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
|
||||
bpatch4:
|
||||
mov eax, [eax + 12345678h] ; harsh clip left sample
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], al ; write left sample to destination
|
||||
bpatch5:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip right sample
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
bpatch7:
|
||||
mov [edi+12345678h], bl ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
bpatch8:
|
||||
add edi, 2 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
|
||||
EXIT8S:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix16BitMono
|
||||
_MV_Mix16BitMono:
|
||||
; Two at once
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [cpatch5+3],bl
|
||||
mov byte ptr [cpatch6+3],bl
|
||||
add bl,bl
|
||||
mov byte ptr [cpatch7+2],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [cpatch1+4],ebx
|
||||
mov dword ptr [cpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [cpatch3+2],edx
|
||||
mov dword ptr [cpatch4+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je exit16M
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; cpatch1 - volume table
|
||||
; cpatch2 - volume table
|
||||
; cpatch3 - sample rate
|
||||
; cpatch4 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Mloop:
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
cpatch1:
|
||||
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
|
||||
cpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
cpatch5:
|
||||
movsx edx, word ptr [edi + 2] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short m16skip1
|
||||
mov eax, -32768
|
||||
jmp short m16skip2
|
||||
m16skip1:
|
||||
cmp eax, 32767
|
||||
jle short m16skip2
|
||||
mov eax, 32767
|
||||
m16skip2:
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], ax ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short m16skip3
|
||||
mov ebx, -32768
|
||||
jmp short m16skip4
|
||||
m16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short m16skip4
|
||||
mov ebx, 32767
|
||||
m16skip4:
|
||||
cpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
cpatch6:
|
||||
mov [edi + 2], bx ; write new sample to destination
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
|
||||
cpatch4:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
cpatch7:
|
||||
add edi, 4 ; move destination to third sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
EXIT16M:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_Mix16BitStereo
|
||||
_MV_Mix16BitStereo:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [dpatch6+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [dpatch4+3],ebx
|
||||
mov dword ptr [dpatch5+3],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [dpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [dpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [dpatch3+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je exit16S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; dpatch1 - left volume table
|
||||
; dpatch2 - right volume table
|
||||
; dpatch3 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Sloop:
|
||||
dpatch1:
|
||||
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
dpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
dpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
dpatch4:
|
||||
movsx edx, word ptr [edi+12345678h] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short s16skip1
|
||||
mov eax, -32768
|
||||
jmp short s16skip2
|
||||
s16skip1:
|
||||
cmp eax, 32767
|
||||
jle short s16skip2
|
||||
mov eax, 32767
|
||||
s16skip2:
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], ax ; write left sample to destination
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short s16skip3
|
||||
mov ebx, -32768
|
||||
jmp short s16skip4
|
||||
s16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short s16skip4
|
||||
mov ebx, 32767
|
||||
s16skip4:
|
||||
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
dpatch5:
|
||||
mov [edi+12345678h], bx ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
dpatch6:
|
||||
add edi, 4 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit16S:
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,491 +1,491 @@
|
|||
.586P
|
||||
|
||||
EXTRN _MV_HarshClipTable : dword
|
||||
EXTRN _MV_MixDestination : dword
|
||||
EXTRN _MV_MixPosition : dword
|
||||
EXTRN _MV_LeftVolume : dword
|
||||
EXTRN _MV_RightVolume : dword
|
||||
EXTRN _MV_SampleSize : dword
|
||||
EXTRN _MV_RightChannelOffset : dword
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix8BitMono_
|
||||
MV_Mix8BitMono_:
|
||||
; Two at once
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [apatch7+2],bl
|
||||
mov byte ptr [apatch8+2],bl
|
||||
mov byte ptr [apatch9+3],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
|
||||
mov dword ptr [apatch1+4],ebx
|
||||
mov dword ptr [apatch2+4],ebx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx, 128
|
||||
mov dword ptr [apatch3+2],ebx
|
||||
mov dword ptr [apatch4+2],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [apatch5+2],edx
|
||||
mov dword ptr [apatch6+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je short exit8m
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; apatch1 - volume table
|
||||
; apatch2 - volume table
|
||||
; apatch3 - harsh clip table
|
||||
; apatch4 - harsh clip table
|
||||
; apatch5 - sample rate
|
||||
; apatch6 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Mloop:
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
apatch1:
|
||||
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
|
||||
apatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
apatch9:
|
||||
movzx edx, byte ptr [edi + 1] ; get current sample from destination
|
||||
apatch3:
|
||||
mov eax, [eax + 12345678h] ; harsh clip new sample
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], al ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
apatch4:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip new sample
|
||||
apatch5:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
apatch7:
|
||||
add edi, 1 ; move destination to second sample
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
mov [edi], bl ; write new sample to destination
|
||||
apatch6:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
apatch8:
|
||||
add edi, 2 ; move destination to third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit8m:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix8BitStereo_
|
||||
MV_Mix8BitStereo_:
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [bpatch8+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [bpatch6+3],ebx
|
||||
mov dword ptr [bpatch7+2],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [bpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [bpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [bpatch3+2],edx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx,128
|
||||
mov dword ptr [bpatch4+2],ebx
|
||||
mov dword ptr [bpatch5+2],ebx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je short exit8S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; bpatch1 - left volume table
|
||||
; bpatch2 - right volume table
|
||||
; bpatch3 - sample rate
|
||||
; bpatch4 - harsh clip table
|
||||
; bpatch5 - harsh clip table
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Sloop:
|
||||
bpatch1:
|
||||
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
bpatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
bpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
bpatch6:
|
||||
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
|
||||
bpatch4:
|
||||
mov eax, [eax + 12345678h] ; harsh clip left sample
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], al ; write left sample to destination
|
||||
bpatch5:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip right sample
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
bpatch7:
|
||||
mov [edi+12345678h], bl ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
bpatch8:
|
||||
add edi, 2 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
|
||||
EXIT8S:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix16BitMono_
|
||||
MV_Mix16BitMono_:
|
||||
; Two at once
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [cpatch5+3],bl
|
||||
mov byte ptr [cpatch6+3],bl
|
||||
add bl,bl
|
||||
mov byte ptr [cpatch7+2],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [cpatch1+4],ebx
|
||||
mov dword ptr [cpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [cpatch3+2],edx
|
||||
mov dword ptr [cpatch4+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je exit16M
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; cpatch1 - volume table
|
||||
; cpatch2 - volume table
|
||||
; cpatch3 - sample rate
|
||||
; cpatch4 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Mloop:
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
cpatch1:
|
||||
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
|
||||
cpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
cpatch5:
|
||||
movsx edx, word ptr [edi + 2] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short m16skip1
|
||||
mov eax, -32768
|
||||
jmp short m16skip2
|
||||
m16skip1:
|
||||
cmp eax, 32767
|
||||
jle short m16skip2
|
||||
mov eax, 32767
|
||||
m16skip2:
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], ax ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short m16skip3
|
||||
mov ebx, -32768
|
||||
jmp short m16skip4
|
||||
m16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short m16skip4
|
||||
mov ebx, 32767
|
||||
m16skip4:
|
||||
cpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
cpatch6:
|
||||
mov [edi + 2], bx ; write new sample to destination
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
|
||||
cpatch4:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
cpatch7:
|
||||
add edi, 4 ; move destination to third sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
EXIT16M:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix16BitStereo_
|
||||
MV_Mix16BitStereo_:
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [dpatch6+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [dpatch4+3],ebx
|
||||
mov dword ptr [dpatch5+3],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [dpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [dpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [dpatch3+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je exit16S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; dpatch1 - left volume table
|
||||
; dpatch2 - right volume table
|
||||
; dpatch3 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Sloop:
|
||||
dpatch1:
|
||||
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
dpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
dpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
dpatch4:
|
||||
movsx edx, word ptr [edi+12345678h] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short s16skip1
|
||||
mov eax, -32768
|
||||
jmp short s16skip2
|
||||
s16skip1:
|
||||
cmp eax, 32767
|
||||
jle short s16skip2
|
||||
mov eax, 32767
|
||||
s16skip2:
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], ax ; write left sample to destination
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short s16skip3
|
||||
mov ebx, -32768
|
||||
jmp short s16skip4
|
||||
s16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short s16skip4
|
||||
mov ebx, 32767
|
||||
s16skip4:
|
||||
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
dpatch5:
|
||||
mov [edi+12345678h], bx ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
dpatch6:
|
||||
add edi, 4 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit16S:
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
.586P
|
||||
|
||||
EXTRN _MV_HarshClipTable : dword
|
||||
EXTRN _MV_MixDestination : dword
|
||||
EXTRN _MV_MixPosition : dword
|
||||
EXTRN _MV_LeftVolume : dword
|
||||
EXTRN _MV_RightVolume : dword
|
||||
EXTRN _MV_SampleSize : dword
|
||||
EXTRN _MV_RightChannelOffset : dword
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix8BitMono_
|
||||
MV_Mix8BitMono_:
|
||||
; Two at once
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [apatch7+2],bl
|
||||
mov byte ptr [apatch8+2],bl
|
||||
mov byte ptr [apatch9+3],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
|
||||
mov dword ptr [apatch1+4],ebx
|
||||
mov dword ptr [apatch2+4],ebx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx, 128
|
||||
mov dword ptr [apatch3+2],ebx
|
||||
mov dword ptr [apatch4+2],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [apatch5+2],edx
|
||||
mov dword ptr [apatch6+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je short exit8m
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; apatch1 - volume table
|
||||
; apatch2 - volume table
|
||||
; apatch3 - harsh clip table
|
||||
; apatch4 - harsh clip table
|
||||
; apatch5 - sample rate
|
||||
; apatch6 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Mloop:
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
apatch1:
|
||||
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
|
||||
apatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
apatch9:
|
||||
movzx edx, byte ptr [edi + 1] ; get current sample from destination
|
||||
apatch3:
|
||||
mov eax, [eax + 12345678h] ; harsh clip new sample
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], al ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
apatch4:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip new sample
|
||||
apatch5:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
apatch7:
|
||||
add edi, 1 ; move destination to second sample
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
mov [edi], bl ; write new sample to destination
|
||||
apatch6:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
apatch8:
|
||||
add edi, 2 ; move destination to third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit8m:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix8BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix8BitStereo_
|
||||
MV_Mix8BitStereo_:
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [bpatch8+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [bpatch6+3],ebx
|
||||
mov dword ptr [bpatch7+2],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [bpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [bpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [bpatch3+2],edx
|
||||
|
||||
; Harsh Clip table ptr
|
||||
mov ebx, _MV_HarshClipTable
|
||||
add ebx,128
|
||||
mov dword ptr [bpatch4+2],ebx
|
||||
mov dword ptr [bpatch5+2],ebx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je short exit8S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; bpatch1 - left volume table
|
||||
; bpatch2 - right volume table
|
||||
; bpatch3 - sample rate
|
||||
; bpatch4 - harsh clip table
|
||||
; bpatch5 - harsh clip table
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix8Sloop:
|
||||
bpatch1:
|
||||
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movzx edx, byte ptr [edi] ; get current sample from destination
|
||||
bpatch2:
|
||||
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
bpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
bpatch6:
|
||||
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
|
||||
bpatch4:
|
||||
mov eax, [eax + 12345678h] ; harsh clip left sample
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], al ; write left sample to destination
|
||||
bpatch5:
|
||||
mov ebx, [ebx + 12345678h] ; harsh clip right sample
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
bpatch7:
|
||||
mov [edi+12345678h], bl ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
bpatch8:
|
||||
add edi, 2 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix8Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
|
||||
EXIT8S:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitMono
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix16BitMono_
|
||||
MV_Mix16BitMono_:
|
||||
; Two at once
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [cpatch5+3],bl
|
||||
mov byte ptr [cpatch6+3],bl
|
||||
add bl,bl
|
||||
mov byte ptr [cpatch7+2],bl
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [cpatch1+4],ebx
|
||||
mov dword ptr [cpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [cpatch3+2],edx
|
||||
mov dword ptr [cpatch4+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
shr ecx, 1 ; double sample count
|
||||
cmp ecx, 0
|
||||
je exit16M
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; cpatch1 - volume table
|
||||
; cpatch2 - volume table
|
||||
; cpatch3 - sample rate
|
||||
; cpatch4 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
mov ebx,ebp ; begin calculating second sample
|
||||
add ebp,edx ; advance frac pointer
|
||||
shr ebx,16 ; finish calculation for second sample
|
||||
|
||||
movzx eax, byte ptr [esi+eax] ; get first sample
|
||||
movzx ebx, byte ptr [esi+ebx] ; get second sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Mloop:
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
cpatch1:
|
||||
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
|
||||
cpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
|
||||
add eax, edx ; mix first sample
|
||||
cpatch5:
|
||||
movsx edx, word ptr [edi + 2] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short m16skip1
|
||||
mov eax, -32768
|
||||
jmp short m16skip2
|
||||
m16skip1:
|
||||
cmp eax, 32767
|
||||
jle short m16skip2
|
||||
mov eax, 32767
|
||||
m16skip2:
|
||||
add ebx, edx ; mix second sample
|
||||
mov [edi], ax ; write new sample to destination
|
||||
mov edx, ebp ; begin calculating third sample
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short m16skip3
|
||||
mov ebx, -32768
|
||||
jmp short m16skip4
|
||||
m16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short m16skip4
|
||||
mov ebx, 32767
|
||||
m16skip4:
|
||||
cpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
shr edx, 16 ; finish calculation for third sample
|
||||
mov eax, ebp ; begin calculating fourth sample
|
||||
cpatch6:
|
||||
mov [edi + 2], bx ; write new sample to destination
|
||||
shr eax, 16 ; finish calculation for fourth sample
|
||||
|
||||
cpatch4:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
movzx ebx, byte ptr [esi+eax] ; get fourth sample
|
||||
cpatch7:
|
||||
add edi, 4 ; move destination to third sample
|
||||
movzx eax, byte ptr [esi+edx] ; get third sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Mloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
EXIT16M:
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_Mix16BitStereo
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - position
|
||||
; edx - rate
|
||||
; ebx - start
|
||||
; ecx - number of samples to mix
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_Mix16BitStereo_
|
||||
MV_Mix16BitStereo_:
|
||||
pushad
|
||||
; Thanks to Lauri Liinat for spotting this lunacy
|
||||
;mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
;mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
;mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
;mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov ebp, eax
|
||||
|
||||
mov esi, ebx ; Source pointer
|
||||
|
||||
; Sample size
|
||||
mov ebx, _MV_SampleSize
|
||||
mov byte ptr [dpatch6+2],bl
|
||||
|
||||
; Right channel offset
|
||||
mov ebx, _MV_RightChannelOffset
|
||||
mov dword ptr [dpatch4+3],ebx
|
||||
mov dword ptr [dpatch5+3],ebx
|
||||
|
||||
; Volume table ptr
|
||||
mov ebx, _MV_LeftVolume
|
||||
mov dword ptr [dpatch1+4],ebx
|
||||
|
||||
mov ebx, _MV_RightVolume
|
||||
mov dword ptr [dpatch2+4],ebx
|
||||
|
||||
; Rate scale ptr
|
||||
mov dword ptr [dpatch3+2],edx
|
||||
|
||||
mov edi, _MV_MixDestination ; Get the position to write to
|
||||
|
||||
; Number of samples to mix
|
||||
cmp ecx, 0
|
||||
je exit16S
|
||||
|
||||
; eax - scratch
|
||||
; ebx - scratch
|
||||
; edx - scratch
|
||||
; ecx - count
|
||||
; edi - destination
|
||||
; esi - source
|
||||
; ebp - frac pointer
|
||||
; dpatch1 - left volume table
|
||||
; dpatch2 - right volume table
|
||||
; dpatch3 - sample rate
|
||||
|
||||
mov eax,ebp ; begin calculating first sample
|
||||
shr eax,16 ; finish calculation for first sample
|
||||
|
||||
movzx ebx, byte ptr [esi+eax] ; get first sample
|
||||
|
||||
;ALIGN 4
|
||||
mix16Sloop:
|
||||
dpatch1:
|
||||
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
|
||||
movsx edx, word ptr [edi] ; get current sample from destination
|
||||
dpatch2:
|
||||
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
|
||||
add eax, edx ; mix left sample
|
||||
dpatch3:
|
||||
add ebp,12345678h ; advance frac pointer
|
||||
dpatch4:
|
||||
movsx edx, word ptr [edi+12345678h] ; get current sample from destination
|
||||
|
||||
cmp eax, -32768 ; Harsh clip sample
|
||||
jge short s16skip1
|
||||
mov eax, -32768
|
||||
jmp short s16skip2
|
||||
s16skip1:
|
||||
cmp eax, 32767
|
||||
jle short s16skip2
|
||||
mov eax, 32767
|
||||
s16skip2:
|
||||
add ebx, edx ; mix right sample
|
||||
mov [edi], ax ; write left sample to destination
|
||||
|
||||
cmp ebx, -32768 ; Harsh clip sample
|
||||
jge short s16skip3
|
||||
mov ebx, -32768
|
||||
jmp short s16skip4
|
||||
s16skip3:
|
||||
cmp ebx, 32767
|
||||
jle short s16skip4
|
||||
mov ebx, 32767
|
||||
s16skip4:
|
||||
|
||||
mov edx, ebp ; begin calculating second sample
|
||||
dpatch5:
|
||||
mov [edi+12345678h], bx ; write right sample to destination
|
||||
shr edx, 16 ; finish calculation for second sample
|
||||
dpatch6:
|
||||
add edi, 4 ; move destination to second sample
|
||||
movzx ebx, byte ptr [esi+edx] ; get second sample
|
||||
dec ecx ; decrement count
|
||||
jnz mix16Sloop ; loop
|
||||
|
||||
mov _MV_MixDestination, edi ; Store the current write position
|
||||
mov _MV_MixPosition, ebp ; return position
|
||||
exit16S:
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,202 +1,202 @@
|
|||
.586P
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_16BitReverb
|
||||
_MV_16BitReverb:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_8BitReverb
|
||||
_MV_8BitReverb:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
;ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_16BitReverbFast
|
||||
_MV_16BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_8BitReverbFast
|
||||
_MV_8BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
;ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
.586P
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_16BitReverb
|
||||
_MV_16BitReverb:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_8BitReverb
|
||||
_MV_8BitReverb:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
;ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_16BitReverbFast
|
||||
_MV_16BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC _MV_8BitReverbFast
|
||||
_MV_8BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword ptr [esp + 0*4 + 9*4]
|
||||
mov edx, dword ptr [esp + 1*4 + 9*4]
|
||||
mov ebx, dword ptr [esp + 2*4 + 9*4]
|
||||
mov ecx, dword ptr [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
;ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
|
|
|
@ -1,230 +1,230 @@
|
|||
;Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either version 2
|
||||
;of the License, or (at your option) any later version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
;
|
||||
;See the GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
;
|
||||
;Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
CPU 386
|
||||
|
||||
SECTION .data
|
||||
|
||||
%ifdef UNDERSCORES
|
||||
|
||||
%define MV_16BitReverb _MV_16BitReverb
|
||||
%define MV_8BitReverb _MV_8BitReverb
|
||||
%define MV_16BitReverbFast _MV_16BitReverbFast
|
||||
%define MV_8BitReverbFast _MV_8BitReverbFast
|
||||
|
||||
%endif
|
||||
|
||||
GLOBAL MV_16BitReverb
|
||||
GLOBAL MV_8BitReverb
|
||||
GLOBAL MV_16BitReverbFast
|
||||
GLOBAL MV_8BitReverbFast
|
||||
|
||||
%define OFFSET
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 4
|
||||
MV_16BitReverb:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov word [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 4
|
||||
MV_8BitReverb:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov byte [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 4
|
||||
MV_16BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov byte [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov word [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 4
|
||||
MV_8BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov byte [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov byte [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
;Copyright (C) 1994-1995 Apogee Software, Ltd.
|
||||
;
|
||||
;This program is free software; you can redistribute it and/or
|
||||
;modify it under the terms of the GNU General Public License
|
||||
;as published by the Free Software Foundation; either version 2
|
||||
;of the License, or (at your option) any later version.
|
||||
;
|
||||
;This program is distributed in the hope that it will be useful,
|
||||
;but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
;
|
||||
;See the GNU General Public License for more details.
|
||||
;
|
||||
;You should have received a copy of the GNU General Public License
|
||||
;along with this program; if not, write to the Free Software
|
||||
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
;
|
||||
;Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
||||
|
||||
CPU 386
|
||||
|
||||
SECTION .data
|
||||
|
||||
%ifdef UNDERSCORES
|
||||
|
||||
%define MV_16BitReverb _MV_16BitReverb
|
||||
%define MV_8BitReverb _MV_8BitReverb
|
||||
%define MV_16BitReverbFast _MV_16BitReverbFast
|
||||
%define MV_8BitReverbFast _MV_8BitReverbFast
|
||||
|
||||
%endif
|
||||
|
||||
GLOBAL MV_16BitReverb
|
||||
GLOBAL MV_8BitReverb
|
||||
GLOBAL MV_16BitReverbFast
|
||||
GLOBAL MV_8BitReverbFast
|
||||
|
||||
%define OFFSET
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 4
|
||||
MV_16BitReverb:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov word [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 4
|
||||
MV_8BitReverb:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov byte [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 4
|
||||
MV_16BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov byte [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov word [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 4
|
||||
MV_8BitReverbFast:
|
||||
pushad
|
||||
mov eax, dword [esp + 0*4 + 9*4]
|
||||
mov edx, dword [esp + 1*4 + 9*4]
|
||||
mov ebx, dword [esp + 2*4 + 9*4]
|
||||
mov ecx, dword [esp + 3*4 + 9*4]
|
||||
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov byte [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov byte [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
|
|
@ -1,174 +1,174 @@
|
|||
.586P
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_16BitReverb_
|
||||
MV_16BitReverb_:
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_8BitReverb_
|
||||
MV_8BitReverb_:
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
;ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_16BitReverbFast_
|
||||
MV_16BitReverbFast_:
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_8BitReverbFast_
|
||||
MV_8BitReverbFast_:
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
;ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
.586P
|
||||
|
||||
CODE SEGMENT PUBLIC USE32 'DATA'
|
||||
ASSUME cs:CODE,ds:CODE
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_16BitReverb_
|
||||
MV_16BitReverb_:
|
||||
mov esi, eax
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
rev16loop:
|
||||
movzx eax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
movzx edx, ah
|
||||
sub ah, ah
|
||||
|
||||
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
|
||||
xor edx, 80h
|
||||
|
||||
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
|
||||
add esi, 2
|
||||
|
||||
lea eax, [ eax + edx + 80h ] ; mix high byte of sample
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
jnz rev16loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverb
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - Volume table
|
||||
; ecx - number of samples
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_8BitReverb_
|
||||
MV_8BitReverb_:
|
||||
mov esi, eax
|
||||
lea edi, [edx - 1]
|
||||
|
||||
xor eax, eax
|
||||
|
||||
;ALIGN 4
|
||||
rev8loop:
|
||||
; movzx eax, byte ptr [esi] ; get sample
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc edi
|
||||
|
||||
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
mov al, byte ptr [2*eax+ebx] ; volume translate sample
|
||||
inc esi
|
||||
|
||||
; add eax, 80h
|
||||
add al, 80h
|
||||
dec ecx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz rev8loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_16BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_16BitReverbFast_
|
||||
MV_16BitReverbFast_:
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch16+3
|
||||
|
||||
mov [eax],cl
|
||||
lea edi, [edx - 2]
|
||||
|
||||
;ALIGN 4
|
||||
frev16loop:
|
||||
mov ax, word ptr [esi] ; get sample
|
||||
add edi, 2
|
||||
|
||||
rpatch16:
|
||||
sar ax, 5 ;;;;Add 1 before shift
|
||||
add esi, 2
|
||||
|
||||
mov [edi], ax ; write new sample to destination
|
||||
dec ebx ; decrement count
|
||||
|
||||
jnz frev16loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
|
||||
;================
|
||||
;
|
||||
; MV_8BitReverbFast
|
||||
;
|
||||
;================
|
||||
|
||||
; eax - source position
|
||||
; edx - destination position
|
||||
; ebx - number of samples
|
||||
; ecx - shift
|
||||
|
||||
ALIGN 16
|
||||
PUBLIC MV_8BitReverbFast_
|
||||
MV_8BitReverbFast_:
|
||||
mov esi, eax
|
||||
mov eax,OFFSET rpatch8+2
|
||||
|
||||
mov edi, edx
|
||||
mov edx, 80h
|
||||
|
||||
mov [eax],cl
|
||||
mov eax, 80h
|
||||
|
||||
shr eax, cl
|
||||
|
||||
dec edi
|
||||
sub edx, eax
|
||||
|
||||
;ALIGN 4
|
||||
frev8loop:
|
||||
mov al, byte ptr [esi] ; get sample
|
||||
inc esi
|
||||
|
||||
mov ecx, eax
|
||||
inc edi
|
||||
|
||||
rpatch8:
|
||||
shr eax, 3
|
||||
xor ecx, 80h ; flip the sign bit
|
||||
|
||||
shr ecx, 7 ; shift the sign down to 1
|
||||
add eax, edx
|
||||
|
||||
add eax, ecx ; add sign bit to round to 0
|
||||
dec ebx ; decrement count
|
||||
|
||||
mov [edi], al ; write new sample to destination
|
||||
jnz frev8loop ; loop
|
||||
|
||||
ret
|
||||
|
||||
CODE ENDS
|
||||
END
|
||||
|
|
0
polymer/eduke32/source/jaudiolib/platform.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/platform.h
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/sdlmusic.c
Executable file → Normal file
0
polymer/eduke32/source/jaudiolib/sdlmusic.c
Executable file → Normal file
|
@ -1,114 +1,114 @@
|
|||
#include <cstdio>
|
||||
#include "mdump.h"
|
||||
#include <tchar.H>
|
||||
LPCSTR MiniDumper::m_szAppName;
|
||||
|
||||
MiniDumper g_dumper("eduke32");
|
||||
|
||||
MiniDumper::MiniDumper( LPCSTR szAppName )
|
||||
{
|
||||
// if this assert fires then you have two instances of MiniDumper
|
||||
// which is not allowed
|
||||
assert( m_szAppName==NULL );
|
||||
|
||||
m_szAppName = szAppName ? _strdup(szAppName) : "Application";
|
||||
|
||||
::SetUnhandledExceptionFilter( TopLevelFilter );
|
||||
}
|
||||
|
||||
LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
|
||||
{
|
||||
LONG retval = EXCEPTION_CONTINUE_SEARCH;
|
||||
//HWND hParent = NULL; // find a better value for your app
|
||||
|
||||
// firstly see if dbghelp.dll is around and has the function we need
|
||||
// look next to the EXE first, as the one in System32 might be old
|
||||
// (e.g. Windows 2000)
|
||||
HMODULE hDll = NULL;
|
||||
char szDbgHelpPath[_MAX_PATH];
|
||||
|
||||
if (GetModuleFileName( NULL, szDbgHelpPath, _MAX_PATH ))
|
||||
{
|
||||
char *pSlash = _tcsrchr( szDbgHelpPath, '\\' );
|
||||
if (pSlash)
|
||||
{
|
||||
_tcscpy( pSlash+1, "DBGHELP.DLL" );
|
||||
hDll = ::LoadLibrary( szDbgHelpPath );
|
||||
}
|
||||
}
|
||||
|
||||
if (hDll==NULL)
|
||||
{
|
||||
// load any version we can
|
||||
hDll = ::LoadLibrary( "DBGHELP.DLL" );
|
||||
}
|
||||
|
||||
LPCTSTR szResult = NULL;
|
||||
|
||||
if (hDll)
|
||||
{
|
||||
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
|
||||
if (pDump)
|
||||
{
|
||||
char szDumpPath[_MAX_PATH];
|
||||
char szScratch [_MAX_PATH];
|
||||
|
||||
// work out a good place for the dump file
|
||||
/*if (!GetTempPath( _MAX_PATH, szDumpPath ))
|
||||
_tcscpy( szDumpPath, "c:\\temp\\" );
|
||||
*/
|
||||
sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime());
|
||||
_tcscat( szDumpPath, ".dmp" );
|
||||
|
||||
// ask the user if they want to save a dump file
|
||||
//if (::MessageBox( NULL, "Something bad happened in your program, would you like to save a diagnostic file?", m_szAppName, MB_YESNO )==IDYES)
|
||||
{
|
||||
// create the file
|
||||
HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
|
||||
if (hFile!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
|
||||
|
||||
ExInfo.ThreadId = ::GetCurrentThreadId();
|
||||
ExInfo.ExceptionPointers = pExceptionInfo;
|
||||
ExInfo.ClientPointers = NULL;
|
||||
|
||||
// write the dump
|
||||
BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
|
||||
if (bOK)
|
||||
{
|
||||
sprintf( szScratch, "Saved dump file to '%s'", szDumpPath );
|
||||
szResult = szScratch;
|
||||
retval = EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() );
|
||||
szResult = szScratch;
|
||||
}
|
||||
::CloseHandle(hFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() );
|
||||
szResult = szScratch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szResult = "DBGHELP.DLL too old";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szResult = "DBGHELP.DLL not found";
|
||||
}
|
||||
|
||||
if (szResult)
|
||||
::MessageBox( NULL, szResult, m_szAppName, MB_OK );
|
||||
|
||||
return retval;
|
||||
#include <cstdio>
|
||||
#include "mdump.h"
|
||||
#include <tchar.H>
|
||||
LPCSTR MiniDumper::m_szAppName;
|
||||
|
||||
MiniDumper g_dumper("eduke32");
|
||||
|
||||
MiniDumper::MiniDumper( LPCSTR szAppName )
|
||||
{
|
||||
// if this assert fires then you have two instances of MiniDumper
|
||||
// which is not allowed
|
||||
assert( m_szAppName==NULL );
|
||||
|
||||
m_szAppName = szAppName ? _strdup(szAppName) : "Application";
|
||||
|
||||
::SetUnhandledExceptionFilter( TopLevelFilter );
|
||||
}
|
||||
|
||||
LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
|
||||
{
|
||||
LONG retval = EXCEPTION_CONTINUE_SEARCH;
|
||||
//HWND hParent = NULL; // find a better value for your app
|
||||
|
||||
// firstly see if dbghelp.dll is around and has the function we need
|
||||
// look next to the EXE first, as the one in System32 might be old
|
||||
// (e.g. Windows 2000)
|
||||
HMODULE hDll = NULL;
|
||||
char szDbgHelpPath[_MAX_PATH];
|
||||
|
||||
if (GetModuleFileName( NULL, szDbgHelpPath, _MAX_PATH ))
|
||||
{
|
||||
char *pSlash = _tcsrchr( szDbgHelpPath, '\\' );
|
||||
if (pSlash)
|
||||
{
|
||||
_tcscpy( pSlash+1, "DBGHELP.DLL" );
|
||||
hDll = ::LoadLibrary( szDbgHelpPath );
|
||||
}
|
||||
}
|
||||
|
||||
if (hDll==NULL)
|
||||
{
|
||||
// load any version we can
|
||||
hDll = ::LoadLibrary( "DBGHELP.DLL" );
|
||||
}
|
||||
|
||||
LPCTSTR szResult = NULL;
|
||||
|
||||
if (hDll)
|
||||
{
|
||||
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
|
||||
if (pDump)
|
||||
{
|
||||
char szDumpPath[_MAX_PATH];
|
||||
char szScratch [_MAX_PATH];
|
||||
|
||||
// work out a good place for the dump file
|
||||
/*if (!GetTempPath( _MAX_PATH, szDumpPath ))
|
||||
_tcscpy( szDumpPath, "c:\\temp\\" );
|
||||
*/
|
||||
sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime());
|
||||
_tcscat( szDumpPath, ".dmp" );
|
||||
|
||||
// ask the user if they want to save a dump file
|
||||
//if (::MessageBox( NULL, "Something bad happened in your program, would you like to save a diagnostic file?", m_szAppName, MB_YESNO )==IDYES)
|
||||
{
|
||||
// create the file
|
||||
HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
|
||||
if (hFile!=INVALID_HANDLE_VALUE)
|
||||
{
|
||||
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
|
||||
|
||||
ExInfo.ThreadId = ::GetCurrentThreadId();
|
||||
ExInfo.ExceptionPointers = pExceptionInfo;
|
||||
ExInfo.ClientPointers = NULL;
|
||||
|
||||
// write the dump
|
||||
BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
|
||||
if (bOK)
|
||||
{
|
||||
sprintf( szScratch, "Saved dump file to '%s'", szDumpPath );
|
||||
szResult = szScratch;
|
||||
retval = EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() );
|
||||
szResult = szScratch;
|
||||
}
|
||||
::CloseHandle(hFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() );
|
||||
szResult = szScratch;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szResult = "DBGHELP.DLL too old";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
szResult = "DBGHELP.DLL not found";
|
||||
}
|
||||
|
||||
if (szResult)
|
||||
::MessageBox( NULL, szResult, m_szAppName, MB_OK );
|
||||
|
||||
return retval;
|
||||
}
|
|
@ -1,30 +1,30 @@
|
|||
#define _WIN32_WINNT 0x0500
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#if _MSC_VER < 1300
|
||||
#define DECLSPEC_DEPRECATED
|
||||
// VC6: change this path to your Platform SDK headers
|
||||
#include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" // must be XP version of file
|
||||
#else
|
||||
// VC7: ships with updated headers
|
||||
#include "dbghelp.h"
|
||||
#endif
|
||||
|
||||
// based on dbghelp.h
|
||||
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
|
||||
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
|
||||
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
|
||||
);
|
||||
|
||||
class MiniDumper
|
||||
{
|
||||
private:
|
||||
static LPCSTR m_szAppName;
|
||||
|
||||
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
|
||||
|
||||
public:
|
||||
MiniDumper( LPCSTR szAppName );
|
||||
};
|
||||
#define _WIN32_WINNT 0x0500
|
||||
#include <windows.h>
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#if _MSC_VER < 1300
|
||||
#define DECLSPEC_DEPRECATED
|
||||
// VC6: change this path to your Platform SDK headers
|
||||
#include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" // must be XP version of file
|
||||
#else
|
||||
// VC7: ships with updated headers
|
||||
#include "dbghelp.h"
|
||||
#endif
|
||||
|
||||
// based on dbghelp.h
|
||||
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
|
||||
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
|
||||
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
|
||||
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
|
||||
);
|
||||
|
||||
class MiniDumper
|
||||
{
|
||||
private:
|
||||
static LPCSTR m_szAppName;
|
||||
|
||||
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
|
||||
|
||||
public:
|
||||
MiniDumper( LPCSTR szAppName );
|
||||
};
|
||||
|
|
|
@ -43,13 +43,13 @@ BEGIN
|
|||
|
||||
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
|
||||
END
|
||||
WIN_STARTWINPAGE_GAME DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Game:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 5, 100, 8
|
||||
CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 70
|
||||
END
|
||||
|
||||
WIN_STARTWINPAGE_GAME DIALOGEX DISCARDABLE 20, 40, 279, 168
|
||||
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "&Game:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 5, 100, 8
|
||||
CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 70
|
||||
END
|
||||
|
||||
1 24 "rsrc/manifest.game.xml"
|
||||
|
|
0
polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade
Executable file → Normal file
0
polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade
Executable file → Normal file
0
polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep
Executable file → Normal file
0
polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep
Executable file → Normal file
0
polymer/eduke32/source/misc/gtkstartwin/pixmaps/game.bmp
Executable file → Normal file
0
polymer/eduke32/source/misc/gtkstartwin/pixmaps/game.bmp
Executable file → Normal file
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
File diff suppressed because it is too large
Load diff
|
@ -1,7 +1,7 @@
|
|||
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal);
|
||||
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal);
|
||||
void GAME_drawosdcursor(int x, int y, int type, int lastkeypress);
|
||||
int GAME_getcolumnwidth(int w);
|
||||
int GAME_getrowheight(int w);
|
||||
void GAME_clearbackground(int c, int r);
|
||||
void GAME_onshowosd(int shown);
|
||||
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal);
|
||||
void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal);
|
||||
void GAME_drawosdcursor(int x, int y, int type, int lastkeypress);
|
||||
int GAME_getcolumnwidth(int w);
|
||||
int GAME_getrowheight(int w);
|
||||
void GAME_clearbackground(int c, int r);
|
||||
void GAME_onshowosd(int shown);
|
||||
|
|
|
@ -21,399 +21,399 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#define KICK_HIT 0
|
||||
#define PISTOL_RICOCHET 1
|
||||
#define PISTOL_BODYHIT 2
|
||||
#define PISTOL_FIRE 3
|
||||
#define EJECT_CLIP 4
|
||||
#define INSERT_CLIP 5
|
||||
#define CHAINGUN_FIRE 6
|
||||
#define RPG_SHOOT 7
|
||||
#define POOLBALLHIT 8
|
||||
#define RPG_EXPLODE 9
|
||||
#define CAT_FIRE 10
|
||||
#define SHRINKER_FIRE 11
|
||||
#define ACTOR_SHRINKING 12
|
||||
#define PIPEBOMB_BOUNCE 13
|
||||
#define PIPEBOMB_EXPLODE 14
|
||||
#define LASERTRIP_ONWALL 15
|
||||
#define LASERTRIP_ARMING 16
|
||||
#define LASERTRIP_EXPLODE 17
|
||||
#define VENT_BUST 18
|
||||
#define GLASS_BREAKING 19
|
||||
#define GLASS_HEAVYBREAK 20
|
||||
#define SHORT_CIRCUIT 21
|
||||
#define ITEM_SPLASH 22
|
||||
#define DUKE_BREATHING 23
|
||||
#define DUKE_EXHALING 24
|
||||
#define DUKE_GASP 25
|
||||
#define SLIM_RECOG 26
|
||||
// #define ENDSEQVOL3SND1 27
|
||||
#define DUKE_URINATE 28
|
||||
#define ENDSEQVOL3SND2 29
|
||||
#define ENDSEQVOL3SND3 30
|
||||
#define DUKE_PASSWIND 32
|
||||
#define DUKE_CRACK 33
|
||||
#define SLIM_ATTACK 34
|
||||
#define SOMETHINGHITFORCE 35
|
||||
#define DUKE_DRINKING 36
|
||||
#define DUKE_KILLED1 37
|
||||
#define DUKE_GRUNT 38
|
||||
#define DUKE_HARTBEAT 39
|
||||
#define DUKE_ONWATER 40
|
||||
#define DUKE_DEAD 41
|
||||
#define DUKE_LAND 42
|
||||
#define DUKE_WALKINDUCTS 43
|
||||
#define DUKE_GLAD 44
|
||||
#define DUKE_YES 45
|
||||
#define DUKE_HEHE 46
|
||||
#define DUKE_SHUCKS 47
|
||||
#define DUKE_UNDERWATER 48
|
||||
#define DUKE_JETPACK_ON 49
|
||||
#define DUKE_JETPACK_IDLE 50
|
||||
#define DUKE_JETPACK_OFF 51
|
||||
#define LIZTROOP_GROWL 52
|
||||
#define LIZTROOP_TALK1 53
|
||||
#define LIZTROOP_TALK2 54
|
||||
#define LIZTROOP_TALK3 55
|
||||
#define DUKETALKTOBOSS 56
|
||||
#define LIZCAPT_GROWL 57
|
||||
#define LIZCAPT_TALK1 58
|
||||
#define LIZCAPT_TALK2 59
|
||||
#define LIZCAPT_TALK3 60
|
||||
#define LIZARD_BEG 61
|
||||
#define LIZARD_PAIN 62
|
||||
#define LIZARD_DEATH 63
|
||||
#define LIZARD_SPIT 64
|
||||
#define DRONE1_HISSRATTLE 65
|
||||
#define DRONE1_HISSSCREECH 66
|
||||
#define DUKE_TIP2 67
|
||||
#define FLESH_BURNING 68
|
||||
#define SQUISHED 69
|
||||
#define TELEPORTER 70
|
||||
#define ELEVATOR_ON 71
|
||||
#define DUKE_KILLED3 72
|
||||
#define ELEVATOR_OFF 73
|
||||
#define DOOR_OPERATE1 74
|
||||
#define SUBWAY 75
|
||||
#define SWITCH_ON 76
|
||||
#define FAN 77
|
||||
#define DUKE_GETWEAPON3 78
|
||||
#define FLUSH_TOILET 79
|
||||
#define HOVER_CRAFT 80
|
||||
#define EARTHQUAKE 81
|
||||
#define INTRUDER_ALERT 82
|
||||
#define END_OF_LEVEL_WARN 83
|
||||
#define ENGINE_OPERATING 84
|
||||
#define REACTOR_ON 85
|
||||
#define COMPUTER_AMBIENCE 86
|
||||
#define GEARS_GRINDING 87
|
||||
#define BUBBLE_AMBIENCE 88
|
||||
#define MACHINE_AMBIENCE 89
|
||||
#define SEWER_AMBIENCE 90
|
||||
#define WIND_AMBIENCE 91
|
||||
#define SOMETHING_DRIPPING 92
|
||||
#define STEAM_HISSING 93
|
||||
#define THEATER_BREATH 94
|
||||
#define BAR_MUSIC 95
|
||||
#define BOS1_ROAM 96
|
||||
#define BOS1_RECOG 97
|
||||
#define BOS1_ATTACK1 98
|
||||
#define BOS1_PAIN 99
|
||||
#define BOS1_DYING 100
|
||||
#define BOS2_ROAM 101
|
||||
#define BOS2_RECOG 102
|
||||
#define BOS2_ATTACK 103
|
||||
#define BOS2_PAIN 104
|
||||
#define BOS2_DYING 105
|
||||
#define GETATOMICHEALTH 106
|
||||
#define DUKE_GETWEAPON2 107
|
||||
#define BOS3_DYING 108
|
||||
#define SHOTGUN_FIRE 109
|
||||
#define PRED_ROAM 110
|
||||
#define PRED_RECOG 111
|
||||
#define PRED_ATTACK 112
|
||||
#define PRED_PAIN 113
|
||||
#define PRED_DYING 114
|
||||
#define CAPT_ROAM 115
|
||||
#define CAPT_ATTACK 116
|
||||
#define CAPT_RECOG 117
|
||||
#define CAPT_PAIN 118
|
||||
#define CAPT_DYING 119
|
||||
#define PIG_ROAM 120
|
||||
#define PIG_RECOG 121
|
||||
#define PIG_ATTACK 122
|
||||
#define PIG_PAIN 123
|
||||
#define PIG_DYING 124
|
||||
#define RECO_ROAM 125
|
||||
#define RECO_RECOG 126
|
||||
#define RECO_ATTACK 127
|
||||
#define RECO_PAIN 128
|
||||
#define RECO_DYING 129
|
||||
#define DRON_ROAM 130
|
||||
#define DRON_RECOG 131
|
||||
#define DRON_ATTACK1 132
|
||||
#define DRON_PAIN 133
|
||||
#define DRON_DYING 134
|
||||
#define COMM_ROAM 135
|
||||
#define COMM_RECOG 136
|
||||
#define COMM_ATTACK 137
|
||||
#define COMM_PAIN 138
|
||||
#define COMM_DYING 139
|
||||
#define OCTA_ROAM 140
|
||||
#define OCTA_RECOG 141
|
||||
#define OCTA_ATTACK1 142
|
||||
#define OCTA_PAIN 143
|
||||
#define OCTA_DYING 144
|
||||
#define TURR_ROAM 145
|
||||
#define TURR_RECOG 146
|
||||
#define TURR_ATTACK 147
|
||||
#define DUMPSTER_MOVE 148
|
||||
#define SLIM_DYING 149
|
||||
#define BOS3_ROAM 150
|
||||
#define BOS3_RECOG 151
|
||||
#define BOS3_ATTACK1 152
|
||||
#define BOS3_PAIN 153
|
||||
#define BOS1_ATTACK2 154
|
||||
#define COMM_SPIN 155
|
||||
#define BOS1_WALK 156
|
||||
#define DRON_ATTACK2 157
|
||||
#define THUD 158
|
||||
#define OCTA_ATTACK2 159
|
||||
#define WIERDSHOT_FLY 160
|
||||
#define TURR_PAIN 161
|
||||
#define TURR_DYING 162
|
||||
#define SLIM_ROAM 163
|
||||
#define LADY_SCREAM 164
|
||||
#define DOOR_OPERATE2 165
|
||||
#define DOOR_OPERATE3 166
|
||||
#define DOOR_OPERATE4 167
|
||||
#define BORNTOBEWILDSND 168
|
||||
#define SHOTGUN_COCK 169
|
||||
#define GENERIC_AMBIENCE1 170
|
||||
#define GENERIC_AMBIENCE2 171
|
||||
#define GENERIC_AMBIENCE3 172
|
||||
#define GENERIC_AMBIENCE4 173
|
||||
#define GENERIC_AMBIENCE5 174
|
||||
#define GENERIC_AMBIENCE6 175
|
||||
#define BOS3_ATTACK2 176
|
||||
#define GENERIC_AMBIENCE17 177
|
||||
#define GENERIC_AMBIENCE18 178
|
||||
#define GENERIC_AMBIENCE19 179
|
||||
#define GENERIC_AMBIENCE20 180
|
||||
#define GENERIC_AMBIENCE21 181
|
||||
#define GENERIC_AMBIENCE22 182
|
||||
#define SECRETLEVELSND 183
|
||||
#define GENERIC_AMBIENCE8 184
|
||||
#define GENERIC_AMBIENCE9 185
|
||||
#define GENERIC_AMBIENCE10 186
|
||||
#define GENERIC_AMBIENCE11 187
|
||||
#define GENERIC_AMBIENCE12 188
|
||||
#define GENERIC_AMBIENCE13 189
|
||||
#define GENERIC_AMBIENCE14 190
|
||||
#define GENERIC_AMBIENCE15 192
|
||||
#define GENERIC_AMBIENCE16 193
|
||||
#define FIRE_CRACKLE 194
|
||||
#define BONUS_SPEECH1 195
|
||||
#define BONUS_SPEECH2 196
|
||||
#define BONUS_SPEECH3 197
|
||||
#define PIG_CAPTURE_DUKE 198
|
||||
#define BONUS_SPEECH4 199
|
||||
#define DUKE_LAND_HURT 200
|
||||
#define DUKE_HIT_STRIPPER1 201
|
||||
#define DUKE_TIP1 202
|
||||
#define DUKE_KILLED2 203
|
||||
#define PRED_ROAM2 204
|
||||
#define PIG_ROAM2 205
|
||||
#define DUKE_GETWEAPON1 206
|
||||
#define DUKE_SEARCH2 207
|
||||
#define DUKE_CRACK2 208
|
||||
#define DUKE_SEARCH 209
|
||||
#define DUKE_GET 210
|
||||
#define DUKE_LONGTERM_PAIN 211
|
||||
#define MONITOR_ACTIVE 212
|
||||
#define NITEVISION_ONOFF 213
|
||||
#define DUKE_HIT_STRIPPER2 214
|
||||
#define DUKE_CRACK_FIRST 215
|
||||
#define DUKE_USEMEDKIT 216
|
||||
#define DUKE_TAKEPILLS 217
|
||||
#define DUKE_PISSRELIEF 218
|
||||
#define SELECT_WEAPON 219
|
||||
#define WATER_GURGLE 220
|
||||
#define DUKE_GETWEAPON4 221
|
||||
#define JIBBED_ACTOR1 222
|
||||
#define JIBBED_ACTOR2 223
|
||||
#define JIBBED_ACTOR3 224
|
||||
#define JIBBED_ACTOR4 225
|
||||
#define JIBBED_ACTOR5 226
|
||||
#define JIBBED_ACTOR6 227
|
||||
#define JIBBED_ACTOR7 228
|
||||
#define DUKE_GOTHEALTHATLOW 229
|
||||
#define BOSSTALKTODUKE 230
|
||||
#define WAR_AMBIENCE1 231
|
||||
#define WAR_AMBIENCE2 232
|
||||
#define WAR_AMBIENCE3 233
|
||||
#define WAR_AMBIENCE4 234
|
||||
#define WAR_AMBIENCE5 235
|
||||
#define WAR_AMBIENCE6 236
|
||||
#define WAR_AMBIENCE7 237
|
||||
#define WAR_AMBIENCE8 238
|
||||
#define WAR_AMBIENCE9 239
|
||||
#define WAR_AMBIENCE10 240
|
||||
#define ALIEN_TALK1 241
|
||||
#define ALIEN_TALK2 242
|
||||
#define EXITMENUSOUND 243
|
||||
#define FLY_BY 244
|
||||
#define DUKE_SCREAM 245
|
||||
#define SHRINKER_HIT 246
|
||||
#define RATTY 247
|
||||
#define INTO_MENU 248
|
||||
#define BONUSMUSIC 249
|
||||
#define DUKE_BOOBY 250
|
||||
#define DUKE_TALKTOBOSSFALL 251
|
||||
#define DUKE_LOOKINTOMIRROR 252
|
||||
#define PIG_ROAM3 253
|
||||
#define KILLME 254
|
||||
#define DRON_JETSND 255
|
||||
#define SPACE_DOOR1 256
|
||||
#define SPACE_DOOR2 257
|
||||
#define SPACE_DOOR3 258
|
||||
#define SPACE_DOOR4 259
|
||||
#define SPACE_DOOR5 260
|
||||
#define ALIEN_ELEVATOR1 261
|
||||
#define VAULT_DOOR 262
|
||||
#define JIBBED_ACTOR13 263
|
||||
#define DUKE_GETWEAPON6 264
|
||||
#define JIBBED_ACTOR8 265
|
||||
#define JIBBED_ACTOR9 266
|
||||
#define JIBBED_ACTOR10 267
|
||||
#define JIBBED_ACTOR11 268
|
||||
#define JIBBED_ACTOR12 269
|
||||
#define DUKE_KILLED4 270
|
||||
#define DUKE_KILLED5 271
|
||||
#define ALIEN_SWITCH1 272
|
||||
#define DUKE_STEPONFECES 273
|
||||
#define DUKE_LONGTERM_PAIN2 274
|
||||
#define DUKE_LONGTERM_PAIN3 275
|
||||
#define DUKE_LONGTERM_PAIN4 276
|
||||
#define COMPANB2 277
|
||||
#define KTIT 278
|
||||
#define HELICOP_IDLE 279
|
||||
#define STEPNIT 280
|
||||
#define SPACE_AMBIENCE1 281
|
||||
#define SPACE_AMBIENCE2 282
|
||||
#define SLIM_HATCH 283
|
||||
#define RIPHEADNECK 284
|
||||
#define FOUNDJONES 285
|
||||
#define ALIEN_DOOR1 286
|
||||
#define ALIEN_DOOR2 287
|
||||
#define ENDSEQVOL3SND4 288
|
||||
#define ENDSEQVOL3SND5 289
|
||||
#define ENDSEQVOL3SND6 290
|
||||
#define ENDSEQVOL3SND7 291
|
||||
#define ENDSEQVOL3SND8 292
|
||||
#define ENDSEQVOL3SND9 293
|
||||
#define WHIPYOURASS 294
|
||||
#define ENDSEQVOL2SND1 295
|
||||
#define ENDSEQVOL2SND2 296
|
||||
#define ENDSEQVOL2SND3 297
|
||||
#define ENDSEQVOL2SND4 298
|
||||
#define ENDSEQVOL2SND5 299
|
||||
#define ENDSEQVOL2SND6 300
|
||||
#define ENDSEQVOL2SND7 301
|
||||
#define GENERIC_AMBIENCE23 302
|
||||
#define SOMETHINGFROZE 303
|
||||
#define DUKE_LONGTERM_PAIN5 304
|
||||
#define DUKE_LONGTERM_PAIN6 305
|
||||
#define DUKE_LONGTERM_PAIN7 306
|
||||
#define DUKE_LONGTERM_PAIN8 307
|
||||
#define WIND_REPEAT 308
|
||||
#define MYENEMY_ROAM 309
|
||||
#define MYENEMY_HURT 310
|
||||
#define MYENEMY_DEAD 311
|
||||
#define MYENEMY_SHOOT 312
|
||||
#define STORE_MUSIC 313
|
||||
#define STORE_MUSIC_BROKE 314
|
||||
#define ACTOR_GROWING 315
|
||||
#define NEWBEAST_ROAM 316
|
||||
#define NEWBEAST_RECOG 317
|
||||
#define NEWBEAST_ATTACK 318
|
||||
#define NEWBEAST_PAIN 319
|
||||
#define NEWBEAST_DYING 320
|
||||
#define NEWBEAST_SPIT 321
|
||||
#define VOL4_1 322
|
||||
#define SUPERMARKET 323
|
||||
#define MOUSEANNOY 324
|
||||
#define BOOKEM 325
|
||||
#define SUPERMARKETCRY 326
|
||||
#define DESTRUCT 327
|
||||
#define EATFOOD 328
|
||||
#define MAKEMYDAY 329
|
||||
#define WITNESSSTAND 330
|
||||
#define VACATIONSPEECH 331
|
||||
#define YIPPEE1 332
|
||||
#define YOHOO1 333
|
||||
#define YOHOO2 334
|
||||
#define DOLPHINSND 335
|
||||
#define TOUGHGALSND1 336
|
||||
#define TOUGHGALSND2 337
|
||||
#define TOUGHGALSND3 338
|
||||
#define TOUGHGALSND4 339
|
||||
#define TANK_ROAM 340
|
||||
#define BOS4_ROAM 341
|
||||
#define BOS4_RECOG 342
|
||||
#define BOS4_ATTACK 343
|
||||
#define BOS4_PAIN 344
|
||||
#define BOS4_DYING 345
|
||||
#define NEWBEAST_ATTACKMISS 346
|
||||
#define VOL4_2 347
|
||||
#define COOKINGDEEPFRIER 348
|
||||
#define WHINING_DOG 349
|
||||
#define DEAD_DOG 350
|
||||
#define LIGHTNING_SLAP 351
|
||||
#define THUNDER 352
|
||||
#define HAPPYMOUSESND1 353
|
||||
#define HAPPYMOUSESND2 354
|
||||
#define HAPPYMOUSESND3 355
|
||||
#define HAPPYMOUSESND4 356
|
||||
#define ALARM 357
|
||||
#define RAIN 358
|
||||
#define DTAG_GREENRUN 359
|
||||
#define DTAG_BROWNRUN 360
|
||||
#define DTAG_GREENSCORE 361
|
||||
#define DTAG_BROWNSCORE 362
|
||||
#define INTRO4_1 363
|
||||
#define INTRO4_2 364
|
||||
#define INTRO4_3 365
|
||||
#define INTRO4_4 366
|
||||
#define INTRO4_5 367
|
||||
#define INTRO4_6 368
|
||||
#define SCREECH 369
|
||||
#define BOSS4_DEADSPEECH 370
|
||||
#define BOSS4_FIRSTSEE 371
|
||||
#define PARTY_SPEECH 372
|
||||
#define POSTAL_SPEECH 373
|
||||
#define TGSPEECH 374
|
||||
#define DOGROOMSPEECH 375
|
||||
#define SMACKED 376
|
||||
#define MDEVSPEECH 377
|
||||
#define AREA51SPEECH 378
|
||||
#define JEEPSOUND 379
|
||||
#define BIGDOORSLAM 380
|
||||
#define BOS4_LAY 381
|
||||
#define WAVESOUND 382
|
||||
#define ILLBEBACK 383
|
||||
#define VOL4ENDSND1 384
|
||||
#define VOL4ENDSND2 385
|
||||
#define EXPANDERHIT 386
|
||||
#define SNAKESPEECH 387
|
||||
#define EXPANDERSHOOT 388
|
||||
#define GETBACKTOWORK 389
|
||||
#define JIBBED_ACTOR14 390
|
||||
#define JIBBED_ACTOR15 391
|
||||
#define INTRO4_B 392
|
||||
#define BIGBANG 393
|
||||
#define SMACKIT 394
|
||||
#define BELLSND 395
|
||||
// MAXIMUM NUMBER OF SOUNDS: 450 ( 0-449 )
|
||||
|
||||
#define KICK_HIT 0
|
||||
#define PISTOL_RICOCHET 1
|
||||
#define PISTOL_BODYHIT 2
|
||||
#define PISTOL_FIRE 3
|
||||
#define EJECT_CLIP 4
|
||||
#define INSERT_CLIP 5
|
||||
#define CHAINGUN_FIRE 6
|
||||
#define RPG_SHOOT 7
|
||||
#define POOLBALLHIT 8
|
||||
#define RPG_EXPLODE 9
|
||||
#define CAT_FIRE 10
|
||||
#define SHRINKER_FIRE 11
|
||||
#define ACTOR_SHRINKING 12
|
||||
#define PIPEBOMB_BOUNCE 13
|
||||
#define PIPEBOMB_EXPLODE 14
|
||||
#define LASERTRIP_ONWALL 15
|
||||
#define LASERTRIP_ARMING 16
|
||||
#define LASERTRIP_EXPLODE 17
|
||||
#define VENT_BUST 18
|
||||
#define GLASS_BREAKING 19
|
||||
#define GLASS_HEAVYBREAK 20
|
||||
#define SHORT_CIRCUIT 21
|
||||
#define ITEM_SPLASH 22
|
||||
#define DUKE_BREATHING 23
|
||||
#define DUKE_EXHALING 24
|
||||
#define DUKE_GASP 25
|
||||
#define SLIM_RECOG 26
|
||||
// #define ENDSEQVOL3SND1 27
|
||||
#define DUKE_URINATE 28
|
||||
#define ENDSEQVOL3SND2 29
|
||||
#define ENDSEQVOL3SND3 30
|
||||
#define DUKE_PASSWIND 32
|
||||
#define DUKE_CRACK 33
|
||||
#define SLIM_ATTACK 34
|
||||
#define SOMETHINGHITFORCE 35
|
||||
#define DUKE_DRINKING 36
|
||||
#define DUKE_KILLED1 37
|
||||
#define DUKE_GRUNT 38
|
||||
#define DUKE_HARTBEAT 39
|
||||
#define DUKE_ONWATER 40
|
||||
#define DUKE_DEAD 41
|
||||
#define DUKE_LAND 42
|
||||
#define DUKE_WALKINDUCTS 43
|
||||
#define DUKE_GLAD 44
|
||||
#define DUKE_YES 45
|
||||
#define DUKE_HEHE 46
|
||||
#define DUKE_SHUCKS 47
|
||||
#define DUKE_UNDERWATER 48
|
||||
#define DUKE_JETPACK_ON 49
|
||||
#define DUKE_JETPACK_IDLE 50
|
||||
#define DUKE_JETPACK_OFF 51
|
||||
#define LIZTROOP_GROWL 52
|
||||
#define LIZTROOP_TALK1 53
|
||||
#define LIZTROOP_TALK2 54
|
||||
#define LIZTROOP_TALK3 55
|
||||
#define DUKETALKTOBOSS 56
|
||||
#define LIZCAPT_GROWL 57
|
||||
#define LIZCAPT_TALK1 58
|
||||
#define LIZCAPT_TALK2 59
|
||||
#define LIZCAPT_TALK3 60
|
||||
#define LIZARD_BEG 61
|
||||
#define LIZARD_PAIN 62
|
||||
#define LIZARD_DEATH 63
|
||||
#define LIZARD_SPIT 64
|
||||
#define DRONE1_HISSRATTLE 65
|
||||
#define DRONE1_HISSSCREECH 66
|
||||
#define DUKE_TIP2 67
|
||||
#define FLESH_BURNING 68
|
||||
#define SQUISHED 69
|
||||
#define TELEPORTER 70
|
||||
#define ELEVATOR_ON 71
|
||||
#define DUKE_KILLED3 72
|
||||
#define ELEVATOR_OFF 73
|
||||
#define DOOR_OPERATE1 74
|
||||
#define SUBWAY 75
|
||||
#define SWITCH_ON 76
|
||||
#define FAN 77
|
||||
#define DUKE_GETWEAPON3 78
|
||||
#define FLUSH_TOILET 79
|
||||
#define HOVER_CRAFT 80
|
||||
#define EARTHQUAKE 81
|
||||
#define INTRUDER_ALERT 82
|
||||
#define END_OF_LEVEL_WARN 83
|
||||
#define ENGINE_OPERATING 84
|
||||
#define REACTOR_ON 85
|
||||
#define COMPUTER_AMBIENCE 86
|
||||
#define GEARS_GRINDING 87
|
||||
#define BUBBLE_AMBIENCE 88
|
||||
#define MACHINE_AMBIENCE 89
|
||||
#define SEWER_AMBIENCE 90
|
||||
#define WIND_AMBIENCE 91
|
||||
#define SOMETHING_DRIPPING 92
|
||||
#define STEAM_HISSING 93
|
||||
#define THEATER_BREATH 94
|
||||
#define BAR_MUSIC 95
|
||||
#define BOS1_ROAM 96
|
||||
#define BOS1_RECOG 97
|
||||
#define BOS1_ATTACK1 98
|
||||
#define BOS1_PAIN 99
|
||||
#define BOS1_DYING 100
|
||||
#define BOS2_ROAM 101
|
||||
#define BOS2_RECOG 102
|
||||
#define BOS2_ATTACK 103
|
||||
#define BOS2_PAIN 104
|
||||
#define BOS2_DYING 105
|
||||
#define GETATOMICHEALTH 106
|
||||
#define DUKE_GETWEAPON2 107
|
||||
#define BOS3_DYING 108
|
||||
#define SHOTGUN_FIRE 109
|
||||
#define PRED_ROAM 110
|
||||
#define PRED_RECOG 111
|
||||
#define PRED_ATTACK 112
|
||||
#define PRED_PAIN 113
|
||||
#define PRED_DYING 114
|
||||
#define CAPT_ROAM 115
|
||||
#define CAPT_ATTACK 116
|
||||
#define CAPT_RECOG 117
|
||||
#define CAPT_PAIN 118
|
||||
#define CAPT_DYING 119
|
||||
#define PIG_ROAM 120
|
||||
#define PIG_RECOG 121
|
||||
#define PIG_ATTACK 122
|
||||
#define PIG_PAIN 123
|
||||
#define PIG_DYING 124
|
||||
#define RECO_ROAM 125
|
||||
#define RECO_RECOG 126
|
||||
#define RECO_ATTACK 127
|
||||
#define RECO_PAIN 128
|
||||
#define RECO_DYING 129
|
||||
#define DRON_ROAM 130
|
||||
#define DRON_RECOG 131
|
||||
#define DRON_ATTACK1 132
|
||||
#define DRON_PAIN 133
|
||||
#define DRON_DYING 134
|
||||
#define COMM_ROAM 135
|
||||
#define COMM_RECOG 136
|
||||
#define COMM_ATTACK 137
|
||||
#define COMM_PAIN 138
|
||||
#define COMM_DYING 139
|
||||
#define OCTA_ROAM 140
|
||||
#define OCTA_RECOG 141
|
||||
#define OCTA_ATTACK1 142
|
||||
#define OCTA_PAIN 143
|
||||
#define OCTA_DYING 144
|
||||
#define TURR_ROAM 145
|
||||
#define TURR_RECOG 146
|
||||
#define TURR_ATTACK 147
|
||||
#define DUMPSTER_MOVE 148
|
||||
#define SLIM_DYING 149
|
||||
#define BOS3_ROAM 150
|
||||
#define BOS3_RECOG 151
|
||||
#define BOS3_ATTACK1 152
|
||||
#define BOS3_PAIN 153
|
||||
#define BOS1_ATTACK2 154
|
||||
#define COMM_SPIN 155
|
||||
#define BOS1_WALK 156
|
||||
#define DRON_ATTACK2 157
|
||||
#define THUD 158
|
||||
#define OCTA_ATTACK2 159
|
||||
#define WIERDSHOT_FLY 160
|
||||
#define TURR_PAIN 161
|
||||
#define TURR_DYING 162
|
||||
#define SLIM_ROAM 163
|
||||
#define LADY_SCREAM 164
|
||||
#define DOOR_OPERATE2 165
|
||||
#define DOOR_OPERATE3 166
|
||||
#define DOOR_OPERATE4 167
|
||||
#define BORNTOBEWILDSND 168
|
||||
#define SHOTGUN_COCK 169
|
||||
#define GENERIC_AMBIENCE1 170
|
||||
#define GENERIC_AMBIENCE2 171
|
||||
#define GENERIC_AMBIENCE3 172
|
||||
#define GENERIC_AMBIENCE4 173
|
||||
#define GENERIC_AMBIENCE5 174
|
||||
#define GENERIC_AMBIENCE6 175
|
||||
#define BOS3_ATTACK2 176
|
||||
#define GENERIC_AMBIENCE17 177
|
||||
#define GENERIC_AMBIENCE18 178
|
||||
#define GENERIC_AMBIENCE19 179
|
||||
#define GENERIC_AMBIENCE20 180
|
||||
#define GENERIC_AMBIENCE21 181
|
||||
#define GENERIC_AMBIENCE22 182
|
||||
#define SECRETLEVELSND 183
|
||||
#define GENERIC_AMBIENCE8 184
|
||||
#define GENERIC_AMBIENCE9 185
|
||||
#define GENERIC_AMBIENCE10 186
|
||||
#define GENERIC_AMBIENCE11 187
|
||||
#define GENERIC_AMBIENCE12 188
|
||||
#define GENERIC_AMBIENCE13 189
|
||||
#define GENERIC_AMBIENCE14 190
|
||||
#define GENERIC_AMBIENCE15 192
|
||||
#define GENERIC_AMBIENCE16 193
|
||||
#define FIRE_CRACKLE 194
|
||||
#define BONUS_SPEECH1 195
|
||||
#define BONUS_SPEECH2 196
|
||||
#define BONUS_SPEECH3 197
|
||||
#define PIG_CAPTURE_DUKE 198
|
||||
#define BONUS_SPEECH4 199
|
||||
#define DUKE_LAND_HURT 200
|
||||
#define DUKE_HIT_STRIPPER1 201
|
||||
#define DUKE_TIP1 202
|
||||
#define DUKE_KILLED2 203
|
||||
#define PRED_ROAM2 204
|
||||
#define PIG_ROAM2 205
|
||||
#define DUKE_GETWEAPON1 206
|
||||
#define DUKE_SEARCH2 207
|
||||
#define DUKE_CRACK2 208
|
||||
#define DUKE_SEARCH 209
|
||||
#define DUKE_GET 210
|
||||
#define DUKE_LONGTERM_PAIN 211
|
||||
#define MONITOR_ACTIVE 212
|
||||
#define NITEVISION_ONOFF 213
|
||||
#define DUKE_HIT_STRIPPER2 214
|
||||
#define DUKE_CRACK_FIRST 215
|
||||
#define DUKE_USEMEDKIT 216
|
||||
#define DUKE_TAKEPILLS 217
|
||||
#define DUKE_PISSRELIEF 218
|
||||
#define SELECT_WEAPON 219
|
||||
#define WATER_GURGLE 220
|
||||
#define DUKE_GETWEAPON4 221
|
||||
#define JIBBED_ACTOR1 222
|
||||
#define JIBBED_ACTOR2 223
|
||||
#define JIBBED_ACTOR3 224
|
||||
#define JIBBED_ACTOR4 225
|
||||
#define JIBBED_ACTOR5 226
|
||||
#define JIBBED_ACTOR6 227
|
||||
#define JIBBED_ACTOR7 228
|
||||
#define DUKE_GOTHEALTHATLOW 229
|
||||
#define BOSSTALKTODUKE 230
|
||||
#define WAR_AMBIENCE1 231
|
||||
#define WAR_AMBIENCE2 232
|
||||
#define WAR_AMBIENCE3 233
|
||||
#define WAR_AMBIENCE4 234
|
||||
#define WAR_AMBIENCE5 235
|
||||
#define WAR_AMBIENCE6 236
|
||||
#define WAR_AMBIENCE7 237
|
||||
#define WAR_AMBIENCE8 238
|
||||
#define WAR_AMBIENCE9 239
|
||||
#define WAR_AMBIENCE10 240
|
||||
#define ALIEN_TALK1 241
|
||||
#define ALIEN_TALK2 242
|
||||
#define EXITMENUSOUND 243
|
||||
#define FLY_BY 244
|
||||
#define DUKE_SCREAM 245
|
||||
#define SHRINKER_HIT 246
|
||||
#define RATTY 247
|
||||
#define INTO_MENU 248
|
||||
#define BONUSMUSIC 249
|
||||
#define DUKE_BOOBY 250
|
||||
#define DUKE_TALKTOBOSSFALL 251
|
||||
#define DUKE_LOOKINTOMIRROR 252
|
||||
#define PIG_ROAM3 253
|
||||
#define KILLME 254
|
||||
#define DRON_JETSND 255
|
||||
#define SPACE_DOOR1 256
|
||||
#define SPACE_DOOR2 257
|
||||
#define SPACE_DOOR3 258
|
||||
#define SPACE_DOOR4 259
|
||||
#define SPACE_DOOR5 260
|
||||
#define ALIEN_ELEVATOR1 261
|
||||
#define VAULT_DOOR 262
|
||||
#define JIBBED_ACTOR13 263
|
||||
#define DUKE_GETWEAPON6 264
|
||||
#define JIBBED_ACTOR8 265
|
||||
#define JIBBED_ACTOR9 266
|
||||
#define JIBBED_ACTOR10 267
|
||||
#define JIBBED_ACTOR11 268
|
||||
#define JIBBED_ACTOR12 269
|
||||
#define DUKE_KILLED4 270
|
||||
#define DUKE_KILLED5 271
|
||||
#define ALIEN_SWITCH1 272
|
||||
#define DUKE_STEPONFECES 273
|
||||
#define DUKE_LONGTERM_PAIN2 274
|
||||
#define DUKE_LONGTERM_PAIN3 275
|
||||
#define DUKE_LONGTERM_PAIN4 276
|
||||
#define COMPANB2 277
|
||||
#define KTIT 278
|
||||
#define HELICOP_IDLE 279
|
||||
#define STEPNIT 280
|
||||
#define SPACE_AMBIENCE1 281
|
||||
#define SPACE_AMBIENCE2 282
|
||||
#define SLIM_HATCH 283
|
||||
#define RIPHEADNECK 284
|
||||
#define FOUNDJONES 285
|
||||
#define ALIEN_DOOR1 286
|
||||
#define ALIEN_DOOR2 287
|
||||
#define ENDSEQVOL3SND4 288
|
||||
#define ENDSEQVOL3SND5 289
|
||||
#define ENDSEQVOL3SND6 290
|
||||
#define ENDSEQVOL3SND7 291
|
||||
#define ENDSEQVOL3SND8 292
|
||||
#define ENDSEQVOL3SND9 293
|
||||
#define WHIPYOURASS 294
|
||||
#define ENDSEQVOL2SND1 295
|
||||
#define ENDSEQVOL2SND2 296
|
||||
#define ENDSEQVOL2SND3 297
|
||||
#define ENDSEQVOL2SND4 298
|
||||
#define ENDSEQVOL2SND5 299
|
||||
#define ENDSEQVOL2SND6 300
|
||||
#define ENDSEQVOL2SND7 301
|
||||
#define GENERIC_AMBIENCE23 302
|
||||
#define SOMETHINGFROZE 303
|
||||
#define DUKE_LONGTERM_PAIN5 304
|
||||
#define DUKE_LONGTERM_PAIN6 305
|
||||
#define DUKE_LONGTERM_PAIN7 306
|
||||
#define DUKE_LONGTERM_PAIN8 307
|
||||
#define WIND_REPEAT 308
|
||||
#define MYENEMY_ROAM 309
|
||||
#define MYENEMY_HURT 310
|
||||
#define MYENEMY_DEAD 311
|
||||
#define MYENEMY_SHOOT 312
|
||||
#define STORE_MUSIC 313
|
||||
#define STORE_MUSIC_BROKE 314
|
||||
#define ACTOR_GROWING 315
|
||||
#define NEWBEAST_ROAM 316
|
||||
#define NEWBEAST_RECOG 317
|
||||
#define NEWBEAST_ATTACK 318
|
||||
#define NEWBEAST_PAIN 319
|
||||
#define NEWBEAST_DYING 320
|
||||
#define NEWBEAST_SPIT 321
|
||||
#define VOL4_1 322
|
||||
#define SUPERMARKET 323
|
||||
#define MOUSEANNOY 324
|
||||
#define BOOKEM 325
|
||||
#define SUPERMARKETCRY 326
|
||||
#define DESTRUCT 327
|
||||
#define EATFOOD 328
|
||||
#define MAKEMYDAY 329
|
||||
#define WITNESSSTAND 330
|
||||
#define VACATIONSPEECH 331
|
||||
#define YIPPEE1 332
|
||||
#define YOHOO1 333
|
||||
#define YOHOO2 334
|
||||
#define DOLPHINSND 335
|
||||
#define TOUGHGALSND1 336
|
||||
#define TOUGHGALSND2 337
|
||||
#define TOUGHGALSND3 338
|
||||
#define TOUGHGALSND4 339
|
||||
#define TANK_ROAM 340
|
||||
#define BOS4_ROAM 341
|
||||
#define BOS4_RECOG 342
|
||||
#define BOS4_ATTACK 343
|
||||
#define BOS4_PAIN 344
|
||||
#define BOS4_DYING 345
|
||||
#define NEWBEAST_ATTACKMISS 346
|
||||
#define VOL4_2 347
|
||||
#define COOKINGDEEPFRIER 348
|
||||
#define WHINING_DOG 349
|
||||
#define DEAD_DOG 350
|
||||
#define LIGHTNING_SLAP 351
|
||||
#define THUNDER 352
|
||||
#define HAPPYMOUSESND1 353
|
||||
#define HAPPYMOUSESND2 354
|
||||
#define HAPPYMOUSESND3 355
|
||||
#define HAPPYMOUSESND4 356
|
||||
#define ALARM 357
|
||||
#define RAIN 358
|
||||
#define DTAG_GREENRUN 359
|
||||
#define DTAG_BROWNRUN 360
|
||||
#define DTAG_GREENSCORE 361
|
||||
#define DTAG_BROWNSCORE 362
|
||||
#define INTRO4_1 363
|
||||
#define INTRO4_2 364
|
||||
#define INTRO4_3 365
|
||||
#define INTRO4_4 366
|
||||
#define INTRO4_5 367
|
||||
#define INTRO4_6 368
|
||||
#define SCREECH 369
|
||||
#define BOSS4_DEADSPEECH 370
|
||||
#define BOSS4_FIRSTSEE 371
|
||||
#define PARTY_SPEECH 372
|
||||
#define POSTAL_SPEECH 373
|
||||
#define TGSPEECH 374
|
||||
#define DOGROOMSPEECH 375
|
||||
#define SMACKED 376
|
||||
#define MDEVSPEECH 377
|
||||
#define AREA51SPEECH 378
|
||||
#define JEEPSOUND 379
|
||||
#define BIGDOORSLAM 380
|
||||
#define BOS4_LAY 381
|
||||
#define WAVESOUND 382
|
||||
#define ILLBEBACK 383
|
||||
#define VOL4ENDSND1 384
|
||||
#define VOL4ENDSND2 385
|
||||
#define EXPANDERHIT 386
|
||||
#define SNAKESPEECH 387
|
||||
#define EXPANDERSHOOT 388
|
||||
#define GETBACKTOWORK 389
|
||||
#define JIBBED_ACTOR14 390
|
||||
#define JIBBED_ACTOR15 391
|
||||
#define INTRO4_B 392
|
||||
#define BIGBANG 393
|
||||
#define SMACKIT 394
|
||||
#define BELLSND 395
|
||||
// MAXIMUM NUMBER OF SOUNDS: 450 ( 0-449 )
|
||||
|
|
|
@ -21,32 +21,32 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
//****************************************************************************
|
||||
//
|
||||
// sounds.h
|
||||
//
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef _sounds_public_
|
||||
#define _sounds_public_
|
||||
|
||||
void SoundStartup( void );
|
||||
void SoundShutdown( void );
|
||||
void MusicStartup( void );
|
||||
void MusicShutdown( void );
|
||||
void AudioUpdate(void);
|
||||
|
||||
struct audioenumdev {
|
||||
char *def;
|
||||
char **devs;
|
||||
struct audioenumdev *next;
|
||||
};
|
||||
struct audioenumdrv {
|
||||
char *def;
|
||||
char **drvs;
|
||||
struct audioenumdev *devs;
|
||||
};
|
||||
int EnumAudioDevs(struct audioenumdrv **wave, struct audioenumdev **midi, struct audioenumdev **cda);
|
||||
|
||||
#endif
|
||||
|
||||
//****************************************************************************
|
||||
//
|
||||
// sounds.h
|
||||
//
|
||||
//****************************************************************************
|
||||
|
||||
#ifndef _sounds_public_
|
||||
#define _sounds_public_
|
||||
|
||||
void SoundStartup( void );
|
||||
void SoundShutdown( void );
|
||||
void MusicStartup( void );
|
||||
void MusicShutdown( void );
|
||||
void AudioUpdate(void);
|
||||
|
||||
struct audioenumdev {
|
||||
char *def;
|
||||
char **devs;
|
||||
struct audioenumdev *next;
|
||||
};
|
||||
struct audioenumdrv {
|
||||
char *def;
|
||||
char **drvs;
|
||||
struct audioenumdev *devs;
|
||||
};
|
||||
int EnumAudioDevs(struct audioenumdrv **wave, struct audioenumdev **midi, struct audioenumdev **cda);
|
||||
|
||||
#endif
|
||||
|
|
0
polymer/eduke32/source/startgtk.game.c
Executable file → Normal file
0
polymer/eduke32/source/startgtk.game.c
Executable file → Normal file
0
polymer/eduke32/source/startwin.game.c
Executable file → Normal file
0
polymer/eduke32/source/startwin.game.c
Executable file → Normal file
0
polymer/eduke32/source/startwin.game.h
Executable file → Normal file
0
polymer/eduke32/source/startwin.game.h
Executable file → Normal file
0
polymer/eduke32/source/wrapper.c
Executable file → Normal file
0
polymer/eduke32/source/wrapper.c
Executable file → Normal file
0
polymer/eduke32/tiles.cfg
Executable file → Normal file
0
polymer/eduke32/tiles.cfg
Executable file → Normal file
Loading…
Reference in a new issue