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:
hnt_ts 2008-07-12 14:09:52 +00:00
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
View file

0
polymer/build/include/osxmain.h Executable file → Normal file
View file

0
polymer/build/include/startwin.editor.h Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cerrno Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cmath Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cstdarg Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cstdio Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cstdlib Executable file → Normal file
View file

0
polymer/build/include/watcomhax/cstring Executable file → Normal file
View file

0
polymer/build/include/watcomhax/ctime Executable file → Normal file
View file

0
polymer/build/src/StartupWinController.editor.m Executable file → Normal file
View 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
View file

View file

@ -1,33 +1,33 @@
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include "startwin.editor.h" #include "startwin.editor.h"
RSRC_ICON ICON "rsrc/build_icon.ico" RSRC_ICON ICON "rsrc/build_icon.ico"
RSRC_BMP BITMAP "rsrc/build.bmp" RSRC_BMP BITMAP "rsrc/build.bmp"
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 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 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
CAPTION "Startup" CAPTION "Startup"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 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 "", 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 "&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 "&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 CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
END END
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
CAPTION "Dialog" CAPTION "Dialog"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 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 "", 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 "&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 "&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 "", 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 CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
END END

View file

@ -1,31 +1,31 @@
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include "startwin.game.h" #include "startwin.game.h"
RSRC_ICON ICON "rsrc/game_icon.ico" RSRC_ICON ICON "rsrc/game_icon.ico"
RSRC_BMP BITMAP "rsrc/game.bmp" RSRC_BMP BITMAP "rsrc/game.bmp"
WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 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 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU
CAPTION "Startup" CAPTION "Startup"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 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 "", 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 "&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 "&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 CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32
END END
WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
CAPTION "Dialog" CAPTION "Dialog"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 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 "", 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 "&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 CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
END END

0
polymer/build/src/misc/gtkstartwin/gtkstartwin.glade Executable file → Normal file
View file

0
polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep Executable file → Normal file
View file

0
polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

0
polymer/build/src/startgtk.editor.c Executable file → Normal file
View file

0
polymer/build/src/startwin.editor.c Executable file → Normal file
View file

View file

@ -1,151 +1,151 @@
// BIN2C.CPP // BIN2C.CPP
// by Jonathon Fowler (jonof@edgenetwork.org) // by Jonathon Fowler (jonof@edgenetwork.org)
// Converts a binary file to C source // Converts a binary file to C source
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1 // This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <dir.h> #include <dir.h>
#include <io.h> #include <io.h>
#include <stdlib.h> #include <stdlib.h>
char defsrcext[] = ".DAT"; char defsrcext[] = ".DAT";
char defoutext[] = ".C"; char defoutext[] = ".C";
char source[MAXPATH], output[MAXPATH], bytesize; char source[MAXPATH], output[MAXPATH], bytesize;
int PathAddExt(char *path, char *ext); int PathAddExt(char *path, char *ext);
void main(int argc, char *argv[]) void main(int argc, char *argv[])
{ {
printf("BIN2C - Binary to C data converter\n" printf("BIN2C - Binary to C data converter\n"
"Copyright (c) 1999 Jonathon Fowler\n\n"); "Copyright (c) 1999 Jonathon Fowler\n\n");
if (argc < 4) if (argc < 4)
{ {
printf("Usage:\n" printf("Usage:\n"
" BIN2C source<.DAT> output<.C> b|w\n\n" " BIN2C source<.DAT> output<.C> b|w\n\n"
" source<.DAT> Binary source file\n" " source<.DAT> Binary source file\n"
" output<.C> Output C code file\n" " output<.C> Output C code file\n"
" b|w Byte or word-sized data\n\n"); " b|w Byte or word-sized data\n\n");
exit(0); exit(0);
} }
int arg; int arg;
FILE *in, *out; FILE *in, *out;
char datab1, datab2; char datab1, datab2;
int across=0, maxacross; int across=0, maxacross;
int length, written=0; int length, written=0;
// get the source file // get the source file
strcpy(source, argv[1]); strcpy(source, argv[1]);
strupr(source); strupr(source);
PathAddExt(source, defsrcext); PathAddExt(source, defsrcext);
printf("þ Source file: %s\n", source); printf("þ Source file: %s\n", source);
// get the output file // get the output file
strcpy(output, argv[2]); strcpy(output, argv[2]);
strupr(output); strupr(output);
PathAddExt(output, defoutext); PathAddExt(output, defoutext);
printf("þ Output file: %s\n", output); printf("þ Output file: %s\n", output);
// get byte/word data // get byte/word data
switch (tolower(argv[3][0])) switch (tolower(argv[3][0]))
{ {
case 'b': case 'b':
printf("þ Byte data.\n"); printf("þ Byte data.\n");
bytesize=1; bytesize=1;
break; break;
case 'w': case 'w':
printf("þ Word data.\n"); printf("þ Word data.\n");
bytesize=0; bytesize=0;
break; break;
default: default:
printf("þ Unknown data size specified. Defaulting to byte.\n"); printf("þ Unknown data size specified. Defaulting to byte.\n");
bytesize=1; bytesize=1;
break; break;
} }
// open the input file // open the input file
in = fopen(source, "rb"); in = fopen(source, "rb");
if (!in) if (!in)
{ {
printf("Error opening %s\n", source); printf("Error opening %s\n", source);
exit(1); exit(1);
} }
// open the output file // open the output file
out = fopen(output, "w+t"); out = fopen(output, "w+t");
if (!out) if (!out)
{ {
printf("Error creating %s\n", output); printf("Error creating %s\n", output);
exit(1); exit(1);
} }
length = filelength(fileno(in)); length = filelength(fileno(in));
// write a header out to the output file // write a header out to the output file
fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output); fprintf(out, "// %s\n\n// Generated by BIN2C.EXE\n// By Jonathon Fowler\n\n", output);
// start a data block // start a data block
fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length); fprintf(out, "%s datablock[] = {\n // %ld bytes", (bytesize) ? "char" : "unsigned", length);
if (bytesize) if (bytesize)
maxacross = 12; maxacross = 12;
else else
maxacross = 9; maxacross = 9;
across = maxacross; across = maxacross;
// convert the data // convert the data
for (written=0; written<length; written++) { for (written=0; written<length; written++) {
if (across == maxacross) if (across == maxacross)
{ {
fprintf(out, "\n "); fprintf(out, "\n ");
across = 0; across = 0;
} }
if (bytesize) if (bytesize)
{ {
datab1 = fgetc(in); datab1 = fgetc(in);
fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n'); fprintf(out, " 0x%02X%c", datab1, ((length-written)>1) ? ',' : '\n');
} else { } else {
datab1 = fgetc(in); datab1 = fgetc(in);
datab2 = fgetc(in); datab2 = fgetc(in);
fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n'); fprintf(out, " 0x%02X%02X%c", datab2, datab1, ((length-written)>2) ? ',' : '\n');
} }
across++; across++;
if (!bytesize) written++; if (!bytesize) written++;
} }
fprintf(out, " };"); fprintf(out, " };");
fclose(out); fclose(out);
fclose(in); fclose(in);
} }
// Add an extention to a path if one doesn't exist // Add an extention to a path if one doesn't exist
int PathAddExt(char *path, char *ext) int PathAddExt(char *path, char *ext)
{ {
char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT]; char drive[MAXDRIVE], dir[MAXDIR], name[MAXFILE], extn[MAXEXT];
int flags; int flags;
flags = fnsplit(path, drive, dir, name, extn); flags = fnsplit(path, drive, dir, name, extn);
if (!(flags & EXTENSION)) // tack on an extension if (!(flags & EXTENSION)) // tack on an extension
strcat(path, ext); strcat(path, ext);
return ((flags & EXTENSION) == 0); return ((flags & EXTENSION) == 0);
} }

View file

@ -1,171 +1,171 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken" // Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info. // See the included license file "BUILDLIC.TXT" for license info.
// //
// This file has been modified from Ken Silverman's original release // This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jonof@edgenetwk.com) // by Jonathon Fowler (jonof@edgenetwk.com)
#include "compat.h" #include "compat.h"
// Glibc doesn't provide this function, so for the sake of less ugliess // Glibc doesn't provide this function, so for the sake of less ugliess
// for all platforms, here's a replacement just for this program. // for all platforms, here's a replacement just for this program.
static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } } static void jstrupr(char *s) { while (*s) { *s = Btoupper(*s); s++; } }
#define MAXFILES 4096 #define MAXFILES 4096
static char buf[65536]; // These limits should be abolished one day static char buf[65536]; // These limits should be abolished one day
static int numfiles; static int numfiles;
static char filespec[MAXFILES][128], filelist[MAXFILES][16]; static char filespec[MAXFILES][128], filelist[MAXFILES][16];
static int fileleng[MAXFILES]; static int fileleng[MAXFILES];
static char *matchstr = "*.*"; static char *matchstr = "*.*";
int checkmatch(const struct Bdirent *a) int checkmatch(const struct Bdirent *a)
{ {
if (a->mode & BS_IFDIR) return 0; // is a directory if (a->mode & BS_IFDIR) return 0; // is a directory
if (a->namlen > 12) return 0; // name too long if (a->namlen > 12) return 0; // name too long
return Bwildmatch(a->name, matchstr); return Bwildmatch(a->name, matchstr);
} }
int filesize(const char *path, const char *name) int filesize(const char *path, const char *name)
{ {
char p[BMAX_PATH]; char p[BMAX_PATH];
struct stat st; struct stat st;
strcpy(p, path); strcpy(p, path);
strcat(p, "/"); strcat(p, "/");
strcat(p, name); strcat(p, name);
if (!stat(p, &st)) return st.st_size; if (!stat(p, &st)) return st.st_size;
return 0; return 0;
} }
void findfiles(const char *dafilespec) void findfiles(const char *dafilespec)
{ {
struct Bdirent *name; struct Bdirent *name;
int daspeclen; int daspeclen;
char daspec[128], *dir; char daspec[128], *dir;
BDIR *di; BDIR *di;
strcpy(daspec,dafilespec); strcpy(daspec,dafilespec);
daspeclen=strlen(daspec); daspeclen=strlen(daspec);
while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--; while ((daspec[daspeclen] != '\\') && (daspec[daspeclen] != '/') && (daspeclen > 0)) daspeclen--;
if (daspeclen > 0) { if (daspeclen > 0) {
daspec[daspeclen]=0; daspec[daspeclen]=0;
dir = daspec; dir = daspec;
matchstr = &daspec[daspeclen+1]; matchstr = &daspec[daspeclen+1];
} else { } else {
dir = "."; dir = ".";
matchstr = daspec; matchstr = daspec;
} }
di = Bopendir(dir); di = Bopendir(dir);
if (!di) return; if (!di) return;
while ((name = Breaddir(di))) { while ((name = Breaddir(di))) {
if (!checkmatch(name)) continue; if (!checkmatch(name)) continue;
strcpy(&filelist[numfiles][0],name->name); strcpy(&filelist[numfiles][0],name->name);
jstrupr(&filelist[numfiles][0]); jstrupr(&filelist[numfiles][0]);
fileleng[numfiles] = name->size; fileleng[numfiles] = name->size;
filelist[numfiles][12] = (char)(fileleng[numfiles]&255); filelist[numfiles][12] = (char)(fileleng[numfiles]&255);
filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255); filelist[numfiles][13] = (char)((fileleng[numfiles]>>8)&255);
filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255); filelist[numfiles][14] = (char)((fileleng[numfiles]>>16)&255);
filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255); filelist[numfiles][15] = (char)((fileleng[numfiles]>>24)&255);
strcpy(filespec[numfiles],dir); strcpy(filespec[numfiles],dir);
strcat(filespec[numfiles], "/"); strcat(filespec[numfiles], "/");
strcat(filespec[numfiles],name->name); strcat(filespec[numfiles],name->name);
numfiles++; numfiles++;
if (numfiles > MAXFILES) if (numfiles > MAXFILES)
{ {
printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n"); printf("FATAL ERROR: TOO MANY FILES SELECTED! (MAX is 4096)\n");
exit(0); exit(0);
} }
} }
Bclosedir(di); Bclosedir(di);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i, j, k, l, fil, fil2; int i, j, k, l, fil, fil2;
if (argc < 3) if (argc < 3)
{ {
printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n"); printf("KGROUP [grouped file][@file or filespec...] by Kenneth Silverman\n");
printf(" This program collects many files into 1 big uncompressed file called a\n"); printf(" This program collects many files into 1 big uncompressed file called a\n");
printf(" group file\n"); printf(" group file\n");
printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n"); printf(" Ex: kgroup stuff.dat *.art *.map *.k?? palette.dat tables.dat\n");
printf(" (stuff.dat is the group file, the rest are the files to add)\n"); printf(" (stuff.dat is the group file, the rest are the files to add)\n");
exit(0); exit(0);
} }
numfiles = 0; numfiles = 0;
for(i=argc-1;i>1;i--) for(i=argc-1;i>1;i--)
{ {
if (argv[i][0] == '@') if (argv[i][0] == '@')
{ {
if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1) if ((fil = Bopen(&argv[i][1],BO_BINARY|BO_RDONLY,BS_IREAD)) != -1)
{ {
l = Bread(fil,buf,65536); l = Bread(fil,buf,65536);
j = 0; j = 0;
while ((j < l) && (buf[j] <= 32)) j++; while ((j < l) && (buf[j] <= 32)) j++;
while (j < l) while (j < l)
{ {
k = j; k = j;
while ((k < l) && (buf[k] > 32)) k++; while ((k < l) && (buf[k] > 32)) k++;
buf[k] = 0; buf[k] = 0;
findfiles(&buf[j]); findfiles(&buf[j]);
j = k+1; j = k+1;
while ((j < l) && (buf[j] <= 32)) j++; while ((j < l) && (buf[j] <= 32)) j++;
} }
Bclose(fil); Bclose(fil);
} }
} }
else else
findfiles(argv[i]); findfiles(argv[i]);
} }
if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) if ((fil = Bopen(argv[1],BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
{ {
printf("Error: %s could not be opened\n",argv[1]); printf("Error: %s could not be opened\n",argv[1]);
exit(0); exit(0);
} }
Bwrite(fil,"KenSilverman",12); Bwrite(fil,"KenSilverman",12);
Bwrite(fil,&numfiles,4); Bwrite(fil,&numfiles,4);
Bwrite(fil,filelist,numfiles<<4); Bwrite(fil,filelist,numfiles<<4);
for(i=0;i<numfiles;i++) for(i=0;i<numfiles;i++)
{ {
printf("Adding %s...\n",filespec[i]); printf("Adding %s...\n",filespec[i]);
if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1) if ((fil2 = Bopen(filespec[i],BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
{ {
printf("Error: %s not found\n",filespec[i]); printf("Error: %s not found\n",filespec[i]);
Bclose(fil); Bclose(fil);
return(0); return(0);
} }
for(j=0;j<fileleng[i];j+=65536) for(j=0;j<fileleng[i];j+=65536)
{ {
k = min(fileleng[i]-j,65536); k = min(fileleng[i]-j,65536);
Bread(fil2,buf,k); Bread(fil2,buf,k);
if (Bwrite(fil,buf,k) < k) if (Bwrite(fil,buf,k) < k)
{ {
Bclose(fil2); Bclose(fil2);
Bclose(fil); Bclose(fil);
printf("OUT OF HD SPACE!\n"); printf("OUT OF HD SPACE!\n");
return(0); return(0);
} }
} }
Bclose(fil2); Bclose(fil2);
} }
Bclose(fil); Bclose(fil);
printf("Saved to %s.\n",argv[1]); printf("Saved to %s.\n",argv[1]);
return 0; return 0;
} }

View file

@ -1,58 +1,58 @@
#if 0 #if 0
kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98 kmd2tool.exe: kmd2tool.c; cl kmd2tool.c /Ox /G6fy /MD /link /opt:nowin98
del kmd2tool.obj del kmd2tool.obj
!if 0 !if 0
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <io.h> #include <io.h>
#include <math.h> #include <math.h>
typedef struct { float x, y, z; } point3d; typedef struct { float x, y, z; } point3d;
typedef struct typedef struct
{ int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8 { int id, vers, skinxsiz, skinysiz, framebytes; //id:"IPD2", vers:8
int numskins, numverts, numuv, numtris, numglcmds, numframes; int numskins, numverts, numuv, numtris, numglcmds, numframes;
int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each) int ofsskins, ofsuv, ofstris, ofsframes, ofsglcmds, ofseof; //ofsskins: skin names (64 bytes each)
} md2typ; } md2typ;
typedef struct { point3d mul, add; } frametyp; typedef struct { point3d mul, add; } frametyp;
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
FILE *fil; FILE *fil;
int i, leng; int i, leng;
char *fbuf; char *fbuf;
md2typ *head; md2typ *head;
frametyp *fptr; frametyp *fptr;
if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); } if (argc != 4) { puts("KMD2TOOL [MD2 in file] [MD2 out file] [z offset] by Ken Silverman"); return(0); }
if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); } if (!stricmp(argv[1],argv[2])) { puts("input&output filenames can't be same"); return(0); }
fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); } fil = fopen(argv[1],"rb"); if (!fil) { puts("error"); return(0); }
leng = filelength(_fileno(fil)); leng = filelength(_fileno(fil));
fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); } fbuf = (char *)malloc(leng); if (!fbuf) { puts("error"); return(0); }
fread(fbuf,leng,1,fil); fread(fbuf,leng,1,fil);
fclose(fil); fclose(fil);
head = (md2typ *)fbuf; head = (md2typ *)fbuf;
if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2" if ((head->id != 0x32504449) && (head->vers != 8)) { free(fbuf); puts("error"); return(0); } //"IDP2"
for(i=0;i<head->numframes;i++) for(i=0;i<head->numframes;i++)
{ {
fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i]; fptr = (frametyp *)&fbuf[head->ofsframes+head->framebytes*i];
printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z); printf("frame %2d scale:%f,%f,%f offs:%f,%f,%f\n",i,fptr->mul.x,fptr->mul.y,fptr->mul.z,fptr->add.x,fptr->add.y,fptr->add.z);
fptr->add.z += atof(argv[3]); fptr->add.z += atof(argv[3]);
} }
fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); } fil = fopen(argv[2],"wb"); if (!fil) { puts("error"); return(0); }
fwrite(fbuf,leng,1,fil); fwrite(fbuf,leng,1,fil);
fclose(fil); fclose(fil);
free(fbuf); free(fbuf);
return(0); return(0);
} }
#if 0 #if 0
!endif !endif
#endif #endif

View file

@ -1,270 +1,270 @@
// "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman // "Build Engine & Tools" Copyright (c) 1993-1997 Ken Silverman
// Ken Silverman's official web site: "http://www.advsys.net/ken" // Ken Silverman's official web site: "http://www.advsys.net/ken"
// See the included license file "BUILDLIC.TXT" for license info. // See the included license file "BUILDLIC.TXT" for license info.
// //
// This file has been modified from Ken Silverman's original release // This file has been modified from Ken Silverman's original release
// by Jonathon Fowler (jonof@edgenetwk.com) // by Jonathon Fowler (jonof@edgenetwk.com)
#include "compat.h" #include "compat.h"
#include "pragmas.h" #include "pragmas.h"
#define MAXPALOOKUPS 256 #define MAXPALOOKUPS 256
static int numpalookups, transratio; static int numpalookups, transratio;
static char palettefilename[13], origpalookup[MAXPALOOKUPS<<8]; static char palettefilename[13], origpalookup[MAXPALOOKUPS<<8];
static char palette[768], palookup[MAXPALOOKUPS<<8], transluc[65536]; static char palette[768], palookup[MAXPALOOKUPS<<8], transluc[65536];
static char closestcol[64][64][64]; static char closestcol[64][64][64];
#define FASTPALGRIDSIZ 8 #define FASTPALGRIDSIZ 8
static int rdist[129], gdist[129], bdist[129]; static int rdist[129], gdist[129], bdist[129];
static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3]; static char colhere[((FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2))>>3];
static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)]; static char colhead[(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)*(FASTPALGRIDSIZ+2)];
static int colnext[256]; static int colnext[256];
static char coldist[8] = {0,1,2,3,4,3,2,1}; static char coldist[8] = {0,1,2,3,4,3,2,1};
static int colscan[27]; static int colscan[27];
char getclosestcol(int r, int g, int b) char getclosestcol(int r, int g, int b)
{ {
int i, j, k, dist, mindist, retcol; int i, j, k, dist, mindist, retcol;
int *rlookup, *glookup, *blookup; int *rlookup, *glookup, *blookup;
char *ptr; char *ptr;
if (closestcol[r][g][b] != 255) return(closestcol[r][g][b]); if (closestcol[r][g][b] != 255) return(closestcol[r][g][b]);
j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; j = (r>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(g>>3)*FASTPALGRIDSIZ+(b>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]); mindist = min(rdist[coldist[r&7]+64+8],gdist[coldist[g&7]+64+8]);
mindist = min(mindist,bdist[coldist[b&7]+64+8]); mindist = min(mindist,bdist[coldist[b&7]+64+8]);
mindist++; mindist++;
rlookup = (int *)&rdist[64-r]; rlookup = (int *)&rdist[64-r];
glookup = (int *)&gdist[64-g]; glookup = (int *)&gdist[64-g];
blookup = (int *)&bdist[64-b]; blookup = (int *)&bdist[64-b];
retcol = -1; retcol = -1;
for(k=26;k>=0;k--) for(k=26;k>=0;k--)
{ {
i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue; i = colscan[k]+j; if ((colhere[i>>3]&(1<<(i&7))) == 0) continue;
for(i=colhead[i];i>=0;i=colnext[i]) for(i=colhead[i];i>=0;i=colnext[i])
{ {
ptr = (char *)&palette[i*3]; ptr = (char *)&palette[i*3];
dist = glookup[ptr[1]]; if (dist >= mindist) continue; dist = glookup[ptr[1]]; if (dist >= mindist) continue;
dist += rlookup[ptr[0]]; if (dist >= mindist) continue; dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
dist += blookup[ptr[2]]; if (dist >= mindist) continue; dist += blookup[ptr[2]]; if (dist >= mindist) continue;
mindist = dist; retcol = i; mindist = dist; retcol = i;
} }
} }
if (retcol < 0) if (retcol < 0)
{ {
mindist = 0x7fffffff; mindist = 0x7fffffff;
ptr = (char *)&palette[768-3]; ptr = (char *)&palette[768-3];
for(i=255;i>=0;i--,ptr-=3) for(i=255;i>=0;i--,ptr-=3)
{ {
dist = glookup[ptr[1]]; if (dist >= mindist) continue; dist = glookup[ptr[1]]; if (dist >= mindist) continue;
dist += rlookup[ptr[0]]; if (dist >= mindist) continue; dist += rlookup[ptr[0]]; if (dist >= mindist) continue;
dist += blookup[ptr[2]]; if (dist >= mindist) continue; dist += blookup[ptr[2]]; if (dist >= mindist) continue;
mindist = dist; retcol = i; mindist = dist; retcol = i;
} }
} }
ptr = (char *)&closestcol[r][g][b]; ptr = (char *)&closestcol[r][g][b];
*ptr = retcol; *ptr = retcol;
if ((r >= 4) && (ptr[(-2)<<12] == retcol)) ptr[(-3)<<12] = retcol, ptr[(-2)<<12] = retcol, ptr[(-1)<<12] = retcol; if ((r >= 4) && (ptr[(-2)<<12] == retcol)) ptr[(-3)<<12] = retcol, ptr[(-2)<<12] = retcol, ptr[(-1)<<12] = retcol;
if ((g >= 4) && (ptr[(-2)<<6] == retcol)) ptr[(-3)<<6] = retcol, ptr[(-2)<<6] = retcol, ptr[(-1)<<6] = retcol; if ((g >= 4) && (ptr[(-2)<<6] == retcol)) ptr[(-3)<<6] = retcol, ptr[(-2)<<6] = retcol, ptr[(-1)<<6] = retcol;
if ((b >= 4) && (ptr[(-2)] == retcol)) ptr[(-3)] = retcol, ptr[(-2)] = retcol, ptr[(-1)] = retcol; if ((b >= 4) && (ptr[(-2)] == retcol)) ptr[(-3)] = retcol, ptr[(-2)] = retcol, ptr[(-1)] = retcol;
if ((r < 64-4) && (ptr[(2)<<12] == retcol)) ptr[(3)<<12] = retcol, ptr[(2)<<12] = retcol, ptr[(1)<<12] = retcol; if ((r < 64-4) && (ptr[(2)<<12] == retcol)) ptr[(3)<<12] = retcol, ptr[(2)<<12] = retcol, ptr[(1)<<12] = retcol;
if ((g < 64-4) && (ptr[(2)<<6] == retcol)) ptr[(3)<<6] = retcol, ptr[(2)<<6] = retcol, ptr[(1)<<6] = retcol; if ((g < 64-4) && (ptr[(2)<<6] == retcol)) ptr[(3)<<6] = retcol, ptr[(2)<<6] = retcol, ptr[(1)<<6] = retcol;
if ((b < 64-4) && (ptr[(2)] == retcol)) ptr[(3)] = retcol, ptr[(2)] = retcol, ptr[(1)] = retcol; if ((b < 64-4) && (ptr[(2)] == retcol)) ptr[(3)] = retcol, ptr[(2)] = retcol, ptr[(1)] = retcol;
if ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol; if ((r >= 2) && (ptr[(-1)<<12] == retcol)) ptr[(-1)<<12] = retcol;
if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol; if ((g >= 2) && (ptr[(-1)<<6] == retcol)) ptr[(-1)<<6] = retcol;
if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = retcol; if ((b >= 2) && (ptr[(-1)] == retcol)) ptr[(-1)] = retcol;
if ((r < 64-2) && (ptr[(1)<<12] == retcol)) ptr[(1)<<12] = retcol; if ((r < 64-2) && (ptr[(1)<<12] == retcol)) ptr[(1)<<12] = retcol;
if ((g < 64-2) && (ptr[(1)<<6] == retcol)) ptr[(1)<<6] = retcol; if ((g < 64-2) && (ptr[(1)<<6] == retcol)) ptr[(1)<<6] = retcol;
if ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol; if ((b < 64-2) && (ptr[(1)] == retcol)) ptr[(1)] = retcol;
return(retcol); return(retcol);
} }
char getpalookup(char dashade, char dacol) char getpalookup(char dashade, char dacol)
{ {
int r, g, b, t; int r, g, b, t;
char *ptr; char *ptr;
ptr = (char *)&palette[dacol*3]; ptr = (char *)&palette[dacol*3];
t = divscale16(numpalookups-dashade,numpalookups); t = divscale16(numpalookups-dashade,numpalookups);
r = ((ptr[0]*t+32768)>>16); r = ((ptr[0]*t+32768)>>16);
g = ((ptr[1]*t+32768)>>16); g = ((ptr[1]*t+32768)>>16);
b = ((ptr[2]*t+32768)>>16); b = ((ptr[2]*t+32768)>>16);
return(getclosestcol(r,g,b)); return(getclosestcol(r,g,b));
} }
char gettrans(char dat1, char dat2, int datransratio) char gettrans(char dat1, char dat2, int datransratio)
{ {
int r, g, b; int r, g, b;
char *ptr, *ptr2; char *ptr, *ptr2;
ptr = (char *)&palette[dat1*3]; ptr = (char *)&palette[dat1*3];
ptr2 = (char *)&palette[dat2*3]; ptr2 = (char *)&palette[dat2*3];
r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8); r = ptr[0]; r += (((ptr2[0]-r)*datransratio+128)>>8);
g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8); g = ptr[1]; g += (((ptr2[1]-g)*datransratio+128)>>8);
b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8); b = ptr[2]; b += (((ptr2[2]-b)*datransratio+128)>>8);
return(getclosestcol(r,g,b)); return(getclosestcol(r,g,b));
} }
void initfastcolorlookup(int rscale, int gscale, int bscale) void initfastcolorlookup(int rscale, int gscale, int bscale)
{ {
int i, j, x, y, z; int i, j, x, y, z;
char *ptr; char *ptr;
j = 0; j = 0;
for(i=64;i>=0;i--) for(i=64;i>=0;i--)
{ {
//j = (i-64)*(i-64); //j = (i-64)*(i-64);
rdist[i] = rdist[128-i] = j*rscale; rdist[i] = rdist[128-i] = j*rscale;
gdist[i] = gdist[128-i] = j*gscale; gdist[i] = gdist[128-i] = j*gscale;
bdist[i] = bdist[128-i] = j*bscale; bdist[i] = bdist[128-i] = j*bscale;
j += 129-(i<<1); j += 129-(i<<1);
} }
clearbufbyte(FP_OFF(colhere),sizeof(colhere),0L); clearbufbyte(FP_OFF(colhere),sizeof(colhere),0L);
clearbufbyte(FP_OFF(colhead),sizeof(colhead),0L); clearbufbyte(FP_OFF(colhead),sizeof(colhead),0L);
ptr = (char *)&palette[768-3]; ptr = (char *)&palette[768-3];
for(i=255;i>=0;i--,ptr-=3) for(i=255;i>=0;i--,ptr-=3)
{ {
j = (ptr[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(ptr[1]>>3)*FASTPALGRIDSIZ+(ptr[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1; j = (ptr[0]>>3)*FASTPALGRIDSIZ*FASTPALGRIDSIZ+(ptr[1]>>3)*FASTPALGRIDSIZ+(ptr[2]>>3)+FASTPALGRIDSIZ*FASTPALGRIDSIZ+FASTPALGRIDSIZ+1;
if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1; if (colhere[j>>3]&(1<<(j&7))) colnext[i] = colhead[j]; else colnext[i] = -1;
colhead[j] = i; colhead[j] = i;
colhere[j>>3] |= (1<<(j&7)); colhere[j>>3] |= (1<<(j&7));
} }
i = 0; i = 0;
for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ) for(x=-FASTPALGRIDSIZ*FASTPALGRIDSIZ;x<=FASTPALGRIDSIZ*FASTPALGRIDSIZ;x+=FASTPALGRIDSIZ*FASTPALGRIDSIZ)
for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ) for(y=-FASTPALGRIDSIZ;y<=FASTPALGRIDSIZ;y+=FASTPALGRIDSIZ)
for(z=-1;z<=1;z++) for(z=-1;z<=1;z++)
colscan[i++] = x+y+z; colscan[i++] = x+y+z;
i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i; i = colscan[13]; colscan[13] = colscan[26]; colscan[26] = i;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char col, ch; char col, ch;
short orignumpalookups; short orignumpalookups;
int fil, i, j, rscale, gscale, bscale; int fil, i, j, rscale, gscale, bscale;
char buf[65536]; char buf[65536];
ch = 13; ch = 13;
if (argc>1) { if (argc>1) {
if (argv[1][0] == '-') { if (argv[1][0] == '-') {
if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); } if (argv[1][1] == 't') { ch = 32; puts("Updating translucency table ONLY"); }
argc--; argc--;
argv++; argv++;
} }
} }
if ((argc != 3) && (argc != 6)) if ((argc != 3) && (argc != 6))
{ {
printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n"); printf("TRANSPAL [-t] [numshades][trans#(0-inv,256-opa)][r][g][b] by Kenneth Silverman\n");
printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n"); printf(" Ex #1: transpal 32 170 30 59 11 (I use these values in my BUILD demo)\n");
printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n"); printf(" ÀÄÄÁÄÄÁÄÄÄ The RGB scales are optional\n");
printf(" Ex #2: transpal 64 160\n\n"); printf(" Ex #2: transpal 64 160\n\n");
printf("Once tables are generated, the optional -t switch determines what to save:\n"); printf("Once tables are generated, the optional -t switch determines what to save:\n");
printf(" Exclude -t to update both the shade table and transluscent table\n"); printf(" Exclude -t to update both the shade table and transluscent table\n");
printf(" Include -t to update the transluscent table ONLY\n"); printf(" Include -t to update the transluscent table ONLY\n");
exit(0); exit(0);
} }
strcpy(palettefilename,"palette.dat"); strcpy(palettefilename,"palette.dat");
numpalookups = atol(argv[1]); numpalookups = atol(argv[1]);
transratio = atol(argv[2]); transratio = atol(argv[2]);
if (argc == 6) if (argc == 6)
{ {
rscale = atol(argv[3]); rscale = atol(argv[3]);
gscale = atol(argv[4]); gscale = atol(argv[4]);
bscale = atol(argv[5]); bscale = atol(argv[5]);
} }
else else
{ {
rscale = 30; rscale = 30;
gscale = 59; gscale = 59;
bscale = 11; bscale = 11;
} }
if ((numpalookups < 1) || (numpalookups > 256)) if ((numpalookups < 1) || (numpalookups > 256))
{ printf("Invalid number of shades\n"); exit(0); } { printf("Invalid number of shades\n"); exit(0); }
if ((transratio < 0) || (transratio > 256)) if ((transratio < 0) || (transratio > 256))
{ printf("Invalid transluscent ratio\n"); exit(0); } { printf("Invalid transluscent ratio\n"); exit(0); }
if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1) if ((fil = Bopen(palettefilename,BO_BINARY|BO_RDONLY,BS_IREAD)) == -1)
{ {
printf("%s not found",palettefilename); printf("%s not found",palettefilename);
return(0); return(0);
} }
Bread(fil,palette,768); Bread(fil,palette,768);
Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups); Bread(fil,&orignumpalookups,2); orignumpalookups = B_LITTLE16(orignumpalookups);
orignumpalookups = min(max(orignumpalookups,1),256); orignumpalookups = min(max(orignumpalookups,1),256);
Bread(fil,origpalookup,(int)orignumpalookups<<8); Bread(fil,origpalookup,(int)orignumpalookups<<8);
Bclose(fil); Bclose(fil);
clearbuf(buf,65536>>2,0L); clearbuf(buf,65536>>2,0L);
initfastcolorlookup(rscale,gscale,bscale); initfastcolorlookup(rscale,gscale,bscale);
clearbuf(closestcol,262144>>2,0xffffffff); clearbuf(closestcol,262144>>2,0xffffffff);
for(i=0;i<numpalookups;i++) for(i=0;i<numpalookups;i++)
for(j=0;j<256;j++) for(j=0;j<256;j++)
{ {
col = getpalookup((char)i,(char)j); col = getpalookup((char)i,(char)j);
palookup[(i<<8)+j] = col; palookup[(i<<8)+j] = col;
drawpixel(((((i<<1)+0)*320+(j+8))>>2)+buf,(int)col); drawpixel(((((i<<1)+0)*320+(j+8))>>2)+buf,(int)col);
drawpixel(((((i<<1)+1)*320+(j+8))>>2)+buf,(int)col); drawpixel(((((i<<1)+1)*320+(j+8))>>2)+buf,(int)col);
} }
for(i=0;i<256;i++) for(i=0;i<256;i++)
for(j=0;j<6;j++) for(j=0;j<6;j++)
{ {
drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i); drawpixel((((j+132+0)*320+(i+8))>>2)+buf,i);
drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i); drawpixel((((i+132+8)*320+(j+0))>>2)+buf,i);
} }
for(i=0;i<256;i++) for(i=0;i<256;i++)
for(j=0;j<256;j++) for(j=0;j<256;j++)
{ {
col = gettrans((char)i,(char)j,transratio); col = gettrans((char)i,(char)j,transratio);
transluc[(i<<8)+j] = col; transluc[(i<<8)+j] = col;
drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col); drawpixel((((j+132+8)*320+(i+8))>>2)+buf,(int)col);
} }
if (ch == 13) if (ch == 13)
{ {
short s; short s;
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
{ printf("Couldn't save file %s",palettefilename); return(0); } { printf("Couldn't save file %s",palettefilename); return(0); }
Bwrite(fil,palette,768); Bwrite(fil,palette,768);
s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2); s = B_LITTLE16(numpalookups); Bwrite(fil,&s,2);
Bwrite(fil,palookup,numpalookups<<8); Bwrite(fil,palookup,numpalookups<<8);
Bwrite(fil,transluc,65536); Bwrite(fil,transluc,65536);
Bclose(fil); Bclose(fil);
printf("Shade table AND transluscent table updated\n"); printf("Shade table AND transluscent table updated\n");
} }
else if (ch == 32) else if (ch == 32)
{ {
short s; short s;
if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) if ((fil = Bopen(palettefilename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
{ printf("Couldn't save file %s",palettefilename); return(0); } { printf("Couldn't save file %s",palettefilename); return(0); }
Bwrite(fil,palette,768); Bwrite(fil,palette,768);
s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2); s = B_LITTLE16(orignumpalookups); Bwrite(fil,&s,2);
Bwrite(fil,origpalookup,(int)orignumpalookups<<8); Bwrite(fil,origpalookup,(int)orignumpalookups<<8);
Bwrite(fil,transluc,65536); Bwrite(fil,transluc,65536);
Bclose(fil); Bclose(fil);
printf("Transluscent table updated\n"); printf("Transluscent table updated\n");
} }
else else
printf("Palette file wasn't touched\n"); printf("Palette file wasn't touched\n");
return 0; return 0;
} }

View file

@ -1,139 +1,139 @@
// VGA Font Grabber // VGA Font Grabber
// Copyright (c) 1997 Jonathon Fowler // Copyright (c) 1997 Jonathon Fowler
// This is a DOS program originally written with Borland Turbo C++ for DOS 3.1 // This is a DOS program originally written with Borland Turbo C++ for DOS 3.1
#include <dos.h> #include <dos.h>
#include <stdio.h> #include <stdio.h>
void main(void) void main(void)
{ {
int font, width, height, numchars; int font, width, height, numchars;
struct REGPACK r; struct REGPACK r;
FILE *fp; FILE *fp;
printf("VGA Font Grabber\n" printf("VGA Font Grabber\n"
"Copyright (c) 1997 Jonathon Fowler\n"); "Copyright (c) 1997 Jonathon Fowler\n");
do { do {
printf("\nSelect which font to grab:\n" printf("\nSelect which font to grab:\n"
" 1. 8-by-8 ROM\n" " 1. 8-by-8 ROM\n"
" 2. 8-by-14 ROM\n" " 2. 8-by-14 ROM\n"
" 3. 8-by-16 ROM\n" " 3. 8-by-16 ROM\n"
" 4. 9-by-16 ROM\n" " 4. 9-by-16 ROM\n"
" 5. 9-by-14 ROM\n" " 5. 9-by-14 ROM\n"
" 6. Quit\n" " 6. Quit\n"
" > "); " > ");
scanf("%d",&font); scanf("%d",&font);
switch (font) { switch (font) {
case 1: case 1:
printf("Getting 8-by-8 ROM font..."); printf("Getting 8-by-8 ROM font...");
if ((fp = fopen("88vga.dat", "wb")) != NULL) { if ((fp = fopen("88vga.dat", "wb")) != NULL) {
width = 8; width = 8;
height = 8; height = 8;
numchars = 256; numchars = 256;
r.r_ax = 0x1130; // locate the font (1st half) r.r_ax = 0x1130; // locate the font (1st half)
r.r_bx = 0x0300; r.r_bx = 0x0300;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
r.r_ax = 0x1130; // locate the font (2nd half) r.r_ax = 0x1130; // locate the font (2nd half)
r.r_bx = 0x0400; r.r_bx = 0x0400;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (8 * 128), fp);
fclose(fp); fclose(fp);
} }
printf("Done\n"); printf("Done\n");
break; break;
case 2: case 2:
printf("Getting 8-by-14 ROM font..."); printf("Getting 8-by-14 ROM font...");
if ((fp = fopen("814vga.dat", "wb")) != NULL) { if ((fp = fopen("814vga.dat", "wb")) != NULL) {
width = 8; width = 8;
height = 14; height = 14;
numchars = 256; numchars = 256;
r.r_ax = 0x1130; // locate the font r.r_ax = 0x1130; // locate the font
r.r_bx = 0x0200; r.r_bx = 0x0200;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256), fp);
fclose(fp); fclose(fp);
} }
printf("Done\n"); printf("Done\n");
break; break;
case 3: case 3:
printf("Getting 8-by-16 ROM font..."); printf("Getting 8-by-16 ROM font...");
if ((fp = fopen("816vga.dat", "wb")) != NULL) { if ((fp = fopen("816vga.dat", "wb")) != NULL) {
width = 8; width = 8;
height = 16; height = 16;
numchars = 256; numchars = 256;
r.r_ax = 0x1130; // locate the font r.r_ax = 0x1130; // locate the font
r.r_bx = 0x0600; r.r_bx = 0x0600;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256), fp);
fclose(fp); fclose(fp);
} }
printf("Done\n"); printf("Done\n");
break; break;
case 4: case 4:
printf("Getting 9-by-16 ROM font..."); printf("Getting 9-by-16 ROM font...");
if ((fp = fopen("916vga.dat", "wb")) != NULL) { if ((fp = fopen("916vga.dat", "wb")) != NULL) {
width = 9; width = 9;
height = 16; height = 16;
numchars = 256; numchars = 256;
r.r_ax = 0x1130; // locate the font r.r_ax = 0x1130; // locate the font
r.r_bx = 0x0700; r.r_bx = 0x0700;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (16 * 256) *2, fp);
fclose(fp); fclose(fp);
} }
printf("Done\n"); printf("Done\n");
break; break;
case 5: case 5:
printf("Getting 9-by-14 ROM font..."); printf("Getting 9-by-14 ROM font...");
if ((fp = fopen("914vga.dat", "wb")) != NULL) { if ((fp = fopen("914vga.dat", "wb")) != NULL) {
width = 9; width = 9;
height = 16; height = 16;
numchars = 256; numchars = 256;
r.r_ax = 0x1130; // locate the font r.r_ax = 0x1130; // locate the font
r.r_bx = 0x0500; r.r_bx = 0x0500;
intr(0x10, &r); intr(0x10, &r);
fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp); fwrite(MK_FP(r.r_es, r.r_bp), 1, (14 * 256)* 2, fp);
fclose(fp); fclose(fp);
} }
printf("Done\n"); printf("Done\n");
break; break;
case 6: case 6:
break; break;
default: default:
printf("Please try again\n"); printf("Please try again\n");
break; break;
} }
} while (font != 6); } while (font != 6);
} }

0
polymer/eduke32/buildlic.txt Executable file → Normal file
View file

0
polymer/eduke32/eobj_win/keep.me Executable file → Normal file
View file

0
polymer/eduke32/installer/eduke32.nsi Executable file → Normal file
View file

0
polymer/eduke32/names.h Executable file → Normal file
View file

0
polymer/eduke32/obj_win/keep.me Executable file → Normal file
View file

0
polymer/eduke32/rsrc/manifest.build.xml Executable file → Normal file
View file

0
polymer/eduke32/rsrc/manifest.game.xml Executable file → Normal file
View file

0
polymer/eduke32/source/gamevars.c Executable file → Normal file
View file

0
polymer/eduke32/source/grpscan.c Executable file → Normal file
View file

0
polymer/eduke32/source/grpscan.h Executable file → Normal file
View file

File diff suppressed because it is too large Load diff

0
polymer/eduke32/source/jaudiolib/debugio.h Executable file → Normal file
View file

0
polymer/eduke32/source/jaudiolib/dsl.c Executable file → Normal file
View file

0
polymer/eduke32/source/jaudiolib/dsl.h Executable file → Normal file
View file

0
polymer/eduke32/source/jaudiolib/interrup.h Executable file → Normal file
View file

View file

@ -1,103 +1,103 @@
/* /*
Copyright (C) 1994-1995 Apogee Software, Ltd. Copyright (C) 1994-1995 Apogee Software, Ltd.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/ */
/********************************************************************** /**********************************************************************
module: LL_MAN.C module: LL_MAN.C
author: James R. Dose author: James R. Dose
date: January 1, 1994 date: January 1, 1994
Linked list management routines. Linked list management routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved. (c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/ **********************************************************************/
#include <stddef.h> #include <stddef.h>
#include "ll_man.h" #include "ll_man.h"
#define OFFSET( structure, offset ) \ #define OFFSET( structure, offset ) \
( *( ( char ** )&( structure )[ offset ] ) ) ( *( ( char ** )&( structure )[ offset ] ) )
/********************************************************************** /**********************************************************************
Memory locked functions: Memory locked functions:
**********************************************************************/ **********************************************************************/
void LL_AddNode void LL_AddNode
( (
char *item, char *item,
char **head, char **head,
char **tail, char **tail,
int next, int next,
int prev int prev
) )
{ {
OFFSET(item, prev) = NULL; OFFSET(item, prev) = NULL;
OFFSET(item, next) = *head; OFFSET(item, next) = *head;
if (*head) if (*head)
{ {
OFFSET(*head, prev) = item; OFFSET(*head, prev) = item;
} }
else else
{ {
*tail = item; *tail = item;
} }
*head = item; *head = item;
} }
void LL_RemoveNode void LL_RemoveNode
( (
char *item, char *item,
char **head, char **head,
char **tail, char **tail,
int next, int next,
int prev int prev
) )
{ {
if (OFFSET(item, prev) == NULL) if (OFFSET(item, prev) == NULL)
{ {
*head = OFFSET(item, next); *head = OFFSET(item, next);
} }
else else
{ {
OFFSET(OFFSET(item, prev), next) = OFFSET(item, next); OFFSET(OFFSET(item, prev), next) = OFFSET(item, next);
} }
if (OFFSET(item, next) == NULL) if (OFFSET(item, next) == NULL)
{ {
*tail = OFFSET(item, prev); *tail = OFFSET(item, prev);
} }
else else
{ {
OFFSET(OFFSET(item, next), prev) = OFFSET(item, prev); OFFSET(OFFSET(item, next), prev) = OFFSET(item, prev);
} }
OFFSET(item, next) = NULL; OFFSET(item, next) = NULL;
OFFSET(item, prev) = NULL; OFFSET(item, prev) = NULL;
} }

View file

@ -1,495 +1,495 @@
/* /*
Copyright (C) 1994-1995 Apogee Software, Ltd. Copyright (C) 1994-1995 Apogee Software, Ltd.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/ */
/********************************************************************** /**********************************************************************
module: MPU401.C module: MPU401.C
author: James R. Dose author: James R. Dose
date: January 1, 1994 date: January 1, 1994
Low level routines to support sending of MIDI data to MPU401 Low level routines to support sending of MIDI data to MPU401
compatible MIDI interfaces. compatible MIDI interfaces.
(c) Copyright 1994 James R. Dose. All Rights Reserved. (c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/ **********************************************************************/
#include "mpu401.h" #include "mpu401.h"
#include "compat.h" #include "compat.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
static HMIDISTRM hmido = (HMIDISTRM)-1; static HMIDISTRM hmido = (HMIDISTRM)-1;
static MIDIOUTCAPS midicaps; static MIDIOUTCAPS midicaps;
static DWORD mididevice = -1; static DWORD mididevice = -1;
typedef struct typedef struct
{ {
int time; int time;
int stream; int stream;
int event; int event;
} }
MIDIEVENTHEAD; MIDIEVENTHEAD;
#define PAD(x) ((((x)+3)&(~3))) #define PAD(x) ((((x)+3)&(~3)))
#define BUFFERLEN (32*4*4) #define BUFFERLEN (32*4*4)
#define NUMBUFFERS 6 #define NUMBUFFERS 6
static char eventbuf[NUMBUFFERS][BUFFERLEN]; static char eventbuf[NUMBUFFERS][BUFFERLEN];
static int eventcnt[NUMBUFFERS]; static int eventcnt[NUMBUFFERS];
static MIDIHDR bufferheaders[NUMBUFFERS]; static MIDIHDR bufferheaders[NUMBUFFERS];
int _MPU_CurrentBuffer = 0; int _MPU_CurrentBuffer = 0;
int _MPU_BuffersWaiting = 0; int _MPU_BuffersWaiting = 0;
extern unsigned int _MIDI_GlobalPositionInTicks; extern unsigned int _MIDI_GlobalPositionInTicks;
unsigned int _MPU_LastEvent=0; unsigned int _MPU_LastEvent=0;
#define MIDI_NOTE_OFF 0x80 #define MIDI_NOTE_OFF 0x80
#define MIDI_NOTE_ON 0x90 #define MIDI_NOTE_ON 0x90
#define MIDI_POLY_AFTER_TCH 0xA0 #define MIDI_POLY_AFTER_TCH 0xA0
#define MIDI_CONTROL_CHANGE 0xB0 #define MIDI_CONTROL_CHANGE 0xB0
#define MIDI_PROGRAM_CHANGE 0xC0 #define MIDI_PROGRAM_CHANGE 0xC0
#define MIDI_AFTER_TOUCH 0xD0 #define MIDI_AFTER_TOUCH 0xD0
#define MIDI_PITCH_BEND 0xE0 #define MIDI_PITCH_BEND 0xE0
#define MIDI_META_EVENT 0xFF #define MIDI_META_EVENT 0xFF
#define MIDI_END_OF_TRACK 0x2F #define MIDI_END_OF_TRACK 0x2F
#define MIDI_TEMPO_CHANGE 0x51 #define MIDI_TEMPO_CHANGE 0x51
#define MIDI_MONO_MODE_ON 0x7E #define MIDI_MONO_MODE_ON 0x7E
#define MIDI_ALL_NOTES_OFF 0x7B #define MIDI_ALL_NOTES_OFF 0x7B
/********************************************************************** /**********************************************************************
Memory locked functions: Memory locked functions:
**********************************************************************/ **********************************************************************/
void MPU_FinishBuffer(int buffer) void MPU_FinishBuffer(int buffer)
{ {
if (!eventcnt[buffer]) return; if (!eventcnt[buffer]) return;
ZeroMemory(&bufferheaders[buffer], sizeof(MIDIHDR)); ZeroMemory(&bufferheaders[buffer], sizeof(MIDIHDR));
bufferheaders[buffer].lpData = eventbuf[buffer]; bufferheaders[buffer].lpData = eventbuf[buffer];
bufferheaders[buffer].dwBufferLength = bufferheaders[buffer].dwBufferLength =
bufferheaders[buffer].dwBytesRecorded = eventcnt[buffer]; bufferheaders[buffer].dwBytesRecorded = eventcnt[buffer];
midiOutPrepareHeader((HMIDIOUT)hmido, &bufferheaders[buffer], sizeof(MIDIHDR)); midiOutPrepareHeader((HMIDIOUT)hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
midiStreamOut(hmido, &bufferheaders[buffer], sizeof(MIDIHDR)); midiStreamOut(hmido, &bufferheaders[buffer], sizeof(MIDIHDR));
// printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer); // printf("Sending %d bytes (buffer %d)\n",eventcnt[buffer],buffer);
_MPU_BuffersWaiting++; _MPU_BuffersWaiting++;
} }
void MPU_BeginPlayback(void) void MPU_BeginPlayback(void)
{ {
_MPU_LastEvent = _MIDI_GlobalPositionInTicks; _MPU_LastEvent = _MIDI_GlobalPositionInTicks;
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido); if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
} }
void MPU_Pause(void) void MPU_Pause(void)
{ {
if (hmido != (HMIDISTRM)-1) midiStreamPause(hmido); if (hmido != (HMIDISTRM)-1) midiStreamPause(hmido);
} }
void MPU_Unpause(void) void MPU_Unpause(void)
{ {
if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido); if (hmido != (HMIDISTRM)-1) midiStreamRestart(hmido);
} }
void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{ {
int i; int i;
UNREFERENCED_PARAMETER(dwInstance); UNREFERENCED_PARAMETER(dwInstance);
UNREFERENCED_PARAMETER(dwParam2); UNREFERENCED_PARAMETER(dwParam2);
switch (uMsg) switch (uMsg)
{ {
case MOM_DONE: case MOM_DONE:
midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR)); midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR));
for (i=0;i<NUMBUFFERS;i++) for (i=0;i<NUMBUFFERS;i++)
{ {
if (dwParam1 == (unsigned int)&bufferheaders[i]) if (dwParam1 == (unsigned int)&bufferheaders[i])
{ {
eventcnt[i] = 0; // marks the buffer as free eventcnt[i] = 0; // marks the buffer as free
// printf("Finished buffer %d\n",i); // printf("Finished buffer %d\n",i);
_MPU_BuffersWaiting--; _MPU_BuffersWaiting--;
break; break;
} }
} }
return; return;
default: return; default: return;
} }
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_SendMidi Function: MPU_SendMidi
Queues a MIDI message to the music device. Queues a MIDI message to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MPU_GetNextBuffer(void) int MPU_GetNextBuffer(void)
{ {
int i; int i;
for (i=0; i<NUMBUFFERS; i++) for (i=0; i<NUMBUFFERS; i++)
{ {
if (eventcnt[i] == 0) return i; if (eventcnt[i] == 0) return i;
} }
return -1; return -1;
} }
void MPU_SendMidi(char *data, int count) void MPU_SendMidi(char *data, int count)
{ {
char *p; char *p;
int padded, nextbuffer; int padded, nextbuffer;
static int masks[3] = { 0x000000ffl, 0x0000ffffl, 0x00ffffffl }; static int masks[3] = { 0x000000ffl, 0x0000ffffl, 0x00ffffffl };
if (count <= 0) return; if (count <= 0) return;
if (count <= 3) if (count <= 3)
{ {
if (eventcnt[_MPU_CurrentBuffer] + 12 > BUFFERLEN) if (eventcnt[_MPU_CurrentBuffer] + 12 > BUFFERLEN)
{ {
// buffer over-full // buffer over-full
nextbuffer = MPU_GetNextBuffer(); nextbuffer = MPU_GetNextBuffer();
if (nextbuffer < 0) if (nextbuffer < 0)
{ {
// printf("All buffers full!\n"); // printf("All buffers full!\n");
return; return;
} }
MPU_FinishBuffer(_MPU_CurrentBuffer); MPU_FinishBuffer(_MPU_CurrentBuffer);
_MPU_CurrentBuffer = nextbuffer; _MPU_CurrentBuffer = nextbuffer;
} }
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer]; p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent; ((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
((int*)p)[1] = 0; ((int*)p)[1] = 0;
((int*)p)[2] = (MEVT_SHORTMSG << 24) | ((*((int*)data)) & masks[count-1]); ((int*)p)[2] = (MEVT_SHORTMSG << 24) | ((*((int*)data)) & masks[count-1]);
eventcnt[_MPU_CurrentBuffer] += 12; eventcnt[_MPU_CurrentBuffer] += 12;
} }
else else
{ {
padded = PAD(count); padded = PAD(count);
if (eventcnt[_MPU_CurrentBuffer] + 12 + padded > BUFFERLEN) if (eventcnt[_MPU_CurrentBuffer] + 12 + padded > BUFFERLEN)
{ {
// buffer over-full // buffer over-full
nextbuffer = MPU_GetNextBuffer(); nextbuffer = MPU_GetNextBuffer();
if (nextbuffer < 0) if (nextbuffer < 0)
{ {
// printf("All buffers full!\n"); // printf("All buffers full!\n");
return; return;
} }
MPU_FinishBuffer(_MPU_CurrentBuffer); MPU_FinishBuffer(_MPU_CurrentBuffer);
_MPU_CurrentBuffer = nextbuffer; _MPU_CurrentBuffer = nextbuffer;
} }
p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer]; p = eventbuf[_MPU_CurrentBuffer] + eventcnt[_MPU_CurrentBuffer];
((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent; ((int*)p)[0] = _MIDI_GlobalPositionInTicks - _MPU_LastEvent;
((int*)p)[1] = 0; ((int*)p)[1] = 0;
((int*)p)[2] = (MEVT_LONGMSG<<24) | (count & 0xffffffl); ((int*)p)[2] = (MEVT_LONGMSG<<24) | (count & 0xffffffl);
p+=12; eventcnt[_MPU_CurrentBuffer] += 12; p+=12; eventcnt[_MPU_CurrentBuffer] += 12;
for (; count>0; count--, padded--, eventcnt[_MPU_CurrentBuffer]++) for (; count>0; count--, padded--, eventcnt[_MPU_CurrentBuffer]++)
*(p++) = *(data++); *(p++) = *(data++);
for (; padded>0; padded--, eventcnt[_MPU_CurrentBuffer]++) for (; padded>0; padded--, eventcnt[_MPU_CurrentBuffer]++)
*(p++) = 0; *(p++) = 0;
} }
_MPU_LastEvent = _MIDI_GlobalPositionInTicks; _MPU_LastEvent = _MIDI_GlobalPositionInTicks;
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_SendMidiImmediate Function: MPU_SendMidiImmediate
Sends a MIDI message immediately to the the music device. Sends a MIDI message immediately to the the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_SendMidiImmediate(char *data, int count) void MPU_SendMidiImmediate(char *data, int count)
{ {
MIDIHDR mhdr; MIDIHDR mhdr;
static int masks[3] = { 0x00ffffffl, 0x0000ffffl, 0x000000ffl }; static int masks[3] = { 0x00ffffffl, 0x0000ffffl, 0x000000ffl };
if (!count) return; if (!count) return;
if (count<=3) midiOutShortMsg((HMIDIOUT)hmido, (*((int*)data)) & masks[count-1]); if (count<=3) midiOutShortMsg((HMIDIOUT)hmido, (*((int*)data)) & masks[count-1]);
else else
{ {
ZeroMemory(&mhdr, sizeof(mhdr)); ZeroMemory(&mhdr, sizeof(mhdr));
mhdr.lpData = data; mhdr.lpData = data;
mhdr.dwBufferLength = count; mhdr.dwBufferLength = count;
midiOutPrepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR)); midiOutPrepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
midiOutLongMsg((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR)); midiOutLongMsg((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
while (!(mhdr.dwFlags & MHDR_DONE)) ; while (!(mhdr.dwFlags & MHDR_DONE)) ;
midiOutUnprepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR)); midiOutUnprepareHeader((HMIDIOUT)hmido, &mhdr, sizeof(MIDIHDR));
} }
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_Reset Function: MPU_Reset
Resets the MPU401 card. Resets the MPU401 card.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MPU_Reset int MPU_Reset
( (
void void
) )
{ {
midiStreamStop(hmido); midiStreamStop(hmido);
midiStreamClose(hmido); midiStreamClose(hmido);
return(MPU_Ok); return(MPU_Ok);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_Init Function: MPU_Init
Detects and initializes the MPU401 card. Detects and initializes the MPU401 card.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
int MPU_Init int MPU_Init
( (
int addr int addr
) )
{ {
int i; int i;
for (i=0;i<NUMBUFFERS;i++) eventcnt[i]=0; for (i=0;i<NUMBUFFERS;i++) eventcnt[i]=0;
mididevice = addr; mididevice = addr;
if (midiOutGetDevCaps(mididevice, &midicaps, sizeof(MIDIOUTCAPS)) != MMSYSERR_NOERROR) return MPU_Error; 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); if (midiStreamOpen(&hmido,(LPUINT)&mididevice,1,(DWORD)MPU_MIDICallback,0L,CALLBACK_FUNCTION) != MMSYSERR_NOERROR) return(MPU_Error);
return(MPU_Ok); return(MPU_Ok);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_NoteOff Function: MPU_NoteOff
Sends a full MIDI note off event out to the music device. Sends a full MIDI note off event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_NoteOff void MPU_NoteOff
( (
int channel, int channel,
int key, int key,
int velocity int velocity
) )
{ {
char msg[3]; char msg[3];
msg[0] = (MIDI_NOTE_OFF | channel); msg[0] = (MIDI_NOTE_OFF | channel);
msg[1] = (key); msg[1] = (key);
msg[2] = (velocity); msg[2] = (velocity);
MPU_SendMidi(msg, 3); MPU_SendMidi(msg, 3);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_NoteOn Function: MPU_NoteOn
Sends a full MIDI note on event out to the music device. Sends a full MIDI note on event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_NoteOn void MPU_NoteOn
( (
int channel, int channel,
int key, int key,
int velocity int velocity
) )
{ {
char msg[3]; char msg[3];
msg[0] = (MIDI_NOTE_ON | channel); msg[0] = (MIDI_NOTE_ON | channel);
msg[1] = (key); msg[1] = (key);
msg[2] = (velocity); msg[2] = (velocity);
MPU_SendMidi(msg, 3); MPU_SendMidi(msg, 3);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_PolyAftertouch Function: MPU_PolyAftertouch
Sends a full MIDI polyphonic aftertouch event out to the music device. Sends a full MIDI polyphonic aftertouch event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_PolyAftertouch void MPU_PolyAftertouch
( (
int channel, int channel,
int key, int key,
int pressure int pressure
) )
{ {
char msg[3]; char msg[3];
msg[0] = (MIDI_POLY_AFTER_TCH | channel); msg[0] = (MIDI_POLY_AFTER_TCH | channel);
msg[1] = (key); msg[1] = (key);
msg[2] = (pressure); msg[2] = (pressure);
MPU_SendMidi(msg, 3); MPU_SendMidi(msg, 3);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_ControlChange Function: MPU_ControlChange
Sends a full MIDI control change event out to the music device. Sends a full MIDI control change event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_ControlChange void MPU_ControlChange
( (
int channel, int channel,
int number, int number,
int value int value
) )
{ {
char msg[3]; char msg[3];
msg[0] = (MIDI_CONTROL_CHANGE | channel); msg[0] = (MIDI_CONTROL_CHANGE | channel);
msg[1] = (number); msg[1] = (number);
msg[2] = (value); msg[2] = (value);
MPU_SendMidi(msg, 3); MPU_SendMidi(msg, 3);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_ProgramChange Function: MPU_ProgramChange
Sends a full MIDI program change event out to the music device. Sends a full MIDI program change event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_ProgramChange void MPU_ProgramChange
( (
int channel, int channel,
int program int program
) )
{ {
char msg[2]; char msg[2];
msg[0] = (MIDI_PROGRAM_CHANGE | channel); msg[0] = (MIDI_PROGRAM_CHANGE | channel);
msg[1] = (program); msg[1] = (program);
MPU_SendMidi(msg, 2); MPU_SendMidi(msg, 2);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_ChannelAftertouch Function: MPU_ChannelAftertouch
Sends a full MIDI channel aftertouch event out to the music device. Sends a full MIDI channel aftertouch event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_ChannelAftertouch void MPU_ChannelAftertouch
( (
int channel, int channel,
int pressure int pressure
) )
{ {
char msg[2]; char msg[2];
msg[0] = (MIDI_AFTER_TOUCH | channel); msg[0] = (MIDI_AFTER_TOUCH | channel);
msg[1] = (pressure); msg[1] = (pressure);
MPU_SendMidi(msg, 2); MPU_SendMidi(msg, 2);
} }
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MPU_PitchBend Function: MPU_PitchBend
Sends a full MIDI pitch bend event out to the music device. Sends a full MIDI pitch bend event out to the music device.
---------------------------------------------------------------------*/ ---------------------------------------------------------------------*/
void MPU_PitchBend void MPU_PitchBend
( (
int channel, int channel,
int lsb, int lsb,
int msb int msb
) )
{ {
char msg[3]; char msg[3];
msg[0] = (MIDI_PITCH_BEND | channel); msg[0] = (MIDI_PITCH_BEND | channel);
msg[1] = (lsb); msg[1] = (lsb);
msg[2] = (msb); msg[2] = (msb);
MPU_SendMidi(msg, 3); MPU_SendMidi(msg, 3);
} }
void MPU_SetTempo(int tempo) void MPU_SetTempo(int tempo)
{ {
MIDIPROPTEMPO prop; MIDIPROPTEMPO prop;
prop.cbStruct = sizeof(MIDIPROPTEMPO); prop.cbStruct = sizeof(MIDIPROPTEMPO);
prop.dwTempo = 60000000l/tempo; prop.dwTempo = 60000000l/tempo;
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TEMPO); midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TEMPO);
} }
void MPU_SetDivision(int division) void MPU_SetDivision(int division)
{ {
MIDIPROPTIMEDIV prop; MIDIPROPTIMEDIV prop;
prop.cbStruct = sizeof(MIDIPROPTIMEDIV); prop.cbStruct = sizeof(MIDIPROPTIMEDIV);
prop.dwTimeDiv = division; prop.dwTimeDiv = division;
midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TIMEDIV); midiStreamProperty(hmido, (LPBYTE)&prop, MIDIPROP_SET|MIDIPROP_TIMEDIV);
} }
void MPU_SetVolume(int volume) void MPU_SetVolume(int volume)
{ {
/* /*
HMIXER hmixer; HMIXER hmixer;
int mixerid; int mixerid;
MIXERCONTROLDETAILS mxcd; MIXERCONTROLDETAILS mxcd;
MIXERCONTROLDETAILS_UNSIGNED mxcdu; MIXERCONTROLDETAILS_UNSIGNED mxcdu;
MMRESULT mme; MMRESULT mme;
if (mididevice < 0) return; if (mididevice < 0) return;
mme = mixerOpen(&hmixer, mididevice, 0,0, MIXER_OBJECTF_MIDIOUT); mme = mixerOpen(&hmixer, mididevice, 0,0, MIXER_OBJECTF_MIDIOUT);
if (mme) { if (mme) {
puts("Failed opening mixer"); puts("Failed opening mixer");
return; return;
} }
mixerGetID(hmixer, &mixerid, MIXER_OBJECTF_HMIXER); mixerGetID(hmixer, &mixerid, MIXER_OBJECTF_HMIXER);
printf("mixerid=%d\n",mixerid); printf("mixerid=%d\n",mixerid);
ZeroMemory(&mxcd,sizeof(mxcd)); ZeroMemory(&mxcd,sizeof(mxcd));
mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS); mxcd.cbStruct = sizeof(MIXERCONTROLDETAILS);
mxcd.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME; mxcd.dwControlID = MIXERCONTROL_CONTROLTYPE_VOLUME;
mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED); mxcd.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
mxcd.paDetails = (LPVOID)&mxcdu; mxcd.paDetails = (LPVOID)&mxcdu;
mxcdu.dwValue = (volume << 8) & 0xffff; mxcdu.dwValue = (volume << 8) & 0xffff;
printf("set %d\n",mixerSetControlDetails((HMIXEROBJ)mididevice, &mxcd, printf("set %d\n",mixerSetControlDetails((HMIXEROBJ)mididevice, &mxcd,
MIXER_OBJECTF_MIDIOUT|MIXER_SETCONTROLDETAILSF_VALUE)); MIXER_OBJECTF_MIDIOUT|MIXER_SETCONTROLDETAILSF_VALUE));
mixerClose(hmixer); mixerClose(hmixer);
*/ */
UNREFERENCED_PARAMETER(volume); UNREFERENCED_PARAMETER(volume);
} }
int MPU_GetVolume(void) int MPU_GetVolume(void)
{ {
// if (mididevice < 0) return 0; // if (mididevice < 0) return 0;
return 0; return 0;
} }

View file

@ -1,487 +1,487 @@
.586P .586P
EXTRN _MV_HarshClipTable : dword EXTRN _MV_HarshClipTable : dword
EXTRN _MV_MixDestination : dword EXTRN _MV_MixDestination : dword
EXTRN _MV_MixPosition : dword EXTRN _MV_MixPosition : dword
EXTRN _MV_LeftVolume : dword EXTRN _MV_LeftVolume : dword
EXTRN _MV_RightVolume : dword EXTRN _MV_RightVolume : dword
EXTRN _MV_SampleSize : dword EXTRN _MV_SampleSize : dword
EXTRN _MV_RightChannelOffset : dword EXTRN _MV_RightChannelOffset : dword
CODE SEGMENT PUBLIC USE32 'DATA' CODE SEGMENT PUBLIC USE32 'DATA'
ASSUME cs:CODE,ds:CODE ASSUME cs:CODE,ds:CODE
;================ ;================
; ;
; MV_Mix8BitMono ; MV_Mix8BitMono
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC _MV_Mix8BitMono PUBLIC _MV_Mix8BitMono
_MV_Mix8BitMono: _MV_Mix8BitMono:
; Two at once ; Two at once
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [apatch7+2],bl mov byte ptr [apatch7+2],bl
mov byte ptr [apatch8+2],bl mov byte ptr [apatch8+2],bl
mov byte ptr [apatch9+3],bl mov byte ptr [apatch9+3],bl
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
mov dword ptr [apatch1+4],ebx mov dword ptr [apatch1+4],ebx
mov dword ptr [apatch2+4],ebx mov dword ptr [apatch2+4],ebx
; Harsh Clip table ptr ; Harsh Clip table ptr
mov ebx, _MV_HarshClipTable mov ebx, _MV_HarshClipTable
add ebx, 128 add ebx, 128
mov dword ptr [apatch3+2],ebx mov dword ptr [apatch3+2],ebx
mov dword ptr [apatch4+2],ebx mov dword ptr [apatch4+2],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [apatch5+2],edx mov dword ptr [apatch5+2],edx
mov dword ptr [apatch6+2],edx mov dword ptr [apatch6+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
shr ecx, 1 ; double sample count shr ecx, 1 ; double sample count
cmp ecx, 0 cmp ecx, 0
je short exit8m je short exit8m
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; apatch1 - volume table ; apatch1 - volume table
; apatch2 - volume table ; apatch2 - volume table
; apatch3 - harsh clip table ; apatch3 - harsh clip table
; apatch4 - harsh clip table ; apatch4 - harsh clip table
; apatch5 - sample rate ; apatch5 - sample rate
; apatch6 - sample rate ; apatch6 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
mov ebx,ebp ; begin calculating second sample mov ebx,ebp ; begin calculating second sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr ebx,16 ; finish calculation for second sample shr ebx,16 ; finish calculation for second sample
movzx eax, byte ptr [esi+eax] ; get first sample movzx eax, byte ptr [esi+eax] ; get first sample
movzx ebx, byte ptr [esi+ebx] ; get second sample movzx ebx, byte ptr [esi+ebx] ; get second sample
;ALIGN 4 ;ALIGN 4
mix8Mloop: mix8Mloop:
movzx edx, byte ptr [edi] ; get current sample from destination movzx edx, byte ptr [edi] ; get current sample from destination
apatch1: apatch1:
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
apatch2: apatch2:
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
add eax, edx ; mix first sample add eax, edx ; mix first sample
apatch9: apatch9:
movzx edx, byte ptr [edi + 1] ; get current sample from destination movzx edx, byte ptr [edi + 1] ; get current sample from destination
apatch3: apatch3:
mov eax, [eax + 12345678h] ; harsh clip new sample mov eax, [eax + 12345678h] ; harsh clip new sample
add ebx, edx ; mix second sample add ebx, edx ; mix second sample
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
mov edx, ebp ; begin calculating third sample mov edx, ebp ; begin calculating third sample
apatch4: apatch4:
mov ebx, [ebx + 12345678h] ; harsh clip new sample mov ebx, [ebx + 12345678h] ; harsh clip new sample
apatch5: apatch5:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
shr edx, 16 ; finish calculation for third sample shr edx, 16 ; finish calculation for third sample
mov eax, ebp ; begin calculating fourth sample mov eax, ebp ; begin calculating fourth sample
apatch7: apatch7:
add edi, 1 ; move destination to second sample add edi, 1 ; move destination to second sample
shr eax, 16 ; finish calculation for fourth sample shr eax, 16 ; finish calculation for fourth sample
mov [edi], bl ; write new sample to destination mov [edi], bl ; write new sample to destination
apatch6: apatch6:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
movzx ebx, byte ptr [esi+eax] ; get fourth sample movzx ebx, byte ptr [esi+eax] ; get fourth sample
movzx eax, byte ptr [esi+edx] ; get third sample movzx eax, byte ptr [esi+edx] ; get third sample
apatch8: apatch8:
add edi, 2 ; move destination to third sample add edi, 2 ; move destination to third sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix8Mloop ; loop jnz mix8Mloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
exit8m: exit8m:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix8BitStereo ; MV_Mix8BitStereo
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC _MV_Mix8BitStereo PUBLIC _MV_Mix8BitStereo
_MV_Mix8BitStereo: _MV_Mix8BitStereo:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [bpatch8+2],bl mov byte ptr [bpatch8+2],bl
; Right channel offset ; Right channel offset
mov ebx, _MV_RightChannelOffset mov ebx, _MV_RightChannelOffset
mov dword ptr [bpatch6+3],ebx mov dword ptr [bpatch6+3],ebx
mov dword ptr [bpatch7+2],ebx mov dword ptr [bpatch7+2],ebx
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [bpatch1+4],ebx mov dword ptr [bpatch1+4],ebx
mov ebx, _MV_RightVolume mov ebx, _MV_RightVolume
mov dword ptr [bpatch2+4],ebx mov dword ptr [bpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [bpatch3+2],edx mov dword ptr [bpatch3+2],edx
; Harsh Clip table ptr ; Harsh Clip table ptr
mov ebx, _MV_HarshClipTable mov ebx, _MV_HarshClipTable
add ebx,128 add ebx,128
mov dword ptr [bpatch4+2],ebx mov dword ptr [bpatch4+2],ebx
mov dword ptr [bpatch5+2],ebx mov dword ptr [bpatch5+2],ebx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
cmp ecx, 0 cmp ecx, 0
je short exit8S je short exit8S
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; bpatch1 - left volume table ; bpatch1 - left volume table
; bpatch2 - right volume table ; bpatch2 - right volume table
; bpatch3 - sample rate ; bpatch3 - sample rate
; bpatch4 - harsh clip table ; bpatch4 - harsh clip table
; bpatch5 - harsh clip table ; bpatch5 - harsh clip table
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
movzx ebx, byte ptr [esi+eax] ; get first sample movzx ebx, byte ptr [esi+eax] ; get first sample
;ALIGN 4 ;ALIGN 4
mix8Sloop: mix8Sloop:
bpatch1: bpatch1:
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
movzx edx, byte ptr [edi] ; get current sample from destination movzx edx, byte ptr [edi] ; get current sample from destination
bpatch2: bpatch2:
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
add eax, edx ; mix left sample add eax, edx ; mix left sample
bpatch3: bpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
bpatch6: bpatch6:
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
bpatch4: bpatch4:
mov eax, [eax + 12345678h] ; harsh clip left sample mov eax, [eax + 12345678h] ; harsh clip left sample
add ebx, edx ; mix right sample add ebx, edx ; mix right sample
mov [edi], al ; write left sample to destination mov [edi], al ; write left sample to destination
bpatch5: bpatch5:
mov ebx, [ebx + 12345678h] ; harsh clip right sample mov ebx, [ebx + 12345678h] ; harsh clip right sample
mov edx, ebp ; begin calculating second sample mov edx, ebp ; begin calculating second sample
bpatch7: bpatch7:
mov [edi+12345678h], bl ; write right sample to destination mov [edi+12345678h], bl ; write right sample to destination
shr edx, 16 ; finish calculation for second sample shr edx, 16 ; finish calculation for second sample
bpatch8: bpatch8:
add edi, 2 ; move destination to second sample add edi, 2 ; move destination to second sample
movzx ebx, byte ptr [esi+edx] ; get second sample movzx ebx, byte ptr [esi+edx] ; get second sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix8Sloop ; loop jnz mix8Sloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
EXIT8S: EXIT8S:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix16BitMono ; MV_Mix16BitMono
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC _MV_Mix16BitMono PUBLIC _MV_Mix16BitMono
_MV_Mix16BitMono: _MV_Mix16BitMono:
; Two at once ; Two at once
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [cpatch5+3],bl mov byte ptr [cpatch5+3],bl
mov byte ptr [cpatch6+3],bl mov byte ptr [cpatch6+3],bl
add bl,bl add bl,bl
mov byte ptr [cpatch7+2],bl mov byte ptr [cpatch7+2],bl
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [cpatch1+4],ebx mov dword ptr [cpatch1+4],ebx
mov dword ptr [cpatch2+4],ebx mov dword ptr [cpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [cpatch3+2],edx mov dword ptr [cpatch3+2],edx
mov dword ptr [cpatch4+2],edx mov dword ptr [cpatch4+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
shr ecx, 1 ; double sample count shr ecx, 1 ; double sample count
cmp ecx, 0 cmp ecx, 0
je exit16M je exit16M
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; cpatch1 - volume table ; cpatch1 - volume table
; cpatch2 - volume table ; cpatch2 - volume table
; cpatch3 - sample rate ; cpatch3 - sample rate
; cpatch4 - sample rate ; cpatch4 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
mov ebx,ebp ; begin calculating second sample mov ebx,ebp ; begin calculating second sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr ebx,16 ; finish calculation for second sample shr ebx,16 ; finish calculation for second sample
movzx eax, byte ptr [esi+eax] ; get first sample movzx eax, byte ptr [esi+eax] ; get first sample
movzx ebx, byte ptr [esi+ebx] ; get second sample movzx ebx, byte ptr [esi+ebx] ; get second sample
;ALIGN 4 ;ALIGN 4
mix16Mloop: mix16Mloop:
movsx edx, word ptr [edi] ; get current sample from destination movsx edx, word ptr [edi] ; get current sample from destination
cpatch1: cpatch1:
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
cpatch2: cpatch2:
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
add eax, edx ; mix first sample add eax, edx ; mix first sample
cpatch5: cpatch5:
movsx edx, word ptr [edi + 2] ; get current sample from destination movsx edx, word ptr [edi + 2] ; get current sample from destination
cmp eax, -32768 ; Harsh clip sample cmp eax, -32768 ; Harsh clip sample
jge short m16skip1 jge short m16skip1
mov eax, -32768 mov eax, -32768
jmp short m16skip2 jmp short m16skip2
m16skip1: m16skip1:
cmp eax, 32767 cmp eax, 32767
jle short m16skip2 jle short m16skip2
mov eax, 32767 mov eax, 32767
m16skip2: m16skip2:
add ebx, edx ; mix second sample add ebx, edx ; mix second sample
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
mov edx, ebp ; begin calculating third sample mov edx, ebp ; begin calculating third sample
cmp ebx, -32768 ; Harsh clip sample cmp ebx, -32768 ; Harsh clip sample
jge short m16skip3 jge short m16skip3
mov ebx, -32768 mov ebx, -32768
jmp short m16skip4 jmp short m16skip4
m16skip3: m16skip3:
cmp ebx, 32767 cmp ebx, 32767
jle short m16skip4 jle short m16skip4
mov ebx, 32767 mov ebx, 32767
m16skip4: m16skip4:
cpatch3: cpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
shr edx, 16 ; finish calculation for third sample shr edx, 16 ; finish calculation for third sample
mov eax, ebp ; begin calculating fourth sample mov eax, ebp ; begin calculating fourth sample
cpatch6: cpatch6:
mov [edi + 2], bx ; write new sample to destination mov [edi + 2], bx ; write new sample to destination
shr eax, 16 ; finish calculation for fourth sample shr eax, 16 ; finish calculation for fourth sample
cpatch4: cpatch4:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
movzx ebx, byte ptr [esi+eax] ; get fourth sample movzx ebx, byte ptr [esi+eax] ; get fourth sample
cpatch7: cpatch7:
add edi, 4 ; move destination to third sample add edi, 4 ; move destination to third sample
movzx eax, byte ptr [esi+edx] ; get third sample movzx eax, byte ptr [esi+edx] ; get third sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix16Mloop ; loop jnz mix16Mloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
EXIT16M: EXIT16M:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix16BitStereo ; MV_Mix16BitStereo
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC _MV_Mix16BitStereo PUBLIC _MV_Mix16BitStereo
_MV_Mix16BitStereo: _MV_Mix16BitStereo:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [dpatch6+2],bl mov byte ptr [dpatch6+2],bl
; Right channel offset ; Right channel offset
mov ebx, _MV_RightChannelOffset mov ebx, _MV_RightChannelOffset
mov dword ptr [dpatch4+3],ebx mov dword ptr [dpatch4+3],ebx
mov dword ptr [dpatch5+3],ebx mov dword ptr [dpatch5+3],ebx
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [dpatch1+4],ebx mov dword ptr [dpatch1+4],ebx
mov ebx, _MV_RightVolume mov ebx, _MV_RightVolume
mov dword ptr [dpatch2+4],ebx mov dword ptr [dpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [dpatch3+2],edx mov dword ptr [dpatch3+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
cmp ecx, 0 cmp ecx, 0
je exit16S je exit16S
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; dpatch1 - left volume table ; dpatch1 - left volume table
; dpatch2 - right volume table ; dpatch2 - right volume table
; dpatch3 - sample rate ; dpatch3 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
movzx ebx, byte ptr [esi+eax] ; get first sample movzx ebx, byte ptr [esi+eax] ; get first sample
;ALIGN 4 ;ALIGN 4
mix16Sloop: mix16Sloop:
dpatch1: dpatch1:
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
movsx edx, word ptr [edi] ; get current sample from destination movsx edx, word ptr [edi] ; get current sample from destination
dpatch2: dpatch2:
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
add eax, edx ; mix left sample add eax, edx ; mix left sample
dpatch3: dpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
dpatch4: dpatch4:
movsx edx, word ptr [edi+12345678h] ; get current sample from destination movsx edx, word ptr [edi+12345678h] ; get current sample from destination
cmp eax, -32768 ; Harsh clip sample cmp eax, -32768 ; Harsh clip sample
jge short s16skip1 jge short s16skip1
mov eax, -32768 mov eax, -32768
jmp short s16skip2 jmp short s16skip2
s16skip1: s16skip1:
cmp eax, 32767 cmp eax, 32767
jle short s16skip2 jle short s16skip2
mov eax, 32767 mov eax, 32767
s16skip2: s16skip2:
add ebx, edx ; mix right sample add ebx, edx ; mix right sample
mov [edi], ax ; write left sample to destination mov [edi], ax ; write left sample to destination
cmp ebx, -32768 ; Harsh clip sample cmp ebx, -32768 ; Harsh clip sample
jge short s16skip3 jge short s16skip3
mov ebx, -32768 mov ebx, -32768
jmp short s16skip4 jmp short s16skip4
s16skip3: s16skip3:
cmp ebx, 32767 cmp ebx, 32767
jle short s16skip4 jle short s16skip4
mov ebx, 32767 mov ebx, 32767
s16skip4: s16skip4:
mov edx, ebp ; begin calculating second sample mov edx, ebp ; begin calculating second sample
dpatch5: dpatch5:
mov [edi+12345678h], bx ; write right sample to destination mov [edi+12345678h], bx ; write right sample to destination
shr edx, 16 ; finish calculation for second sample shr edx, 16 ; finish calculation for second sample
dpatch6: dpatch6:
add edi, 4 ; move destination to second sample add edi, 4 ; move destination to second sample
movzx ebx, byte ptr [esi+edx] ; get second sample movzx ebx, byte ptr [esi+edx] ; get second sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix16Sloop ; loop jnz mix16Sloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
exit16S: exit16S:
popad popad
ret ret
CODE ENDS CODE ENDS
END END

File diff suppressed because it is too large Load diff

View file

@ -1,491 +1,491 @@
.586P .586P
EXTRN _MV_HarshClipTable : dword EXTRN _MV_HarshClipTable : dword
EXTRN _MV_MixDestination : dword EXTRN _MV_MixDestination : dword
EXTRN _MV_MixPosition : dword EXTRN _MV_MixPosition : dword
EXTRN _MV_LeftVolume : dword EXTRN _MV_LeftVolume : dword
EXTRN _MV_RightVolume : dword EXTRN _MV_RightVolume : dword
EXTRN _MV_SampleSize : dword EXTRN _MV_SampleSize : dword
EXTRN _MV_RightChannelOffset : dword EXTRN _MV_RightChannelOffset : dword
CODE SEGMENT PUBLIC USE32 'DATA' CODE SEGMENT PUBLIC USE32 'DATA'
ASSUME cs:CODE,ds:CODE ASSUME cs:CODE,ds:CODE
;================ ;================
; ;
; MV_Mix8BitMono ; MV_Mix8BitMono
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC MV_Mix8BitMono_ PUBLIC MV_Mix8BitMono_
MV_Mix8BitMono_: MV_Mix8BitMono_:
; Two at once ; Two at once
pushad pushad
; Thanks to Lauri Liinat for spotting this lunacy ; Thanks to Lauri Liinat for spotting this lunacy
;mov eax, dword ptr [esp + 0*4 + 9*4] ;mov eax, dword ptr [esp + 0*4 + 9*4]
;mov edx, dword ptr [esp + 1*4 + 9*4] ;mov edx, dword ptr [esp + 1*4 + 9*4]
;mov ebx, dword ptr [esp + 2*4 + 9*4] ;mov ebx, dword ptr [esp + 2*4 + 9*4]
;mov ecx, dword ptr [esp + 3*4 + 9*4] ;mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [apatch7+2],bl mov byte ptr [apatch7+2],bl
mov byte ptr [apatch8+2],bl mov byte ptr [apatch8+2],bl
mov byte ptr [apatch9+3],bl mov byte ptr [apatch9+3],bl
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume ; Since we're mono, use left volume mov ebx, _MV_LeftVolume ; Since we're mono, use left volume
mov dword ptr [apatch1+4],ebx mov dword ptr [apatch1+4],ebx
mov dword ptr [apatch2+4],ebx mov dword ptr [apatch2+4],ebx
; Harsh Clip table ptr ; Harsh Clip table ptr
mov ebx, _MV_HarshClipTable mov ebx, _MV_HarshClipTable
add ebx, 128 add ebx, 128
mov dword ptr [apatch3+2],ebx mov dword ptr [apatch3+2],ebx
mov dword ptr [apatch4+2],ebx mov dword ptr [apatch4+2],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [apatch5+2],edx mov dword ptr [apatch5+2],edx
mov dword ptr [apatch6+2],edx mov dword ptr [apatch6+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
shr ecx, 1 ; double sample count shr ecx, 1 ; double sample count
cmp ecx, 0 cmp ecx, 0
je short exit8m je short exit8m
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; apatch1 - volume table ; apatch1 - volume table
; apatch2 - volume table ; apatch2 - volume table
; apatch3 - harsh clip table ; apatch3 - harsh clip table
; apatch4 - harsh clip table ; apatch4 - harsh clip table
; apatch5 - sample rate ; apatch5 - sample rate
; apatch6 - sample rate ; apatch6 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
mov ebx,ebp ; begin calculating second sample mov ebx,ebp ; begin calculating second sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr ebx,16 ; finish calculation for second sample shr ebx,16 ; finish calculation for second sample
movzx eax, byte ptr [esi+eax] ; get first sample movzx eax, byte ptr [esi+eax] ; get first sample
movzx ebx, byte ptr [esi+ebx] ; get second sample movzx ebx, byte ptr [esi+ebx] ; get second sample
;ALIGN 4 ;ALIGN 4
mix8Mloop: mix8Mloop:
movzx edx, byte ptr [edi] ; get current sample from destination movzx edx, byte ptr [edi] ; get current sample from destination
apatch1: apatch1:
movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample movsx eax, byte ptr [2*eax+12345678h] ; volume translate first sample
apatch2: apatch2:
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate second sample
add eax, edx ; mix first sample add eax, edx ; mix first sample
apatch9: apatch9:
movzx edx, byte ptr [edi + 1] ; get current sample from destination movzx edx, byte ptr [edi + 1] ; get current sample from destination
apatch3: apatch3:
mov eax, [eax + 12345678h] ; harsh clip new sample mov eax, [eax + 12345678h] ; harsh clip new sample
add ebx, edx ; mix second sample add ebx, edx ; mix second sample
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
mov edx, ebp ; begin calculating third sample mov edx, ebp ; begin calculating third sample
apatch4: apatch4:
mov ebx, [ebx + 12345678h] ; harsh clip new sample mov ebx, [ebx + 12345678h] ; harsh clip new sample
apatch5: apatch5:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
shr edx, 16 ; finish calculation for third sample shr edx, 16 ; finish calculation for third sample
mov eax, ebp ; begin calculating fourth sample mov eax, ebp ; begin calculating fourth sample
apatch7: apatch7:
add edi, 1 ; move destination to second sample add edi, 1 ; move destination to second sample
shr eax, 16 ; finish calculation for fourth sample shr eax, 16 ; finish calculation for fourth sample
mov [edi], bl ; write new sample to destination mov [edi], bl ; write new sample to destination
apatch6: apatch6:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
movzx ebx, byte ptr [esi+eax] ; get fourth sample movzx ebx, byte ptr [esi+eax] ; get fourth sample
movzx eax, byte ptr [esi+edx] ; get third sample movzx eax, byte ptr [esi+edx] ; get third sample
apatch8: apatch8:
add edi, 2 ; move destination to third sample add edi, 2 ; move destination to third sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix8Mloop ; loop jnz mix8Mloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
exit8m: exit8m:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix8BitStereo ; MV_Mix8BitStereo
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC MV_Mix8BitStereo_ PUBLIC MV_Mix8BitStereo_
MV_Mix8BitStereo_: MV_Mix8BitStereo_:
pushad pushad
; Thanks to Lauri Liinat for spotting this lunacy ; Thanks to Lauri Liinat for spotting this lunacy
;mov eax, dword ptr [esp + 0*4 + 9*4] ;mov eax, dword ptr [esp + 0*4 + 9*4]
;mov edx, dword ptr [esp + 1*4 + 9*4] ;mov edx, dword ptr [esp + 1*4 + 9*4]
;mov ebx, dword ptr [esp + 2*4 + 9*4] ;mov ebx, dword ptr [esp + 2*4 + 9*4]
;mov ecx, dword ptr [esp + 3*4 + 9*4] ;mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [bpatch8+2],bl mov byte ptr [bpatch8+2],bl
; Right channel offset ; Right channel offset
mov ebx, _MV_RightChannelOffset mov ebx, _MV_RightChannelOffset
mov dword ptr [bpatch6+3],ebx mov dword ptr [bpatch6+3],ebx
mov dword ptr [bpatch7+2],ebx mov dword ptr [bpatch7+2],ebx
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [bpatch1+4],ebx mov dword ptr [bpatch1+4],ebx
mov ebx, _MV_RightVolume mov ebx, _MV_RightVolume
mov dword ptr [bpatch2+4],ebx mov dword ptr [bpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [bpatch3+2],edx mov dword ptr [bpatch3+2],edx
; Harsh Clip table ptr ; Harsh Clip table ptr
mov ebx, _MV_HarshClipTable mov ebx, _MV_HarshClipTable
add ebx,128 add ebx,128
mov dword ptr [bpatch4+2],ebx mov dword ptr [bpatch4+2],ebx
mov dword ptr [bpatch5+2],ebx mov dword ptr [bpatch5+2],ebx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
cmp ecx, 0 cmp ecx, 0
je short exit8S je short exit8S
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; bpatch1 - left volume table ; bpatch1 - left volume table
; bpatch2 - right volume table ; bpatch2 - right volume table
; bpatch3 - sample rate ; bpatch3 - sample rate
; bpatch4 - harsh clip table ; bpatch4 - harsh clip table
; bpatch5 - harsh clip table ; bpatch5 - harsh clip table
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
movzx ebx, byte ptr [esi+eax] ; get first sample movzx ebx, byte ptr [esi+eax] ; get first sample
;ALIGN 4 ;ALIGN 4
mix8Sloop: mix8Sloop:
bpatch1: bpatch1:
movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample movsx eax, byte ptr [2*ebx+12345678h] ; volume translate left sample
movzx edx, byte ptr [edi] ; get current sample from destination movzx edx, byte ptr [edi] ; get current sample from destination
bpatch2: bpatch2:
movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample movsx ebx, byte ptr [2*ebx+12345678h] ; volume translate right sample
add eax, edx ; mix left sample add eax, edx ; mix left sample
bpatch3: bpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
bpatch6: bpatch6:
movzx edx, byte ptr [edi+12345678h] ; get current sample from destination movzx edx, byte ptr [edi+12345678h] ; get current sample from destination
bpatch4: bpatch4:
mov eax, [eax + 12345678h] ; harsh clip left sample mov eax, [eax + 12345678h] ; harsh clip left sample
add ebx, edx ; mix right sample add ebx, edx ; mix right sample
mov [edi], al ; write left sample to destination mov [edi], al ; write left sample to destination
bpatch5: bpatch5:
mov ebx, [ebx + 12345678h] ; harsh clip right sample mov ebx, [ebx + 12345678h] ; harsh clip right sample
mov edx, ebp ; begin calculating second sample mov edx, ebp ; begin calculating second sample
bpatch7: bpatch7:
mov [edi+12345678h], bl ; write right sample to destination mov [edi+12345678h], bl ; write right sample to destination
shr edx, 16 ; finish calculation for second sample shr edx, 16 ; finish calculation for second sample
bpatch8: bpatch8:
add edi, 2 ; move destination to second sample add edi, 2 ; move destination to second sample
movzx ebx, byte ptr [esi+edx] ; get second sample movzx ebx, byte ptr [esi+edx] ; get second sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix8Sloop ; loop jnz mix8Sloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
EXIT8S: EXIT8S:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix16BitMono ; MV_Mix16BitMono
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC MV_Mix16BitMono_ PUBLIC MV_Mix16BitMono_
MV_Mix16BitMono_: MV_Mix16BitMono_:
; Two at once ; Two at once
pushad pushad
; Thanks to Lauri Liinat for spotting this lunacy ; Thanks to Lauri Liinat for spotting this lunacy
;mov eax, dword ptr [esp + 0*4 + 9*4] ;mov eax, dword ptr [esp + 0*4 + 9*4]
;mov edx, dword ptr [esp + 1*4 + 9*4] ;mov edx, dword ptr [esp + 1*4 + 9*4]
;mov ebx, dword ptr [esp + 2*4 + 9*4] ;mov ebx, dword ptr [esp + 2*4 + 9*4]
;mov ecx, dword ptr [esp + 3*4 + 9*4] ;mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [cpatch5+3],bl mov byte ptr [cpatch5+3],bl
mov byte ptr [cpatch6+3],bl mov byte ptr [cpatch6+3],bl
add bl,bl add bl,bl
mov byte ptr [cpatch7+2],bl mov byte ptr [cpatch7+2],bl
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [cpatch1+4],ebx mov dword ptr [cpatch1+4],ebx
mov dword ptr [cpatch2+4],ebx mov dword ptr [cpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [cpatch3+2],edx mov dword ptr [cpatch3+2],edx
mov dword ptr [cpatch4+2],edx mov dword ptr [cpatch4+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
shr ecx, 1 ; double sample count shr ecx, 1 ; double sample count
cmp ecx, 0 cmp ecx, 0
je exit16M je exit16M
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; cpatch1 - volume table ; cpatch1 - volume table
; cpatch2 - volume table ; cpatch2 - volume table
; cpatch3 - sample rate ; cpatch3 - sample rate
; cpatch4 - sample rate ; cpatch4 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
mov ebx,ebp ; begin calculating second sample mov ebx,ebp ; begin calculating second sample
add ebp,edx ; advance frac pointer add ebp,edx ; advance frac pointer
shr ebx,16 ; finish calculation for second sample shr ebx,16 ; finish calculation for second sample
movzx eax, byte ptr [esi+eax] ; get first sample movzx eax, byte ptr [esi+eax] ; get first sample
movzx ebx, byte ptr [esi+ebx] ; get second sample movzx ebx, byte ptr [esi+ebx] ; get second sample
;ALIGN 4 ;ALIGN 4
mix16Mloop: mix16Mloop:
movsx edx, word ptr [edi] ; get current sample from destination movsx edx, word ptr [edi] ; get current sample from destination
cpatch1: cpatch1:
movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample movsx eax, word ptr [2*eax+12345678h] ; volume translate first sample
cpatch2: cpatch2:
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample movsx ebx, word ptr [2*ebx+12345678h] ; volume translate second sample
add eax, edx ; mix first sample add eax, edx ; mix first sample
cpatch5: cpatch5:
movsx edx, word ptr [edi + 2] ; get current sample from destination movsx edx, word ptr [edi + 2] ; get current sample from destination
cmp eax, -32768 ; Harsh clip sample cmp eax, -32768 ; Harsh clip sample
jge short m16skip1 jge short m16skip1
mov eax, -32768 mov eax, -32768
jmp short m16skip2 jmp short m16skip2
m16skip1: m16skip1:
cmp eax, 32767 cmp eax, 32767
jle short m16skip2 jle short m16skip2
mov eax, 32767 mov eax, 32767
m16skip2: m16skip2:
add ebx, edx ; mix second sample add ebx, edx ; mix second sample
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
mov edx, ebp ; begin calculating third sample mov edx, ebp ; begin calculating third sample
cmp ebx, -32768 ; Harsh clip sample cmp ebx, -32768 ; Harsh clip sample
jge short m16skip3 jge short m16skip3
mov ebx, -32768 mov ebx, -32768
jmp short m16skip4 jmp short m16skip4
m16skip3: m16skip3:
cmp ebx, 32767 cmp ebx, 32767
jle short m16skip4 jle short m16skip4
mov ebx, 32767 mov ebx, 32767
m16skip4: m16skip4:
cpatch3: cpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
shr edx, 16 ; finish calculation for third sample shr edx, 16 ; finish calculation for third sample
mov eax, ebp ; begin calculating fourth sample mov eax, ebp ; begin calculating fourth sample
cpatch6: cpatch6:
mov [edi + 2], bx ; write new sample to destination mov [edi + 2], bx ; write new sample to destination
shr eax, 16 ; finish calculation for fourth sample shr eax, 16 ; finish calculation for fourth sample
cpatch4: cpatch4:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
movzx ebx, byte ptr [esi+eax] ; get fourth sample movzx ebx, byte ptr [esi+eax] ; get fourth sample
cpatch7: cpatch7:
add edi, 4 ; move destination to third sample add edi, 4 ; move destination to third sample
movzx eax, byte ptr [esi+edx] ; get third sample movzx eax, byte ptr [esi+edx] ; get third sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix16Mloop ; loop jnz mix16Mloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
EXIT16M: EXIT16M:
popad popad
ret ret
;================ ;================
; ;
; MV_Mix16BitStereo ; MV_Mix16BitStereo
; ;
;================ ;================
; eax - position ; eax - position
; edx - rate ; edx - rate
; ebx - start ; ebx - start
; ecx - number of samples to mix ; ecx - number of samples to mix
ALIGN 16 ALIGN 16
PUBLIC MV_Mix16BitStereo_ PUBLIC MV_Mix16BitStereo_
MV_Mix16BitStereo_: MV_Mix16BitStereo_:
pushad pushad
; Thanks to Lauri Liinat for spotting this lunacy ; Thanks to Lauri Liinat for spotting this lunacy
;mov eax, dword ptr [esp + 0*4 + 9*4] ;mov eax, dword ptr [esp + 0*4 + 9*4]
;mov edx, dword ptr [esp + 1*4 + 9*4] ;mov edx, dword ptr [esp + 1*4 + 9*4]
;mov ebx, dword ptr [esp + 2*4 + 9*4] ;mov ebx, dword ptr [esp + 2*4 + 9*4]
;mov ecx, dword ptr [esp + 3*4 + 9*4] ;mov ecx, dword ptr [esp + 3*4 + 9*4]
mov ebp, eax mov ebp, eax
mov esi, ebx ; Source pointer mov esi, ebx ; Source pointer
; Sample size ; Sample size
mov ebx, _MV_SampleSize mov ebx, _MV_SampleSize
mov byte ptr [dpatch6+2],bl mov byte ptr [dpatch6+2],bl
; Right channel offset ; Right channel offset
mov ebx, _MV_RightChannelOffset mov ebx, _MV_RightChannelOffset
mov dword ptr [dpatch4+3],ebx mov dword ptr [dpatch4+3],ebx
mov dword ptr [dpatch5+3],ebx mov dword ptr [dpatch5+3],ebx
; Volume table ptr ; Volume table ptr
mov ebx, _MV_LeftVolume mov ebx, _MV_LeftVolume
mov dword ptr [dpatch1+4],ebx mov dword ptr [dpatch1+4],ebx
mov ebx, _MV_RightVolume mov ebx, _MV_RightVolume
mov dword ptr [dpatch2+4],ebx mov dword ptr [dpatch2+4],ebx
; Rate scale ptr ; Rate scale ptr
mov dword ptr [dpatch3+2],edx mov dword ptr [dpatch3+2],edx
mov edi, _MV_MixDestination ; Get the position to write to mov edi, _MV_MixDestination ; Get the position to write to
; Number of samples to mix ; Number of samples to mix
cmp ecx, 0 cmp ecx, 0
je exit16S je exit16S
; eax - scratch ; eax - scratch
; ebx - scratch ; ebx - scratch
; edx - scratch ; edx - scratch
; ecx - count ; ecx - count
; edi - destination ; edi - destination
; esi - source ; esi - source
; ebp - frac pointer ; ebp - frac pointer
; dpatch1 - left volume table ; dpatch1 - left volume table
; dpatch2 - right volume table ; dpatch2 - right volume table
; dpatch3 - sample rate ; dpatch3 - sample rate
mov eax,ebp ; begin calculating first sample mov eax,ebp ; begin calculating first sample
shr eax,16 ; finish calculation for first sample shr eax,16 ; finish calculation for first sample
movzx ebx, byte ptr [esi+eax] ; get first sample movzx ebx, byte ptr [esi+eax] ; get first sample
;ALIGN 4 ;ALIGN 4
mix16Sloop: mix16Sloop:
dpatch1: dpatch1:
movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample movsx eax, word ptr [2*ebx+12345678h] ; volume translate left sample
movsx edx, word ptr [edi] ; get current sample from destination movsx edx, word ptr [edi] ; get current sample from destination
dpatch2: dpatch2:
movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample movsx ebx, word ptr [2*ebx+12345678h] ; volume translate right sample
add eax, edx ; mix left sample add eax, edx ; mix left sample
dpatch3: dpatch3:
add ebp,12345678h ; advance frac pointer add ebp,12345678h ; advance frac pointer
dpatch4: dpatch4:
movsx edx, word ptr [edi+12345678h] ; get current sample from destination movsx edx, word ptr [edi+12345678h] ; get current sample from destination
cmp eax, -32768 ; Harsh clip sample cmp eax, -32768 ; Harsh clip sample
jge short s16skip1 jge short s16skip1
mov eax, -32768 mov eax, -32768
jmp short s16skip2 jmp short s16skip2
s16skip1: s16skip1:
cmp eax, 32767 cmp eax, 32767
jle short s16skip2 jle short s16skip2
mov eax, 32767 mov eax, 32767
s16skip2: s16skip2:
add ebx, edx ; mix right sample add ebx, edx ; mix right sample
mov [edi], ax ; write left sample to destination mov [edi], ax ; write left sample to destination
cmp ebx, -32768 ; Harsh clip sample cmp ebx, -32768 ; Harsh clip sample
jge short s16skip3 jge short s16skip3
mov ebx, -32768 mov ebx, -32768
jmp short s16skip4 jmp short s16skip4
s16skip3: s16skip3:
cmp ebx, 32767 cmp ebx, 32767
jle short s16skip4 jle short s16skip4
mov ebx, 32767 mov ebx, 32767
s16skip4: s16skip4:
mov edx, ebp ; begin calculating second sample mov edx, ebp ; begin calculating second sample
dpatch5: dpatch5:
mov [edi+12345678h], bx ; write right sample to destination mov [edi+12345678h], bx ; write right sample to destination
shr edx, 16 ; finish calculation for second sample shr edx, 16 ; finish calculation for second sample
dpatch6: dpatch6:
add edi, 4 ; move destination to second sample add edi, 4 ; move destination to second sample
movzx ebx, byte ptr [esi+edx] ; get second sample movzx ebx, byte ptr [esi+edx] ; get second sample
dec ecx ; decrement count dec ecx ; decrement count
jnz mix16Sloop ; loop jnz mix16Sloop ; loop
mov _MV_MixDestination, edi ; Store the current write position mov _MV_MixDestination, edi ; Store the current write position
mov _MV_MixPosition, ebp ; return position mov _MV_MixPosition, ebp ; return position
exit16S: exit16S:
popad popad
ret ret
CODE ENDS CODE ENDS
END 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

View file

@ -1,202 +1,202 @@
.586P .586P
CODE SEGMENT PUBLIC USE32 'DATA' CODE SEGMENT PUBLIC USE32 'DATA'
ASSUME cs:CODE,ds:CODE ASSUME cs:CODE,ds:CODE
;================ ;================
; ;
; MV_16BitReverb ; MV_16BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 16 ALIGN 16
PUBLIC _MV_16BitReverb PUBLIC _MV_16BitReverb
_MV_16BitReverb: _MV_16BitReverb:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
lea edi, [edx - 2] lea edi, [edx - 2]
;ALIGN 4 ;ALIGN 4
rev16loop: rev16loop:
movzx eax, word ptr [esi] ; get sample movzx eax, word ptr [esi] ; get sample
add edi, 2 add edi, 2
movzx edx, ah movzx edx, ah
sub ah, ah sub ah, ah
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
xor edx, 80h xor edx, 80h
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
add esi, 2 add esi, 2
lea eax, [ eax + edx + 80h ] ; mix high byte of sample lea eax, [ eax + edx + 80h ] ; mix high byte of sample
dec ecx ; decrement count dec ecx ; decrement count
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
jnz rev16loop ; loop jnz rev16loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_8BitReverb ; MV_8BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 16 ALIGN 16
PUBLIC _MV_8BitReverb PUBLIC _MV_8BitReverb
_MV_8BitReverb: _MV_8BitReverb:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
lea edi, [edx - 1] lea edi, [edx - 1]
xor eax, eax xor eax, eax
;ALIGN 4 ;ALIGN 4
rev8loop: rev8loop:
; movzx eax, byte ptr [esi] ; get sample ; movzx eax, byte ptr [esi] ; get sample
mov al, byte ptr [esi] ; get sample mov al, byte ptr [esi] ; get sample
inc edi inc edi
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample ; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
mov al, byte ptr [2*eax+ebx] ; volume translate sample mov al, byte ptr [2*eax+ebx] ; volume translate sample
inc esi inc esi
; add eax, 80h ; add eax, 80h
add al, 80h add al, 80h
dec ecx ; decrement count dec ecx ; decrement count
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
jnz rev8loop ; loop jnz rev8loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_16BitReverbFast ; MV_16BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 16 ALIGN 16
PUBLIC _MV_16BitReverbFast PUBLIC _MV_16BitReverbFast
_MV_16BitReverbFast: _MV_16BitReverbFast:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch16+3 mov eax,OFFSET rpatch16+3
mov [eax],cl mov [eax],cl
lea edi, [edx - 2] lea edi, [edx - 2]
;ALIGN 4 ;ALIGN 4
frev16loop: frev16loop:
mov ax, word ptr [esi] ; get sample mov ax, word ptr [esi] ; get sample
add edi, 2 add edi, 2
rpatch16: rpatch16:
sar ax, 5 ;;;;Add 1 before shift sar ax, 5 ;;;;Add 1 before shift
add esi, 2 add esi, 2
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
dec ebx ; decrement count dec ebx ; decrement count
jnz frev16loop ; loop jnz frev16loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_8BitReverbFast ; MV_8BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 16 ALIGN 16
PUBLIC _MV_8BitReverbFast PUBLIC _MV_8BitReverbFast
_MV_8BitReverbFast: _MV_8BitReverbFast:
pushad pushad
mov eax, dword ptr [esp + 0*4 + 9*4] mov eax, dword ptr [esp + 0*4 + 9*4]
mov edx, dword ptr [esp + 1*4 + 9*4] mov edx, dword ptr [esp + 1*4 + 9*4]
mov ebx, dword ptr [esp + 2*4 + 9*4] mov ebx, dword ptr [esp + 2*4 + 9*4]
mov ecx, dword ptr [esp + 3*4 + 9*4] mov ecx, dword ptr [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch8+2 mov eax,OFFSET rpatch8+2
mov edi, edx mov edi, edx
mov edx, 80h mov edx, 80h
mov [eax],cl mov [eax],cl
mov eax, 80h mov eax, 80h
shr eax, cl shr eax, cl
dec edi dec edi
sub edx, eax sub edx, eax
;ALIGN 4 ;ALIGN 4
frev8loop: frev8loop:
mov al, byte ptr [esi] ; get sample mov al, byte ptr [esi] ; get sample
inc esi inc esi
mov ecx, eax mov ecx, eax
inc edi inc edi
rpatch8: rpatch8:
shr eax, 3 shr eax, 3
xor ecx, 80h ; flip the sign bit xor ecx, 80h ; flip the sign bit
shr ecx, 7 ; shift the sign down to 1 shr ecx, 7 ; shift the sign down to 1
add eax, edx add eax, edx
add eax, ecx ; add sign bit to round to 0 add eax, ecx ; add sign bit to round to 0
dec ebx ; decrement count dec ebx ; decrement count
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
jnz frev8loop ; loop jnz frev8loop ; loop
popad popad
ret ret
CODE ENDS CODE ENDS
END END

View file

@ -1,230 +1,230 @@
;Copyright (C) 1994-1995 Apogee Software, Ltd. ;Copyright (C) 1994-1995 Apogee Software, Ltd.
; ;
;This program is free software; you can redistribute it and/or ;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License ;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2 ;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version. ;of the License, or (at your option) any later version.
; ;
;This program is distributed in the hope that it will be useful, ;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of ;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
; ;
;See the GNU General Public License for more details. ;See the GNU General Public License for more details.
; ;
;You should have received a copy of the GNU General Public License ;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software ;along with this program; if not, write to the Free Software
;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
; ;
;Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com) ;Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
CPU 386 CPU 386
SECTION .data SECTION .data
%ifdef UNDERSCORES %ifdef UNDERSCORES
%define MV_16BitReverb _MV_16BitReverb %define MV_16BitReverb _MV_16BitReverb
%define MV_8BitReverb _MV_8BitReverb %define MV_8BitReverb _MV_8BitReverb
%define MV_16BitReverbFast _MV_16BitReverbFast %define MV_16BitReverbFast _MV_16BitReverbFast
%define MV_8BitReverbFast _MV_8BitReverbFast %define MV_8BitReverbFast _MV_8BitReverbFast
%endif %endif
GLOBAL MV_16BitReverb GLOBAL MV_16BitReverb
GLOBAL MV_8BitReverb GLOBAL MV_8BitReverb
GLOBAL MV_16BitReverbFast GLOBAL MV_16BitReverbFast
GLOBAL MV_8BitReverbFast GLOBAL MV_8BitReverbFast
%define OFFSET %define OFFSET
;================ ;================
; ;
; MV_16BitReverb ; MV_16BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 4 ALIGN 4
MV_16BitReverb: MV_16BitReverb:
pushad pushad
mov eax, dword [esp + 0*4 + 9*4] mov eax, dword [esp + 0*4 + 9*4]
mov edx, dword [esp + 1*4 + 9*4] mov edx, dword [esp + 1*4 + 9*4]
mov ebx, dword [esp + 2*4 + 9*4] mov ebx, dword [esp + 2*4 + 9*4]
mov ecx, dword [esp + 3*4 + 9*4] mov ecx, dword [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
lea edi, [edx - 2] lea edi, [edx - 2]
ALIGN 4 ALIGN 4
rev16loop: rev16loop:
movzx eax, word [esi] ; get sample movzx eax, word [esi] ; get sample
add edi, 2 add edi, 2
movzx edx, ah movzx edx, ah
sub ah, ah sub ah, ah
movsx eax, byte [2*eax+ebx+1] ; volume translate low byte of sample movsx eax, byte [2*eax+ebx+1] ; volume translate low byte of sample
xor edx, 80h xor edx, 80h
movsx edx, word [2*edx+ebx] ; volume translate high byte of sample movsx edx, word [2*edx+ebx] ; volume translate high byte of sample
add esi, 2 add esi, 2
lea eax, [ eax + edx + 80h ] ; mix high byte of sample lea eax, [ eax + edx + 80h ] ; mix high byte of sample
dec ecx ; decrement count dec ecx ; decrement count
mov word [edi], ax ; write new sample to destination mov word [edi], ax ; write new sample to destination
jnz rev16loop ; loop jnz rev16loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_8BitReverb ; MV_8BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 4 ALIGN 4
MV_8BitReverb: MV_8BitReverb:
pushad pushad
mov eax, dword [esp + 0*4 + 9*4] mov eax, dword [esp + 0*4 + 9*4]
mov edx, dword [esp + 1*4 + 9*4] mov edx, dword [esp + 1*4 + 9*4]
mov ebx, dword [esp + 2*4 + 9*4] mov ebx, dword [esp + 2*4 + 9*4]
mov ecx, dword [esp + 3*4 + 9*4] mov ecx, dword [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
lea edi, [edx - 1] lea edi, [edx - 1]
xor eax, eax xor eax, eax
ALIGN 4 ALIGN 4
rev8loop: rev8loop:
; movzx eax, byte ptr [esi] ; get sample ; movzx eax, byte ptr [esi] ; get sample
mov al, byte [esi] ; get sample mov al, byte [esi] ; get sample
inc edi inc edi
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample ; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
mov al, byte [2*eax+ebx] ; volume translate sample mov al, byte [2*eax+ebx] ; volume translate sample
inc esi inc esi
; add eax, 80h ; add eax, 80h
add al, 80h add al, 80h
dec ecx ; decrement count dec ecx ; decrement count
mov byte [edi], al ; write new sample to destination mov byte [edi], al ; write new sample to destination
jnz rev8loop ; loop jnz rev8loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_16BitReverbFast ; MV_16BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 4 ALIGN 4
MV_16BitReverbFast: MV_16BitReverbFast:
pushad pushad
mov eax, dword [esp + 0*4 + 9*4] mov eax, dword [esp + 0*4 + 9*4]
mov edx, dword [esp + 1*4 + 9*4] mov edx, dword [esp + 1*4 + 9*4]
mov ebx, dword [esp + 2*4 + 9*4] mov ebx, dword [esp + 2*4 + 9*4]
mov ecx, dword [esp + 3*4 + 9*4] mov ecx, dword [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch16+3 mov eax,OFFSET rpatch16+3
mov byte [eax],cl mov byte [eax],cl
lea edi, [edx - 2] lea edi, [edx - 2]
ALIGN 4 ALIGN 4
frev16loop: frev16loop:
mov ax, word [esi] ; get sample mov ax, word [esi] ; get sample
add edi, 2 add edi, 2
rpatch16: rpatch16:
sar ax, 5 ;;;;Add 1 before shift sar ax, 5 ;;;;Add 1 before shift
add esi, 2 add esi, 2
mov word [edi], ax ; write new sample to destination mov word [edi], ax ; write new sample to destination
dec ebx ; decrement count dec ebx ; decrement count
jnz frev16loop ; loop jnz frev16loop ; loop
popad popad
ret ret
;================ ;================
; ;
; MV_8BitReverbFast ; MV_8BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 4 ALIGN 4
MV_8BitReverbFast: MV_8BitReverbFast:
pushad pushad
mov eax, dword [esp + 0*4 + 9*4] mov eax, dword [esp + 0*4 + 9*4]
mov edx, dword [esp + 1*4 + 9*4] mov edx, dword [esp + 1*4 + 9*4]
mov ebx, dword [esp + 2*4 + 9*4] mov ebx, dword [esp + 2*4 + 9*4]
mov ecx, dword [esp + 3*4 + 9*4] mov ecx, dword [esp + 3*4 + 9*4]
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch8+2 mov eax,OFFSET rpatch8+2
mov edi, edx mov edi, edx
mov edx, 80h mov edx, 80h
mov byte [eax],cl mov byte [eax],cl
mov eax, 80h mov eax, 80h
shr eax, cl shr eax, cl
dec edi dec edi
sub edx, eax sub edx, eax
ALIGN 4 ALIGN 4
frev8loop: frev8loop:
mov al, byte [esi] ; get sample mov al, byte [esi] ; get sample
inc esi inc esi
mov ecx, eax mov ecx, eax
inc edi inc edi
rpatch8: rpatch8:
shr eax, 3 shr eax, 3
xor ecx, 80h ; flip the sign bit xor ecx, 80h ; flip the sign bit
shr ecx, 7 ; shift the sign down to 1 shr ecx, 7 ; shift the sign down to 1
add eax, edx add eax, edx
add eax, ecx ; add sign bit to round to 0 add eax, ecx ; add sign bit to round to 0
dec ebx ; decrement count dec ebx ; decrement count
mov byte [edi], al ; write new sample to destination mov byte [edi], al ; write new sample to destination
jnz frev8loop ; loop jnz frev8loop ; loop
popad popad
ret ret

View file

@ -1,174 +1,174 @@
.586P .586P
CODE SEGMENT PUBLIC USE32 'DATA' CODE SEGMENT PUBLIC USE32 'DATA'
ASSUME cs:CODE,ds:CODE ASSUME cs:CODE,ds:CODE
;================ ;================
; ;
; MV_16BitReverb ; MV_16BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 16 ALIGN 16
PUBLIC MV_16BitReverb_ PUBLIC MV_16BitReverb_
MV_16BitReverb_: MV_16BitReverb_:
mov esi, eax mov esi, eax
lea edi, [edx - 2] lea edi, [edx - 2]
;ALIGN 4 ;ALIGN 4
rev16loop: rev16loop:
movzx eax, word ptr [esi] ; get sample movzx eax, word ptr [esi] ; get sample
add edi, 2 add edi, 2
movzx edx, ah movzx edx, ah
sub ah, ah sub ah, ah
movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample movsx eax, byte ptr [2*eax+ebx+1] ; volume translate low byte of sample
xor edx, 80h xor edx, 80h
movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample movsx edx, word ptr [2*edx+ebx] ; volume translate high byte of sample
add esi, 2 add esi, 2
lea eax, [ eax + edx + 80h ] ; mix high byte of sample lea eax, [ eax + edx + 80h ] ; mix high byte of sample
dec ecx ; decrement count dec ecx ; decrement count
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
jnz rev16loop ; loop jnz rev16loop ; loop
ret ret
;================ ;================
; ;
; MV_8BitReverb ; MV_8BitReverb
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - Volume table ; ebx - Volume table
; ecx - number of samples ; ecx - number of samples
ALIGN 16 ALIGN 16
PUBLIC MV_8BitReverb_ PUBLIC MV_8BitReverb_
MV_8BitReverb_: MV_8BitReverb_:
mov esi, eax mov esi, eax
lea edi, [edx - 1] lea edi, [edx - 1]
xor eax, eax xor eax, eax
;ALIGN 4 ;ALIGN 4
rev8loop: rev8loop:
; movzx eax, byte ptr [esi] ; get sample ; movzx eax, byte ptr [esi] ; get sample
mov al, byte ptr [esi] ; get sample mov al, byte ptr [esi] ; get sample
inc edi inc edi
; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample ; movsx eax, byte ptr [2*eax+ebx] ; volume translate sample
mov al, byte ptr [2*eax+ebx] ; volume translate sample mov al, byte ptr [2*eax+ebx] ; volume translate sample
inc esi inc esi
; add eax, 80h ; add eax, 80h
add al, 80h add al, 80h
dec ecx ; decrement count dec ecx ; decrement count
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
jnz rev8loop ; loop jnz rev8loop ; loop
ret ret
;================ ;================
; ;
; MV_16BitReverbFast ; MV_16BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 16 ALIGN 16
PUBLIC MV_16BitReverbFast_ PUBLIC MV_16BitReverbFast_
MV_16BitReverbFast_: MV_16BitReverbFast_:
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch16+3 mov eax,OFFSET rpatch16+3
mov [eax],cl mov [eax],cl
lea edi, [edx - 2] lea edi, [edx - 2]
;ALIGN 4 ;ALIGN 4
frev16loop: frev16loop:
mov ax, word ptr [esi] ; get sample mov ax, word ptr [esi] ; get sample
add edi, 2 add edi, 2
rpatch16: rpatch16:
sar ax, 5 ;;;;Add 1 before shift sar ax, 5 ;;;;Add 1 before shift
add esi, 2 add esi, 2
mov [edi], ax ; write new sample to destination mov [edi], ax ; write new sample to destination
dec ebx ; decrement count dec ebx ; decrement count
jnz frev16loop ; loop jnz frev16loop ; loop
ret ret
;================ ;================
; ;
; MV_8BitReverbFast ; MV_8BitReverbFast
; ;
;================ ;================
; eax - source position ; eax - source position
; edx - destination position ; edx - destination position
; ebx - number of samples ; ebx - number of samples
; ecx - shift ; ecx - shift
ALIGN 16 ALIGN 16
PUBLIC MV_8BitReverbFast_ PUBLIC MV_8BitReverbFast_
MV_8BitReverbFast_: MV_8BitReverbFast_:
mov esi, eax mov esi, eax
mov eax,OFFSET rpatch8+2 mov eax,OFFSET rpatch8+2
mov edi, edx mov edi, edx
mov edx, 80h mov edx, 80h
mov [eax],cl mov [eax],cl
mov eax, 80h mov eax, 80h
shr eax, cl shr eax, cl
dec edi dec edi
sub edx, eax sub edx, eax
;ALIGN 4 ;ALIGN 4
frev8loop: frev8loop:
mov al, byte ptr [esi] ; get sample mov al, byte ptr [esi] ; get sample
inc esi inc esi
mov ecx, eax mov ecx, eax
inc edi inc edi
rpatch8: rpatch8:
shr eax, 3 shr eax, 3
xor ecx, 80h ; flip the sign bit xor ecx, 80h ; flip the sign bit
shr ecx, 7 ; shift the sign down to 1 shr ecx, 7 ; shift the sign down to 1
add eax, edx add eax, edx
add eax, ecx ; add sign bit to round to 0 add eax, ecx ; add sign bit to round to 0
dec ebx ; decrement count dec ebx ; decrement count
mov [edi], al ; write new sample to destination mov [edi], al ; write new sample to destination
jnz frev8loop ; loop jnz frev8loop ; loop
ret ret
CODE ENDS CODE ENDS
END END

0
polymer/eduke32/source/jaudiolib/platform.h Executable file → Normal file
View file

0
polymer/eduke32/source/jaudiolib/sdlmusic.c Executable file → Normal file
View file

View file

@ -1,114 +1,114 @@
#include <cstdio> #include <cstdio>
#include "mdump.h" #include "mdump.h"
#include <tchar.H> #include <tchar.H>
LPCSTR MiniDumper::m_szAppName; LPCSTR MiniDumper::m_szAppName;
MiniDumper g_dumper("eduke32"); MiniDumper g_dumper("eduke32");
MiniDumper::MiniDumper( LPCSTR szAppName ) MiniDumper::MiniDumper( LPCSTR szAppName )
{ {
// if this assert fires then you have two instances of MiniDumper // if this assert fires then you have two instances of MiniDumper
// which is not allowed // which is not allowed
assert( m_szAppName==NULL ); assert( m_szAppName==NULL );
m_szAppName = szAppName ? _strdup(szAppName) : "Application"; m_szAppName = szAppName ? _strdup(szAppName) : "Application";
::SetUnhandledExceptionFilter( TopLevelFilter ); ::SetUnhandledExceptionFilter( TopLevelFilter );
} }
LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
{ {
LONG retval = EXCEPTION_CONTINUE_SEARCH; LONG retval = EXCEPTION_CONTINUE_SEARCH;
//HWND hParent = NULL; // find a better value for your app //HWND hParent = NULL; // find a better value for your app
// firstly see if dbghelp.dll is around and has the function we need // 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 // look next to the EXE first, as the one in System32 might be old
// (e.g. Windows 2000) // (e.g. Windows 2000)
HMODULE hDll = NULL; HMODULE hDll = NULL;
char szDbgHelpPath[_MAX_PATH]; char szDbgHelpPath[_MAX_PATH];
if (GetModuleFileName( NULL, szDbgHelpPath, _MAX_PATH )) if (GetModuleFileName( NULL, szDbgHelpPath, _MAX_PATH ))
{ {
char *pSlash = _tcsrchr( szDbgHelpPath, '\\' ); char *pSlash = _tcsrchr( szDbgHelpPath, '\\' );
if (pSlash) if (pSlash)
{ {
_tcscpy( pSlash+1, "DBGHELP.DLL" ); _tcscpy( pSlash+1, "DBGHELP.DLL" );
hDll = ::LoadLibrary( szDbgHelpPath ); hDll = ::LoadLibrary( szDbgHelpPath );
} }
} }
if (hDll==NULL) if (hDll==NULL)
{ {
// load any version we can // load any version we can
hDll = ::LoadLibrary( "DBGHELP.DLL" ); hDll = ::LoadLibrary( "DBGHELP.DLL" );
} }
LPCTSTR szResult = NULL; LPCTSTR szResult = NULL;
if (hDll) if (hDll)
{ {
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" ); MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
if (pDump) if (pDump)
{ {
char szDumpPath[_MAX_PATH]; char szDumpPath[_MAX_PATH];
char szScratch [_MAX_PATH]; char szScratch [_MAX_PATH];
// work out a good place for the dump file // work out a good place for the dump file
/*if (!GetTempPath( _MAX_PATH, szDumpPath )) /*if (!GetTempPath( _MAX_PATH, szDumpPath ))
_tcscpy( szDumpPath, "c:\\temp\\" ); _tcscpy( szDumpPath, "c:\\temp\\" );
*/ */
sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime()); sprintf(szDumpPath,"%s_%u",m_szAppName,timeGetTime());
_tcscat( szDumpPath, ".dmp" ); _tcscat( szDumpPath, ".dmp" );
// ask the user if they want to save a dump file // 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) //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 // create the file
HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, HANDLE hFile = ::CreateFile( szDumpPath, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL ); FILE_ATTRIBUTE_NORMAL, NULL );
if (hFile!=INVALID_HANDLE_VALUE) if (hFile!=INVALID_HANDLE_VALUE)
{ {
_MINIDUMP_EXCEPTION_INFORMATION ExInfo; _MINIDUMP_EXCEPTION_INFORMATION ExInfo;
ExInfo.ThreadId = ::GetCurrentThreadId(); ExInfo.ThreadId = ::GetCurrentThreadId();
ExInfo.ExceptionPointers = pExceptionInfo; ExInfo.ExceptionPointers = pExceptionInfo;
ExInfo.ClientPointers = NULL; ExInfo.ClientPointers = NULL;
// write the dump // write the dump
BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL ); BOOL bOK = pDump( GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL );
if (bOK) if (bOK)
{ {
sprintf( szScratch, "Saved dump file to '%s'", szDumpPath ); sprintf( szScratch, "Saved dump file to '%s'", szDumpPath );
szResult = szScratch; szResult = szScratch;
retval = EXCEPTION_EXECUTE_HANDLER; retval = EXCEPTION_EXECUTE_HANDLER;
} }
else else
{ {
sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() ); sprintf( szScratch, "Failed to save dump file to '%s' (error %d)", szDumpPath, GetLastError() );
szResult = szScratch; szResult = szScratch;
} }
::CloseHandle(hFile); ::CloseHandle(hFile);
} }
else else
{ {
sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() ); sprintf( szScratch, "Failed to create dump file '%s' (error %d)", szDumpPath, GetLastError() );
szResult = szScratch; szResult = szScratch;
} }
} }
} }
else else
{ {
szResult = "DBGHELP.DLL too old"; szResult = "DBGHELP.DLL too old";
} }
} }
else else
{ {
szResult = "DBGHELP.DLL not found"; szResult = "DBGHELP.DLL not found";
} }
if (szResult) if (szResult)
::MessageBox( NULL, szResult, m_szAppName, MB_OK ); ::MessageBox( NULL, szResult, m_szAppName, MB_OK );
return retval; return retval;
} }

View file

@ -1,30 +1,30 @@
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#include <windows.h> #include <windows.h>
#include <assert.h> #include <assert.h>
#include <cstring> #include <cstring>
#if _MSC_VER < 1300 #if _MSC_VER < 1300
#define DECLSPEC_DEPRECATED #define DECLSPEC_DEPRECATED
// VC6: change this path to your Platform SDK headers // 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 #include "M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h" // must be XP version of file
#else #else
// VC7: ships with updated headers // VC7: ships with updated headers
#include "dbghelp.h" #include "dbghelp.h"
#endif #endif
// based on dbghelp.h // based on dbghelp.h
typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType,
CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
); );
class MiniDumper class MiniDumper
{ {
private: private:
static LPCSTR m_szAppName; static LPCSTR m_szAppName;
static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ); static LONG WINAPI TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo );
public: public:
MiniDumper( LPCSTR szAppName ); MiniDumper( LPCSTR szAppName );
}; };

View file

@ -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 CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
END END
WIN_STARTWINPAGE_GAME DIALOGEX DISCARDABLE 20, 40, 279, 168 WIN_STARTWINPAGE_GAME DIALOGEX DISCARDABLE 20, 40, 279, 168
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
CAPTION "Dialog" CAPTION "Dialog"
FONT 8, "MS Shell Dlg" FONT 8, "MS Shell Dlg"
BEGIN BEGIN
CONTROL "&Game:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 5, 100, 8 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 CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_STANDARD | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 70
END END
1 24 "rsrc/manifest.game.xml" 1 24 "rsrc/manifest.game.xml"

View file

View file

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
void GAME_drawosdchar(int x, int y, char ch, int shade, int pal); 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_drawosdstr(int x, int y, char *ch, int len, int shade, int pal);
void GAME_drawosdcursor(int x, int y, int type, int lastkeypress); void GAME_drawosdcursor(int x, int y, int type, int lastkeypress);
int GAME_getcolumnwidth(int w); int GAME_getcolumnwidth(int w);
int GAME_getrowheight(int w); int GAME_getrowheight(int w);
void GAME_clearbackground(int c, int r); void GAME_clearbackground(int c, int r);
void GAME_onshowosd(int shown); void GAME_onshowosd(int shown);

View file

@ -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. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#define KICK_HIT 0 #define KICK_HIT 0
#define PISTOL_RICOCHET 1 #define PISTOL_RICOCHET 1
#define PISTOL_BODYHIT 2 #define PISTOL_BODYHIT 2
#define PISTOL_FIRE 3 #define PISTOL_FIRE 3
#define EJECT_CLIP 4 #define EJECT_CLIP 4
#define INSERT_CLIP 5 #define INSERT_CLIP 5
#define CHAINGUN_FIRE 6 #define CHAINGUN_FIRE 6
#define RPG_SHOOT 7 #define RPG_SHOOT 7
#define POOLBALLHIT 8 #define POOLBALLHIT 8
#define RPG_EXPLODE 9 #define RPG_EXPLODE 9
#define CAT_FIRE 10 #define CAT_FIRE 10
#define SHRINKER_FIRE 11 #define SHRINKER_FIRE 11
#define ACTOR_SHRINKING 12 #define ACTOR_SHRINKING 12
#define PIPEBOMB_BOUNCE 13 #define PIPEBOMB_BOUNCE 13
#define PIPEBOMB_EXPLODE 14 #define PIPEBOMB_EXPLODE 14
#define LASERTRIP_ONWALL 15 #define LASERTRIP_ONWALL 15
#define LASERTRIP_ARMING 16 #define LASERTRIP_ARMING 16
#define LASERTRIP_EXPLODE 17 #define LASERTRIP_EXPLODE 17
#define VENT_BUST 18 #define VENT_BUST 18
#define GLASS_BREAKING 19 #define GLASS_BREAKING 19
#define GLASS_HEAVYBREAK 20 #define GLASS_HEAVYBREAK 20
#define SHORT_CIRCUIT 21 #define SHORT_CIRCUIT 21
#define ITEM_SPLASH 22 #define ITEM_SPLASH 22
#define DUKE_BREATHING 23 #define DUKE_BREATHING 23
#define DUKE_EXHALING 24 #define DUKE_EXHALING 24
#define DUKE_GASP 25 #define DUKE_GASP 25
#define SLIM_RECOG 26 #define SLIM_RECOG 26
// #define ENDSEQVOL3SND1 27 // #define ENDSEQVOL3SND1 27
#define DUKE_URINATE 28 #define DUKE_URINATE 28
#define ENDSEQVOL3SND2 29 #define ENDSEQVOL3SND2 29
#define ENDSEQVOL3SND3 30 #define ENDSEQVOL3SND3 30
#define DUKE_PASSWIND 32 #define DUKE_PASSWIND 32
#define DUKE_CRACK 33 #define DUKE_CRACK 33
#define SLIM_ATTACK 34 #define SLIM_ATTACK 34
#define SOMETHINGHITFORCE 35 #define SOMETHINGHITFORCE 35
#define DUKE_DRINKING 36 #define DUKE_DRINKING 36
#define DUKE_KILLED1 37 #define DUKE_KILLED1 37
#define DUKE_GRUNT 38 #define DUKE_GRUNT 38
#define DUKE_HARTBEAT 39 #define DUKE_HARTBEAT 39
#define DUKE_ONWATER 40 #define DUKE_ONWATER 40
#define DUKE_DEAD 41 #define DUKE_DEAD 41
#define DUKE_LAND 42 #define DUKE_LAND 42
#define DUKE_WALKINDUCTS 43 #define DUKE_WALKINDUCTS 43
#define DUKE_GLAD 44 #define DUKE_GLAD 44
#define DUKE_YES 45 #define DUKE_YES 45
#define DUKE_HEHE 46 #define DUKE_HEHE 46
#define DUKE_SHUCKS 47 #define DUKE_SHUCKS 47
#define DUKE_UNDERWATER 48 #define DUKE_UNDERWATER 48
#define DUKE_JETPACK_ON 49 #define DUKE_JETPACK_ON 49
#define DUKE_JETPACK_IDLE 50 #define DUKE_JETPACK_IDLE 50
#define DUKE_JETPACK_OFF 51 #define DUKE_JETPACK_OFF 51
#define LIZTROOP_GROWL 52 #define LIZTROOP_GROWL 52
#define LIZTROOP_TALK1 53 #define LIZTROOP_TALK1 53
#define LIZTROOP_TALK2 54 #define LIZTROOP_TALK2 54
#define LIZTROOP_TALK3 55 #define LIZTROOP_TALK3 55
#define DUKETALKTOBOSS 56 #define DUKETALKTOBOSS 56
#define LIZCAPT_GROWL 57 #define LIZCAPT_GROWL 57
#define LIZCAPT_TALK1 58 #define LIZCAPT_TALK1 58
#define LIZCAPT_TALK2 59 #define LIZCAPT_TALK2 59
#define LIZCAPT_TALK3 60 #define LIZCAPT_TALK3 60
#define LIZARD_BEG 61 #define LIZARD_BEG 61
#define LIZARD_PAIN 62 #define LIZARD_PAIN 62
#define LIZARD_DEATH 63 #define LIZARD_DEATH 63
#define LIZARD_SPIT 64 #define LIZARD_SPIT 64
#define DRONE1_HISSRATTLE 65 #define DRONE1_HISSRATTLE 65
#define DRONE1_HISSSCREECH 66 #define DRONE1_HISSSCREECH 66
#define DUKE_TIP2 67 #define DUKE_TIP2 67
#define FLESH_BURNING 68 #define FLESH_BURNING 68
#define SQUISHED 69 #define SQUISHED 69
#define TELEPORTER 70 #define TELEPORTER 70
#define ELEVATOR_ON 71 #define ELEVATOR_ON 71
#define DUKE_KILLED3 72 #define DUKE_KILLED3 72
#define ELEVATOR_OFF 73 #define ELEVATOR_OFF 73
#define DOOR_OPERATE1 74 #define DOOR_OPERATE1 74
#define SUBWAY 75 #define SUBWAY 75
#define SWITCH_ON 76 #define SWITCH_ON 76
#define FAN 77 #define FAN 77
#define DUKE_GETWEAPON3 78 #define DUKE_GETWEAPON3 78
#define FLUSH_TOILET 79 #define FLUSH_TOILET 79
#define HOVER_CRAFT 80 #define HOVER_CRAFT 80
#define EARTHQUAKE 81 #define EARTHQUAKE 81
#define INTRUDER_ALERT 82 #define INTRUDER_ALERT 82
#define END_OF_LEVEL_WARN 83 #define END_OF_LEVEL_WARN 83
#define ENGINE_OPERATING 84 #define ENGINE_OPERATING 84
#define REACTOR_ON 85 #define REACTOR_ON 85
#define COMPUTER_AMBIENCE 86 #define COMPUTER_AMBIENCE 86
#define GEARS_GRINDING 87 #define GEARS_GRINDING 87
#define BUBBLE_AMBIENCE 88 #define BUBBLE_AMBIENCE 88
#define MACHINE_AMBIENCE 89 #define MACHINE_AMBIENCE 89
#define SEWER_AMBIENCE 90 #define SEWER_AMBIENCE 90
#define WIND_AMBIENCE 91 #define WIND_AMBIENCE 91
#define SOMETHING_DRIPPING 92 #define SOMETHING_DRIPPING 92
#define STEAM_HISSING 93 #define STEAM_HISSING 93
#define THEATER_BREATH 94 #define THEATER_BREATH 94
#define BAR_MUSIC 95 #define BAR_MUSIC 95
#define BOS1_ROAM 96 #define BOS1_ROAM 96
#define BOS1_RECOG 97 #define BOS1_RECOG 97
#define BOS1_ATTACK1 98 #define BOS1_ATTACK1 98
#define BOS1_PAIN 99 #define BOS1_PAIN 99
#define BOS1_DYING 100 #define BOS1_DYING 100
#define BOS2_ROAM 101 #define BOS2_ROAM 101
#define BOS2_RECOG 102 #define BOS2_RECOG 102
#define BOS2_ATTACK 103 #define BOS2_ATTACK 103
#define BOS2_PAIN 104 #define BOS2_PAIN 104
#define BOS2_DYING 105 #define BOS2_DYING 105
#define GETATOMICHEALTH 106 #define GETATOMICHEALTH 106
#define DUKE_GETWEAPON2 107 #define DUKE_GETWEAPON2 107
#define BOS3_DYING 108 #define BOS3_DYING 108
#define SHOTGUN_FIRE 109 #define SHOTGUN_FIRE 109
#define PRED_ROAM 110 #define PRED_ROAM 110
#define PRED_RECOG 111 #define PRED_RECOG 111
#define PRED_ATTACK 112 #define PRED_ATTACK 112
#define PRED_PAIN 113 #define PRED_PAIN 113
#define PRED_DYING 114 #define PRED_DYING 114
#define CAPT_ROAM 115 #define CAPT_ROAM 115
#define CAPT_ATTACK 116 #define CAPT_ATTACK 116
#define CAPT_RECOG 117 #define CAPT_RECOG 117
#define CAPT_PAIN 118 #define CAPT_PAIN 118
#define CAPT_DYING 119 #define CAPT_DYING 119
#define PIG_ROAM 120 #define PIG_ROAM 120
#define PIG_RECOG 121 #define PIG_RECOG 121
#define PIG_ATTACK 122 #define PIG_ATTACK 122
#define PIG_PAIN 123 #define PIG_PAIN 123
#define PIG_DYING 124 #define PIG_DYING 124
#define RECO_ROAM 125 #define RECO_ROAM 125
#define RECO_RECOG 126 #define RECO_RECOG 126
#define RECO_ATTACK 127 #define RECO_ATTACK 127
#define RECO_PAIN 128 #define RECO_PAIN 128
#define RECO_DYING 129 #define RECO_DYING 129
#define DRON_ROAM 130 #define DRON_ROAM 130
#define DRON_RECOG 131 #define DRON_RECOG 131
#define DRON_ATTACK1 132 #define DRON_ATTACK1 132
#define DRON_PAIN 133 #define DRON_PAIN 133
#define DRON_DYING 134 #define DRON_DYING 134
#define COMM_ROAM 135 #define COMM_ROAM 135
#define COMM_RECOG 136 #define COMM_RECOG 136
#define COMM_ATTACK 137 #define COMM_ATTACK 137
#define COMM_PAIN 138 #define COMM_PAIN 138
#define COMM_DYING 139 #define COMM_DYING 139
#define OCTA_ROAM 140 #define OCTA_ROAM 140
#define OCTA_RECOG 141 #define OCTA_RECOG 141
#define OCTA_ATTACK1 142 #define OCTA_ATTACK1 142
#define OCTA_PAIN 143 #define OCTA_PAIN 143
#define OCTA_DYING 144 #define OCTA_DYING 144
#define TURR_ROAM 145 #define TURR_ROAM 145
#define TURR_RECOG 146 #define TURR_RECOG 146
#define TURR_ATTACK 147 #define TURR_ATTACK 147
#define DUMPSTER_MOVE 148 #define DUMPSTER_MOVE 148
#define SLIM_DYING 149 #define SLIM_DYING 149
#define BOS3_ROAM 150 #define BOS3_ROAM 150
#define BOS3_RECOG 151 #define BOS3_RECOG 151
#define BOS3_ATTACK1 152 #define BOS3_ATTACK1 152
#define BOS3_PAIN 153 #define BOS3_PAIN 153
#define BOS1_ATTACK2 154 #define BOS1_ATTACK2 154
#define COMM_SPIN 155 #define COMM_SPIN 155
#define BOS1_WALK 156 #define BOS1_WALK 156
#define DRON_ATTACK2 157 #define DRON_ATTACK2 157
#define THUD 158 #define THUD 158
#define OCTA_ATTACK2 159 #define OCTA_ATTACK2 159
#define WIERDSHOT_FLY 160 #define WIERDSHOT_FLY 160
#define TURR_PAIN 161 #define TURR_PAIN 161
#define TURR_DYING 162 #define TURR_DYING 162
#define SLIM_ROAM 163 #define SLIM_ROAM 163
#define LADY_SCREAM 164 #define LADY_SCREAM 164
#define DOOR_OPERATE2 165 #define DOOR_OPERATE2 165
#define DOOR_OPERATE3 166 #define DOOR_OPERATE3 166
#define DOOR_OPERATE4 167 #define DOOR_OPERATE4 167
#define BORNTOBEWILDSND 168 #define BORNTOBEWILDSND 168
#define SHOTGUN_COCK 169 #define SHOTGUN_COCK 169
#define GENERIC_AMBIENCE1 170 #define GENERIC_AMBIENCE1 170
#define GENERIC_AMBIENCE2 171 #define GENERIC_AMBIENCE2 171
#define GENERIC_AMBIENCE3 172 #define GENERIC_AMBIENCE3 172
#define GENERIC_AMBIENCE4 173 #define GENERIC_AMBIENCE4 173
#define GENERIC_AMBIENCE5 174 #define GENERIC_AMBIENCE5 174
#define GENERIC_AMBIENCE6 175 #define GENERIC_AMBIENCE6 175
#define BOS3_ATTACK2 176 #define BOS3_ATTACK2 176
#define GENERIC_AMBIENCE17 177 #define GENERIC_AMBIENCE17 177
#define GENERIC_AMBIENCE18 178 #define GENERIC_AMBIENCE18 178
#define GENERIC_AMBIENCE19 179 #define GENERIC_AMBIENCE19 179
#define GENERIC_AMBIENCE20 180 #define GENERIC_AMBIENCE20 180
#define GENERIC_AMBIENCE21 181 #define GENERIC_AMBIENCE21 181
#define GENERIC_AMBIENCE22 182 #define GENERIC_AMBIENCE22 182
#define SECRETLEVELSND 183 #define SECRETLEVELSND 183
#define GENERIC_AMBIENCE8 184 #define GENERIC_AMBIENCE8 184
#define GENERIC_AMBIENCE9 185 #define GENERIC_AMBIENCE9 185
#define GENERIC_AMBIENCE10 186 #define GENERIC_AMBIENCE10 186
#define GENERIC_AMBIENCE11 187 #define GENERIC_AMBIENCE11 187
#define GENERIC_AMBIENCE12 188 #define GENERIC_AMBIENCE12 188
#define GENERIC_AMBIENCE13 189 #define GENERIC_AMBIENCE13 189
#define GENERIC_AMBIENCE14 190 #define GENERIC_AMBIENCE14 190
#define GENERIC_AMBIENCE15 192 #define GENERIC_AMBIENCE15 192
#define GENERIC_AMBIENCE16 193 #define GENERIC_AMBIENCE16 193
#define FIRE_CRACKLE 194 #define FIRE_CRACKLE 194
#define BONUS_SPEECH1 195 #define BONUS_SPEECH1 195
#define BONUS_SPEECH2 196 #define BONUS_SPEECH2 196
#define BONUS_SPEECH3 197 #define BONUS_SPEECH3 197
#define PIG_CAPTURE_DUKE 198 #define PIG_CAPTURE_DUKE 198
#define BONUS_SPEECH4 199 #define BONUS_SPEECH4 199
#define DUKE_LAND_HURT 200 #define DUKE_LAND_HURT 200
#define DUKE_HIT_STRIPPER1 201 #define DUKE_HIT_STRIPPER1 201
#define DUKE_TIP1 202 #define DUKE_TIP1 202
#define DUKE_KILLED2 203 #define DUKE_KILLED2 203
#define PRED_ROAM2 204 #define PRED_ROAM2 204
#define PIG_ROAM2 205 #define PIG_ROAM2 205
#define DUKE_GETWEAPON1 206 #define DUKE_GETWEAPON1 206
#define DUKE_SEARCH2 207 #define DUKE_SEARCH2 207
#define DUKE_CRACK2 208 #define DUKE_CRACK2 208
#define DUKE_SEARCH 209 #define DUKE_SEARCH 209
#define DUKE_GET 210 #define DUKE_GET 210
#define DUKE_LONGTERM_PAIN 211 #define DUKE_LONGTERM_PAIN 211
#define MONITOR_ACTIVE 212 #define MONITOR_ACTIVE 212
#define NITEVISION_ONOFF 213 #define NITEVISION_ONOFF 213
#define DUKE_HIT_STRIPPER2 214 #define DUKE_HIT_STRIPPER2 214
#define DUKE_CRACK_FIRST 215 #define DUKE_CRACK_FIRST 215
#define DUKE_USEMEDKIT 216 #define DUKE_USEMEDKIT 216
#define DUKE_TAKEPILLS 217 #define DUKE_TAKEPILLS 217
#define DUKE_PISSRELIEF 218 #define DUKE_PISSRELIEF 218
#define SELECT_WEAPON 219 #define SELECT_WEAPON 219
#define WATER_GURGLE 220 #define WATER_GURGLE 220
#define DUKE_GETWEAPON4 221 #define DUKE_GETWEAPON4 221
#define JIBBED_ACTOR1 222 #define JIBBED_ACTOR1 222
#define JIBBED_ACTOR2 223 #define JIBBED_ACTOR2 223
#define JIBBED_ACTOR3 224 #define JIBBED_ACTOR3 224
#define JIBBED_ACTOR4 225 #define JIBBED_ACTOR4 225
#define JIBBED_ACTOR5 226 #define JIBBED_ACTOR5 226
#define JIBBED_ACTOR6 227 #define JIBBED_ACTOR6 227
#define JIBBED_ACTOR7 228 #define JIBBED_ACTOR7 228
#define DUKE_GOTHEALTHATLOW 229 #define DUKE_GOTHEALTHATLOW 229
#define BOSSTALKTODUKE 230 #define BOSSTALKTODUKE 230
#define WAR_AMBIENCE1 231 #define WAR_AMBIENCE1 231
#define WAR_AMBIENCE2 232 #define WAR_AMBIENCE2 232
#define WAR_AMBIENCE3 233 #define WAR_AMBIENCE3 233
#define WAR_AMBIENCE4 234 #define WAR_AMBIENCE4 234
#define WAR_AMBIENCE5 235 #define WAR_AMBIENCE5 235
#define WAR_AMBIENCE6 236 #define WAR_AMBIENCE6 236
#define WAR_AMBIENCE7 237 #define WAR_AMBIENCE7 237
#define WAR_AMBIENCE8 238 #define WAR_AMBIENCE8 238
#define WAR_AMBIENCE9 239 #define WAR_AMBIENCE9 239
#define WAR_AMBIENCE10 240 #define WAR_AMBIENCE10 240
#define ALIEN_TALK1 241 #define ALIEN_TALK1 241
#define ALIEN_TALK2 242 #define ALIEN_TALK2 242
#define EXITMENUSOUND 243 #define EXITMENUSOUND 243
#define FLY_BY 244 #define FLY_BY 244
#define DUKE_SCREAM 245 #define DUKE_SCREAM 245
#define SHRINKER_HIT 246 #define SHRINKER_HIT 246
#define RATTY 247 #define RATTY 247
#define INTO_MENU 248 #define INTO_MENU 248
#define BONUSMUSIC 249 #define BONUSMUSIC 249
#define DUKE_BOOBY 250 #define DUKE_BOOBY 250
#define DUKE_TALKTOBOSSFALL 251 #define DUKE_TALKTOBOSSFALL 251
#define DUKE_LOOKINTOMIRROR 252 #define DUKE_LOOKINTOMIRROR 252
#define PIG_ROAM3 253 #define PIG_ROAM3 253
#define KILLME 254 #define KILLME 254
#define DRON_JETSND 255 #define DRON_JETSND 255
#define SPACE_DOOR1 256 #define SPACE_DOOR1 256
#define SPACE_DOOR2 257 #define SPACE_DOOR2 257
#define SPACE_DOOR3 258 #define SPACE_DOOR3 258
#define SPACE_DOOR4 259 #define SPACE_DOOR4 259
#define SPACE_DOOR5 260 #define SPACE_DOOR5 260
#define ALIEN_ELEVATOR1 261 #define ALIEN_ELEVATOR1 261
#define VAULT_DOOR 262 #define VAULT_DOOR 262
#define JIBBED_ACTOR13 263 #define JIBBED_ACTOR13 263
#define DUKE_GETWEAPON6 264 #define DUKE_GETWEAPON6 264
#define JIBBED_ACTOR8 265 #define JIBBED_ACTOR8 265
#define JIBBED_ACTOR9 266 #define JIBBED_ACTOR9 266
#define JIBBED_ACTOR10 267 #define JIBBED_ACTOR10 267
#define JIBBED_ACTOR11 268 #define JIBBED_ACTOR11 268
#define JIBBED_ACTOR12 269 #define JIBBED_ACTOR12 269
#define DUKE_KILLED4 270 #define DUKE_KILLED4 270
#define DUKE_KILLED5 271 #define DUKE_KILLED5 271
#define ALIEN_SWITCH1 272 #define ALIEN_SWITCH1 272
#define DUKE_STEPONFECES 273 #define DUKE_STEPONFECES 273
#define DUKE_LONGTERM_PAIN2 274 #define DUKE_LONGTERM_PAIN2 274
#define DUKE_LONGTERM_PAIN3 275 #define DUKE_LONGTERM_PAIN3 275
#define DUKE_LONGTERM_PAIN4 276 #define DUKE_LONGTERM_PAIN4 276
#define COMPANB2 277 #define COMPANB2 277
#define KTIT 278 #define KTIT 278
#define HELICOP_IDLE 279 #define HELICOP_IDLE 279
#define STEPNIT 280 #define STEPNIT 280
#define SPACE_AMBIENCE1 281 #define SPACE_AMBIENCE1 281
#define SPACE_AMBIENCE2 282 #define SPACE_AMBIENCE2 282
#define SLIM_HATCH 283 #define SLIM_HATCH 283
#define RIPHEADNECK 284 #define RIPHEADNECK 284
#define FOUNDJONES 285 #define FOUNDJONES 285
#define ALIEN_DOOR1 286 #define ALIEN_DOOR1 286
#define ALIEN_DOOR2 287 #define ALIEN_DOOR2 287
#define ENDSEQVOL3SND4 288 #define ENDSEQVOL3SND4 288
#define ENDSEQVOL3SND5 289 #define ENDSEQVOL3SND5 289
#define ENDSEQVOL3SND6 290 #define ENDSEQVOL3SND6 290
#define ENDSEQVOL3SND7 291 #define ENDSEQVOL3SND7 291
#define ENDSEQVOL3SND8 292 #define ENDSEQVOL3SND8 292
#define ENDSEQVOL3SND9 293 #define ENDSEQVOL3SND9 293
#define WHIPYOURASS 294 #define WHIPYOURASS 294
#define ENDSEQVOL2SND1 295 #define ENDSEQVOL2SND1 295
#define ENDSEQVOL2SND2 296 #define ENDSEQVOL2SND2 296
#define ENDSEQVOL2SND3 297 #define ENDSEQVOL2SND3 297
#define ENDSEQVOL2SND4 298 #define ENDSEQVOL2SND4 298
#define ENDSEQVOL2SND5 299 #define ENDSEQVOL2SND5 299
#define ENDSEQVOL2SND6 300 #define ENDSEQVOL2SND6 300
#define ENDSEQVOL2SND7 301 #define ENDSEQVOL2SND7 301
#define GENERIC_AMBIENCE23 302 #define GENERIC_AMBIENCE23 302
#define SOMETHINGFROZE 303 #define SOMETHINGFROZE 303
#define DUKE_LONGTERM_PAIN5 304 #define DUKE_LONGTERM_PAIN5 304
#define DUKE_LONGTERM_PAIN6 305 #define DUKE_LONGTERM_PAIN6 305
#define DUKE_LONGTERM_PAIN7 306 #define DUKE_LONGTERM_PAIN7 306
#define DUKE_LONGTERM_PAIN8 307 #define DUKE_LONGTERM_PAIN8 307
#define WIND_REPEAT 308 #define WIND_REPEAT 308
#define MYENEMY_ROAM 309 #define MYENEMY_ROAM 309
#define MYENEMY_HURT 310 #define MYENEMY_HURT 310
#define MYENEMY_DEAD 311 #define MYENEMY_DEAD 311
#define MYENEMY_SHOOT 312 #define MYENEMY_SHOOT 312
#define STORE_MUSIC 313 #define STORE_MUSIC 313
#define STORE_MUSIC_BROKE 314 #define STORE_MUSIC_BROKE 314
#define ACTOR_GROWING 315 #define ACTOR_GROWING 315
#define NEWBEAST_ROAM 316 #define NEWBEAST_ROAM 316
#define NEWBEAST_RECOG 317 #define NEWBEAST_RECOG 317
#define NEWBEAST_ATTACK 318 #define NEWBEAST_ATTACK 318
#define NEWBEAST_PAIN 319 #define NEWBEAST_PAIN 319
#define NEWBEAST_DYING 320 #define NEWBEAST_DYING 320
#define NEWBEAST_SPIT 321 #define NEWBEAST_SPIT 321
#define VOL4_1 322 #define VOL4_1 322
#define SUPERMARKET 323 #define SUPERMARKET 323
#define MOUSEANNOY 324 #define MOUSEANNOY 324
#define BOOKEM 325 #define BOOKEM 325
#define SUPERMARKETCRY 326 #define SUPERMARKETCRY 326
#define DESTRUCT 327 #define DESTRUCT 327
#define EATFOOD 328 #define EATFOOD 328
#define MAKEMYDAY 329 #define MAKEMYDAY 329
#define WITNESSSTAND 330 #define WITNESSSTAND 330
#define VACATIONSPEECH 331 #define VACATIONSPEECH 331
#define YIPPEE1 332 #define YIPPEE1 332
#define YOHOO1 333 #define YOHOO1 333
#define YOHOO2 334 #define YOHOO2 334
#define DOLPHINSND 335 #define DOLPHINSND 335
#define TOUGHGALSND1 336 #define TOUGHGALSND1 336
#define TOUGHGALSND2 337 #define TOUGHGALSND2 337
#define TOUGHGALSND3 338 #define TOUGHGALSND3 338
#define TOUGHGALSND4 339 #define TOUGHGALSND4 339
#define TANK_ROAM 340 #define TANK_ROAM 340
#define BOS4_ROAM 341 #define BOS4_ROAM 341
#define BOS4_RECOG 342 #define BOS4_RECOG 342
#define BOS4_ATTACK 343 #define BOS4_ATTACK 343
#define BOS4_PAIN 344 #define BOS4_PAIN 344
#define BOS4_DYING 345 #define BOS4_DYING 345
#define NEWBEAST_ATTACKMISS 346 #define NEWBEAST_ATTACKMISS 346
#define VOL4_2 347 #define VOL4_2 347
#define COOKINGDEEPFRIER 348 #define COOKINGDEEPFRIER 348
#define WHINING_DOG 349 #define WHINING_DOG 349
#define DEAD_DOG 350 #define DEAD_DOG 350
#define LIGHTNING_SLAP 351 #define LIGHTNING_SLAP 351
#define THUNDER 352 #define THUNDER 352
#define HAPPYMOUSESND1 353 #define HAPPYMOUSESND1 353
#define HAPPYMOUSESND2 354 #define HAPPYMOUSESND2 354
#define HAPPYMOUSESND3 355 #define HAPPYMOUSESND3 355
#define HAPPYMOUSESND4 356 #define HAPPYMOUSESND4 356
#define ALARM 357 #define ALARM 357
#define RAIN 358 #define RAIN 358
#define DTAG_GREENRUN 359 #define DTAG_GREENRUN 359
#define DTAG_BROWNRUN 360 #define DTAG_BROWNRUN 360
#define DTAG_GREENSCORE 361 #define DTAG_GREENSCORE 361
#define DTAG_BROWNSCORE 362 #define DTAG_BROWNSCORE 362
#define INTRO4_1 363 #define INTRO4_1 363
#define INTRO4_2 364 #define INTRO4_2 364
#define INTRO4_3 365 #define INTRO4_3 365
#define INTRO4_4 366 #define INTRO4_4 366
#define INTRO4_5 367 #define INTRO4_5 367
#define INTRO4_6 368 #define INTRO4_6 368
#define SCREECH 369 #define SCREECH 369
#define BOSS4_DEADSPEECH 370 #define BOSS4_DEADSPEECH 370
#define BOSS4_FIRSTSEE 371 #define BOSS4_FIRSTSEE 371
#define PARTY_SPEECH 372 #define PARTY_SPEECH 372
#define POSTAL_SPEECH 373 #define POSTAL_SPEECH 373
#define TGSPEECH 374 #define TGSPEECH 374
#define DOGROOMSPEECH 375 #define DOGROOMSPEECH 375
#define SMACKED 376 #define SMACKED 376
#define MDEVSPEECH 377 #define MDEVSPEECH 377
#define AREA51SPEECH 378 #define AREA51SPEECH 378
#define JEEPSOUND 379 #define JEEPSOUND 379
#define BIGDOORSLAM 380 #define BIGDOORSLAM 380
#define BOS4_LAY 381 #define BOS4_LAY 381
#define WAVESOUND 382 #define WAVESOUND 382
#define ILLBEBACK 383 #define ILLBEBACK 383
#define VOL4ENDSND1 384 #define VOL4ENDSND1 384
#define VOL4ENDSND2 385 #define VOL4ENDSND2 385
#define EXPANDERHIT 386 #define EXPANDERHIT 386
#define SNAKESPEECH 387 #define SNAKESPEECH 387
#define EXPANDERSHOOT 388 #define EXPANDERSHOOT 388
#define GETBACKTOWORK 389 #define GETBACKTOWORK 389
#define JIBBED_ACTOR14 390 #define JIBBED_ACTOR14 390
#define JIBBED_ACTOR15 391 #define JIBBED_ACTOR15 391
#define INTRO4_B 392 #define INTRO4_B 392
#define BIGBANG 393 #define BIGBANG 393
#define SMACKIT 394 #define SMACKIT 394
#define BELLSND 395 #define BELLSND 395
// MAXIMUM NUMBER OF SOUNDS: 450 ( 0-449 ) // MAXIMUM NUMBER OF SOUNDS: 450 ( 0-449 )

View file

@ -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. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//**************************************************************************** //****************************************************************************
// //
// sounds.h // sounds.h
// //
//**************************************************************************** //****************************************************************************
#ifndef _sounds_public_ #ifndef _sounds_public_
#define _sounds_public_ #define _sounds_public_
void SoundStartup( void ); void SoundStartup( void );
void SoundShutdown( void ); void SoundShutdown( void );
void MusicStartup( void ); void MusicStartup( void );
void MusicShutdown( void ); void MusicShutdown( void );
void AudioUpdate(void); void AudioUpdate(void);
struct audioenumdev { struct audioenumdev {
char *def; char *def;
char **devs; char **devs;
struct audioenumdev *next; struct audioenumdev *next;
}; };
struct audioenumdrv { struct audioenumdrv {
char *def; char *def;
char **drvs; char **drvs;
struct audioenumdev *devs; struct audioenumdev *devs;
}; };
int EnumAudioDevs(struct audioenumdrv **wave, struct audioenumdev **midi, struct audioenumdev **cda); int EnumAudioDevs(struct audioenumdrv **wave, struct audioenumdev **midi, struct audioenumdev **cda);
#endif #endif

0
polymer/eduke32/source/startgtk.game.c Executable file → Normal file
View file

0
polymer/eduke32/source/startwin.game.c Executable file → Normal file
View file

0
polymer/eduke32/source/startwin.game.h Executable file → Normal file
View file

0
polymer/eduke32/source/wrapper.c Executable file → Normal file
View file

0
polymer/eduke32/tiles.cfg Executable file → Normal file
View file